repo_id
stringclasses
927 values
file_path
stringlengths
99
214
content
stringlengths
2
4.15M
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/generics-implementation-dictionaries.md
# Generics implementation - Dictionaries This document describes a method to implement the [Go generics proposal](https://go.googlesource.com/proposal/+/refs/heads/master/design/go2draft-type-parameters.md) using compile-time instantiated dictionaries. Dictionaries will be stenciled per instantiation of a generic function. When we generate code for a generic function, we will generate only a single chunk of assembly for that function. It will take as an argument a _dictionary_, which is a set of information describing the concrete types that the parameterized types take on. It includes the concrete types themselves, of course, but also derived information as we will see below. A counter-proposal would generate a different chunk of assembly for each instantiation and not require dictionaries - see the [Generics Implementation - Stenciling](https://go.googlesource.com/proposal/+/refs/heads/master/design/generics-implementation-stenciling.md) proposal. The [Generics Implementation - GC Shape Stenciling](https://go.googlesource.com/proposal/+/refs/heads/master/design/generics-implementation-gcshape.md) proposal is a hybrid of that proposal and this one. The most important feature of a dictionary is that it is compile-time computeable. All dictionaries will reside in the read-only data section, and will be passed around by reference. Anything they reference (types, other dictionaries, etc.) must also be in the read-only or code data sections. A running example of a generic function: ``` func f [T1, T2 any](x int, y T1) T2 { ... } ``` With a callsite: ``` f[int, float64](7, 3.5) ``` The implementation of f will have an additional argument which is the pointer to the dictionary structure. We could put the additional argument first or last, or in its own register. Reserving a register for it seems overkill. Putting it first is similar to how receivers are passed (speaking of which, would the receiver or the dictionary come first?). Putting it last means less argument shuffling in the case where wrappers are required (not sure where those might be yet). The dictionary will contain lots of fields of various types, depending on what the implementation of f needs. Note that we must look inside the implementation of f to determine what is required. This means that the compiler will need to summarize what fields are necessary in the dictionary of the function, so that callers can compute that information and put it in the dictionary when it knows what the instantiated types are. (Note this implies that we can’t instantiate a generic function knowing only its signature - we need its implementation at compile time also. So implemented-in-assembly and cross-shared-object-boundary instantiations are not possible.) The dictionary will contain the following items: ## Instantiated types The first thing that the dictionary will contain is a reference to the `runtime._type` for each parameterized type. ``` type dictionary struct { T1 *runtime._type T2 *runtime._type ... } ``` We should probably include these values unconditionally, even if the implementation doesn’t need them (for printing in tracebacks, for example). ## Derived types The code in f may declare new types which are derived from the generic parameter types. For instance: ``` type X struct { x int; y T1 } m := map[string]T1{} ``` The dictionary needs to contain a `*runtime._type` for each of the types mentioned in the body of f which are derived from the generic parameter types. ``` type dictionary struct { ... D1 *runtime._type // struct { x int; y T1 } D2 *runtime._type // map[string]T1 ... } ``` How will the caller know what derived types the body of f needs? This is a very important question, and will be discussed at length later (see the proto-dictionary section). For now, just assume that there will be summary information for each function which lets the callsite know what derived types are needed. ## Subdictionaries If f calls other functions, it needs a dictionary for those calls. For example, ``` func g[T](g T) { ... } ``` Then in f, ``` g[T1](y) ``` The call to g needs a dictionary. At the callsite to g from f, f has no way to know what dictionary it should use, because the type parameterizing the instantiation of g is a generic type. So the caller of f must provide that dictionary. ``` type dictionary struct { ... S1 *dictionary // SubDictionary for call to g S2 *dictionary // SubDictionary for some other call ... } ``` ## Helper methods The dictionary should contain methods that operate on the generic types. For instance, if f has the code: ``` y2 := y + 1 if y2 > y { … } ``` (assuming here that `T1` has a type list that allows `+` and `>`), then the dictionary must contain methods that implement `+` and `>`. ``` type dictionary struct { ... plus func(z, x, y *T1) // does *z = *x+*y greater func(x, y *T1) bool // computes *x>*y ... } ``` There’s some choice available here as to what methods to include. For `new(T1)` we could include in the dictionary a method that returns a `*T1`, or we could call `runtime.newobject` directly with the `T1` field of the dictionary. Similarly for many other tasks (`+`, `>`, ...), we could use runtime helpers instead of dictionary methods, passing the appropriate `*runtime._type` arguments so the runtime could switch on the type and do the appropriate computation. ## Stack layout `f` needs to allocate stack space for any temporary variables it needs. Some of those variables would be of generic type, so `f` doesn’t know how big they are. It is up to the dictionary to tell it that. ``` type dictionary struct { ... frameSize uintptr ... } ``` The caller knows the types of all the temporary variables, so it can compute the stack size required. (Note that this depends a lot on the implementation of `f`. I’ll get to that later.) Stack scanning and copying also need to know about the stack objects in `f`. The dictionary can provide that information ``` type dictionary struct { ... stackObjects []stackObject ... } type stackObject struct { offset uintptr typ *runtime._type } ``` All values of generic type, as well as derived types that have bare generic types in them (e.g. `struct {x int; y T1}` or `[4]T1`, but not reference types with generic bases, like `[]T1` or `map[T1]T2`), must be stack objects. `f` will operate on such types using pointers to these stack objects. Preamble code in `f` will set up local variables as pointers to each of the stack objects (along with zeroing locals and return values?). All accesses to generic typed values will be by reference from these pointers. There might also be non-generic stack objects in `f`. Maybe we list them separately, or combine the lists in the dictionary (so we only have to look in one place for the list). The outargs section also needs some help. Marshaling arguments to a call, and copying back results from a call, are challenging because the offsets from SP are not known to `f` (if any argument has a type with a bare generic type in it). We could marshal/unmarshal arguments one at a time, keeping track of an argument pointer while doing so. If `f` calls `h`: ``` func f[T1, T2 any](x int, y T1, h func(x T1, y int, z T2) int) T2 { var z T2 .... r := h(y, x, z) } ``` then we would compile that to: ``` argPtr = SP memmove(argPtr, &y, dictionary.T1.size) argPtr += T1.size argPtr = roundUp(argPtr, alignof(int)) *(*int)argPtr = x argPtr += sizeof(int) memmove(argPtr, &z, dictionary.T2.size) argPtr += T2.size call h argPtr = roundUp(argPtr, 8) // alignment of return value start r = *(*int)argPtr ``` Another option is to include in the dictionary the offset needed for every argument/return value of every function call in `f`. That would make life simpler, but it’s a lot of information. Something like: ``` memmove(SP + dictionary.callsite1.arg1offset, &y, dictionary.T1.size) *(*int)(SP + dictionary.callsite1.arg2offset) = x memmove(SP + dictionary.callsite1.arg3offset, &z, dictionary.T2.size) call h r = *(*int)(SP + dictionary.callsite1.ret1offset) ``` We could share information for identically-shaped callsites. And maybe keep the offset arrays as separate global symbols and keep references to them in the dictionary (one more indirection for each argument marshal, but may use less space). We need to reserve enough space in the outargs section for all the marshaled arguments, across all callsites. The `frameSize` field of the dictionary should include this space. Another option in this space is to change the calling convention to pass all values of generic type by pointer. This will simplify the layout problem for the arguments sections. But it requires implementing wrapper functions for calls from generic code to non-generic code or vice-versa. It is not entirely clear what the rules would be for where those wrappers get generated and instantiated. The outargs plan will get extra complicated when we move to a [register-based calling convention](https://github.com/golang/go/issues/40724). Possibly calls out from generic code will remain on ABI0. ## Pointer maps Each stack frame needs to tell the runtime where all of its pointers are. Because all arguments and local variables of generic type will be stack objects, we don’t need special pointer maps for them. Each variable of generic type will be referenced by a local pointer variable, and those local pointer variables will have their liveness tracked as usual (similar to how moved-to-heap variables are handled today). Arguments of generic type will be stack objects, but that leaves the problem of how to scan those arguments before the function starts - we need a pointer map at function entry, before stack objects can be set up. For the function entry problem, we can add a pointer bitmap to the dictionary. This will be used when the function needs to call morestack, or when the function is used in a `go` or `defer` statement and hasn’t started running yet. ``` type dictionary struct { ... argPointerMap bitMap // arg size and ptr/nonptr bitmap ... } ``` We may be able to derive the pointer bitmap from the list of stack objects, if that list made it easy to distinguish arguments (args+returns are distinguished because the former are positive offsets from FP and the latter are negative offsets from FP. Distinguishing args vs returns might also be doable using a retoffset field in funcdata). ## End of Dictionary ``` type dictionary struct { ... // That's all? } ``` ## The Proto-Dictionary There’s a lot of information we need to record about a function `f`, so that callers of `f` can assemble an appropriate dictionary. We’ll call this information a proto-dictionary. Each entry in the proto-dictionary is conceptually a function from the concrete types used to instantiate the generic function, to the contents of the dictionary entry. At each callsite at compile time, the proto-dictionary is evaluated with the concrete type parameters to produce a real dictionary. (Or, if the callsite uses some generic types as type arguments, partially evaluate the proto-dictionary to produce a new proto-dictionary that represents some sub-dictionary of a higher-level dictionary.) There are two main features of the proto-dictionary. The first is that the functions described above must be computable at compile time. The second is that the proto-dictionary must be serializable, as we need to write it to an object file and read it back from an object file (for cases where the call to the generic function is in a different package than the generic function being called). The proto-dictionary includes information for all the sections listed above: * Derived types. Each derived type is a “skeleton” type with slots to put some of `f`’s type parameters. * Any sub-proto-dictionaries for callsites in `f`. (Note: any callsites in `f` which use only concrete type parameters do not need to be in the dictionary of `f`, because they can be generated at that callsite. Only callsites in `f` which use one or more of `f`’s type parameters need to be a subdictionary of `f`’s dictionary.) * Helper methods, if needed, for all types+operations that need them. * Stack layout information. The proto-dictionary needs a list of all of the stack objects and their types (which could be one of the derived types, above), and all callsites and their types (maybe one representative for each arg/result shape). Converting from a proto-dictionary to a dictionary would involve listing all the stack objects and their types, computing all the outargs section offsets, and adding up all the pieces of the frame to come up with an overall frame size. * Pointer maps. The proto-dictionary needs a list of argument/return values and their types, so that it can compute the argument layout and derive a pointer bitmap from that. We also need liveness bits for each argument/return value at each safepoint, so we can compute pointer maps once we know the argument/return value types. ## Closures Suppose f creates a closure? ``` func f[T any](x T, y T) { c := func() { x = y } c() } ``` We need to pass a dictionary to the anonymous function as part of the closure, so it knows how to do things like copy values of generic type. When building the dictionary for `f`, one of the subdictionaries needs to be the dictionary required for the anonymous function, which `f` can then use as part of constructing the closure. ## Generic Types This document has so far just considered generic functions. But we also need to handle generic types. These should be straightforward to stencil just like we do for derived types within functions. ## Deduplication We should name the dictionaries appropriately, so deduplication happens automatically. For instance, two different packages instantiating `f` using the same concrete types should use the same dictionary in the final binary. Deduplication should work fine using just names as is done currently in the compiler for, e.g., `runtime._type` structures. Then the worst case space usage is one dictionary per instantiation. Note that some subdictionaries might be equivalent to a top-level dictionary for that same function. ## Other Issues Recursion - can a dictionary ever reference itself? How do we build it, and the corresponding proto-dictionaries, then? I haven’t wrapped my head around the cases in which this could come up. Computing the proto-dictionary for a function probably requires compiling the function, so we know how many of each temporary of generic type is required. For other global passes like escape analysis, we don’t actually need the compiled code to compute the summary. An early pass over the source code is enough. It’s possible we could avoid the need to compile the function if we were ok with being conservative about the locals needed. Dictionary layout. Because the dictionary is completely compile time and read only, it does not need to adhere to any particular structure. It’s just an array of bytes. The compiler assigns meanings to the fields as needed, including any ordering or packing. We would, of course, keep some sort of ordering just for our sanity. The exception to the above is that the runtime needs access to a few of the dictionary fields. Those include the stackObjects slice and the pointer maps. So we should put these fields first in the dictionary. We also need a way for the runtime to get access to the dictionary itself, which could be done by always making it the first argument, and storing it in a known place (or reading out the stack object slice and pointer maps, and storing those in a known place in the stack frame). Register calling convention: argument stack objects? Use ABI0? If arguments come in registers, and those registers contain data for a generic type, it could be complicated to get that data into a memory location so we can take the address of it. Mentioned above, for the same reason we might want to use ABI0 for calling out (at least if any argument type is generic). TODO: calling methods on generic types ## Risks * Is it all worth it? Are we wasting so much space on these dictionaries that we might as well just stencil the code? At the very least, the dictionaries won’t take up code space. We’re in effect trading data cache misses for instruction cache misses (and associated instruction cache things, like branch predictor entries). * How much slower would this dictionary implementation be, than just stenciling everything? This design is pretty careful to produce no more allocations than a fully stenciled implementation, but there are a lot of other costs to operating in a generic fashion which are harder to measure. For example, if the concrete type is an `int`, a fully stenciled implementation can do `x = y` with a single load and store (or even just a register-register copy), whereas the dictionary implementation must call `memmove`.
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/freeze-syscall.md
# The syscall package Author: Rob Pike Date: 2014 Status: this proposal was [adopted for the Go 1.4 release] (https://go.dev/doc/go1.4#major_library_changes). ## Problem The `syscall` package as it stands today has several problems: 1. Bloat. It contains definitions of many system calls and constants for a large and growing set of architectures and operating systems. 2. Testing. Little of the interface has explicit tests, and cross-platform testing is impossible. 3. Curation. Many change lists arrive, in support of wide-ranging packages and systems. The merit of these changes is hard to judge, so essentially anything goes. The package is the worst maintained, worst tested, and worst documented package in the standard repository, and continues to worsen. 4. Documentation. The single package, called `syscall`, is different for every system, but godoc only shows the variant for its own native environment. Moreover, the documentation is sorely lacking anyway. Most functions have no doc comment at all. 5. Compatibility. Despite best intentions, the package does not meet the Go 1 compatibility guarantee because operating systems change in ways that are beyond our control. The recent changes to FreeBSD are one example. This proposal is an attempt to ameliorate these issues. ## Proposal The proposal has several components. In no particular order: 1. The Go 1 compatibility rules mean that we cannot fix the problem outright, say by making the package internal. We therefore propose to freeze the package as of Go 1.3, which will mean backing out some changes that have gone in since then. 2. Any changes to the system call interface necessary to support future versions of Go will be done through the internal package mechanism proposed for Go 1.4. 3. The `syscall` package will not be updated in future releases, not even to keep pace with changes in operating systems it references. For example, if the value of a kernel constant changes in a future NetBSD release, package `syscall` will not be updated to reflect that. 4. A new subrepository, `go.sys`, will be created. 5. Inside `go.sys`, there will be three packages, independent of syscall, called `plan9`, `unix`, and `windows`, and the current `syscall` package's contents will be broken apart as appropriate and installed in those packages. (This split expresses the fundamental interface differences between the systems, permitting some source-level portability, but within the packages build tags will still be needed to separate out architectures and variants (darwin, linux)). These are the packages we expect all external Go packages to migrate to when they need support for system calls. Because they are distinct, they are easier to curate, easier to examine with godoc, and may be easier to keep well documented. This layout also makes it clearer how to write cross-platform code: by separating system-dependent elements into separately imported components. 6. The `go.sys` repositories will be updated as operating systems evolve. 7. The documentation for the standard `syscall` package will direct users to the new repository. Although the `syscall` package will continue to exist and work as well as feasible, all new public development will occur in `go.sys`. 8. The core repository will not depend on the `go.sys` packages, although it is likely some of the subrepositories, such as `go.net`, will. 9. As with any standard repository, the `go.sys` repository will be curated by the Go team. Separating it out of the main repository makes it more practical to automate some of the maintenance, for example to create packages automatically by exhaustive processing of system include files. 10. Any non-essential changes at tip that have occurred in the `syscall` package since 1.3 will be migrated to the `go.sys` subrepository. Note that we cannot clean up the existing `syscall` package to any meaningful extent because of the compatibility guarantee. We can freeze and, in effect, deprecate it, however. ## Timeline We propose to complete these changes before the September 1, 2014 deadline for Go 1.4.
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/30333-smarter-scavenging.md
# Proposal: Smarter Scavenging Author(s): Michael Knyszek \<mknyszek@google.com\> Last Updated: 2019-02-20 ## Motivation & Purpose Out-of-memory errors (OOMs) have long been a pain-point for Go applications. A class of these errors come from the same underlying cause: a temporary spike in memory causes the Go runtime to grow the heap, but it takes a very long time (on the order of minutes) to return that unneeded memory back to the system. The system can end up killing the application in many situations, such as if the system has no swap space or if system monitors count this space against your application. In addition, if this additional space is counted against your application, you end up paying more for memory when you don’t really need it. The Go runtime does have internal mechanisms to help deal with this, but they don’t react to changes in the application promptly enough. The way users solve this problem today is through a runtime library function called `debug.FreeOSMemory`. `debug.FreeOSMemory` performs a GC and subsequently returns all unallocated memory back to the underlying system. However, this solution is very heavyweight: * Returning all free memory back to the underlying system at once is expensive, and can lead to latency spikes as it holds the heap lock through the whole process. * It’s an invasive solution: you need to modify your code to call it when you need it. * Reusing free chunks of memory becomes more expensive. On UNIX-y systems that means an extra page fault (which is surprisingly expensive on some systems). The purpose of this document is to propose we replace the existing mechanisms in the runtime with something stronger that responds promptly to the memory requirements of Go applications, ensuring the application is only charged for as much as it needs to remain performant. ## Background ### Scavenging Dynamic memory allocators typically obtain memory from the operating system by requesting for it to be mapped into their virtual address space. Sometimes this space ends up unused, and modern operating systems provide a way to tell the OS that certain virtual memory address regions won’t be used without unmapping them. This means the physical memory backing those regions may be taken back by the OS and used elsewhere. We in the Go runtime refer to this technique as “scavenging”. Scavenging is especially useful in dealing with page-level external fragmentation, since we can give these fragments back to the OS, reducing the process’ resident set size (RSS). That is, the amount of memory that is backed by physical memory in the application’s address space. ### Go 1.11 As of Go 1.11, the only scavenging process in the Go runtime was a periodic scavenger which runs every 2.5 minutes. This scavenger combs over all the free spans in the heap and scavenge them if they have been unused for at least 5 minutes. When the runtime coalesced spans, it would track how much of the new span was scavenged. While this simple technique is surprisingly effective for long-running applications, the peak RSS of an application can end up wildly exaggerated in many circumstances, even though the application’s peak in-use memory is significantly smaller. The periodic scavenger just does not react quickly enough to changes in the application’s memory usage. ### Go 1.12 As of Go 1.12, in addition to the periodic scavenger, the Go runtime also performs heap-growth scavenging. On each heap growth up to N bytes of the largest spans are scavenged, where N is the amount of bytes the heap grew by. The idea here is to “pay back” the cost of a heap growth. This technique helped to reduce the peak RSS of some applications. #### Note on Span Coalescing Rules As part of the Go 1.12 release, the span coalescing rules had changed such that scavenged and unscavenged spans would not coalesce. Earlier in the Go 1.12 cycle a choice was made to coalesce the two different kinds of spans by scavenging them, but this turned out to be far too aggressive in practice since most spans would become scavenged over time. This policy was especially costly if scavenging was particularly expensive on a given platform. In addition to avoiding the problem above, there’s a key reason why not to merge across this boundary: if most spans end up scavenged over time, then we do not have the fine-grained control we need over memory to create good policies and mechanisms for scavenging memory. ### Prior Art For scavenging, we look to C/C++ allocators which have a much richer history of scavenging memory than allocators for managed languages. For example, the HotSpot VM just started scavenging memory, and even then its policies are very conservative, [only returning memory during low application activity](https://openjdk.java.net/jeps/346). The [Shenandoah collector](https://mail.openjdk.java.net/pipermail/hotspot-gc-dev/2018-June/022203.html) has had this functionality for a little while, but it just does the same thing Go 1.11 did, as far as I can tell. For the purposes of this document, we will focus our comparisons on [jemalloc](https://jemalloc.net), which appears to me to be the state-of-the-art in scavenging. ## Goals The goal in scavenging smarter is two-fold: * Reduce the average and peak RSS of Go applications. * Minimize the CPU impact of keeping the RSS low. The two goals go hand-in-hand. On the one hand, you want to keep the RSS of the application as close to its in-use memory usage as possible. On the other hand, doing so is expensive in terms of CPU time, having to make syscalls and handle page faults. If we’re too aggressive and scavenge every free space we have, then on every span allocation we effectively incur a hard page fault (or invoke a syscall), and we’re calling a syscall on every span free. The ideal scenario, in my view, is that the RSS of the application “tracks” the peak in-use memory over time. * We should keep the RSS close to the actual in-use heap, but leave enough of a buffer such that the application has a pool of unscavenged memory to allocate from. * We should try to smooth over fast and transient changes in heap size. The goal of this proposal is to improve the Go runtime’s scavenging mechanisms such that it exhibits the behavior shown above. Compared with today’s implementation, this behavior should reduce the average overall RSS of most Go applications with minimal impact on performance. ## Proposal Three questions represent the key policy decisions that describe a memory scavenging system. 1. At what rate is memory scavenged? 1. How much memory should we retain (not scavenge)? 1. Which memory should we scavenge? I propose that for the Go runtime, we: 1. Scavenge at a rate proportional to the rate at which the application is allocating memory. 1. Retain some constant times the peak heap goal over the last `N` GCs. 1. Scavenge the unscavenged spans with the highest base addresses first. Additionally, I propose we change the span allocation policy to prefer unscavenged spans over scavenged spans, and to be first-fit rather than best-fit. ## Rationale ### How much memory should we retain? As part of our goal to keep the program’s reported RSS to a minimum, we ideally want to scavenge as many pages as it takes to track the program’s in-use memory. However, there’s a performance trade-off in tracking the program’s in-use memory too closely. For example, if the heap very suddenly shrinks but then grows again, there's a significant cost in terms of syscalls and page faults incurred. On the other hand, if we scavenge too passively, then the program’s reported RSS may be inflated significantly. This question is difficult to answer in general, because generally allocators can not predict the future behavior of the application. jemalloc avoids this question entirely, relying solely on having a good (albeit complicated) answer to the “rate” question (see next section). But, as Austin mentioned in [golang/go#16930](https://github.com/golang/go/issues/16930), Go has an advantage over C/C++ allocators in this respect. The Go runtime knows that before the next GC, the heap will grow to the heap goal. This suggests that between GCs there may be some body of free memory that one can drop with relatively few consequences. Thus, I propose the following heuristic, borrowed from #16930: retain `C*max(heap goal, max(heap goal over the last N GCs))` bytes of memory, and scavenge the rest. For a full rationale of the formula, see [golang/go#16930](https://github.com/golang/go/issues/16930). `C` is the "steady state variance factor" mentioned in #16930. `C` also represents a pool of unscavenged memory in addition to that guaranteed by the heap goal which the application may allocate from, increasing the probability that a given allocation will be satisfied by unscavenged memory and thus not incur a page fault on access. The initial proposed values for `C` and `N` are 1.125 (9/8) and 16, respectively. ### At what rate is memory scavenged? In order to have the application’s RSS track the amount of heap space it’s actually using over time, we want to be able to grow and shrink the RSS at a rate proportional to how the in-use memory of the application is growing and shrinking, with smoothing. When it comes to growth, that problem is generally solved. The application may cause the heap to grow, and the allocator will map new, unscavenged memory in response. Or, similarly, the application may allocate out of scavenged memory. On the flip side, figuring out the rate at which to shrink the RSS is harder. Ideally the rate is “as soon as possible”, but unfortunately this could result in latency issues. jemalloc solves this by having its memory “decay” according to a sigmoid-like curve. Each contiguous extent of allocable memory decays according to a globally-defined tunable rate, and how many of them end up available for scavenging is governed by a sigmoid-like function. The result of this policy is that the heap shrinks in sigmoidal fashion: carefully turning down to smooth out noise in in-use memory but at some point committing and scavenging lots of memory at once. While this strategy works well in general, it’s still prone to making bad decisions in certain cases, and relies on the developer to tune the decay rate for the application. Furthermore, I believe that this design by jemalloc was a direct result of not knowing anything about the future state of the heap. As mentioned earlier, the Go runtime does know that the heap will grow to the heap goal. Thus, I propose a *proportional scavenging policy*, in the same vein as the runtime’s proportional sweeping implementation. Because of how Go’s GC is paced, we know that the heap will grow to the heap goal in the future and we can measure how quickly it’s approaching that goal by seeing how quickly it’s allocating. Between GCs, I propose that the scavenger do its best to scavenge down to the scavenge goal by the time the next GC comes in. The proportional scavenger will run asynchronously, much like the Go runtime’s background sweeper, but will be more aggressive, batching more scavenging work if it finds itself falling behind. One issue with this design is situations where the application goes idle. In that case, the scavenger will do at least one unit of work (scavenge one span) on wake-up to ensure it makes progress as long as there's work to be done. Another issue with having the scavenger be fully asynchronous is that the application could actively create more work for the scavenger to do. There are two ways this could happen: * An allocation causes the heap to grow. * An allocation is satisfied using scavenged memory. The former case is already eliminated by heap-growth scavenging. The latter case may be eliminated by scavenging memory when we allocate from scavenged memory, which as of Go 1.12 we also already do. The additional scavenging during allocation could prove expensive, given the costs associated with the madvise syscall. I believe we can dramatically reduce the amount of times this is necessary by reusing unscavenged memory before scavenged memory when allocating. Thus, where currently we try to find the best-fit span across both scavenged and unscavenged spans, I propose we *prefer unscavenged to scavenged spans during allocation*. The benefits of this policy are that unscavenged pages are now significantly more likely to be reused. ### Which memory should we scavenge? At first, this question appears to be a lot like trying to pick an eviction policy for caches or a page replacement policy. The naive answer is thus to favor least-recently used memory, since there’s a cost to allocating scavenged memory (much like a cache miss). Indeed, this is the route which jemalloc takes. However unlike cache eviction policies or page replacement policies, which cannot make any assumptions about memory accesses, scavenging policy is deeply tied to allocation policy. Fundamentally, we want to scavenge the memory that the allocator is least likely to pick in the future. For a best-fit allocation policy, one idea (the current one) is to pick the largest contiguous chunks of memory first for scavenging. This scavenging policy does well and picks the least likely to be reused spans assuming that most allocations are small. If most allocations are small, then smaller contiguous free spaces will be used up first, and larger ones may be scavenged with little consequence. Consider also that even though the cost of scavenging memory is generally proportional to how many physical pages are scavenged at once, scavenging memory still has fixed costs that may be amortized by picking larger spans first. In essence, by making fewer madvise syscalls, we pay the cost of the syscall itself less often. In the cases where most span allocations aren’t small, however, we’ll be making the same number of madvise syscalls but we will incur many more page faults. Thus, I propose a more robust alternative: *change the Go runtime’s span allocation policy to be first-fit, rather than best-fit*. Address-ordered first-fit allocation policies generally perform as well as best-fit in practice when it comes to fragmentation [Johnstone98], a claim which I verified holds true for the Go runtime by simulating a large span allocation trace. Furthermore, I propose we then *scavenge the spans with the highest base address first*. The advantage of a first-fit allocation policy here is that we know something about which chunks of memory will actually be chosen, which leads us to a sensible scavenging policy. First-fit allocation paired with scavenging the "last" spans has a clear preference for taking spans which are less likely to be used, even if the assumption that most allocations are small does not hold. Therefore this policy is more robust than the current one and should therefore incur fewer page faults overall. There’s still the more general question of how performant this policy will be. First and foremost, efficient implementations of first fit-allocation exist (see Appendix). Secondly, a valid concern with this new policy is that it no longer amortizes the fixed costs of scavenging because it may choose smaller spans to scavenge, thereby making more syscalls to scavenge the same amount of memory. In the case where most span allocations are small, a first-fit allocation policy actually works to our advantage since it tends to aggregate smaller fragments at lower addresses and larger fragments at higher addresses [Wilson95]. In this case I expect performance to be on par with best-fit allocation and largest-spans-first scavenging. Where this assumption does not hold true, it’s true that this new policy may end up making more syscalls. However, the sum total of the marginal costs in scavenging generally outweigh the fixed costs. The one exception here is huge pages, which have very tiny marginal costs, but it's unclear how good of a job we or anyone else is doing with keeping huge pages intact, and this demands more research that is outside the scope of this design. Overall, I suspect any performance degradation will be minimal. ## Implementation Michael Knyszek will implement this functionality. The rough plan will be as follows: 1. Remove the existing periodic scavenger. 1. Track the last N heap goals, as in the prompt scavenging proposal. 1. Add a background goroutine which performs proportional scavenging. 1. Modify and augment the treap implementation to efficiently implement first-fit allocation. * This step will simultaneously change the policy to pick higher addresses first without any additional work. * Add tests to ensure the augmented treap works as intended. ## Other Considerations *Heap Lock Contention.* Currently the scavenging process happens with the heap lock held. With each scavenging operation taking on the order of 10µs, this can add up fast and block progress. The way jemalloc combats this is to give up the heap lock when actually making any scavenging-related syscalls. Unfortunately this comes with the caveat that any spans currently being scavenged are not available for allocation, which could cause more heap growths and discourage reuse of existing virtual address space. Also, a process’s memory map is protected by a single coarse-grained read-write lock on many modern operating systems and writers typically need to queue behind readers. Since scavengers are usually readers of this lock and heap growth is a writer on this lock it may mean that letting go of the heap lock doesn’t help so much. ## Appendix: Implementing a First-fit Data Structure We can efficiently find the lowest-address available chunk of memory that also satisfies the allocation request by modifying and augmenting any existing balanced binary tree. For brevity we’ll focus just on the treap implementation in the runtime here. The technique shown here is similar to that found in [Rezaei00]. The recipe for transforming out best-fit treap into a first-fit treap consists of the following steps: First, modify the existing treap implementation to sort by a span’s base address. Next, attach a new field to each binary tree node called maxPages. This field represents the maximum size in 8 KiB pages of a span in the subtree rooted at that node. For a leaf node, maxPages is always equal to the node’s span’s length. This invariant is maintained every time the tree changes. For most balanced trees, the tree may change in one of three ways: insertion, removal, and tree rotations. Tree rotations are simple: one only needs to update the two rotated nodes by checking their span’s size and comparing it with maxPages of their left and right subtrees, taking the maximum (effectively just recomputing maxPages non-recursively). A newly-inserted node in a treap is always a leaf, so that case is handled. Once we insert it, however, any number of subtrees from the parent may now have a different maxPages, so we start from the newly-inserted node and walk up the tree, updating maxPages. Once we reach a point where maxPages does not change, we may stop. Then we may rotate the leaf into place. At most, we travel the height of the tree in this update, but usually we’ll travel less. On removal, a treap uses rotations to make the node to-be-deleted a leaf. Once the node becomes a leaf, we remove it, and then update its ancestors starting from its new parent. We may stop, as before, when maxPages is no longer affected by the change. Finally, we modify the algorithm which finds a suitable span to use for allocation, or returns nil if one is not found. To find the first-fit span in the tree we leverage maxPages in the following algorithm (in pseudo-Go pseudocode): ``` 1 func Find(root, pages): 2 t = root 3 for t != nil: 4 if t.left != nil and t.left.maxPages >= pages: 5 t = t.left 6 else if t.span.pages >= pages: 7 return t.span 8 else t.right != nil and t.right.maxPages >= pages: 9 t = t.right 10 else: 11 return nil ``` By only going down paths where we’re sure there’s at least one span that can satisfy the allocation, we ensure that the algorithm always returns a span of at least `pages` in size. Because we prefer going left if possible (line 4) over taking the current node’s span (line 6) over going right if possible (line 8), we ensure that we allocate the node with the lowest base address. The case where we cannot go left, cannot take the current node, and cannot go right (line 10) should only be possible at the root if maxPages is managed properly. That is, just by looking at the root, one can tell whether an allocation request is satisfiable. ## References Johnstone, Mark S., and Paul R. Wilson. "The Memory Fragmentation Problem: Solved?" Proceedings of the First International Symposium on Memory Management - ISMM 98, 1998. doi:10.1145/286860.286864. M. Rezaei and K. M. Kavi, "A new implementation technique for memory management," Proceedings of the IEEE SoutheastCon 2000. 'Preparing for The New Millennium' (Cat.No.00CH37105), Nashville, TN, USA, 2000, pp. 332-339. doi:10.1109/SECON.2000.845587 Wilson, Paul R., Mark S. Johnstone, Michael Neely, and David Boles. "Dynamic Storage Allocation: A Survey and Critical Review." Memory Management Lecture Notes in Computer Science, 1995, 1-116. doi:10.1007/3-540-60368-9_19.
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/go2draft-error-handling.md
# Error Handling — Draft Design Marcel van Lohuizen\ August 27, 2018 ## Abstract We present a draft design to extend the Go language with dedicated error handling constructs. These constructs are in the spirit of "[errors are values](https://blog.golang.org/errors-are-values)" but aim to reduce the verbosity of handling errors. For more context, see the [error handling problem overview](go2draft-error-handling-overview.md). ## Background There have been many proposals over time to improve error handling in Go. For instance, see: * [golang.org/issue/21161](https://golang.org/issue/21161): simplify error handling with `|| err` suffix * [golang.org/issue/18721](https://golang.org/issue/18721): add "must" operator `#` to check and return error * [golang.org/issue/16225](https://golang.org/issue/16225): add functionality to remove repetitive `if err != nil` return * [golang.org/issue/21182](https://golang.org/issue/21182): reduce noise in return statements that contain mostly zero values * [golang.org/issue/19727](https://golang.org/issue/19727): add vet check for test of wrong `err` variable * [golang.org/issue/19642](https://golang.org/issue/19642): define `_` on right-hand side of assignment as zero value * [golang.org/issue/19991](https://golang.org/issue/19991): add built-in result type, like Rust, OCaml Related, but not addressed by this proposal: * [golang.org/issue/20803](https://golang.org/issue/20803): require call results to be used or explicitly gnored * [golang.org/issue/19511](https://golang.org/issue/19511): “Writing Web Applications” ignores error from `ListenAndServe` * [golang.org/issue/20148](https://golang.org/issue/20148): add vet check for missing test of returned error We have also consulted the [experience reports about error handling](https://golang.org/wiki/ExperienceReports#error-handling). Many of the proposals focus on verbosity. both the verbosity of having to check error values and the verbosity of zeroing out non-error return values. Other proposals address issues related to correctness, like error variable shadowing or the relative ease with which one can forget to check an error value. This draft design incorporates many of the suggestions made in these issues. ## Design This draft design builds upon the convention in Go programs that a function that can fail returns an `error` value as its final result. This draft design introduces the keywords `check` and `handle`, which we will introduce first by example. Today, errors are commonly handled in Go using the following pattern: func printSum(a, b string) error { x, err := strconv.Atoi(a) if err != nil { return err } y, err := strconv.Atoi(b) if err != nil { return err } fmt.Println("result:", x + y) return nil } With the `check`/`handle` construct, we can instead write: func printSum(a, b string) error { handle err { return err } x := check strconv.Atoi(a) y := check strconv.Atoi(b) fmt.Println("result:", x + y) return nil } For each check, there is an implicit handler chain function, explained in more detail below. Here, the handler chain is the same for each check and is defined by the single `handle` statement to be: func handleChain(err error) error { return err } The handler chain is only presented here as a function to define its semantics; it is likely to be implemented differently inside the Go compiler. ### Checks A `check` applies to an expression of type `error` or a function call returning a list of values ending in a value of type `error`. If the error is non-nil. A `check` returns from the enclosing function by returning the result of invoking the handler chain with the error value. A `check` expression applied to a function call returning multiple results evaluates to the result of that call with the final error result removed. A `check` expression applied to a plain expression or to a function call returning only an error value cannot itself be used as a value; it can only appear as an expression statement. Given new variables `v1`, `v2`, ..., `vN`, `vErr`, v1, ..., vN := check <expr> is equivalent to: v1, ..., vN, vErr := <expr> if vErr != nil { <error result> = handlerChain(vn) return } where `vErr` must have type `error` and `<error result>` denotes the (possibly unnamed) error result from the enclosing function. Similarly, foo(check <expr>) is equivalent to: v1, ..., vN, vErr := <expr> if vErr != nil { <error result> = handlerChain(vn) return } foo(v1, ..., vN) If the enclosing function has no final error result, a failing `check` calls `handlerChain` followed by a return. Since a `check` is an expression, we could write the `printSum` example above as: func printSum(a, b string) error { handle err { return err } fmt.Println("result:", check strconv.Atoi(x) + check strconv.Atoi(y)) return nil } For purposes of order of evaluation, `check` expressions are treated as equivalent to function calls. In general, the syntax of `check` is: UnaryExpr = PrimaryExpr | unary_op UnaryExpr | CheckExpr . CheckExpr = "check" UnaryExpr . It is common for idiomatic Go code to wrap the error with context information. Suppose our original example wrapped the error with the name of the function: func printSum(a, b string) error { x, err := strconv.Atoi(a) if err != nil { return fmt.Errorf("printSum(%q + %q): %v", a, b, err) } y, err := strconv.Atoi(b) if err != nil { return fmt.Errorf("printSum(%q + %q): %v", a, b, err) } fmt.Println("result:", x+y) return nil } Using a handler allows writing the wrapping just once: func printSum(a, b string) error { handle err { return fmt.Errorf("printSum(%q + %q): %v", a, b, err) } x := check strconv.Atoi(a) y := check strconv.Atoi(b) fmt.Println("result:", x + y) return nil } It is not necessary to vary the wrapping code to determine where in `printSum` the error occurred: The error returned by `strconv.Atoi` will include its argument. This design encourages writing more idiomatic and cleaner error messages and is in keeping with existing Go practice, at least in the standard library. ### Handlers The `handle` statement defines a block, called a _handler_, to handle an error detected by a `check`. A `return` statement in a handler causes the enclosing function to return immediately with the given return values. A `return` without values is only allowed if the enclosing function has no results or uses named results. In the latter case, the function returns with the current values of those results. The syntax for a `handle` statement is: Statement = Declaration | … | DeferStmt | HandleStmt . HandleStmt = "handle" identifier Block . A _handler chain function_ takes an argument of type `error` and has the same result signature as the function for which it is defined. It executes all handlers in lexical scope in reverse order of declaration until one of them executes a `return` statement. The identifier used in each `handle` statement maps to the argument of the handler chain function. Each check may have a different handler chain function depending on the scope in which it is defined. For example, consider this function: func process(user string, files chan string) (n int, err error) { handle err { return 0, fmt.Errorf("process: %v", err) } // handler A for i := 0; i < 3; i++ { handle err { err = fmt.Errorf("attempt %d: %v", i, err) } // handler B handle err { err = moreWrapping(err) } // handler C check do(something()) // check 1: handler chain C, B, A } check do(somethingElse()) // check 2: handler chain A } Check 1, inside the loop, runs handlers C, B, and A, in that order. Note that because `handle` is lexically scoped, the handlers defined in the loop body do not accumulate on each new iteration, in contrast to `defer`. Check 2, at the end of the function, runs only handler A, no matter how many times the loop executed. It is a compile-time error for a handler chain function body to be empty: there must be at least one handler, which may be a default handler. As a consequence of what we have introduced so far: - There is no way to resume control in the enclosing function after `check` detects an error. - Any handler always executes before any deferred functions are executed. - If the enclosing function has result parameters, it is a compile-time error if the handler chain for any check is not guaranteed to execute a `return` statement. A panic in a handler executes as if it occurred in the enclosing function. ### Default handler All functions whose last result is of type `error` begin with an implicit _default handler_. The default handler assigns the error argument to the last result and then returns, using the other results unchanged. In functions without named results, this means using zero values for the leading results. In functions with named results, this means using the current values of those results. Relying on the default handler, `printSum` can be rewritten as func printSum(a, b string) error { x := check strconv.Atoi(a) y := check strconv.Atoi(b) fmt.Println("result:", x + y) return nil } The default handler eliminates one of the motivations for [golang.org/issue/19642](https://golang.org/issue/19642) (using `_` to mean a zero value, to make explicit error returns shorter). In case of named return values, the default handler does not guarantee the non-error return values will be zeroed: the user may have assigned values to them earlier. In this case it will still be necessary to specify the zero values explicitly, but at least it will only have to be done once. ### Stack frame preservation Some error handling packages, like [github.com/pkg/errors](https://github.com/pkg/errors), decorate errors with stack traces. To preserve the ability to provide this information, a handler chain appears to the runtime as if it were called by the enclosing function, in its own stack frame. The `check` expression appears in the stack as the caller of the handler chain. There should be some helper-like mechanism to allow skipping over handler stack frames. This will allow code like func TestFoo(t *testing.T) { for _, tc := range testCases { x, err := Foo(tc.a) if err != nil { t.Fatal(err) } y, err := Foo(tc.b) if err != nil { t.Fatal(err) } if x != y { t.Errorf("Foo(%v) != Foo(%v)", tc.a, tc.b) } } } to be rewritten as: func TestFoo(t *testing.T) { handle err { t.Fatal(err) } for _, tc := range testCases { x := check Foo(tc.a) y := check Foo(tc.b) if x != y { t.Errorf("Foo(%v) != Foo(%v)", tc.a, tc.b) } } } while keeping the error line information useful. Perhaps it would be enough to allow: handle err { t.Helper() t.Fatal(err) } ### Variable shadowing The use of `check` avoids repeated declaration of variables named `err`, which was the main motivation for allowing a mix of new and predeclared variables in [short variable declarations](https://golang.org/ref/spec#Short_variable_declarations) (`:=` assignments). Once `check` statements are available, there would be so little valid redeclaration remaining that we might be able to forbid shadowing and close [issue 377](https://golang.org/issue/377). ### Examples A good error message includes relevant context, such as the function or method name and its arguments. Allowing handlers to chain allows adding new information as the function progresses. For example, consider this function: func SortContents(w io.Writer, files []string) error { handle err { return fmt.Errorf("process: %v", err) // handler A } lines := []strings{} for _, file := range files { handle err { return fmt.Errorf("read %s: %v ", file, err) // handler B } scan := bufio.NewScanner(check os.Open(file)) // check runs B on error for scan.Scan() { lines = append(lines, scan.Text()) } check scan.Err() // check runs B on error } sort.Strings(lines) for _, line := range lines { check io.WriteString(w, line) // check runs A on error } } The comments show which handlers are invoked for each of the `check` expressions if these were to detect an error. Here, only one handler is called in each case. If handler B did not execute in a return statement, it would transfer control to handler A. If a `handle` body does not execute an explicit `return` statement, the next earlier handler in lexical order runs: type Error struct { Func string User string Path string Err error } func (e *Error) Error() string func ProcessFiles(user string, files chan string) error { e := Error{ Func: "ProcessFile", User: user} handle err { e.Err = err; return &e } // handler A u := check OpenUserInfo(user) // check 1 defer u.Close() for file := range files { handle err { e.Path = file } // handler B check process(check os.Open(file)) // check 2 } ... } Here, if check 2 catches an error, it will execute handler B and, since handler B does not execute a `return` statement, then handler A. All handlers will be run before the `defer`. Another key difference between `defer` and `handle`: the second handler will be executed exactly once only when the second `check` fails. A `defer` in that same position would cause a new function call to be deferred until function return for every iteration. ### Draft spec The syntax for a `handle` statement is: HandleStmt = "handle" identifier Block . It declares a _handler_, which is a block of code with access to a new identifier bound to a variable of type `error`. A `return` statement in a handler returns from the enclosing function, with the same semantics and restrictions as for `return` statements in the enclosing function itself. A _default handler_ is defined at the top of functions whose last return parameter is of type `error`. It returns the current values of all leading results (zero values for unnamed results), and the error value as its final result. A _handler chain call_ for a statement and error value executes all handlers in scope of that statement in reverse order in a new stack frame, binding their identifier to the error value. At least one handler must be in scope and, if the enclosing function has result parameters, at least one of those (possibly the default handler) must end with a terminating statement. The syntax of the `check` expression is: CheckExpr = "check" UnaryExpr . It checks whether a plain expression or a function call’s last result, which must be of type error, is non-nil. If the error result is nil, the check evaluates to all but the last value. If the error result is nil, the check calls its handler chain for that value in a new stack frame and returns the result from the enclosing function. The same rules that apply for the order of evaluation of calls in expressions apply to the order of evaluation of multiple checks appearing in a single expression. The `check` expression cannot be used inside handlers. ## Summary * A _handler chain_ is a function, defined within the context of an _enclosing function_, which: - takes a single argument of type `error`, - has the same return parameters as the enclosing function, and - executes one or more blocks, called _handlers_. * A `handle` statement declares a handler for a handler chain and declares an identifier that refers to the error argument of that handler chain. - A `return` statement in a handler causes the handler chain to stop executing and the enclosing function to return using the specified return values. - If the enclosing function has named result parameters, a `return` statement with an empty expression list causes the handler chain to return with the current values of those arguments. * The `check` expression tests whether a plain expression or a function’s last result, which must be of type `error`, is non-nil. - For multi-valued expressions, `check` yields all but the last value as its result. - If `check` is applied to a single error value, `check` consumes that value and doesn’t produce any result. Consequently it cannot be used in an expression. - The _handler chain of a check_ is defined to execute all the handlers in scope within the enclosing function in reverse order until one of them returns. - For non-nil values, `check` calls the handler chain with this value, sets the return values, if any, with the results, and returns from the enclosing function. - The same rules that apply for the order of evaluation of calls in expressions apply to the order of evaluation of multiple checks appearing in a single expression. * A `check` expression cannot be used inside handlers. * A _default handler_ is defined implicitly at the top of a function with a final result parameter of type `error`. - For functions with unnamed results, the default handler returns zero values for all leading results and the error value for the final result. - For functions with named results, the default handler returns the current values of all leading results and the error value for the final result. - Because the default handler is declared at the top of a function, it is always last in the handler chain. As a corollary of these rules: * Because the handler chain is called like a function, the location where the `check` caught an error is preserved as the handler’s caller’s frame. * If the enclosing function has result parameters, it is a compile-time error if at the point of any `check` expression none of the handlers in scope is a [terminating statement](https://golang.org/ref/spec#Terminating_statements). Note that the default handler ends in a terminating statement. * After a `check` detects an error, one cannot resume control of an enclosing function. * If a handler executes, it is always before any `defer` defined within the same enclosing function. ## Discussion One drawback of the presented design is that it introduces a context-dependent control-flow jump, like `break` and `continue`. The semantics of `handle` are similar to but the same as `defer`, adding another thing for developers to learn. We believe that the reduction in verbosity, coupled with the increased ease to wrap error messages as well as doing so idiomatically is worth this cost. Another drawback is that this design might appear to add exceptions to Go. The two biggest problems with exceptions are that checks are not explicitly marked and that the invoked handler is difficult to determine and may depend on the call stack. `Check`/`handle` has neither problem: checks are marked and only execute lexically scoped handlers in the enclosing function. ## Other considerations This section discusses aspects of the design that we have discussed in the past. ### Keyword: try versus check Swift and Rust define a `try` keyword which is similar to the `check` discussed in this design. Unlike `try` in Swift and Rust, check allows checking of any expression that is assignable to error, not just calls, making the use of `try` somewhat contrived. We could consider `try` for the sake of consistency with other languages, but Rust is moving away from try to the new `?` operator, and Swift has not just `try` but also `try!`, `try?`, `catch`, and `throw`. ### Keyword: handle versus catch The keyword `handle` was chosen instead of `catch` to avoid confusion with the exception semantics conventionally associated with `catch`. Most notably, `catch` permits the surrounding function to continue, while a handler cannot: the function will always exit after the handler chain completes. All the handler chain can do is clean up and set the function results. ### Checking error returns from deferred calls The presented design does not provide a mechanism for checking errors returned by deferred calls. We were unable to find a way to unify them cleanly. This code does not compile: func Greet(w io.WriteCloser) error { defer func() { check w.Close() }() fmt.Fprintf(w, "hello, world\n") return nil } What the code likely intends is for the `check` to cause `Greet` to return the error, but the `check` is not in `Greet`. Instead, the `check` appears in a function literal returning no results. The function therefore has no default handler, so there is no handler chain for the `check` to call, which causes a compilation failure. Even with new syntax to write a deferred checked function call, such as `defer check w.Close()`, there is an ordering problem: deferred calls run after the function executes its `return` statement; in the case of an error, the handlers have already run. It would be surprising to run any of them a second time as a result of a deferred `check`. ### A check-else statement A `check <expr> else <block>` statement could allow a block attached to a check to be executed if an error is detected. This would allow, for instance, setting an HTTP error code that a handler can pick up to wrap an error. Joe Duffy proposed a similar construct in his [Error Model](http://joeduffyblog.com/2016/02/07/the-error-model/) blog post. However, this is generally not needed for error wrapping, so it seems that this will not be needed much in practice. Nesting `check` expressions with else blocks could make code unwieldy. Analysis of a large code corpus shows that adding a `check`-`else` construct usually does not help much. Either way, the design does not preclude adding such a construct later if all else fails. Note that a `check`-`else` can already be spelled out explicitly: x, err := <expr> if err != nil { <any custom handling, possibly including "check err"> } We can also write helpers like: func e(err, code int, msg string) *appError { if err == nil { return nil } return &appError{err, msg, code} } check e(doX(), 404, "record not found") instead of: if err := doX(); err != nil { return &appError{err, "record not found", 404} } Many wrapper functions, including `github.com/pkg/errors`'s `Wrap`, start with a nil check. We could rely on the compiler to optimize this particular case. ## Considered Ideas ### Using a ? operator instead of check Rust is moving to a syntax of the form `<expr>?` instead of `try! <expr>`. The rationale is that the `?` allows for better chaining, as in `f()?.g()?.h()`. In Go, control flow transfers are as a general rule accompanied by keywords (the exception being the boolean operators `||` and `&&`). We believe that deviating from this would be too inconsistent. Also, although the `?` approach may read better for chaining, it reads worse for passing the result of a `check` to a function. Compare, for instance check io.Copy(w, check newReader(foo)) to io.Copy(w, newReader(foo)?)? Finally, handlers and `check` expressions go hand-in-hand. Handlers are more naturally defined with a keyword. It would be somewhat inconsistent to have the accompanying `check` construct not also use a keyword. ## Comparisons ### Midori Joe Duffy offers many valuable insights in the use of exceptions versus error codes in his [Error Model](http://joeduffyblog.com/2016/02/07/the-error-model/) blog post. ### C++ proposal Herb Sutter’s [proposal for C++](http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0709r0.pdf) seems to come close to the what is presented here. Although syntax varies in several places, the basic approach of propagating errors as values with try and allowing handlers to deal with errors is similar. The catch handlers, however, discard the error by default unless they are rethrown in the catch block. There is no way to continue after an error in our design. The article offers interesting insights about the advantages of this approach. ### Rust Rust originally defined `try!` as shorthand for checking an error and returning it from the enclosing function if found. For more complex handling, instead of handlers, Rust uses pattern matching on unwrapped return types. ### Swift Swift defines a `try` keyword with somewhat similar semantics to the `check` keyword introduced here. A `try` in Swift may be accompanied by a `catch` block. However, unlike with `check`-`handle`, the `catch` block will prevent the function from returning unless the block explicitly rethrows the error. In the presented design, there is no way to stop exiting the function. Swift also has a `try!`, which panics if an error is detected, and a `try?`-`else`, which allows two blocks to be associated that respectively will be run if the `try?` checks succeeds or fails.
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/go2draft-type-parameters.md
# Type Parameters - Draft Design This draft design has [become a proposal](https://go.googlesource.com/proposal/+/refs/heads/master/design/43651-type-parameters.md).
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/27935-unbounded-queue-package.md
# Proposal: Built in support for high performance unbounded queue Author: Christian Petrin. Last updated: October 2, 2018 Discussion at: https://github.com/golang/go/issues/27935 Design document at https://github.com/golang/proposal/blob/master/design/27935-unbounded-queue-package.md ## Abstract I propose to add a new package, "container/queue", to the standard library to support an in-memory, unbounded, general purpose queue implementation. [Queues](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)) in computer science is a very old, well established and well known concept, yet Go doesn't provide a specialized, safe to use, performant and issue free unbounded queue implementation. Buffered channels provide an excellent option to be used as a queue, but buffered channels are bounded and so doesn't scale to support very large data sets. The same applies for the standard [ring package](https://github.com/golang/go/tree/master/src/container/ring). The standard [list package](https://github.com/golang/go/tree/master/src/container/list) can be used as the underlying data structure for building unbounded queues, but the performance yielded by this linked list based implementation [is not optimal](https://github.com/christianrpetrin/queue-tests/blob/master/bench_queue.md). Implementing a queue using slices as suggested [here](https://stackoverflow.com/a/26863706) is a feasible approach, but the performance yielded by this implementation can be abysmal in some [high load scenarios](https://github.com/christianrpetrin/queue-tests/blob/master/bench_queue.md). ## Background Queues that grows dynamically has many uses. As an example, I'm working on a logging system called [CloudLogger](https://github.com/cloud-logger/docs) that sends all logged data to external logging management systems, such as [Stackdriver](https://cloud.google.com/stackdriver/) and [Cloudwatch](https://aws.amazon.com/cloudwatch/). External logging systems typically [rate limit](https://en.wikipedia.org/wiki/Rate_limiting) how much data their service will accept for a given account and time frame. So in a scenario where the hosting application is logging more data than the logging management system will accept at a given moment, CloudLogger has to queue the extra logs and send them to the logging management system at a pace the system will accept. As there's no telling how much data will have to be queued as it depends on the current traffic, an unbounded, dynamically growing queue is the ideal data structure to be used. Buffered channels in this scenario is not ideal as they have a limit on how much data they will accept, and once that limit has been reached, the producers (routines adding to the channel) start to block, making the adding to the channel operation an "eventual" synchronous process. A fully asynchronous operation in this scenario is highly desirable as logging data should not slow down significantly the hosting application. Above problem is a problem that, potentially, every system that calls another system faces. And in the [cloud](https://en.wikipedia.org/wiki/Cloud_computing) and [microservices](https://en.wikipedia.org/wiki/Microservices) era, this is an extremely common scenario. Due to the lack of support for built in unbounded queues in Go, Go engineers are left to either: 1) Research and use external packages, or 2) Build their own queue implementation Both approaches are riddled with pitfalls. Using external packages, specially in enterprise level software, requires a lot of care as using external, potentially untested and hard to understand code can have unwanted consequences. This problem is made much worse by the fact that, currently, there's no well established and disseminated open source Go queue implementation according to [this stackoverflow discussion](https://stackoverflow.com/questions/2818852/is-there-a-queue-implementation), [this github search for Go queues](https://github.com/search?l=Go&q=go+queue&type=Repositories) and [Awesome Go](https://awesome-go.com/). Building a queue, on the other hand, might sound like a compelling argument, but building efficient, high performant, bug free unbounded queue is a hard job that requires a pretty solid computer science foundation as well a good deal of time to research different design approaches, test different implementations, make sure the code is bug and memory leak free, etc. In the end what Go engineers have been doing up to this point is building their own queues, which are for the most part inefficient and can have disastrous, yet hidden performance and memory issues. As examples of poorly designed and/or implemented queues, the approaches suggested [here](https://stackoverflow.com/a/26863706) and [here](https://stackoverflow.com/a/11757161) (among many others), requires linear copy of the internal slice for resizing purposes. Some implementations also has memory issues such as an ever expanding internal slice and memory leaks. ## Proposal I propose to add a new package, "container/queue", to the standard library to support in-memory unbounded queues. The [proposed queue implementation](https://github.com/christianrpetrin/queue-tests/blob/master/queueimpl7/queueimpl7.go) offers [excellent performance and very low memory consumption](https://github.com/christianrpetrin/queue-tests/blob/master/bench_queue.md) when comparing it to three promising open source implementations ([gammazero](https://github.com/gammazero/deque), [phf](https://github.com/phf/go-queue) and [juju](https://github.com/juju/utils/tree/master/deque)); to use Go channels as queue; the standard list package as a queue as well as six other experimental queue implementations. The [proposed queue implementation](https://github.com/christianrpetrin/queue-tests/blob/master/queueimpl7/queueimpl7.go) offers the most balanced approach to performance given different loads, being significantly faster and still uses less memory than every other queue implementation in the [tests](https://github.com/christianrpetrin/queue-tests/blob/master/benchmark_test.go). The closest data structure Go has to offer for building dynamically growing queues for large data sets is the [standard list package](https://github.com/golang/go/tree/master/src/container/list). When comparing the proposed solution to [using the list package as an unbounded queue](https://github.com/christianrpetrin/queue-tests/blob/master/benchmark_test.go) (refer to "BenchmarkList"), the proposed solution is consistently faster than using the list package as a queue as well as displaying a much lower memory footprint. ### Reasoning There's [two well accepted approaches](https://en.wikipedia.org/wiki/Queue_(abstract_data_type)#Queue_implementation) to implementing queues when in comes to the queue underlying data structure: 1) Using linked list 2) Using array Linked list as the underlying data structure for an unbounded queue has the advantage of scaling efficiently when the underlying data structure needs to grow to accommodate more values. This is due to the fact that the existing elements doesn't need to be repositioned or copied around when the queue needs to grow. However, there's a few concerns with this approach: 1) The use of prev/next pointers for each value requires a good deal of extra memory 2) Due to the fact that each "node" in the linked list can be allocated far away from the previous one, navigating through the list can be slow due to its bad [memory locality](https://www.cs.cornell.edu/courses/cs3110/2012sp/lectures/lec25-locality/lec25.html) properties 3) Adding new values always require new memory allocations and pointers being set, hindering performance On the other hand, using a slice as the underlying data structure for unbounded queues has the advantage of very good [memory locality](https://www.cs.cornell.edu/courses/cs3110/2012sp/lectures/lec25-locality/lec25.html), making retrieval of values faster when comparing to linked lists. Also an "alloc more than needed right now" approach can easily be implemented with slices. However, when the slice needs to expand to accommodate new values, a [well adopted strategy](https://en.wikipedia.org/wiki/Dynamic_array#Geometric_expansion_and_amortized_cost) is to allocate a new, larger slice, copy over all elements from the previous slice into the new one and use the new one to add the new elements. The problem with this approach is the obvious need to copy all the values from the older, small slice, into the new one, yielding a poor performance when the amount of values that need copying are fairly large. Another potential problem is a theoretical lower limit on how much data they can hold as slices, like arrays, have to allocate its specified positions in sequential memory addresses, so the maximum number of items the queue would ever be able to hold is the maximum size a slice can be allocated on that particular system at any given moment. Due to modern memory management techniques such as [virtual memory](https://en.wikipedia.org/wiki/Virtual_memory) and [paging](https://en.wikipedia.org/wiki/Paging), this is a very hard scenario to corroborate thru practical testing. Nonetheless, this approach doesn't scale well with large data sets. Having said that, there's a third, newer approach to implementing unbounded queues: use fixed size linked slices as the underlying data structure. The fixed size linked slices approach is a hybrid between the first two, providing good memory locality arrays have alongside the efficient growing mechanism linked lists offer. It is also not limited on the maximum size a slice can be allocated, being able to hold and deal efficiently with a theoretical much larger amount of data than pure slice based implementations. ## Rationale ### Research [A first implementation](https://github.com/cloud-spin/queue) of the new design was built. The benchmark tests showed the new design was very promising, so I decided to research about other possible queue designs and implementations with the goal to improve the first design and implementation. As part of the research to identify the best possible queue designs and implementations, I implemented and probed below queue implementations. - [queueimpl1](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl1/queueimpl1.go): custom queue implementation that stores the values in a simple slice. Pop removes the first slice element. This is a slice based implementation that tests [this](https://stackoverflow.com/a/26863706) suggestion. - [queueimpl2](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl2/queueimpl2.go): custom queue implementation that stores the values in a simple slice. Pop moves the current position to next one instead of removing the first element. This is a slice based implementation similarly to queueimpl1, but differs in the fact that it uses pointers to point to the current first element in the queue instead of removing the first element. - [queueimpl3](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl3/queueimpl3.go): custom queue implementation that stores the values in linked slices. This implementation tests the queue performance when controlling the length and current positions in the slices using the builtin len and append functions. - [queueimpl4](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl4/queueimpl4.go): custom queue implementation that stores the values in linked arrays. This implementation tests the queue performance when controlling the length and current positions in the arrays using simple local variables instead of the built in len and append functions (i.e. it uses arrays instead of slices). - [queueimpl5](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl5/queueimpl5.go): custom queue implementation that stores the values in linked slices. This implementation tests the queue performance when storing the "next" pointer as part of the values slice instead of having it as a separate "next" field. The next element is stored in the last position of the internal slices, which is a reserved position. - [queueimpl6](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl6/queueimpl6.go): custom queue implementation that stores the values in linked slices. This implementation tests the queue performance when performing lazy creation of the first slice as well as starting with an slice of size 1 and doubling its size up to 128, everytime a new linked slice needs to be created. - [queueimpl7](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl7/queueimpl7.go): custom queue implementation that stores the values in linked slices. This implementation tests the queue performance when performing lazy creation of the internal slice as well as starting with a 1-sized slice, allowing it to grow up to 16 by using the built in append function. Subsequent slices are created with 128 fixed size. Also as part of the research, I investigated and probed below open source queue implementations as well. - [phf](https://github.com/phf/go-queue): this is a slice, ring based queue implementation. Interesting to note the author did a pretty good job researching and probing other queue implementations as well. - [gammazero](https://github.com/gammazero/deque): the deque implemented in this package is also a slice, ring based queue implementation. - [juju](https://github.com/juju/utils/tree/master/deque): the deque implemented in this package uses a linked list based approach, similarly to other experimental implementations in this package such as [queueimpl3](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl3/queueimpl3.go). The biggest difference between this implementation and the other experimental ones is the fact that this queue uses the standard list package as the linked list. The standard list package implements a doubly linked list, while the experimental implementations implements their own singly linked list. The [standard list package](https://github.com/golang/go/blob/master/src/container/list/list.go) as well as buffered channels were probed as well. ### Benchmark Results Initialization time only<br/> Performance<br/> ![ns/op](https://github.com/christianrpetrin/queue-tests/blob/master/images/queue-0-items-perf.jpg?raw=true "Benchmark tests") <br/> Memory<br/> ![B/op](https://github.com/christianrpetrin/queue-tests/blob/master/images/queue-0-items-mem.jpg?raw=true "Benchmark tests") Add and remove 1k items<br/> Performance<br/> ![ns/op](https://github.com/christianrpetrin/queue-tests/blob/master/images/queue-1k-items-perf.jpg?raw=true "Benchmark tests") Memory<br/> ![B/op](https://github.com/christianrpetrin/queue-tests/blob/master/images/queue-1k-items-mem.jpg?raw=true "Benchmark tests") <br/> Add and remove 100k items<br/> Performance<br/> ![ns/op](https://github.com/christianrpetrin/queue-tests/blob/master/images/queue-100k-items-perf.jpg?raw=true "Benchmark tests") Memory<br/> ![B/op](https://github.com/christianrpetrin/queue-tests/blob/master/images/queue-100k-items-mem.jpg?raw=true "Benchmark tests") <br/> Aggregated Results<br/> Performance<br/> ![ns/op](https://github.com/christianrpetrin/queue-tests/blob/master/images/queue-line-perf.jpg?raw=true "Benchmark tests") Memory<br/> ![B/op](https://github.com/christianrpetrin/queue-tests/blob/master/images/queue-line-mem.jpg?raw=true "Benchmark tests") <br/> Detailed, curated results can be found [here](https://docs.google.com/spreadsheets/d/e/2PACX-1vRnCm7v51Eo5nq66NsGi8aQI6gL14XYJWqaeRJ78ZIWq1pRCtEZfsLD2FcI-gIpUhhTPnkzqDte_SDB/pubhtml?gid=668319604&single=true) Aggregated, curated results can be found [here](https://docs.google.com/spreadsheets/d/e/2PACX-1vRnCm7v51Eo5nq66NsGi8aQI6gL14XYJWqaeRJ78ZIWq1pRCtEZfsLD2FcI-gIpUhhTPnkzqDte_SDB/pubhtml?gid=582031751&single=true) <br/> Given above results, [queueimpl7](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl7/queueimpl7.go), henceforth just "impl7", proved to be the most balanced implementation, being either faster or very competitive in all test scenarios from a performance and memory perspective. Refer [here](https://github.com/christianrpetrin/queue-tests) for more details about the tests. The benchmark tests can be found [here](https://github.com/christianrpetrin/queue-tests/blob/master/benchmark_test.go). #### Impl7 Design and Implementation [Impl7](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl7/queueimpl7.go) was the result of the observation that some slice based implementations such as [queueimpl1](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl1/queueimpl1.go) and [queueimpl2](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl2/queueimpl2.go) offers phenomenal performance when the queue is used with small data sets. For instance, comparing [queueimpl3](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl3/queueimpl3.go) (very simple linked slice implementation) with [queueimpl1](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl1/queueimpl1.go) (very simple slice based implementation), the results at adding 0 (init time only), 1 and 10 items are very favorable for impl1, from a performance and memory perspective. ``` benchstat rawresults/bench-impl1.txt rawresults/bench-impl3.txt name old time/op new time/op delta /0-4 6.83ns ± 3% 472.53ns ± 7% +6821.99% (p=0.000 n=20+17) /1-4 48.1ns ± 6% 492.4ns ± 5% +924.66% (p=0.000 n=20+20) /10-4 532ns ± 5% 695ns ± 8% +30.57% (p=0.000 n=20+20) /100-4 3.19µs ± 2% 2.50µs ± 4% -21.69% (p=0.000 n=18+19) /1000-4 24.5µs ± 3% 23.6µs ± 2% -3.33% (p=0.000 n=19+19) /10000-4 322µs ± 4% 238µs ± 1% -26.02% (p=0.000 n=19+18) /100000-4 15.8ms ±10% 3.3ms ±13% -79.32% (p=0.000 n=20+20) name old alloc/op new alloc/op delta /0-4 0.00B 2080.00B ± 0% +Inf% (p=0.000 n=20+20) /1-4 16.0B ± 0% 2080.0B ± 0% +12900.00% (p=0.000 n=20+20) /10-4 568B ± 0% 2152B ± 0% +278.87% (p=0.000 n=20+20) /100-4 4.36kB ± 0% 2.87kB ± 0% -34.13% (p=0.000 n=20+20) /1000-4 40.7kB ± 0% 24.6kB ± 0% -39.54% (p=0.000 n=20+20) /10000-4 746kB ± 0% 244kB ± 0% -67.27% (p=0.000 n=20+20) /100000-4 10.0MB ± 0% 2.4MB ± 0% -75.85% (p=0.000 n=15+20) name old allocs/op new allocs/op delta /0-4 0.00 2.00 ± 0% +Inf% (p=0.000 n=20+20) /1-4 1.00 ± 0% 2.00 ± 0% +100.00% (p=0.000 n=20+20) /10-4 14.0 ± 0% 11.0 ± 0% -21.43% (p=0.000 n=20+20) /100-4 108 ± 0% 101 ± 0% -6.48% (p=0.000 n=20+20) /1000-4 1.01k ± 0% 1.01k ± 0% +0.50% (p=0.000 n=20+20) /10000-4 10.0k ± 0% 10.2k ± 0% +1.35% (p=0.000 n=20+20) /100000-4 100k ± 0% 102k ± 0% +1.53% (p=0.000 n=20+20) ``` Impl7 is a hybrid experiment between using a simple slice based queue implementation for small data sets and the fixed size linked slice approach for large data sets, which is an approach that scales really well, offering really good performance for small and large data sets. The implementation starts by lazily creating the first slice to hold the first values added to the queue. ```go const ( // firstSliceSize holds the size of the first slice. firstSliceSize = 1 // maxFirstSliceSize holds the maximum size of the first slice. maxFirstSliceSize = 16 // maxInternalSliceSize holds the maximum size of each internal slice. maxInternalSliceSize = 128 ) ... // Push adds a value to the queue. // The complexity is amortized O(1). func (q *Queueimpl7) Push(v interface{}) { if q.head == nil { h := newNode(firstSliceSize) // Returns a 1-sized slice. q.head = h q.tail = h q.lastSliceSize = maxFirstSliceSize } else if len(q.tail.v) >= q.lastSliceSize { n := newNode(maxInternalSliceSize) // Returns a 128-sized slice. q.tail.n = n q.tail = n q.lastSliceSize = maxInternalSliceSize } q.tail.v = append(q.tail.v, v) q.len++ } ... // newNode returns an initialized node. func newNode(capacity int) *Node { return &Node{ v: make([]interface{}, 0, capacity), } } ``` The very first created slice is created with capacity 1. The implementation allows the builtin append function to dynamically resize the slice up to 16 (maxFirstSliceSize) positions. After that it reverts to creating fixed size 128 position slices, which offers the best performance for data sets above 16 items. 16 items was chosen as this seems to provide the best balanced performance for small and large data sets according to the [array size benchmark tests](https://github.com/christianrpetrin/queue-tests/blob/master/bench_slice_size.md). Above 16 items, growing the slice means allocating a new, larger one and copying all 16 elements from the previous slice into the new one. The append function phenomenal performance can only compensate for the added copying of elements if the data set is very small, no more than 8 items in the benchmark tests. For above 8 items, the fixed size slice approach is consistently faster and uses less memory, where 128 sized slices are allocated and linked together when the data structure needs to scale to accommodate new values. Why 16? Why not 15 or 14? The builtin append function, as of "go1.11 darwin/amd64", seems to double the slice size every time it needs to allocate a new one. ```go ts := make([]int, 0, 1) ts = append(ts, 1) fmt.Println(cap(ts)) // Slice has 1 item; output: 1 ts = append(ts, 1) fmt.Println(cap(ts)) // Slice has 2 items; output: 2 ts = append(ts, 1) fmt.Println(cap(ts)) // Slice has 3 items; output: 4 ts = append(ts, 1) ts = append(ts, 1) fmt.Println(cap(ts)) // Slice has 5 items; output: 8 ts = append(ts, 1) ts = append(ts, 1) ts = append(ts, 1) ts = append(ts, 1) fmt.Println(cap(ts)) // Slice has 9 items; output: 16 ``` Since the append function will resize the slice from 8 to 16 positions, it makes sense to use all 16 already allocated positions before switching to the fixed size slices approach. #### Design Considerations [Impl7](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl7/queueimpl7.go) uses linked slices as its underlying data structure. The reasonale for the choice comes from two main obervations of slice based queues: 1) When the queue needs to expand to accomodate new values, a new, larger slice needs to be allocated and used 2) Allocating and managing large slices is expensive, especially in an overloaded system with little avaialable physical memory To help clarify the scenario, below is what happens when a slice based queue that already holds, say 1bi items, needs to expand to accommodate a new item. Slice based implementation - Allocate a new, [twice the size](https://en.wikipedia.org/wiki/Dynamic_array#Geometric_expansion_and_amortized_cost) of the previous allocated one, say 2 billion positions slice - Copy over all 1 billion items from the previous slice into the new one - Add the new value into the first unused position in the new array, position 1000000001. The same scenario for impl7 plays out like below. Impl7 - Allocate a new 128 size slice - Set the next pointer - Add the value into the first position of the new array, position 0 Impl7 never copies data around, but slice based ones do, and if the data set is large, it doesn't matter how fast the copying algorithm is. The copying has to be done and will take some time. The decision to use linked slices was also the result of the observation that slices goes to great length to provide predictive, indexed positions. A hash table, for instance, absolutely need this property, but not a queue. So impl7 completely gives up this property and focus on what really matters: add to end, retrieve from head. No copying around and repositioning of elements is needed for that. So when a slice goes to great length to provide that functionality, the whole work of allocating new arrays, copying data around is all wasted work. None of that is necessary. And this work costs dearly for large data sets as observed in the [tests](https://github.com/christianrpetrin/queue-tests/blob/master/bench_queue.md). #### Impl7 Benchmark Results Below compares impl7 with a few selected implementations. The tests name are formatted given below. - Benchmark/N-4: benchmark a queue implementation where N denotes the number of items added and removed to/from the queue; 4 means the number of CPU cores in the host machine. Examples: - Benchmark/0-4: benchmark the queue by creating a new instance of it. This only test initialization time. - Benchmark/100-4: benchmark the queue by creating a new instance of it and adding and removing 100 items to/from the queue. --- Standard list used as a FIFO queue vs impl7. ``` benchstat rawresults/bench-list.txt rawresults/bench-impl7.txt name old time/op new time/op delta /0-4 34.9ns ± 1% 1.2ns ± 3% -96.64% (p=0.000 n=19+20) /1-4 77.0ns ± 1% 68.3ns ± 1% -11.21% (p=0.000 n=20+20) /10-4 574ns ± 0% 578ns ± 0% +0.59% (p=0.000 n=18+20) /100-4 5.94µs ± 1% 3.07µs ± 0% -48.28% (p=0.000 n=19+18) /1000-4 56.0µs ± 1% 25.8µs ± 1% -53.92% (p=0.000 n=20+20) /10000-4 618µs ± 1% 260µs ± 1% -57.99% (p=0.000 n=20+18) /100000-4 13.1ms ± 6% 3.1ms ± 3% -76.50% (p=0.000 n=20+20) name old alloc/op new alloc/op delta /0-4 48.0B ± 0% 0.0B -100.00% (p=0.000 n=20+20) /1-4 96.0B ± 0% 48.0B ± 0% -50.00% (p=0.000 n=20+20) /10-4 600B ± 0% 600B ± 0% ~ (all equal) /100-4 5.64kB ± 0% 3.40kB ± 0% -39.72% (p=0.000 n=20+20) /1000-4 56.0kB ± 0% 25.2kB ± 0% -55.10% (p=0.000 n=20+20) /10000-4 560kB ± 0% 243kB ± 0% -56.65% (p=0.000 n=20+20) /100000-4 5.60MB ± 0% 2.43MB ± 0% -56.66% (p=0.000 n=18+20) name old allocs/op new allocs/op delta /0-4 1.00 ± 0% 0.00 -100.00% (p=0.000 n=20+20) /1-4 2.00 ± 0% 2.00 ± 0% ~ (all equal) /10-4 20.0 ± 0% 15.0 ± 0% -25.00% (p=0.000 n=20+20) /100-4 200 ± 0% 107 ± 0% -46.50% (p=0.000 n=20+20) /1000-4 2.00k ± 0% 1.02k ± 0% -48.95% (p=0.000 n=20+20) /10000-4 20.0k ± 0% 10.2k ± 0% -49.20% (p=0.000 n=20+20) /100000-4 200k ± 0% 102k ± 0% -49.22% (p=0.000 n=20+20) ``` Impl7 is: - Up to ~29x faster (1.2ns vs 34.9ns) than list package for init time (0 items) - Up to ~4x faster (3.1ms vs 13.1ms) than list package for 100k items - Uses ~1/2 memory (2.43MB vs 5.60MB) than list package for 100k items --- [impl1](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl1/queueimpl1.go) (simple slice based queue implementaion) vs impl7. ``` benchstat rawresults/bench-impl1.txt rawresults/bench-impl7.txt name old time/op new time/op delta /0-4 6.83ns ± 3% 1.18ns ± 3% -82.79% (p=0.000 n=20+20) /1-4 48.1ns ± 6% 68.3ns ± 1% +42.23% (p=0.000 n=20+20) /10-4 532ns ± 5% 578ns ± 0% +8.55% (p=0.000 n=20+20) /100-4 3.19µs ± 2% 3.07µs ± 0% -3.74% (p=0.000 n=18+18) /1000-4 24.5µs ± 3% 25.8µs ± 1% +5.51% (p=0.000 n=19+20) /10000-4 322µs ± 4% 260µs ± 1% -19.23% (p=0.000 n=19+18) /100000-4 15.8ms ±10% 3.1ms ± 3% -80.60% (p=0.000 n=20+20) name old alloc/op new alloc/op delta /0-4 0.00B 0.00B ~ (all equal) /1-4 16.0B ± 0% 48.0B ± 0% +200.00% (p=0.000 n=20+20) /10-4 568B ± 0% 600B ± 0% +5.63% (p=0.000 n=20+20) /100-4 4.36kB ± 0% 3.40kB ± 0% -22.02% (p=0.000 n=20+20) /1000-4 40.7kB ± 0% 25.2kB ± 0% -38.25% (p=0.000 n=20+20) /10000-4 746kB ± 0% 243kB ± 0% -67.47% (p=0.000 n=20+20) /100000-4 10.0MB ± 0% 2.4MB ± 0% -75.84% (p=0.000 n=15+20) name old allocs/op new allocs/op delta /0-4 0.00 0.00 ~ (all equal) /1-4 1.00 ± 0% 2.00 ± 0% +100.00% (p=0.000 n=20+20) /10-4 14.0 ± 0% 15.0 ± 0% +7.14% (p=0.000 n=20+20) /100-4 108 ± 0% 107 ± 0% -0.93% (p=0.000 n=20+20) /1000-4 1.01k ± 0% 1.02k ± 0% +1.09% (p=0.000 n=20+20) /10000-4 10.0k ± 0% 10.2k ± 0% +1.39% (p=0.000 n=20+20) /100000-4 100k ± 0% 102k ± 0% +1.54% (p=0.000 n=20+20) ``` Impl7 is: - Up to ~5x faster (1.18ns vs 6.83ns) than impl1 for init time (0 items) - Up to ~5x faster (3.1ms vs 15.8ms) than impl1 for 100k items - Uses ~1/4 memory (2.4MB vs 10MB) than impl1 for 100k items It's important to note that the performance and memory gains for impl7 is exponential like the larger the data set is due to the fact slice based implementations doesn't scale well, [paying a higher and higher price](https://en.wikipedia.org/wiki/Dynamic_array#Geometric_expansion_and_amortized_cost), performance and memory wise, every time it needs to scale to accommodate an ever expanding data set. --- [phf](https://github.com/phf/go-queue) (slice, ring based FIFO queue implementation) vs impl7. ``` benchstat rawresults/bench-phf.txt rawresults/bench-impl7.txt name old time/op new time/op delta /0-4 28.1ns ± 1% 1.2ns ± 3% -95.83% (p=0.000 n=20+20) /1-4 42.5ns ± 1% 68.3ns ± 1% +60.80% (p=0.000 n=20+20) /10-4 681ns ± 1% 578ns ± 0% -15.11% (p=0.000 n=18+20) /100-4 4.55µs ± 1% 3.07µs ± 0% -32.45% (p=0.000 n=19+18) /1000-4 35.5µs ± 1% 25.8µs ± 1% -27.32% (p=0.000 n=18+20) /10000-4 349µs ± 2% 260µs ± 1% -25.67% (p=0.000 n=20+18) /100000-4 11.7ms ±11% 3.1ms ± 3% -73.77% (p=0.000 n=20+20) name old alloc/op new alloc/op delta /0-4 16.0B ± 0% 0.0B -100.00% (p=0.000 n=20+20) /1-4 16.0B ± 0% 48.0B ± 0% +200.00% (p=0.000 n=20+20) /10-4 696B ± 0% 600B ± 0% -13.79% (p=0.000 n=20+20) /100-4 6.79kB ± 0% 3.40kB ± 0% -49.94% (p=0.000 n=20+20) /1000-4 57.0kB ± 0% 25.2kB ± 0% -55.86% (p=0.000 n=20+20) /10000-4 473kB ± 0% 243kB ± 0% -48.68% (p=0.000 n=20+20) /100000-4 7.09MB ± 0% 2.43MB ± 0% -65.77% (p=0.000 n=18+20) name old allocs/op new allocs/op delta /0-4 1.00 ± 0% 0.00 -100.00% (p=0.000 n=20+20) /1-4 1.00 ± 0% 2.00 ± 0% +100.00% (p=0.000 n=20+20) /10-4 15.0 ± 0% 15.0 ± 0% ~ (all equal) /100-4 111 ± 0% 107 ± 0% -3.60% (p=0.000 n=20+20) /1000-4 1.02k ± 0% 1.02k ± 0% +0.39% (p=0.000 n=20+20) /10000-4 10.0k ± 0% 10.2k ± 0% +1.38% (p=0.000 n=20+20) /100000-4 100k ± 0% 102k ± 0% +1.54% (p=0.000 n=20+20) ``` Impl7 is: - Up to ~23x faster (1.2ns vs 28.1ns) than phf for init time (0 items) - Up to ~3x faster (3.1ms vs 11.7ms) than phf for 100k items - Uses ~1/2 memory (2.43MB vs 7.09MB) than phf for 100k items --- Buffered channel vs impl7. ``` benchstat rawresults/bench-channel.txt rawresults/bench-impl7.txt name old time/op new time/op delta /0-4 30.2ns ± 1% 1.2ns ± 3% -96.12% (p=0.000 n=19+20) /1-4 87.6ns ± 1% 68.3ns ± 1% -22.00% (p=0.000 n=19+20) /10-4 704ns ± 1% 578ns ± 0% -17.90% (p=0.000 n=20+20) /100-4 6.78µs ± 1% 3.07µs ± 0% -54.70% (p=0.000 n=20+18) /1000-4 67.3µs ± 1% 25.8µs ± 1% -61.65% (p=0.000 n=20+20) /10000-4 672µs ± 1% 260µs ± 1% -61.36% (p=0.000 n=19+18) /100000-4 6.76ms ± 1% 3.07ms ± 3% -54.61% (p=0.000 n=19+20) name old alloc/op new alloc/op delta /0-4 96.0B ± 0% 0.0B -100.00% (p=0.000 n=20+20) /1-4 112B ± 0% 48B ± 0% -57.14% (p=0.000 n=20+20) /10-4 248B ± 0% 600B ± 0% +141.94% (p=0.000 n=20+20) /100-4 1.69kB ± 0% 3.40kB ± 0% +101.42% (p=0.000 n=20+20) /1000-4 16.2kB ± 0% 25.2kB ± 0% +55.46% (p=0.000 n=20+20) /10000-4 162kB ± 0% 243kB ± 0% +49.93% (p=0.000 n=20+20) /100000-4 1.60MB ± 0% 2.43MB ± 0% +51.43% (p=0.000 n=16+20) name old allocs/op new allocs/op delta /0-4 1.00 ± 0% 0.00 -100.00% (p=0.000 n=20+20) /1-4 1.00 ± 0% 2.00 ± 0% +100.00% (p=0.000 n=20+20) /10-4 10.0 ± 0% 15.0 ± 0% +50.00% (p=0.000 n=20+20) /100-4 100 ± 0% 107 ± 0% +7.00% (p=0.000 n=20+20) /1000-4 1.00k ± 0% 1.02k ± 0% +2.10% (p=0.000 n=20+20) /10000-4 10.0k ± 0% 10.2k ± 0% +1.61% (p=0.000 n=20+20) /100000-4 100k ± 0% 102k ± 0% +1.57% (p=0.000 n=20+20) ``` Impl7 is: - Up to ~25x faster (1.2ns vs 30.2ns) than channels for init time (0 items) - Up to ~2x faster (3.07ms vs 6.76ms) than channels for 100k items - Uses ~50% MORE memory (2.43MB vs 1.60MB) than channels for 100k items Above is not really a fair comparison as standard buffered channels doesn't scale (at all) and they are meant for routine synchronization. Nonetheless, they can and make for an excellent bounded FIFO queue option. Still, impl7 is consistently faster than channels across the board, but uses considerably more memory than channels. --- Given its excellent performance under all scenarios, the hybrid approach impl7 seems to be the ideal candidate for a high performance, low memory footprint general purpose FIFO queue. For above reasons, I propose to port impl7 to the standard library. All raw benchmark results can be found [here](https://github.com/christianrpetrin/queue-tests/tree/master/rawresults). ### Internal Slice Size [Impl7](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl7/queueimpl7.go) uses linked slices as its underlying data structure. The size of the internal slice does influence performance and memory consumption significantly. According to the [internal slice size bench tests](https://github.com/christianrpetrin/queue-tests/blob/master/queueimpl7/benchmark_test.go), larger internal slice sizes yields better performance and lower memory footprint. However, the gains diminishes dramatically as the slice size increases. Below are a few interesting results from the benchmark tests. ``` BenchmarkMaxSubsequentSliceSize/1-4 20000 76836 ns/op 53967 B/op 2752 allocs/op BenchmarkMaxSubsequentSliceSize/2-4 30000 59811 ns/op 40015 B/op 1880 allocs/op BenchmarkMaxSubsequentSliceSize/4-4 30000 42925 ns/op 33039 B/op 1444 allocs/op BenchmarkMaxSubsequentSliceSize/8-4 50000 36946 ns/op 29551 B/op 1226 allocs/op BenchmarkMaxSubsequentSliceSize/16-4 50000 30597 ns/op 27951 B/op 1118 allocs/op BenchmarkMaxSubsequentSliceSize/32-4 50000 28273 ns/op 27343 B/op 1064 allocs/op BenchmarkMaxSubsequentSliceSize/64-4 50000 26969 ns/op 26895 B/op 1036 allocs/op BenchmarkMaxSubsequentSliceSize/128-4 50000 27316 ns/op 26671 B/op 1022 allocs/op BenchmarkMaxSubsequentSliceSize/256-4 50000 26221 ns/op 28623 B/op 1016 allocs/op BenchmarkMaxSubsequentSliceSize/512-4 50000 25882 ns/op 28559 B/op 1012 allocs/op BenchmarkMaxSubsequentSliceSize/1024-4 50000 25674 ns/op 28527 B/op 1010 allocs/op ``` Given the fact that larger internal slices also means potentially more unused memory in some scenarios, 128 seems to be the perfect balance between performance and worst case scenario for memory footprint. Full results can be found [here](https://github.com/christianrpetrin/queue-tests/blob/master/bench_slice_size.md). ### API [Impl7](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl7/queueimpl7.go) implements below API methods. | Operation | Method | | --- | --- | | Add | func (q *Queueimpl7) Push(v interface{}) | | Remove | func (q *Queueimpl7) Pop() (interface{}, bool) | | Size | func (q *Queueimpl7) Len() int | | Return First | func (q *Queueimpl7) Front() (interface{}, bool) | As nil values are considered valid queue values, similarly to the map data structure, "Front" and "Pop" returns a second bool parameter to indicate whether the returned value is valid and whether the queue is empty or not. The resonale for above method names and signatures are the need to keep compatibility with existing Go data structures such as the [list](https://github.com/golang/go/blob/master/src/container/list/list.go), [ring](https://github.com/golang/go/blob/master/src/container/ring/ring.go) and [heap](https://github.com/golang/go/blob/master/src/container/heap/heap.go) packages. Below are the method names used by the existing list, ring and heap Go data structures, as well as the new proposed queue. | Operation | list | ring | heap | queue | | --- | --- | --- | --- | --- | | Add | PushFront/PushBack | Link | Push | Push | | Remove | Remove | Unlink | Pop | Pop | | Size | Len | Len | - | Len | | Return First | Front | - | - | Front | For comparison purposes, below are the method names for [C++](http://www.cplusplus.com/reference/queue/queue/), [Java](https://docs.oracle.com/javase/7/docs/api/java/util/Queue.html) and [C#](https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.queue-1?view=netframework-4.7.2) for their queue implementation. | Operation | C++ | Java | C# | | --- | --- | --- | --- | | Add | push | add/offer | Enqueue | | Remove | pop | remove/poll | Dequeue | | Size | size | - | Count | | Return First | front | peek | Peek | ### Range Support Just like the current container data strucutures such as [list](https://github.com/golang/go/blob/master/src/container/list/list.go), [ring](https://github.com/golang/go/blob/master/src/container/ring/ring.go) and [heap](https://github.com/golang/go/tree/master/src/container/heap), Impl7 doesn't support the range keyword for navigation. The API offers two ways to iterate over the queue items. Either use "Pop" to retrieve the first current element and the second bool parameter to check for an empty queue. ```go for v, ok := q.Pop(); ok; v, ok = q.Pop() { // Do something with v } ``` Or use "Len" and "Pop" to check for an empty queue and retrieve the first current element. ```go for q.Len() > 0 { v, _ := q.Pop() // Do something with v } ``` ### Data Type Just like the current container data strucutures such as the [list](https://github.com/golang/go/blob/master/src/container/list/list.go), [ring](https://github.com/golang/go/blob/master/src/container/ring/ring.go) and [heap](https://github.com/golang/go/tree/master/src/container/heap), Impl7 only supported data type is "interface{}", making it usable by virtually any Go types. It is possible to implement support for specialized data types such as int, float, bool, etc, but that would require duplicating the Push/Pop methods to accept the different data types, much like strconv.ParseBool/ParseFloat/ParseInt/etc. However, with the impending release of generics, we should probrably wait as generics would solve this problem nicely. ### Safe for Concurrent Use [Impl7](https://github.com/christianrpetrin/queue-tests/tree/master/queueimpl7/queueimpl7.go) is not safe for concurrent use by default. The rationale for this decision is below. 1) Not all users will need a safe for concurrent use queue implementation 2) Executing routine synchronization is expensive, causing performance to drop very significantly 3) Getting impl7 to be safe for concurrent use is actually very simple Below is an example of a safe for concurrent use queue implementation that uses impl7 as its underlying queue. ```go package tests import ( "fmt" "sync" "testing" "github.com/christianrpetrin/queue-tests/queueimpl7" ) type SafeQueue struct { q Queueimpl7 m sync.Mutex } func (s *SafeQueue) Len() int { s.m.Lock() defer s.m.Unlock() return s.q.Len() } func (s *SafeQueue) Push(v interface{}) { s.m.Lock() defer s.m.Unlock() s.q.Push(v) } func (s *SafeQueue) Pop() (interface{}, bool) { s.m.Lock() defer s.m.Unlock() return s.q.Pop() } func (s *SafeQueue) Front() (interface{}, bool) { s.m.Lock() defer s.m.Unlock() return s.q.Front() } func TestSafeQueue(t *testing.T) { var q SafeQueue q.Push(1) q.Push(2) for v, ok := q.Pop(); ok; v, ok = q.Pop() { fmt.Println(v) } // Output: // 1 // 2 } ``` ### Drawbacks The biggest drawback of the proposed implementation is the potentially extra allocated but not used memory in its head and tail slices. This scenario realizes when exactly 17 items are added to the queue, causing the creation of a full sized internal slice of 128 positions. Initially only the first element in this new slice is used to store the added value. All the other 127 elements are already allocated, but not used. ```go // Assuming a 128 internal sized slice. q := queueimpl7.New() // Push 16 items to fill the first dynamic slice (sized 16). for i := 1; i <= 16; i++ { q.Push(i) } // Push 1 extra item that causes the creation of a new 128 sized slice to store this value. q.Push(17) // Pops the first 16 items to release the first slice (sized 16). for i := 1; i <= 16; i++ { q.Pop() } // As unsafe.Sizeof (https://golang.org/pkg/unsafe/#Sizeof) doesn't consider the length of slices, // we need to manually calculate the memory used by the internal slices. var internalSliceType interface{} fmt.Println(fmt.Sprintf("%d bytes", unsafe.Sizeof(q)+(unsafe.Sizeof(internalSliceType) /* bytes per slice position */ *127 /* head slice unused positions */))) // Output for a 64bit system (Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz): 2040 bytes ``` The worst case scenario realizes when exactly 145 items are added to the queue and 143 items are removed. This causes the queue struct to hold a 128-sized slice as its head slice, but only the last element is actually used. Similarly, the queue struct will hold a separate 128-sized slice as its tail slice, but only the first position in that slice is being used. ```go // Assuming a 128 internal sized slice. q := queueimpl7.New() // Push 16 items to fill the first dynamic slice (sized 16). for i := 1; i <= 16; i++ { q.Push(i) } // Push an additional 128 items to fill the first full sized slice (sized 128). for i := 1; i <= 128; i++ { q.Push(i) } // Push 1 extra item that causes the creation of a new 128 sized slice to store this value, // adding a total of 145 items to the queue. q.Push(1) // Pops the first 143 items to release the first dynamic slice (sized 16) and // 127 items from the first full sized slice (sized 128). for i := 1; i <= 143; i++ { q.Pop() } // As unsafe.Sizeof (https://golang.org/pkg/unsafe/#Sizeof) doesn't consider the length of slices, // we need to manually calculate the memory used by the internal slices. var internalSliceType interface{} fmt.Println(fmt.Sprintf("%d bytes", unsafe.Sizeof(q)+(unsafe.Sizeof(internalSliceType) /* bytes per slice position */ *(127 /* head slice unused positions */ +127 /* tail slice unused positions */)))) // Output for a 64bit system (Intel(R) Core(TM) i5-7267U CPU @ 3.10GHz): 4072 bytes ``` Above code was run on Go version "go1.11 darwin/amd64". ## Open Questions/Issues Should this be a deque (double-ended queue) implementation instead? The deque could be used as a stack as well, but it would make more sense to have a queue and stack implementations (like most mainstream languages have) instead of a deque that can be used as a stack (confusing). Stack is a very important computer science data structure as well and so I believe Go should have a specialized implementation for it as well (given the specialized implementation offers real value to the users and not just a "nice" named interface and methods). Should "Pop" and "Front" return only the value instead of the value and a second bool parameter (which indicates whether the queue is empty or not)? The implication of the change is adding nil values wouldn't be valid anymore so "Pop" and "Front" would return nil when the queue is empty. Panic should be avoided in libraries. The memory footprint for a 128 sized internal slice causes, in the worst case scenario, a 2040 bytes of memory allocated (on a 64bit system) but not used. Switching to 64 means roughly half the memory would be used with a slight ~2.89% performance drop (252813ns vs 260137ns). The extra memory footprint is not worth the extra performance gain is a very good point to make. Should we change this value to 64 or maybe make it configurable? Should we also provide a safe for concurrent use implementation? A specialized implementation that would rely on atomic operations to update its internal indices and length could offer a much better performance when comparing to a similar implementation that relies on a mutex. With the impending release of generics, should we wait to release the new queue package once the new generics framework is released? Should we implement support for the range keyword for the new queue? It could be done in a generic way so other data structures could also benefit from this feature. For now, IMO, this is a topic for another proposal/discussion. ## Summary I propose to add a new package, "container/queue", to the standard library to support an in-memory, unbounded, general purpose queue implementation. I feel strongly this proposal should be accepted due to below reasons. 1) The proposed solution was well researched and probed, being dramatically and consistently faster than 6 other experimental queue implementations as well 3 promising open source queue implementations as well the standard list package and buffered channels; it still consumes considerably less memory than every other queue implementation tested, except for buffered channels 2) The proposed solution uses a new, unique approach to building queues, yet its [implementation](https://github.com/christianrpetrin/queue-tests/blob/master/queueimpl7/queueimpl7.go) is clean and extremely simple. Both main methods, "Push" and "Pop", are composed of only 16 and 19 lines of code (total), respectively. The proposed implementation also have proper tests with 100% test coverage and should require minimal maintenance moving forward 3) I'll implement any changes the Go community feel are needed for the proposed solution to be worth of the standard library and the Go community
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/go2draft.md
# Go 2 Draft Designs As part of the Go 2 design process, we’ve [published these draft designs](https://blog.golang.org/go2draft) to start community discussions about three topics: generics, error handling, and error value semantics. These draft designs are not proposals in the sense of the [Go proposal process](https://golang.org/s/proposal). They are starting points for discussion, with an eventual goal of producing designs good enough to be turned into actual proposals. Each of the draft designs is accompanied by a “problem overview” (think “cover letter”). The problem overview is meant to provide context; to set the stage for the actual design docs, which of course present the design details; and to help frame and guide discussion about the designs. It presents background, goals, non-goals, design constraints, a brief summary of the design, a short discussion of what areas we think most need attention, and comparison with previous approaches. Again, these are draft designs, not official proposals. There are not associated proposal issues. We hope all Go users will help us improve them and turn them into Go proposals. We have established a wiki page to collect and organize feedback about each topic. Please help us keep those pages up to date, including by adding links to your own feedback. **Error handling**: - [overview](go2draft-error-handling-overview.md) - [draft design](go2draft-error-handling.md) - [wiki feedback page](https://golang.org/wiki/Go2ErrorHandlingFeedback) **Error values**: - [overview](go2draft-error-values-overview.md) - [draft design for error inspection](go2draft-error-inspection.md) - [draft design for error printing](go2draft-error-printing.md) - [wiki feedback page](https://golang.org/wiki/Go2ErrorValuesFeedback) **Generics**: - [overview](go2draft-generics-overview.md) - [draft design](go2draft-contracts.md) - [wiki feedback page](https://golang.org/wiki/Go2GenericsFeedback)
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/go2draft-error-inspection.md
# Error Inspection — Draft Design Jonathan Amsterdam\ Damien Neil\ August 27, 2018 ## Abstract We present a draft design that adds support for programmatic error handling to the standard errors package. The design adds an interface to standardize the common practice of wrapping errors. It then adds a pair of helper functions in [package `errors`](https://golang.org/pkg/errors), one for matching sentinel errors and one for matching errors by type. For more context, see the [error values problem overview](go2draft-error-values-overview.md). ## Background Go promotes the idea that [errors are values](https://blog.golang.org/errors-are-values) and can be handled via ordinary programming. One part of handling errors is extracting information from them, so that the program can make decisions and take action. (The control-flow aspects of error handling are [a separate topic](go2draft-error-handling-overview.md), as is [formatting errors for people to read](go2draft-error-values-overview.md).) Go programmers have two main techniques for providing information in errors. If the intent is only to describe a unique condition with no additional data, a variable of type error suffices, like this one from the [`io` package](https://golang.org/pkg/io). var ErrUnexpectedEOF = errors.New("unexpected EOF") Programs can act on such _sentinel errors_ by a simple comparison: if err == io.ErrUnexpectedEOF { ... } To provide more information, the programmer can define a new type that implements the `error` interface. For example, `os.PathError` is a struct that includes a pathname. Programs can extract information from these errors by using type assertions: if pe, ok := err.(*os.PathError); ok { ... pe.Path ... } Although a great deal of successful Go software has been written over the past decade with these two techniques, their weakness is the inability to handle the addition of new information to existing errors. The Go standard library offers only one tool for this, `fmt.Errorf`, which can be used to add textual information to an error: if err != nil { return fmt.Errorf("loading config: %v", err) } But this reduces the underlying error to a string, easily read by people but not by programs. The natural way to add information while preserving the underlying error is to _wrap_ it in another error. The standard library already does this; for example, `os.PathError` has an `Err` field that contains the underlying error. A variety of packages outside the standard library generalize this idea, providing functions to wrap errors while adding information. (See the references below for a partial list.) We expect that wrapping will become more common if Go adopts the suggested [new error-handling control flow features](go2draft-error-handling-overview.md) to make it more convenient. Wrapping an error preserves its information, but at a cost. If a sentinel error is wrapped, then a program cannot check for the sentinel by a simple equality comparison. And if an error of some type T is wrapped (presumably in an error of a different type), then type-asserting the result to T will fail. If we encourage wrapping, we must also support alternatives to the two main techniques that a program can use to act on errors, equality checks and type assertions. ## Goals Our goal is to provide a common framework so that programs can treat errors from different packages uniformly. We do not wish to replace the existing error-wrapping packages. We do want to make it easier and less error-prone for programs to act on errors, regardless of which package originated the error or how it was augmented on the way back to the caller. And of course we want to preserve the correctness of existing code and the ability for any package to declare a type that is an error. Our design focuses on retrieving information from errors. We don’t want to constrain how errors are constructed or wrapped, nor must we in order to achieve our goal of simple and uniform error handling by programs. ## Design ### The Unwrap Method The first part of the design is to add a standard, optional interface implemented by errors that wrap other errors: package errors // A Wrapper is an error implementation // wrapping context around another error. type Wrapper interface { // Unwrap returns the next error in the error chain. // If there is no next error, Unwrap returns nil. Unwrap() error } Programs can inspect the chain of wrapped errors by using a type assertion to check for the `Unwrap` method and then calling it. The design does not add `Unwrap` to the `error` interface itself: not all errors wrap another error, and we cannot invalidate existing error implementations. ### The Is and As Functions Wrapping errors breaks the two common patterns for acting on errors, equality comparison and type assertion. To reestablish those operations, the second part of the design adds two new functions: `errors.Is`, which searches the error chain for a specific error value, and `errors.As`, which searches the chain for a specific type of error. The `errors.Is` function is used instead of a direct equality check: // instead of err == io.ErrUnexpectedEOF if errors.Is(err, io.ErrUnexpectedEOF) { ... } It follows the wrapping chain, looking for a target error: func Is(err, target error) bool { for { if err == target { return true } wrapper, ok := err.(Wrapper) if !ok { return false } err = wrapper.Unwrap() if err == nil { return false } } } The `errors.As` function is used instead of a type assertion: // instead of pe, ok := err.(*os.PathError) if pe, ok := errors.As(*os.PathError)(err); ok { ... pe.Path ... } Here we are assuming the use of the [contracts draft design](go2draft-generics-overview.md) to make `errors.As` explicitly polymorphic: func As(type E)(err error) (e E, ok bool) { for { if e, ok := err.(E); ok { return e, true } wrapper, ok := err.(Wrapper) if !ok { return e, false } err = wrapper.Unwrap() if err == nil { return e, false } } } If Go 2 does not choose to adopt polymorphism or if we need a function to use in the interim, we could write a temporary helper: // instead of pe, ok := err.(*os.PathError) var pe *os.PathError if errors.AsValue(&pe, err) { ... pe.Path ... } It would be easy to mechanically convert this code to the polymorphic `errors.As`. ## Discussion The most important constraint on the design is that no existing code should break. We intend that all the existing code in the standard library will continue to return unwrapped errors, so that equality and type assertion will behave exactly as before. Replacing equality checks with `errors.Is` and type assertions with `errors.As` will not change the meaning of existing programs that do not wrap errors, and it will future-proof programs against wrapping, so programmers can start using these two functions as soon as they are available. We emphasize that the goal of these functions, and the `errors.Wrapper` interface in particular, is to support _programs_, not _people_. With that in mind, we offer two guidelines: 1. If your error type’s only purpose is to wrap other errors with additional diagnostic information, like text strings and code location, then don’t export it. That way, callers of `As` outside your package won’t be able to retrieve it. However, you should provide an `Unwrap` method that returns the wrapped error, so that `Is` and `As` can walk past your annotations to the actionable errors that may lie underneath. 2. If you want programs to act on your error type but not any errors you’ve wrapped, then export your type and do _not_ implement `Unwrap`. You can still expose the information of underlying errors to people by implementing the `Formatter` interface described in the [error printing draft design](go2draft-error-values-overview.md). As an example of the second guideline, consider a configuration package that happens to read JSON files using the `encoding/json` package. Malformed JSON files will result in a `json.SyntaxError`. The package defines its own error type, `ConfigurationError`, to wrap underlying errors. If `ConfigurationError` provides an `Unwrap` method, then callers of `As` will be able to discover the `json.SyntaxError` underneath. If the use of a JSON is an implementation detail that the package wishes to hide, `ConfigurationError` should still implement `Formatter`, to allow multi-line formatting including the JSON error, but it should not implement `Unwrap`, to hide the use of JSON from programmatic inspection. We recognize that there are situations that `Is` and `As` don’t handle well. Sometimes callers want to perform multiple checks against the same error, like comparing against more than one sentinel value. Although these can be handled by multiple calls to `Is` or `As`, each call walks the chain separately, which could be wasteful. Sometimes, a package will provide a function to retrieve information from an unexported error type, as in this [old version of gRPC's status.Code function](https://github.com/grpc/grpc-go/blob/f4b523765c542aa30ca9cdb657419b2ed4c89872/status/status.go#L172). `Is` and `As` cannot help here at all. For cases like these, programs can traverse the error chain directly. ## Alternative Design Choices Some error packages intend for programs to act on a single error (the "Cause") extracted from the chain of wrapped errors. We feel that a single error is too limited a view into the error chain. More than one error might be worth examining. The `errors.As` function can select any error from the chain; two calls with different types can return two different errors. For instance, a program could both ask whether an error is a `PathError` and also ask whether it is a permission error. We chose `Unwrap` instead of `Cause` as the name for the unwrapping method because different existing packages disagree on the meaning of `Cause`. A new method will allow existing packages to converge. Also, we’ve noticed that having both a `Cause` function and a `Cause` method that do different things tends to confuse people. We considered allowing errors to implement optional `Is` and `As` methods to allow overriding the default checks in `errors.Is` and `errors.As`. We omitted them from the draft design for simplicity. For the same reason, we decided against a design that provided a tree of underlying errors, despite its use in one prominent error package ([github.com/hashicorp/errwrap](https://godoc.org/github.com/hashicorp/errwrap)). We also decided against explicit error hierarchies, as in https://github.com/spacemonkeygo/errors. The `errors.As` function’s ability to retrieve errors of more than one type from the chain provides similar functionality: if you want every `InvalidRowKey` error to be a `DatabaseError`, include both in the chain. ## References We were influenced by several of the existing error-handling packages, notably: - [github.com/pkg/errors](https://godoc.org/github.com/pkg/errors) - [gopkg.in/errgo.v2](https://godoc.org/gopkg.in/errgo.v2) - [github.com/hashicorp/errwrap](https://godoc.org/github.com/hashicorp/errwrap) - [upspin.io/errors](https://commandcenter.blogspot.com/2017/12/error-handling-in-upspin.html) - [github.com/spacemonkeygo/errors](https://godoc.org/github.com/spacemonkeygo/errors) Some of these package would only need to add an `Unwrap` method to their wrapping error types to be compatible with this design. We also want to acknowledge Go proposals similar to ours: - [golang.org/issue/27020](https://golang.org/issue/27020) — add a standard Causer interface for Go 2 errors - [golang.org/issue/25675](https://golang.org/issue/25675) — adopt Cause and Wrap from github.com/pkg/errors
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/19480-xml-stream.md
# Proposal: XML Stream Author(s): Sam Whited <sam@samwhited.com> Last updated: 2017-03-09 Discussion at https://golang.org/issue/19480 ## Abstract The `encoding/xml` package contains an API for tokenizing an XML stream, but no API exists for processing or manipulating the resulting token stream. This proposal describes such an API. ## Background The [`encoding/xml`][encoding/xml] package contains APIs for tokenizing an XML stream and decoding that token stream into native data types. Once unmarshaled, the data can then be manipulated and transformed. However, this is not always ideal. If we cannot change the type we are unmarshaling into and it does not match the XML format we are attempting to deserialize, eg. if the type is defined in a separate package or cannot be modified for API compatibility reasons, we may have to first unmarshal into a type we control, then copy each field over to the original type; this is cumbersome and verbose. Unmarshaling into a struct is also lossy. As stated in the XML package: > Mapping between XML elements and data structures is inherently flawed: > an XML element is an order-dependent collection of anonymous values, while a > data structure is an order-independent collection of named values. This means that transforming the XML stream itself cannot necessarily be accomplished by deserializing into a struct and then reserializing the struct back to XML; instead it requires manipulating the XML tokens directly. This may require re-implementing parts of the XML package, for instance, when renaming an element the start and end tags would have to be matched in user code so that they can both be transformed to the new name. To address these issues, an API for manipulating the token stream itself, before marshaling or unmarshaling occurs, is necessary. Ideally, such an API should allow for the composition of complex XML transformations from simple, well understood building blocks. The transducer pattern, widely available in functional languages, matches these requirements perfectly. Transducers (also called, transformers, adapters, etc.) are iterators that provide a set of operations for manipulating the data being iterated over. Common transducer operations include Map, Reduce, Filter, etc. and these operations are are already widely known and understood. ## Proposal The proposed API introduces two concepts that do not already exist in the `encoding/xml` package: ```go // A Tokenizer is anything that can decode a stream of XML tokens, including an // xml.Decoder. type Tokenizer interface { Token() (xml.Token, error) Skip() error } // A Transformer is a function that takes a Tokenizer and returns a new // Tokenizer which outputs a transformed token stream. type Transformer func(src Tokenizer) Tokenizer ``` Common transducer operations will also be included: ```go // Inspect performs an operation for each token in the stream without // transforming the stream in any way. // It is often injected into the middle of a transformer pipeline for debugging. func Inspect(f func(t xml.Token)) Transformer {} // Map transforms the tokens in the input using the given mapping function. func Map(mapping func(t xml.Token) xml.Token) Transformer {} // Remove returns a Transformer that removes tokens for which f matches. func Remove(f func(t xml.Token) bool) Transformer {} ``` Because Go does not provide a generic iterator concept, this (and all transducers in the Go libraries) are domain specific, meaning operations that only make sense when discussing XML tokens can also be included: ```go // RemoveElement returns a Transformer that removes entire elements (and their // children) if f matches the elements start token. func RemoveElement(f func(start xml.StartElement) bool) Transformer {} ``` ## Rationale Transducers are commonly used in functional programming and in languages that take inspiration from functional programming languages, including Go. Examples include [Clojure transducers][clojure/transducer], [Rust adapters][rust/adapter], and the various "Transformer" types used throughout Go, such as in the [`golang.org/x/text/transform`][transform] package. Because transducers are so widely used (and already used elsewhere in Go), they are well understood. ## Compatibility This proposal introduces two new exported types and 4 exported functions that would be covered by the compatibility promise. A minimal set of Transformers is proposed, but others can be added at a later date without breaking backwards compatibility. ## Implementation A version of this API is already implemented in the [`mellium.im/xmlstream`][xmlstream] package. If this proposal is accepted, the author volunteers to copy the relevant parts to the correct location before the 1.9 (or 1.10, depending on the length of this proposal process) planning cycle closes. ## Open issues - Where does this API live? It could live in the `encoding/xml` package itself, in another package (eg. `encoding/xml/stream`) or, temporarily or permanently, in the subrepos: `golang.org/x/xml/stream`. - A Transformer for removing attributes from `xml.StartElement`'s was originally proposed as part of this API, but its implementation is more difficult to do efficiently since each use of `RemoveAttr` in a pipeline would need to iterate over the `xml.Attr` slice separately. - Existing APIs in the XML package such as `DecodeElement` require an `xml.Decoder` to function and could not be used with the Tokenizer interface used in this package. A compatibility API may be needed to create a new Decoder with an underlying tokenizer. This would require that the new functionality reside in the `encoding/xml` package. Alternatively, general Decoder methods could be reimplemented in a new package with the Tokenizer API. [encoding/xml]: https://golang.org/pkg/encoding/xml/ [clojure/transducer]: https://clojure.org/reference/transducers [rust/adapter]: https://doc.rust-lang.org/std/iter/#adapters [transform]: https://godoc.org/golang.org/x/text/transform [xmlstream]: https://godoc.org/mellium.im/xmlstream
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/24543-non-cooperative-preemption.md
# Proposal: Non-cooperative goroutine preemption Author(s): Austin Clements Last updated: 2019-01-18 Discussion at https://golang.org/issue/24543. ## Abstract Go currently uses compiler-inserted cooperative preemption points in function prologues. The majority of the time, this is good enough to allow Go developers to ignore preemption and focus on writing clear parallel code, but it has sharp edges that we've seen degrade the developer experience time and time again. When it goes wrong, it goes spectacularly wrong, leading to mysterious system-wide latency issues and sometimes complete freezes. And because this is a language implementation issue that exists outside of Go's language semantics, these failures are surprising and very difficult to debug. @dr2chase has put significant effort into prototyping cooperative preemption points in loops, which is one way to solve this problem. However, even sophisticated approaches to this led to unacceptable slow-downs in tight loops (where slow-downs are generally least acceptable). I propose that the Go implementation switch to non-cooperative preemption, which would allow goroutines to be preempted at essentially any point without the need for explicit preemption checks. This approach will solve the problem of delayed preemption and do so with zero run-time overhead. Non-cooperative preemption is a general concept with a whole class of implementation techniques. This document describes and motivates the switch to non-cooperative preemption and discusses common concerns of any non-cooperative preemption approach in Go. Specific implementation approaches are detailed in sub-proposals linked from this document. ## Background Up to and including Go 1.10, Go has used cooperative preemption with safe-points only at function calls (and even then, not if the function is small or gets inlined). This means that Go can only switch between concurrently-executing goroutines at specific points. The main advantage of this is that the compiler can ensure useful invariants at these safe-points. In particular, the compiler ensures that all local garbage collection roots are known at all safe-points, which is critical to precise garbage collection. It can also ensure that no registers are live at safe-points, which means the Go runtime can switch goroutines without having to save and restore a large register set. However, this can result in infrequent safe-points, which leads to many problems: 1. The most common in production code is that this can delay STW operations, such as starting and ending a GC cycle. This increases STW latency, and on large core counts can significantly impact throughput (if, for example, most threads are stopped while the runtime waits on a straggler for a long time). ([#17831](https://golang.org/issue/17831), [#19241](https://golang.org/issue/19241)) 2. This can delay scheduling, preventing competing goroutines from executing in a timely manner. 3. This can delay stack scanning, which consumes CPU while the runtime waits for a preemption point and can ultimately delay GC termination, resulting in an effective STW where the system runs out of heap and no goroutines can allocate. 4. In really extreme cases, it can cause a program to halt, such as when a goroutine spinning on an atomic load starves out the goroutine responsible for setting that atomic. This often indicates bad or buggy code, but is surprising nonetheless and has clearly wasted a lot of developer time on debugging. ([#543](https://golang.org/issue/543), [#12553](https://golang.org/issue/12553), [#13546](https://golang.org/issue/13546), [#14561](https://golang.org/issue/14561), [#15442](https://golang.org/issue/15442), [#17174](https://golang.org/issue/17174), [#20793](https://golang.org/issue/20793), [#21053](https://golang.org/issue/21053)) These problems impede developer productivity and production efficiency and expose Go's users to implementation details they shouldn't have to worry about. ### Cooperative loop preemption @dr2chase put significant effort into trying to solve these problems using cooperative *loop preemption* ([#10958](https://golang.org/issue/10958)). This is a standard approach for runtimes employing cooperative preemption in which the compiler inserts preemption checks and safe-points at back-edges in the flow graph. This significantly improves the quality of preemption, since code almost never executes without a back-edge for any non-trivial amount of time. Our most recent approach to loop preemption, which we call *fault-based preemption*, adds a single instruction, no branches, and no register pressure to loops on x86 and UNIX platforms ([CL 43050](https://golang.org/cl/43050)). Despite this, the geomean slow-down on a [large suite of benchmarks](https://perf.golang.org/search?q=upload%3A20171003.1+%7C+upload-part%3A20171003.1%2F3+vs+upload-part%3A20171003.1%2F1) is 7.8%, with a handful of significantly worse outliers. Even [compared to Go 1.9](https://perf.golang.org/search?q=upload%3A20171003.1+%7C+upload-part%3A20171003.1%2F0+vs+upload-part%3A20171003.1%2F1), where the slow-down is only 1% thanks to other improvements, most benchmarks see some slow-down and there are still significant outliers. Fault-based preemption also has several implementation downsides. It can't target specific threads or goroutines, so it's a poor match for stack scanning, ragged barriers, or regular scheduler preemption. It's also "sticky", in that we can't resume any loops until we resume *all* loops, so the safe-point can't simply resume if it occurs in an unsafe state (such as when runtime locks are held). It requires more instructions (and more overhead) on non-x86 and non-UNIX platforms. Finally, it interferes with debuggers, which assume bad memory references are a good reason to stop a program. It's not clear it can work at all under many debuggers on OS X due to a [kernel bug](https://bugs.llvm.org/show_bug.cgi?id=22868). ## Non-cooperative preemption *Non-cooperative preemption* switches between concurrent execution contexts without explicit preemption checks or assistance from those contexts. This is used by all modern desktop and server operating systems to switch between threads. Without this, a single poorly-behaved application could wedge the entire system, much like how a single poorly-behaved goroutine can currently wedge a Go application. It is also a convenient abstraction: it lets us program as if there are an infinite number of CPUs available, hiding the fact that the OS is time-multiplexing a finite number of CPUs. Operating system schedulers use hardware interrupt support to switch a running thread into the OS scheduler, which can save that thread's state such as its CPU registers so that it can be resumed later. In Go, we would use operating system support to do the same thing. On UNIX-like operating systems, this can be done using signals. However, because of the garbage collector, Go has requirements that an operating system does not: Go must be able to find the live pointers on a goroutine's stack wherever it stops it. Most of the complexity of non-cooperative preemption in Go derives from this requirement. ## Proposal I propose that Go implement non-cooperative goroutine preemption by sending a POSIX signal (or using an equivalent OS mechanism) to stop a running goroutine and capture its CPU state. If a goroutine is interrupted at a point that must be GC atomic, as detailed in the ["Handling unsafe-points"](#handling-unsafe-points) section, the runtime can simply resume the goroutine and try again later. The key difficulty of implementing non-cooperative preemption for Go is finding live pointers in the stack of a preempted goroutine. There are many possible ways to do this, which are detailed in these sub-proposals: * The [safe-points everywhere proposal](24543/safe-points-everywhere.md) describes an implementation where the compiler records stack and register maps for nearly every instruction. This allows the runtime to halt a goroutine anywhere and find its GC roots. * The [conservative inner-frame scanning proposal](24543/conservative-inner-frame.md) describes an implementation that uses conservative GC techniques to find pointers in the inner-most stack frame of a preempted goroutine. This can be done without any extra safe-point metadata. ## Handling unsafe-points Any non-cooperative preemption approach in Go must deal with code sequences that have to be atomic with respect to the garbage collector. We call these "unsafe-points", in contrast with GC safe-points. A few known situations are: 1. Expressions involving `unsafe.Pointer` may temporarily represent the only pointer to an object as a `uintptr`. Hence, there must be no safe-points while a `uintptr` derived from an `unsafe.Pointer` is live. Likewise, we must recognize `reflect.Value.Pointer`, `reflect.Value.UnsafeAddr`, and `reflect.Value.InterfaceData` as `unsafe.Pointer`-to-`uintptr` conversions. Alternatively, if the compiler can reliably detect such `uintptr`s, it could mark this as pointers, but there's a danger that an intermediate value may not represent a legal pointer value. 2. In the write barrier there must not be a safe-point between the write-barrier-enabled check and a direct write. For example, suppose the goroutine is writing a pointer to B into object A. If the check happens, then GC starts and scans A, then the goroutine writes B into A and drops all references to B from its stack, the garbage collector could fail to mark B. 3. There are places where the compiler generates temporary pointers that can be past the end of allocations, such as in range loops over slices and arrays. These would either have to be avoided or safe-points would have to be disallowed while these are live. All of these cases must already avoid significant reordering to avoid being split across a call. Internally, this is achieved via the "mem" pseudo-value, which must be sequentially threaded through all SSA values that manipulate memory. Mem is also threaded through values that must not be reordered, even if they don't touch memory. For example, conversion between `unsafe.Pointer` and `uintptr` is done with a special "Convert" operation that takes a mem solely to constrain reordering. There are several possible solutions to these problem, some of which can be combined: 1. We could mark basic blocks that shouldn't contain preemption points. For `unsafe.Pointer` conversions, we would opt-out the basic block containing the conversion. For code adhering to the `unsafe.Pointer` rules, this should be sufficient, but it may break code that is incorrect but happens to work today in ways that are very difficult to debug. For write barriers this is also sufficient. For loops, this is overly broad and would require splitting some basic blocks. 2. For `unsafe.Pointer` conversions, we could simply opt-out entire functions that convert from `unsafe.Pointer` to `uintptr`. This would be easy to implement, and would keep even broken unsafe code working as well as it does today, but may have broad impact, especially in the presence of inlining. 3. A simple combination of 1 and 2 would be to opt-out any basic block that is *reachable* from an `unsafe.Pointer` to `uintptr` conversion, up to a function call (which is a safe-point today). 4. For range loops, the compiler could compile them differently such that it never constructs an out-of-bounds pointer (see below). 5. A far more precise and general approach (thanks to @cherrymui) would be to create new SSA operations that "taint" and "untaint" memory. The taint operation would take a mem and return a new tainted mem. This taint would flow to any values that themselves took a tainted value. The untaint operation would take a value and a mem and return an untainted value and an untainted mem. During liveness analysis, safe-points would be disallowed wherever a tainted value was live. This is probably the most precise solution, and is likely to keep even incorrect uses of unsafe working, but requires a complex implementation. More broadly, it's worth considering making the compiler check `unsafe.Pointer`-using code and actively reject code that doesn't follow the allowed patterns. This could be implemented as a simple type system that distinguishes pointer-ish `uintptr` from numeric `uintptr`. But this is out of scope for this proposal. ### Range loops As of Go 1.10, range loops are compiled roughly like: ```go for i, x := range s { b } ⇓ for i, _n, _p := 0, len(s), &s[0]; i < _n; i, _p = i+1, _p + unsafe.Sizeof(s[0]) { b } ⇓ i, _n, _p := 0, len(s), &s[0] goto cond body: { b } i, _p = i+1, _p + unsafe.Sizeof(s[0]) cond: if i < _n { goto body } else { goto end } end: ``` The problem with this lowering is that `_p` may temporarily point past the end of the allocation the moment before the loop terminates. Currently this is safe because there's never a safe-point while this value of `_p` is live. This lowering requires that the compiler mark the increment and condition blocks as unsafe-points. However, if the body is short, this could result in infrequent safe-points. It also requires creating a separate block for the increment, which is currently usually appended to the end of the body. Separating these blocks would inhibit reordering opportunities. In preparation for non-cooperative preemption, Go 1.11 began compiling range loops as follows to avoid ever creating a past-the-end pointer: ```go i, _n, _p := 0, len(s), &s[0] if i >= _n { goto end } else { goto body } top: _p += unsafe.Sizeof(s[0]) body: { b } i++ if i >= _n { goto end } else { goto top } end: ``` This allows safe-points everywhere in the loop. Compared to the original loop compilation, it generates slightly more code, but executes the same number of conditional branch instructions (n+1) and results in the same number of SSA basic blocks (3). This lowering does complicate bounds-check elimination. In Go 1.10, bounds-check elimination knew that `i < _n` in the body because the body block is dominated by the cond block. However, in the new lowering, deriving this fact required detecting that `i < _n` on *both* paths into body and hence is true in body. ### Runtime safe-points Beyond generated code, the runtime in general is not written to be arbitrarily preemptible and there are many places that must not be preempted. Hence, we would likely disable safe-points by default in the runtime, except at calls (where they occur now). While this would have little downside for most of the runtime, there are some parts of the runtime that could benefit substantially from non-cooperative preemption, such as memory functions like `memmove`. Non-cooperative preemption is an excellent way to make these preemptible without slowing down the common case, since we would only need to mark their register maps (which would often be empty for functions like `memmove` since all pointers would already be protected by arguments). Over time we may opt-in more of the runtime. ### Unsafe standard library code The Windows syscall package contains many `unsafe.Pointer` conversions that don't follow the `unsafe.Pointer` rules. It broadly makes shaky assumptions about safe-point behavior, liveness, and when stack movement can happen. It would likely need a thorough auditing, or would need to be opted out like the runtime. Perhaps more troubling is that some of the Windows syscall package types have uintptr fields that are actually pointers, hence forcing callers to perform unsafe pointer conversions. For example, see issue [#21376](https://golang.org/issue/21376). ### Ensuring progress with unsafe-points We propose simply giving up and retrying later when a goroutine is interrupted at an unsafe-point. One danger of this is that safe points may be rare in tight loops. However, in many cases, there are more sophisticated alternatives to this approach. For interruptions in the runtime or in functions without any safe points (such as assembly), the signal handler could unwind the stack and insert a return trampoline at the next return to a function with safe point metadata. The runtime could then let the goroutine continue running and the trampoline would pause it as soon as possible. For write barriers and `unsafe.Pointer` sequences, the compiler could insert a cheap, explicit preemption check at the end of the sequence. For example, the runtime could modify some register that would be checked at the end of the sequence and let the thread continue executing. In the write barrier sequence, this could even be the register that the write barrier flag was loaded into, and the compiler could insert a simple register test and conditional branch at the end of the sequence. To even further shrink the sequence, the runtime could put the address of the stop function in this register so the stop sequence would be just a register call and a jump. Alternatives to this check include forward and reverse simulation. Forward simulation is tricky because the compiler must be careful to only generate operations the runtime knows how to simulate. Reverse simulation is easy *if* the compiler can always generate a restartable sequence (simply move the PC back to the write barrier flag check), but quickly becomes complicated if there are multiple writes in the sequence or more complex writes such as DUFFCOPY. ## Other considerations All of the proposed approaches to non-cooperative preemption involve stopping a running goroutine by sending its thread an OS signal. This section discusses general consequences of this. **Windows support.** Unlike fault-based loop preemption, signaled preemption is quite easy to support in Windows because it provides `SuspendThread` and `GetThreadContext`, which make it trivial to get a thread's register set. **Choosing a signal.** We have to choose a signal that is unlikely to interfere with existing uses of signals or with debuggers. There are no perfect choices, but there are some heuristics. 1) It should be a signal that's passed-through by debuggers by default. On Linux, this is SIGALRM, SIGURG, SIGCHLD, SIGIO, SIGVTALRM, SIGPROF, and SIGWINCH, plus some glibc-internal signals. 2) It shouldn't be used internally by libc in mixed Go/C binaries because libc may assume it's the only thing that can handle these signals. For example SIGCANCEL or SIGSETXID. 3) It should be a signal that can happen spuriously without consequences. For example, SIGALRM is a bad choice because the signal handler can't tell if it was caused by the real process alarm or not (arguably this means the signal is broken, but I digress). SIGUSR1 and SIGUSR2 are also bad because those are often used in meaningful ways by applications. 4) We need to deal with platforms without real-time signals (like macOS), so those are out. We use SIGURG because it meets all of these criteria, is extremely unlikely to be used by an application for its "real" meaning (both because out-of-band data is basically unused and because SIGURG doesn't report which socket has the condition, making it pretty useless), and even if it is, the application has to be ready for spurious SIGURG. SIGIO wouldn't be a bad choice either, but is more likely to be used for real. **Scheduler preemption.** This mechanism is well-suited to temporary preemptions where the same goroutine will resume after the preemption because we don't need to save the full register state and can rely on the existing signal return path to restore the full register state. This applies to all GC-related preemptions, but it's not as well suited to permanent preemption performed by the scheduler. However, we could still build on this mechanism. For example, since most of the time goroutines self-preempt, we only need to save the full signal state in the uncommon case, so the `g` could contain a pointer to its full saved state that's only used after a forced preemption. Restoring the full signal state could be done by either writing the architecture-dependent code to restore the full register set (a beefed-up `runtime.gogo`), or by self-signaling, swapping in the desired context, and letting the OS restore the full register set. **Targeting and resuming.** In contrast with fault-based loop preemption, signaled preemption can be targeted at a specific thread and can immediately resume. Thread-targeting is a little different from cooperative preemption, which is goroutine-targeted. However, in many cases this is actually better, since targeting goroutines for preemption is racy and hence requires retry loops that can add significantly to STW time. Taking advantage of this for stack scanning will require some restructuring of how we track GC roots, but the result should eliminate the blocking retry loop we currently use. **Non-pointer pointers.** This has the potential to expose incorrect uses of `unsafe.Pointer` for transiently storing non-pointers. Such uses are a clear violation of the `unsafe.Pointer` rules, but they may happen (especially in, for example, cgo-using code). ## Alternatives ### Single-stepping Rather than making an effort to be able to stop at any instruction, the compiler could emit metadata for safe-points only at back-edges and the runtime could use hardware single-stepping support to advance the thread to a safe-point (or a point where the compiler has provided a branch to reach a safe-point, like in the current loop preemption approach). This works (somewhat surprisingly), but thoroughly bamboozles debuggers since both the debugger and the operating system assume the debugger owns single-stepping, not the process itself. This would also require the compiler to provide register flushing stubs for these safe-points, which increases code size (and hence instruction cache pressure) as well as stack size, much like cooperative loop preemption. However, unlike cooperative loop preemption, this approach would have no effect on mainline code size or performance. ### Jump rewriting We can solve the problems of single-stepping by instead rewriting the next safe-point jump instruction after the interruption point to jump to a preemption path and resuming execution like usual. To make this easy, the compiler could leave enough room (via padding NOPs) so only the jump target needs to be modified. This approach has the usual drawbacks of modifiable code. It's a security risk, it breaks text page sharing, and simply isn't allowed on iOS. It also can't target an individual goroutine (since another goroutine could be executing the same code) and may have odd interactions with concurrent execution on other cores. ### Out-of-line execution A further alternative in the same vein, but that doesn't require modifying existing text is out-of-line execution. In this approach, the signal handler relocates the instruction stream from the interruption point to the next safe-point jump into a temporary buffer, patches it to jump into the runtime at the end, and resumes execution in this relocated sequence. This solves most of the problems with single-stepping and jump rewriting, but is quite complex to implement and requires substantial implementation effort for each platform. It also isn't allowed on iOS. There is precedent for this sort of approach. For example, when Linux uprobes injects an INT3, it relocates the overwritten instructions into an "execute out-of-line" area to avoid the usual problems with resuming from an INT3 instruction. [The implementation](https://github.com/torvalds/linux/blob/v4.18/arch/x86/kernel/uprobes.c) is surprisingly simple given the complexity of the x86 instruction encoding, but is still quite complex.
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/32437-try-builtin.md
# Proposal: A built-in Go error check function, `try` Author: Robert Griesemer Last update: 2019-06-12 Discussion at [golang.org/issue/32437](https://golang.org/issue/32437). ## Summary We propose a new built-in function called `try`, designed specifically to eliminate the boilerplate `if` statements typically associated with error handling in Go. No other language changes are suggested. We advocate using the existing `defer` statement and standard library functions to help with augmenting or wrapping of errors. This minimal approach addresses most common scenarios while adding very little complexity to the language. The `try` built-in is easy to explain, straightforward to implement, orthogonal to other language constructs, and fully backward-compatible. It also leaves open a path to extending the mechanism, should we wish to do so in the future. The rest of this document is organized as follows: After a brief introduction, we provide the definition of the built-in and explain its use in practice. The discussion section reviews alternative proposals and the current design. We’ll end with conclusions and an implementation schedule followed by examples and FAQs. ## Introduction At last year’s Gophercon in Denver, members of the Go Team (Russ Cox, Marcel van Lohuizen) presented some new ideas on how to reduce the tedium of manual error handling in Go ([draft design](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling.md)). We have received a lot of feedback since then. As Russ Cox explained in his [problem overview](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling-overview.md), our goal is to make error handling more lightweight by reducing the amount of source code dedicated solely to error checking. We also want to make it more convenient to write error handling code, to raise the likelihood programmers will take the time to do it. At the same time we do want to keep error handling code explicitly visible in the program text. The ideas discussed in the draft design centered around a new unary operator `check` which simplified explicit checking of an error value returned by some expression (typically a function call), a `handle` declaration for error handlers, and a set of rules connecting the two new language constructs. Much of the immediate feedback we received focused on the details and complexity of `handle` while the idea of a `check`-like operator seemed more palatable. In fact, several community members picked up on the idea of a `check`-like operator and expanded on it. Here are some of the posts most relevant to this proposal: - The first written-down suggestion (known to us) to use a `check` _built-in_ rather than a `check` _operator_ was by [PeterRK](https://gist.github.com/PeterRK) in his post [Key Parts of Error Handling](https://gist.github.com/PeterRK/4f59579c1162cdbc28086f6b5f7b4fa2). - More recently, [Markus](https://github.com/markusheukelom) proposed two new keywords `guard` and `must` as well as the use of `defer` for error wrapping in issue [#31442](https://golang.org/issue/31442). - Related, [pjebs](https://github.com/pjebs) proposed a `must` built-in in issue [#32219](https://golang.org/issue/32219). The current proposal, while different in detail, was influenced by these three issues and the general feedback received on last year’s draft design. For completeness, we note that more error-handling related proposals can be found [here](https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback). Also noteworthy, [Liam Breck](https://gist.github.com/networkimprov) came up with an extensive menu of [requirements](https://gist.github.com/networkimprov/961c9caa2631ad3b95413f7d44a2c98a) to consider. Finally, we learned after publishing this proposal that [Ryan Hileman](https://github.com/lunixbochs) implemented `try` five years ago via the [`og` rewriter tool](https://github.com/lunixbochs/og) and used it with success in real projects. See also https://news.ycombinator.com/item?id=20101417. ## The `try` built-in ### Proposal We propose to add a new function-like built-in called `try` with signature (pseudo-code) ```Go func try(expr) (T1, T2, … Tn) ``` where `expr` stands for an incoming argument expression (usually a function call) producing n+1 result values of types `T1`, `T2`, ... `Tn`, and `error` for the last value. If `expr` evaluates to a single value (n is 0), that value must be of type `error` and `try` doesn't return a result. Calling `try` with an expression that does not produce a last value of type `error` leads to a compile-time error. The `try` built-in may _only_ be used inside a function with at least one result parameter where the last result is of type `error`. Calling `try` in a different context leads to a compile-time error. Invoking `try` with a function call `f()` as in (pseudo-code) ```Go x1, x2, … xn = try(f()) ``` turns into the following (in-lined) code: ```Go t1, … tn, te := f() // t1, … tn, te are local (invisible) temporaries if te != nil { err = te // assign te to the error result parameter return // return from enclosing function } x1, … xn = t1, … tn // assignment only if there was no error ``` In other words, if the last value produced by "expr", of type `error`, is nil, `try` simply returns the first n values, with the final nil error stripped. If the last value produced by "expr" is not nil, the enclosing function’s error result variable (called `err` in the pseudo-code above, but it may have any other name or be unnamed) is set to that non-nil error value and the enclosing function returns. If the enclosing function declares other named result parameters, those result parameters keep whatever value they have. If the function declares other unnamed result parameters, they assume their corresponding zero values (which is the same as keeping the value they already have). If `try` happens to be used in a multiple assignment as in this illustration, and a non-nil error is detected, the assignment (to the user-defined variables) is _not_ executed and none of the variables on the left-hand side of the assignment are changed. That is, `try` behaves like a function call: its results are only available if `try` returns to the actual call site (as opposed to returning from the enclosing function). As a consequence, if the variables on the left-hand side are named result parameters, using `try` will lead to a different result than typical code found today. For instance, if `a`, `b`, and `err` are all named result parameters of the enclosing function, this code ```Go a, b, err = f() if err != nil { return } ``` will always set `a`, `b`, and `err`, independently of whether `f()` returned an error or not. In contrast ```Go a, b = try(f()) ``` will leave `a` and `b` unchanged in case of an error. While this is a subtle difference, we believe cases like these are rare. If current behavior is expected, keep the `if` statement. ### Usage The definition of `try` directly suggests its use: many `if` statements checking for error results today can be eliminated with `try`. For instance ```Go f, err := os.Open(filename) if err != nil { return …, err // zero values for other results, if any } ``` can be simplified to ```Go f := try(os.Open(filename)) ``` If the enclosing function does not return an error result, `try` cannot be used (but see the Discussion section). In that case, an error must be handled locally anyway (since no error is returned), and then an `if` statement remains the appropriate mechanism to test for the error. More generally, it is not a goal to replace all possible testing of errors with the `try` function. Code that needs different semantics can and should continue to use if statements and explicit error variables. ### Testing and `try` In one of our earlier attempts at specifying `try` (see the section on Design iterations, below), `try` was designed to panic upon encountering an error if used inside a function without an `error` result. This enabled the use of `try` in unit tests as supported by the standard library’s `testing` package. One option is for the `testing` package to allow test/benchmark functions of the form ```Go func TestXxx(*testing.T) error func BenchmarkXxx(*testing.B) error ``` to enable the use of `try` in tests. A test or benchmark function returning a non-nil error would implicitly call `t.Fatal(err)` or `b.Fatal(err)`. This would be a modest library change and avoid the need for different semantics (returning or panicking) for `try` depending on context. One drawback of this approach is that `t.Fatal` and `b.Fatal` would not report the line number of the actually failing call. Another drawback is that we must adjust subtests in some way as well. How to address these best is an open question; we do not propose a specific change to the `testing` package with this document. See also issue [#21111](https://golang.org/issue/21111) which proposes that example functions may return an error result. ### Handling errors A significant aspect of the original [draft design](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling.md) concerned language support for wrapping or otherwise augmenting an error. The draft design introduced a new keyword `handle` and a new _error handler_ declaration. This new language construct was problematic because of its non-trivial semantics, especially when considering its impact on control flow. In particular, its functionality intersected with the functionality of `defer` in unfortunate ways, which made it a non-orthogonal new language feature. This proposal reduces the original draft design to its essence. If error augmentation or wrapping is desired there are two approaches: Stick with the tried-and-true `if` statement, or, alternatively, “declare” an error handler with a `defer` statement: ```Go defer func() { if err != nil { // no error may have occurred - check for it err = … // wrap/augment error } }() ``` Here, `err` is the name of the error result of the enclosing function. In practice, we envision suitable helper functions such as ```Go func HandleErrorf(err *error, format string, args ...interface{}) { if *err != nil { *err = fmt.Errorf(format + ": %v", append(args, *err)...) } } ``` or similar; the `fmt` package would be a natural place for such helpers (it already provides `fmt.Errorf`). Using a helper function, the declaration of an error handler will be reduced to a one-liner in many cases. For instance, to augment an error returned by a "copy" function, one might write ```Go defer fmt.HandleErrorf(&err, "copy %s %s", src, dst) ``` if `fmt.HandleErrorf` implicitly adds the error information. This reads reasonably well and has the advantage that it can be implemented without the need for new language features. The main drawback of this approach is that the error result parameter needs to be named, possibly leading to less pretty APIs (but see the FAQs on this subject). We believe that we will get used to it once this style has established itself. ### Efficiency of `defer` An important consideration with using `defer` as error handlers is efficiency. The `defer` statement has a reputation of being [slow](https://golang.org/issue/14939). We do not want to have to choose between efficient code and good error handling. Independently, the Go runtime and compiler team has been discussing alternative implementation options and we believe that we can make typical `defer` uses for error handling about as efficient as existing “manual” code. We hope to make this faster `defer` implementation available in Go 1.14 (see also [CL 171758](https://golang.org/cl/171758/) which is a first step in this direction). ### Special cases: `go try(f)` and `defer try(f)` The `try` built-in looks like a function and thus is expected to be usable wherever a function call is permitted. But if a `try` call is used in a `go` statement, things are less clear: ```Go go try(f) ``` Here, `f` is evaluated when the `go` statement is executed in the current goroutine, and then its results are passed as arguments to `try` which is launched in a new goroutine. If `f` returns a non-nil error, `try` is expected to return from the enclosing function, but there isn’t any such (Go) function (nor a last result parameter of type `error`) since we are running in a separate goroutine. Therefore we suggest to disallow `try` as the called function in a `go` statement. The situation with ```Go defer try(f) ``` appears similar but here the semantics of `defer` mean that the execution of `try` would be suspended until the enclosing function is about to return. As before, the argument `f` is evaluated when the `defer` statement is executed, and `f`’s results are passed to the suspended `try`. Only when the enclosing function is about to return does `try` test for an error returned by `f`. Without changes to the behavior of `try`, such an error might then overwrite another error currently being returned by the enclosing function. This is at best confusing, and at worst error-prone. Therefore we suggest to disallow `try` as the called function in a `defer` statement as well. We can always revisit this decision if sensible applications are found. Finally, like other built-ins, the built-in `try` must be called; it cannot be used as a function value, as in `f := try` (just like `f := print` and `f := new` are also disallowed). ## Discussion ### Design iterations What follows is a brief discussion of earlier designs which led to the current minimal proposal. We hope that this will shed some light on the specific design choices made. Our first iteration of this proposal was inspired by two ideas from [Key Parts of Error Handling](https://gist.github.com/PeterRK/4f59579c1162cdbc28086f6b5f7b4fa2), which is to use a built-in rather than an operator, and an ordinary Go function to handle an error rather than a new error handler language construct. In contrast to that post, our error handler had the fixed function signature `func(error) error` to simplify matters. The error handler would be called by `try` in the presence of an error, just before `try` returned from the enclosing function. Here is an example: ```Go handler := func(err error) error { return fmt.Errorf("foo failed: %v", err) // wrap error } f := try(os.Open(filename), handler) // handler will be called in error case ``` While this approach permitted the specification of efficient user-defined error handlers, it also opened a lot of questions which didn’t have obviously correct answers: What should happen if the handler is provided but is nil? Should `try` panic or treat it as an absent error handler? What if the handler is invoked with a non-nil error and then returns a nil result? Does this mean the error is “cancelled”? Or should the enclosing function return with a nil error? It was also not clear if permitting an optional error handler would lead programmers to ignore proper error handling altogether. It would also be easy to do proper error handling everywhere but miss a single occurrence of a `try`. And so forth. The next iteration removed the ability to provide a user-defined error handler in favor of using `defer` for error wrapping. This seemed a better approach because it made error handlers much more visible in the code. This step eliminated all the questions around optional functions as error handlers but required that error results were named if access to them was needed (we decided that this was ok). Furthermore, in an attempt to make `try` useful not just inside functions with an error result, the semantics of `try` depended on the context: If `try` were used at the package-level, or if it were called inside a function without an error result, `try` would panic upon encountering an error. (As an aside, because of that property the built-in was called `must` rather than `try` in that proposal.) Having `try` (or `must`) behave in this context-sensitive way seemed natural and also quite useful: It would allow the elimination of many user-defined `must` helper functions currently used in package-level variable initialization expressions. It would also open the possibility of using `try` in unit tests via the `testing` package. Yet, the context-sensitivity of `try` was considered fraught: For instance, the behavior of a function containing `try` calls could change silently (from possibly panicking to not panicking, and vice versa) if an error result was added or removed from the signature. This seemed too dangerous a property. The obvious solution would have been to split the functionality of `try` into two separate functions, `must` and `try` (very similar to what is suggested by issue [#31442](https://github.com/golang/go/issues/31442)). But that would have required two new built-in functions, with only `try` directly connected to the immediate need for better error handling support. Thus, in the current iteration, rather than introducing a second built-in, we decided to remove the dual semantics of `try` and consequently only permit its use inside functions that have an error result. ### Properties of the proposed design This proposal is rather minimal, and may even feel like a step back from last year’s draft design. We believe the design choices we made to arrive at `try` are well justified: - First and foremost, `try` has exactly the semantics of the originally proposed `check` operator in the absence of a `handle` declaration. This validates the original draft design in an important aspect. - Choosing a built-in function rather than an operator has several advantages. There is no need for a new keyword such as `check` which would have made the design not backward compatible with existing parsers. There is also no need for extending the expression syntax with the new operator. Adding a new built-in is a comparatively trivial and completely orthogonal language change. - Using a built-in function rather than an operator requires the use of parentheses. We must write `try(f())` rather than `try f()`. This is the (small) price we pay for being backward compatible with existing parsers. But it also makes the design forward-compatible: If we determine down the road that having some form of explicitly provided error handler function, or any other additional parameter for that matter, is a good idea, it is trivially possible to pass that additional argument to a `try` call. - As it turns out, having to write parentheses has its advantages. In more complex expressions with multiple `try` calls, writing parentheses improves readability by eliminating guesswork about the precedence of operators, as the following examples illustrate: ```Go info := try(try(os.Open(file)).Stat()) // proposed try built-in info := try (try os.Open(file)).Stat() // try binding looser than dot info := try (try (os.Open(file)).Stat()) // try binding tighter than dot ``` The second line corresponds to a `try` operator that binds looser than a method call: Parentheses are required around the entire inner `try` expression since the result of that `try` is the receiver of the `.Stat` call (rather than the result of `os.Open`). The third line corresponds to a `try` operator that binds tighter than a method call: Parentheses are required around the `os.Open(file)` call since the results of that are the arguments for the inner `try` (we don’t want the inner `try` to apply only to `os`, nor the outer try to apply only to the inner `try`’s result). The first line is by far the least surprising and most readable as it is just using the familiar function call notation. - The absence of a dedicated language construct to support error wrapping may disappoint some people. However, note that this proposal does not preclude such a construct in the future. It is clearly better to wait until a really good solution presents itself than prematurely add a mechanism to the language that is not fully satisfactory. ## Conclusions The main difference between this design and the original [draft design](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling.md) is the elimination of the error handler as a new language construct. The resulting simplification is huge, yet there is no significant loss of generality. The effect of an explicit error handler declaration can be achieved with a suitable `defer` statement which is also prominently visible at the opening of a function body. In Go, built-ins are the _language escape mechanism of choice_ for operations that are irregular in some way but which don’t justify special syntax. For instance, the very first versions of Go didn’t define the `append` built-in. Only after manually implementing `append` over and over again for various slice types did it become clear that [dedicated language support](https://golang.org/cl/2627043) was warranted. The repeated implementation helped clarify how exactly the built-in should look like. We believe we are in an analogous situation now with `try`. It may also seem odd at first for a built-in to affect control-flow, but we should keep in mind that Go already has a couple of built-ins doing exactly that: `panic` and `recover`. The built-in type `error` and function `try` complement that pair. In summary, `try` may seem unusual at first, but it is simply syntactic sugar tailor-made for one specific task, error handling with less boilerplate, and to handle that task well enough. As such it fits nicely into the philosophy of Go: - There is no interference with the rest of the language. - Because it is syntactic sugar, `try` is easily explained in more basic terms of the language. - The design does not require new syntax. - The design is fully backwards-compatible. This proposal does not solve all error handling situations one might want to handle, but it addresses the most commonly used patterns well. For everything else there are `if` statements. ## Implementation The implementation requires: - Adjusting the Go spec. - Teaching the compiler’s type-checker about the `try` built-in. The actual implementation is expected to be a relatively straight-forward syntax tree transformation in the compiler’s front-end. No back-end changes are expected. - Teaching go/types about the `try` built-in. This is a minor change. - Adjusting gccgo accordingly (again, just the front-end). - Testing the built-in with new tests. As this is a backward-compatible language change, no library changes are required. However, we anticipate that support functions for error handling may be added. Their detailed design and respective implementation work is discussed [elsewhere](https://golang.org/issue/29934). Robert Griesemer will do the spec and go/types changes including additional tests, and (probably) also the cmd/compile compiler changes. We aim to have all the changes ready at the start of the [Go 1.14 cycle](https://golang.org/wiki/Go-Release-Cycle), around August 1, 2019. Separately, Ian Lance Taylor will look into the gccgo changes, which is released according to a different schedule. As noted in our [“Go 2, here we come!” blog post](https://blog.golang.org/go2-here-we-come), the development cycle will serve as a way to collect experience about these new features and feedback from (very) early adopters. At the release freeze, November 1, we will revisit this proposed feature and decide whether to include it in Go 1.14. ## Examples The `CopyFile` example from the [overview](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling-overview.md) becomes ```Go func CopyFile(src, dst string) (err error) { defer func() { if err != nil { err = fmt.Errorf("copy %s %s: %v", src, dst, err) } }() r := try(os.Open(src)) defer r.Close() w := try(os.Create(dst)) defer func() { w.Close() if err != nil { os.Remove(dst) // only if a “try” fails } }() try(io.Copy(w, r)) try(w.Close()) return nil } ``` Using a helper function as discussed in the section on handling errors, the first `defer` in `CopyFile` becomes a one-liner: ```Go defer fmt.HandleErrorf(&err, "copy %s %s", src, dst) ``` It is still possible to have multiple handlers, and even chaining of handlers (via the stack of `defer`’s), but now the control flow is defined by existing `defer` semantics, rather than a new, unfamiliar mechanism that needs to be learned first. The `printSum` example from the [draft design](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling.md) doesn’t require an error handler and becomes ```Go func printSum(a, b string) error { x := try(strconv.Atoi(a)) y := try(strconv.Atoi(b)) fmt.Println("result:", x + y) return nil } ``` or even simpler: ```Go func printSum(a, b string) error { fmt.Println( "result:", try(strconv.Atoi(a)) + try(strconv.Atoi(b)), ) return nil } ``` The `main` function of [this useful but trivial program](https://github.com/rsc/tmp/blob/master/unhex/main.go) could be split into two functions: ```Go func localMain() error { hex := try(ioutil.ReadAll(os.Stdin)) data := try(parseHexdump(string(hex))) try(os.Stdout.Write(data)) return nil } func main() { if err := localMain(); err != nil { log.Fatal(err) } } ``` Since `try` requires at a minimum an `error` argument, it may be used to check for remaining errors: ```Go n, err := src.Read(buf) if err == io.EOF { break } try(err) ``` ## FAQ This section is expected to grow as necessary. __Q: What were the main criticisms of the original [draft design](https://go.googlesource.com/proposal/+/master/design/go2draft-error-handling.md)?__ A: The draft design introduced two new keywords `check` and `handle` which made the proposal not backward-compatible. Furthermore, the semantics of `handle` was quite complicated and its functionality significantly overlapped with `defer`, making `handle` a non-orthogonal language feature. __Q: Why is `try` a built-in?__ A: By making `try` a built-in, there is no need for a new keyword or operator in Go. Introducing a new keyword is not a backward-compatible language change because the keyword may conflict with identifiers in existing programs. Introducing a new operator requires new syntax, and the choice of a suitable operator, which we would like to avoid. Using ordinary function call syntax has also advantages as explained in the section on Properties of the proposed design. And `try` can not be an ordinary function, because the number and types of its results depend on its input. __Q: Why is `try` called `try`?__ A: We have considered various alternatives, including `check`, `must`, and `do`. Even though `try` is a built-in and therefore does not conflict with existing identifiers, such identifiers may still shadow the built-in and thus make it inaccessible. `try` seems less common a user-defined identifier than `check` (probably because it is a keyword in some other languages) and thus it is less likely to be shadowed inadvertently. It is also shorter, and does convey its semantics fairly well. In the standard library we use the pattern of user-defined `must` functions to raise a panic if an error occurs in a variable initialization expression; `try` does not panic. Finally, both Rust and Swift use `try` to annotate explicitly-checked function calls as well (but see the next question). It makes sense to use the same word for the same idea. __Q: Why can’t we use `?` like Rust?__ A: Go has been designed with a strong emphasis on readability; we want even people unfamiliar with the language to be able to make some sense of Go code (that doesn’t imply that each name needs to be self-explanatory; we still have a language spec, after all). So far we have avoided cryptic abbreviations or symbols in the language, including unusual operators such as `?`, which have ambiguous or non-obvious meanings. Generally, identifiers defined by the language are either fully spelled out (`package`, `interface`, `if`, `append`, `recover`, etc.), or shortened if the shortened version is unambiguous and well-understood (`struct`, `var`, `func`, `int`, `len`, `imag`, etc.). Rust introduced `?` to alleviate issues with `try` and chaining - this is much less of an issue in Go where statements tend to be simpler and chaining (as opposed to nesting) less common. Finally, using `?` would introduce a new post-fix operator into the language. This would require a new token and new syntax and with that adjustments to a multitude of packages (scanners, parsers, etc.) and tools. It would also make it much harder to make future changes. Using a built-in eliminates all these problems while keeping the design flexible. __Q: Having to name the final (error) result parameter of a function just so that `defer` has access to it screws up `go doc` output. Isn’t there a better approach?__ A: We could adjust `go doc` to recognize the specific case where all results of a function except for the final error result have a blank (_) name, and omit the result names for that case. For instance, the signature `func f() (_ A, _ B, err error)` could be presented by `go doc` as `func f() (A, B, error)`. Ultimately this is a matter of style, and we believe we will adapt to expecting the new style, much as we adapted to not having semicolons. That said, if we are willing to add more new mechanisms to the language, there are other ways to address this. For instance, one could define a new, suitably named, built-in _variable_ that is an alias for the final error result parameter, perhaps only visible inside a deferred function literal. Alternatively, [Jonathan Geddes](https://github.com/jargv) [proposed](https://golang.org/issue/32437#issuecomment-499594811) that calling `try()` with no arguments could return an `*error` pointing to the error result variable. __Q: Isn’t using `defer` for wrapping errors going to be slow?__ A: Currently a `defer` statement is relatively expensive compared to ordinary control flow. However, we believe that it is possible to make common use cases of `defer` for error handling comparable in performance with the current “manual” approach. See also [CL 171758](https://golang.org/cl/171758/) which is expected to improve the performance of `defer` by around 30%. __Q: Won't this design discourage adding context information to errors?__ A: We think the verbosity of checking error results is a separate issue from adding context. The context a typical function should add to its errors (most commonly, information about its arguments) usually applies to multiple error checks. The plan to encourage the use of `defer` to add context to errors is mostly a separate concern from having shorter checks, which this proposal focuses on. The design of the exact `defer` helpers is part of [golang.org/issue/29934](https://golang.org/issue/29934) (Go 2 error values), not this proposal. __Q: The last argument passed to `try` _must_ be of type `error`. Why is it not sufficient for the incoming argument to be _assignable_ to `error`?__ A: A [common novice mistake](https://golang.org/doc/faq#nil_error) is to assign a concrete nil pointer value to a variable of type `error` (which is an interface) only to find that that variable is not nil. Requiring the incoming argument to be of type `error` prevents this bug from occurring through the use of `try`. (We can revisit this decision in the future if necessary. Relaxing this rule would be a backward-compatible change.) __Q: If Go had “generics”, couldn’t we implement `try` as a generic function?__ A: Implementing `try` requires the ability to return from the function enclosing the `try` call. Absent such a “super return” statement, `try` cannot be implemented in Go even if there were generic functions. `try` also requires a variadic parameter list with parameters of different types. We do not anticipate support for such variadic generic functions. __Q: I can’t use `try` in my code, my error checks don’t fit the required pattern. What should I do?__ A: `try` is not designed to address _all_ error handling situations; it is designed to handle the most common case well, to keep the design simple and clear. If it doesn’t make sense (or it isn’t possible) to change your code such that `try` can be used, stick with what you have. `if` statements are code, too. __Q: In my function, most of the error tests require different error handling. I can use `try` just fine but it gets complicated or even impossible to use `defer` for error handling. What can I do?__ A: You may be able to split your function into smaller functions of code that shares the same error handling. Also, see the previous question. __Q: How is `try` different from exception handling (and where is the `catch`)?__ A: `try` is simply syntactic sugar (a "macro") for extracting the non-error values of an expression followed by a conditional `return` (if a non-nil error was found) from the enclosing function. `try` is always explicit; it must be literally present in the source code. Its effect on control flow is limited to the current function. There is also no mechanism to "catch" an error. After the function has returned, execution continues as usual at the call site. In summary, `try` is a shortcut for a conditional `return`. Exception handling on the other hand, which in some languages involves `throw` and `try`-`catch` statements, is akin to handling Go panics. An exception, which may be explicitly `throw`n but also implicitly raised (for instance a division-by-0 exception), terminates the currently active function (by returning from it) and then continues to unwind the activation stack by terminating the callee and so forth. An exception may be "caught" if it occurs within a `try`-`catch` statement at which point the exception is not further propagated. An exception that is not caught may cause the entire program to terminate. In Go, the equivalent of an exception is a panic. Throwing an exception is equivalent to calling `panic`. And catching an exception is equivalent to `recover`ing from a panic.
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/go2draft-generics-overview.md
# Generics — Problem Overview Russ Cox\ August 27, 2018 ## Introduction This overview and the accompanying [detailed draft design](go2draft-contracts.md) are part of a collection of [Go 2 draft design documents](go2draft.md). The overall goal of the Go 2 effort is to address the most significant ways that Go fails to scale to large code bases and large developer efforts. The Go team, and in particular Ian Lance Taylor, has been investigating and discussing possible designs for "generics" (that is, parametric polymorphism; see note below) since before Go’s first open source release. We understood from experience with C++ and Java that the topic was rich and complex and would take a long time to understand well enough to design a good solution. Instead of attempting that at the start, we spent our time on features more directly applicable to Go’s initial target of networked system software (now "cloud software"), such as concurrency, scalable builds, and low-latency garbage collection. After the release of Go 1, we continued to explore various possible designs for generics, and in April 2016 we [released those early designs](https://go.googlesource.com/proposal/+/master/design/15292-generics.md#), discussed in detail below. As part of re-entering "design mode" for the Go 2 effort, we are again attempting to find a design for generics that we feel fits well into the language while providing enough of the flexibility and expressivity that users want. Some form of generics was one of the top two requested features in both the [2016](https://blog.golang.org/survey2016-results) and [2017](https://blog.golang.org/survey2017-results) Go user surveys (the other was package management). The Go community maintains a "[Summary of Go Generics Discussions](https://docs.google.com/document/d/1vrAy9gMpMoS3uaVphB32uVXX4pi-HnNjkMEgyAHX4N4/view#heading=h.vuko0u3txoew)" document. Many people have concluded (incorrectly) that the Go team’s position is "Go will never have generics." On the contrary, we understand the potential generics have, both to make Go far more flexible and powerful and to make Go far more complicated. If we are to add generics, we want to do it in a way that gets as much flexibility and power with as little added complexity as possible. _Note on terminology_: Generalization based on type parameters was called parametric polymorphism when it was [first identified in 1967](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.332.3161&rep=rep1&type=pdf) and for decades thereafter in the functional programming community. The [GJ proposal](http://homepages.inf.ed.ac.uk/wadler/papers/gj-oopsla/gj-oopsla-letter.pdf), which led to adding parametric polymorphism in Java 5, changed the terminology first to "genericity" and eventually to "generics". All imperative languages since Java that have added support for parametric polymorphism have called it "generics." We make no distinction between the terms, but it is important to emphasize that "generics" means more than just generic data containers. ## Problem To scale Go to large code bases and developer efforts, it is important that code reuse work well. Indeed, one early focus for Go was simply to make sure that programs consisting of many independent packages built quickly, so that code reuse was not too expensive. One of Go’s key distinguishing features is its approach to interfaces, which are also targeted directly at code reuse. Specifically, interfaces make it possible to write abstract implementations of algorithms that elide unnecessary detail. For example, [container/heap](https://godoc.org/container/heap) provides heap-maintenance algorithms as ordinary functions that operate on a [heap.Interface](https://godoc.org/container/heap#Interface), making them applicable to any backing storage, not just a slice of values. This can be very powerful. At the same time, most programmers who want a priority queue don’t want to implement the underlying storage for it and then invoke the heap algorithms. They would prefer to let the implementation manage its own array, but Go does not permit expressing that in a type-safe way. The closest one can come is to make a priority queue of `interface{}` values and use type assertions after fetching each element. (The standard [`container/list`](https://golang.org/pkg/container/list) and [`container/ring`](https://golang.org/pkg/container/ring) implementations take this approach.) Polymorphic programming is about more than data containers. There are many general algorithms we might want to implement as plain functions that would apply to a variety of types, but every function we write in Go today must apply to only a single type. Examples of generic functions we’d like to write include: // Keys returns the keys from a map. func Keys(m map[K]V) []K // Uniq filters repeated elements from a channel, // returning a channel of the filtered data. func Uniq(<-chan T) <-chan T // Merge merges all data received on any of the channels, // returning a channel of the merged data. func Merge(chans ...<-chan T) <-chan T // SortSlice sorts a slice of data using the given comparison function. func SortSlice(data []T, less func(x, y T) bool) [Doug McIlroy has suggested](https://golang.org/issue/26282) that Go add two new channel primitives `splice` and `clone`. These could be implemented as polymorphic functions instead. The "[Go should have generics](https://go.googlesource.com/proposal/+/master/design/15292-generics.md#)" proposal and the "[Summary of Go Generics Discussions](https://docs.google.com/document/d/1vrAy9gMpMoS3uaVphB32uVXX4pi-HnNjkMEgyAHX4N4/view#heading=h.vuko0u3txoew)" contain additional discussion of the problem. ## Goals Our goal is to address the problem of writing Go libraries that abstract away needless type detail, such as the examples in the previous section, by allowing parametric polymorphism with type parameters. In particular, in addition to the expected container types, we aim to make it possible to write useful libraries for manipulating arbitrary map and channel values, and ideally to write polymorphic functions that can operate on both `[]byte` and `string` values. It is not a goal to enable other kinds of parameterization, such as parameterization by constant values. It is also not a goal to enable specialized implementations of polymorphic definitions, such as defining a general `vector<T>` and a special-case `vector<bool>` using bit-packing. We want to learn from and avoid the problems that generics have caused for C++ and in Java (described in detail in the section about other languages, below). To support [software engineering over time](https://research.swtch.com/vgo-eng), generics for Go must record constraints on type parameters explicitly, to serve as a clear, enforced agreement between caller and implementation. It is also critical that the compiler report clear errors when a caller does not meet those constraints or an implementation exceeds them. Polymorphism in Go must fit smoothly into the surrounding language, without awkward special cases and without exposing implementation details. For example, it would not be acceptable to limit type parameters to those whose machine representation is a single pointer or single word. As another example, once the general `Keys(map[K]V) []K` function contemplated above has been instantiated with `K` = `int` and `V` = `string`, it must be treated semantically as equivalent to a hand-written non-generic function. In particular it must be assignable to a variable of type `func(map[int]string) []int`. Polymorphism in Go should be implementable both at compile time (by repeated specialized compilation, as in C++) and at run time, so that the decision about implementation strategy can be left as a decision for the compiler and treated like any other compiler optimization. This flexibility would address the [generic dilemma](https://research.swtch.com/generic) we’ve discussed in the past. Go is in large part a language that is straightforward and understandable for its users. If we add polymorphism, we must preserve that. ## Draft Design This section quickly summarizes the draft design, as a basis for high-level discussion and comparison with other approaches. The draft design adds a new syntax for introducing a type parameter list in a type or function declaration: `(type` <_list of type names_>`)`. For example: type List(type T) []T func Keys(type K, V)(m map[K]V) []K Uses of a parameterized declaration supply the type arguments using ordinary call syntax: var ints List(int) keys := Keys(int, string)(map[int]string{1:"one", 2: "two"}) The generalizations in these examples require nothing of the types `T`, `K`, and `V`: any type will do. In general an implementation may need to constrain the possible types that can be used. For example, we might want to define a `Set(T)`, implemented as a list or map, in which case values of type `T` must be able to be compared for equality. To express that, the draft design introduces the idea of a named **_contract_**. A contract is like a function body illustrating the operations the type must support. For example, to declare that values of type `T` must be comparable: contract Equal(t T) { t == t } To require a contract, we give its name after the list of type parameters: type Set(type T Equal) []T // Find returns the index of x in the set s, // or -1 if x is not contained in s. func (s Set(T)) Find(x T) int { for i, v := range s { if v == x { return i } } return -1 } As another example, here is a generalized `Sum` function: contract Addable(t T) { t + t } func Sum(type T Addable)(x []T) T { var total T for _, v := range x { total += v } return total } Generalized functions are invoked with type arguments to select a specialized function and then invoked again with their value arguments: var x []int total := Sum(int)(x) As you might expect, the two invocations can be split: var x []int intSum := Sum(int) // intSum has type func([]int) int total := intSum(x) The call with type arguments can be omitted, leaving only the call with values, when the necessary type arguments can be inferred from the values: var x []int total := Sum(x) // shorthand for Sum(int)(x) More than one type parameter is also allowed in types, functions, and contracts: contract Graph(n Node, e Edge) { var edges []Edge = n.Edges() var nodes []Node = e.Nodes() } func ShortestPath(type N, E Graph)(src, dst N) []E The contract is applied by default to the list of type parameters, so that `(type T Equal)` is shorthand for `(type T Equal(T))`, and `(type N, E Graph)` is shorthand for `(type N, E Graph(N, E))`. For details, see the [draft design](go2draft-contracts.md). ## Discussion and Open Questions This draft design is meant only as a starting point for community discussion. We fully expect the details to be revised based on feedback and especially experience reports. This section outlines some of the questions that remain to be answered. Our previous four designs for generics in Go all had significant problems, which we identified very quickly. The current draft design appears to avoid the problems in the earlier ones: we’ve spent about half a year discussing and refining it so far and still believe it could work. While we are not formally proposing it today, we think it is at least a good enough starting point for a community discussion with the potential to lead to a formal proposal. Even after six months of (not full time) discussion, the design is still in its earliest stages. We have written a parser but no type checker and no implementation. It will be revised as we learn more about it. Here we identify a few important things we are unsure about, but there are certainly more. **Implied constraints**. One of the examples above applies to maps of arbitrary key and value type: func Keys(type K, V)(m map[K]V) []K { ... } But not all types can be used as key types, so this function should more precisely be written as: func Keys(type K, V Equal(K))(m map[K]V) []K { ... } It is unclear whether that precision about `K` should be required of the user or inferred from the use of `map[K]V` in the function signature. **Dual implementation**. We are hopeful that the draft design satisfies the "dual-implementation" constraint mentioned above, that every parameterized type or function can be implemented either by compile-time or run-time type substitution, so that the decision becomes purely a compiler optimization, not one of semantic significance. But we have not yet confirmed that. One consequence of the dual-implementation constraint is that we have not included support for type parameters in method declarations. The most common place where these arise is in modeling functional operations on general containers. It is tempting to allow: // A Set is a set of values of type T. type Set(type T) ... // Apply applies the function f to each value in the set s, // returning a set of the results. func (s Set(T)) Apply(type U)(f func(T) U) Set(U) // NOT ALLOWED! The problem here is that a value of type `Set(int)` would require an infinite number of `Apply` methods to be available at runtime, one for every possible type `U`, all discoverable by reflection and type assertions. They could not all be compiled ahead of time. An earlier version of the design allowed generic methods but then disallowed their visibility in reflection and interface satisfaction, to avoid forcing the run-time implementation of generics. Disallowing generalized methods entirely seemed cleaner than allowing them with these awkward special cases. Note that it is still possible to write `Apply` as a top-level function: func Apply(type T, U)(s Set(T), f func(T) U) Set(U) Working within the intersection of compile-time and run-time implementations also requires being able to reject parameterized functions or types that cause generation of an arbitrary (or perhaps just very large) number of additional types. For example, here are a few unfortunate programs: // OK type List(type T) struct { elem T next *List(T) } // NOT OK - Implies an infinite sequence of types as you follow .next pointers. type Infinite(type T) struct { next *Infinite(Infinite(T)) } // BigArray(T)(n) returns a nil n-dimensional slice of T. // BigArray(int)(1) returns []int // BigArray(int)(2) returns [][]int // ... func BigArray(type T)(n int) interface{} { if n <= 1 || n >= 1000000000 { return []T(nil) } return BigArray([]T)(n-1) } It is unclear what the algorithm is for deciding which programs to accept and which to reject. **Contract bodies**. Contracts are meant to look like little functions. They use a subset of function body syntax, but the actual syntax is much more limited than just "any Go code" (see the full design for details). We would like to understand better if it is feasible to allow any valid function body as a contract body. The hard part is defining precisely which generic function bodies are allowed by a given contract body. There are parallels with the C++ concepts design (discussed in detail below): the definition of a C++ concept started out being exactly a function body illustrating the necessary requirements, but over time the design changed to use a more limited list of requirements of a specific form. Clearly it was not workable in C++ to support arbitrary function bodies. But Go is a simpler language than C++ and it may be possible here. We would like to explore whether it is possible to implement contract body syntax as exactly function body syntax and whether that would be simpler for users to understand. **Feedback**. The most useful general feedback would be examples of interesting uses that are enabled or disallowed by the draft design. We’d also welcome feedback about the points above, especially based on experience type-checking or implementing generics in other languages. We are most uncertain about exactly what to allow in contract bodies, to make them as easy to read and write for users while still being sure the compiler can enforce them as limits on the implementation. That is, we are unsure about the exact algorithm to deduce the properties required for type-checking a generic function from a corresponding contract. After that we are unsure about the details of a run-time-based (as opposed to compile-time-based) implementation. Feedback on semantics and implementation details is far more useful and important than feedback about syntax. We are collecting links to feedback at [golang.org/wiki/Go2GenericsFeedback](https://golang.org/wiki/Go2GenericsFeedback). ## Designs in Other Languages It is worth comparing the draft design with those in real-world use, either now or in the past. We are not fluent programmers in many of these languages. This is our best attempt to piece together the history, including links to references, but we would welcome corrections about the syntax, semantics, or history of any of these. The discussion of other language designs in this section focuses on the specification of type constraints and also implementation details and problems, because those ended up being the two most difficult parts of the Go draft design for us to work out. They are likely the two most difficult parts of any design for parametric polymorphism. In retrospect, we were biased too much by experience with C++ without concepts and Java generics. We would have been well-served to spend more time with CLU and C++ concepts earlier. We’ll use the `Set`, `Sum`, and `ShortestPath` examples above as points of comparison throughout this section. ### ML, 1975 ML was the first typed language to incorporate polymorphism. Christopher Strachey is usually given credit for introducing the term parametric polymorphism in his 1967 survey, "[Fundamental Concepts in Programming Languages](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.332.3161&rep=rep1&type=pdf)." Robin Milner’s 1978 paper "[A Theory of Type Polymorphism in Programming](https://courses.engr.illinois.edu/cs421/sp2013/project/milner-polymorphism.pdf)" introduced an algorithm to infer the most general types of polymorphic function bodies, instead of forcing the use of concrete types. Milner had already implemented his algorithm for the ML language as part of the Edinburgh LCF system. He wanted to be able to write the kinds of general functions possible in LISP, but in a typed language. ML inferred constraints and for that matter the types themselves from the untyped function body. But the inference was limited - there were no objects, classes, methods, or operators, just values (including function values). There was not even equality checking. Milner [suggested adding "equality types"](http://www.lfcs.inf.ed.ac.uk/reports/87/ECS-LFCS-87-33/ECS-LFCS-87-33.pdf) in 1987, distinguishing a type variable with no constraints (`'t`) from a type variable that must represent a type allowing equality checks (`''t`). The [Standard ML of New Jersey compiler](https://www.cs.princeton.edu/research/techreps/TR-097-87) (1987) implements polymorphic functions by arranging that every value is [represented as a single machine word](https://www.cs.princeton.edu/research/techreps/TR-142-88). That uniformity of representation, combined with the near-complete lack of type constraints, made it possible to use one compiled body for all invocations. Of course, boxing has its own allocation time and space overheads. The [MLton whole-program optimizing compiler](http://mlton.org/History) (1997) specializes polymorphic functions at compile time. ### CLU, 1977 The research language CLU, developed by Barbara Liskov’s group at MIT, was the first to introduce what we would now recognize as modern generics. (CLU also introduced iterators and abstract data types.) [CLU circa 1975](http://csg.csail.mit.edu/CSGArchives/memos/Memo-112-1.pdf) allowed defining parameterized types without constraints, much like in ML. To enable implementing a generic set despite the lack of constraints, all types were required to implement an equal method. By 1977, [CLU had introduced "where clauses"](https://web.eecs.umich.edu/~weimerw/2008-615/reading/liskov-clu-abstraction.pdf) to constrain parameterized types, allowing the set implementation to make its need for `equal` explicit. CLU also had operator methods, so that `x == y` was syntactic sugar for `t$equal(x, y)` where `t` is the type of both `x` and `y`. set = cluster [t: type] is create, member, size, insert, delete, elements where t has equal: proctype (t, t) returns (bool) rep = array[t] % implementation of methods here, using == on values of type t end set The more complex graph example is still simple in CLU: shortestpath = proc[node, edge: type] (src, dst: node) returns array[edge] where node has edges: proctype(node) returns array[edge], edge has nodes: proctype(edge) returns array[node] ... end shortestpath The 1978 paper "[Aspects of Implementing CLU](http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.106.3516&rep=rep1&type=pdf)" discusses the compile-time versus run-time implementations of parameterized generics and details CLU's run-time-only approach. The "BigArray" function shown earlier is also taken from this paper (translated to Go, of course). All the ingredients for modern generics are here: syntax for declaring generalized types and functions, syntax for invoking them, a simple constraint syntax, and a well thought-out implementation. There was no inference of type parameters. The CLU designers found it helpful to see all substitutions made explicitly. In her 1992 retrospective "[A History of CLU](http://citeseerx.ist.psu.edu/viewdoc/download;jsessionid=F5D7C821199F22C5D30A51F155DB9D23?doi=10.1.1.46.9499&rep=rep1&type=pdf)," Liskov observed, "CLU was way ahead of its time in its solution for parameterized modules. Even today, most languages do not support parametric polymorphism, although there is growing recognition of the need for it." ### Ada, 1983 Ada clearly lifted many ideas from CLU, including the approach for exceptions and parametric polymorphism, although not the elegant syntax. Here is an example generic squaring function from the [Ada 1983 spec](https://swtch.com/ada-mil-std-1815a.pdf), assembled from pages 197, 202, and 204 of the PDF. The generic declaration introduces a parameterized "unit" and then the function declaration appears to come separately: generic type ITEM Is private; with function "*"(U, V ITEM) return ITEM is <>; function SQUARING(X : ITEM) return ITEM; function SQUARING(X : ITEM) return ITEM is begin return X*X; end; Interestingly, this definition introduces a function SQUARING parameterized by both the type ITEM and the * operation. If instantiated using type INTEGER, the * operation is taken from that type: function SQUARE is new SQUARING (INTEGER); But the * operation can also be substituted directly, allowing definition of a matrix squarer using the MATRIX-PRODUCT function. These two instantiations are equivalent: function SQUARE is new SQUARING (ITEM -> MATRIX, "*'" => MATRIX-PRODUCT); function SQUARE is new SQUARING (MATRIX, MATRIX-PRODUCT); We have not looked into how Ada generics were implemented. The initial Ada design contest [ran from 1975-1980 or so](https://www.red-gate.com/simple-talk/opinion/geek-of-the-week/tucker-taft-geek-of-the-week/), resulting eventually in the Ada 83 standard in 1983. We are not sure exactly when generics were added. ### C++, 1991 [C++ introduced templates](http://www.stroustrup.com/hopl-almost-final.pdf) in 1991, in the Cfront 3.0 release. The implementation was always by compile-time macro expansion, and there were no "where clauses" or other explicit constraints. template<typename T> class Set { ... void Add(T item) { ... } }; template<typename T> T Sum(x vector<T>) { T s; for(int i = 0; i < x.size(); i++) { s += x[i]; } return s; } Instead, if a template was invoked with an inappropriate type, such as a Sum<char*>, the compiler reported a type-checking error in the middle of the invoked function’s body. This was not terribly user-friendly and soured many developers on the idea of parametric polymorphism. The lack of type constraints enabled the creation of the STL and transformed C++ into a wholly different language than it had been. Then the problem became how to add explicit type constraints sufficiently expressive to allow all the tricks used in the STL. Programmers worked around the lack of constraints by establishing conventions for expressing them. Stroustrup’s 1994 book [The Design and Evolution of C++](http://www.stroustrup.com/dne.html) gives some examples. The first option is to define constraints as classes: template <class T> class Comparable { T& operator=(const T&); int operator==(const T&, const T&); int operator<=(const T&, const T&); int operator<(const T&, const T&); }; template <class T : Comparable> class vector { // ... }; Unfortunately, this requires the original type `T` to explicitly derive from `Comparable`. Instead, Stroustrup suggested writing a function, conventionally named `constraints`, illustrating the requirements: template<class T> class X { // ... void constraints(T* tp) { // T must have: B* bp = tp; // an accessible base B tp->f(); // a member function f T a(l); // a constructor from int a = *tp; // assignment // ... } }; Compiler errors would at least be simple, targeted, and reported as a problem with `X<T>::constraints`. Of course, nothing checked that other templates used only the features of T illustrated in the constraints. In 2003, Stroustrup proposed formalizing this convention as [C++ concepts](http://www.stroustrup.com/N1522-concept-criteria.pdf). The feature was intended for C++0x (eventually C++11 (2011)) but [removed in 2009](http://www.drdobbs.com/cpp/the-c0x-remove-concepts-decision/218600111). Concepts were published as a [separate ISO standard in 2015](https://www.iso.org/standard/64031.html), shipped in GCC, and were intended for C++17 (2017) [but removed in 2016](http://honermann.net/blog/2016/03/06/why-concepts-didnt-make-cxx17/). They are now intended for C++20 (2020). The 2003 proposal gives this syntax: concept Element { constraints(Element e1, Element e2) { bool b = e1<e2; // Elements can be compared using < swap(e1,e2); // Elements can be swapped } }; By 2015, the syntax had changed a bit but the underlying idea was still the same. Stroustrup’s 2015 paper "[Concepts: The Future of Generic Programming, or How to design good concepts and use them well](http://www.stroustrup.com/good_concepts.pdf)" presents as an example a concept for having equality checking. (In C++, `==` and `!=` are unrelated operations so both must be specified.) template<typename T> concept bool Equality_comparable = requires (T a, T b) { { a == b } -> bool; // compare Ts with == { a != b } -> bool; // compare Ts with != }; A requires expression evaluates to true if each of the listed requirements is satisfied, false otherwise. Thus `Equality_comparable<T>` is a boolean constant whose value depends on `T`. Having defined the predicate, we can define our parameterized set: template<Equality_comparable T> class Set { ... }; Set<int> set; set.Add(1); Here the `<Equality_comparable T>` introduces a type variable `T` with the constraint that `Equality_comparable<T> == true`. The class declaration above is shorthand for: template<typename T> requires Equality_comparable<T> class Set { ... }; By allowing a single concept to constrain a group of related types, the C++ concept proposal makes it easy to define our shortest path example: template<typename Node, typename Edge> concept bool Graph = requires(Node n, Edge e) { { n.Edges() } -> vector<Edge>; { e.Nodes() } -> vector<Node>; }; template<typename Node, Edge> requires Graph(Node, Edge) vector<Edge> ShortestPath(Node src, Node dst) { ... } ### Java, 1997-2004 In 1997, Martin Odersky and Philip Wadler introduced [Pizza](http://pizzacompiler.sourceforge.net/doc/pizza-language-spec.pdf), a strict superset of Java, compiled to Java bytecodes, adding three features from functional programming: parametric polymorphism, higher-order functions, and algebraic data types. In 1998, Odersky and Wadler, now joined by Gilad Bracha and David Stoutamire, introduced [GJ](http://homepages.inf.ed.ac.uk/wadler/papers/gj-oopsla/gj-oopsla-letter.pdf), a Pizza-derived Java superset targeted solely at parametric polymorphism, now called generics. The GJ design was adopted with minor changes in Java 5, released in 2004. As seen in the example, this design uses interfaces to express type constraints, with the result that parameterized interfaces must be used to create common self-referential constraints such as having an equal method that checks two items of the same type for equality. In CLU this constraint was written directly: set = cluster[t: type] ... where t has equal: proctype(t, t) returns bool In Java 5, the same constraint is written indirectly, by first defining `Equal<T>`: interface Equal<T> { boolean equal(T o); } Then the constraint is `T implements Equal<T>` as in: class Set<T implements Equal<T>> { ... public void add(T o) { ... } } Set<int> set; set.add(1); This is Java’s variant of the C++ "[curiously recurring template pattern](https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern)" and is a common source of confusion (or at least rote memorization) among Java programmers first learning generics. The graph example is even more complex: interface Node<Edge> { List<Edge> Edges() } interface Edge<Node> { List<Node> Nodes() } class ShortestPath<N implements Node<E>, E implements Edge<N>> { static public List<Edge> Find(Node src, dst) { ... } } Java 4 and earlier had provided untyped, heterogeneous container classes like `List` and `Set` that used the non-specific element type `Object`. Java 5 generics aimed to provide type parameterization for those legacy containers. The originals became `List<Object>` and `Set<Object>`, but now programmers could also write `List<String>`, `List<Set<String>>`, and so on. The implementation was by "type erasure," converting to the original untyped containers, so that at runtime there were only the unparameterized implementations `List` and `Set` (of `Object`). Because the implementation needed to be memory-compatible with `List<Object>`, which is to say a list of pointers, Java value types like `int` and `boolean` could not be used as type parameters: no `List<int>`. Instead there is `List<Integer>`, in which each element becomes an class object instead of a plain `int`, with all the associated memory and allocation overhead. Because of the erasure, reflection on these values, including dynamic type checks using `instanceof`, has no information about the expected type of elements. Reflection and code written using untyped collections like `List` or `Set` therefore served as back doors to bypass the new type system. The inability to use `instanceof` with generics introduced other rough edges, such as not being able to define parameterized exception classes, or more precisely being able to throw an instance of a parameterized class but not catch one. Angelika Langer has written an [extensive FAQ](http://www.angelikalanger.com/GenericsFAQ/JavaGenericsFAQ.html), the size of which gives a sense of the complexity of Java generics. Java 10 may add runtime access to type parameter information. Experience watching the Java generics story unfold, combined with discussions with some of the main players, was the primary reason we avoided tackling any sort of generics in the first version of Go. Since much of the complexity arose from the design being boxed in by pre-existing container types, we mostly avoided adding container types to the standard library ([`container/list`](https://golang.org/pkg/container/list) and [`container/ring`](https://golang.org/pkg/container/ring) are the exceptions, but they are not widely used). Many developers associate Java generics first with the complexity around container types. That complexity, combined with the fact that Java lacks the concept of a plain function (such as `Sum`) as opposed to methods bound to a class, led to the common belief that generics means parameterized data structures, or containers, ignoring parameterized functions. This is particularly ironic given the original inspiration from functional programming. ### C#, 1999-2005 C#, and more broadly the .NET Common Language Runtime (CLR), added [support for generics](https://msdn.microsoft.com/en-us/library/ms379564(v=vs.80).aspx) in C# 2.0, released in 2005 and the culmination of [research beginning in 1999](http://mattwarren.org/2018/03/02/How-generics-were-added-to-.NET/). The syntax and definition of type constraints mostly follows Java’s, using parameterized interfaces. Learning from the Java generics implementation experience, C# removes many of the rough edges. It makes parameterization information available at runtime, so that reflection can distinguish `List<string>` from `List<List<string>>`. It also allows parameterization to use basic types like int, so that `List<int>` is valid and efficient. ### D, 2002 D [added templates in D 0.40](https://wiki.dlang.org/Language_History_and_Future), released in September 2002. We have not tracked down the original design to see how similar it was to the current templates. The current D template mechanism allows parameterizing a block of arbitrary code: template Template(T1, T2) { ... code using T1, T2 ... } The block is instantiated using `Template!` followed by actual types, as in `Template!(int, float64)`. It appears that instantiation is always at compile-time, like in C++. If a template contains a single declaration of the same name, the usage is shortened: template Sum(T) { T Sum(T[] x) { ... } } int[] x = ... int sum = Sum!(int)(x) // short for Sum!(int).Sum(x) This code compiles and runs, but it can be made clearer by adding an [explicit constraint on `T`](https://dlang.org/concepts.html) to say that it must support equality: template hasEquals(T) { const hasEquals = __traits(compiles, (T t) { return t == t; }); } template Sum(T) if (hasEquals!(T)) { T Sum(T []x) { ... } } The `__traits(compiles, ...)` construct is a variant of the C++ concepts idea (see C++ discussion above). As in C++, because the constraints can be applied to a group of types, defining `Graph` does not require mutually-recursive gymnastics: template isGraph(Node, Edge) { const isGraph = __traits(compiles, (Node n, Edge e) { Edge[] edges = n.Edges(); Node[] nodes = e.Nodes(); }); } template ShortestPath(Node, Edge) if (isGraph!(Node, Edge)) { Edge[] ShortestPath(Node src, Node dst) { ... } } ### Rust, 2012 Rust [included generics in version 0.1](https://github.com/rust-lang/rust/blob/master/RELEASES.md#version-01--2012-01-20), released in 2012. Rust defines generics with syntax similar to C#, using traits (Rust’s interfaces) as type constraints. Rust avoids Java’s and C#'s curiously-recurring interface pattern for direct self-reference by introducing a `Self` type. For example, the protocol for having an `Equals` method can be written: pub trait Equals { fn eq(&self, other: &Self) -> bool; fn ne(&self, other: &Self) -> bool; } (In Rust, `&self` denotes the method's receiver variable, written without an explicit type; elsewhere in the function signature, `&Self` can be used to denote the receiver type.) And then our `Set` type can be written: struct Set<T: Equals> { ... } This is shorthand for struct Set<T> where T: Equals { ... } The graph example still needs explicitly mutually-recursive traits: pub trait Node<Edge> { fn edges(&self) -> Vec<Edge>; } pub trait Edge<Node> { fn nodes(&self) -> Vec<Node>; } pub fn shortest_path<N, E>(src: N, dst: N) -> Vec<E> where N: Node<E>, E: Edge<N> { ... } In keeping with its "no runtime" philosophy, Rust implements generics by compile-time expansion, like C++ templates. ### Swift, 2017 Swift added generics in Swift 4, released in 2017. The [Swift language guide](https://docs.swift.org/swift-book/LanguageGuide/Generics.html) gives an example of sequential search through an array, which requires that the type parameter `T` support equality checking. (This is a popular example; it dates back to CLU.) func findIndex<T: Equatable>(of valueToFind: T, in array:[T]) -> Int? { for (index, value) in array.enumerated() { if value == valueToFind { return index } } return nil } Declaring that `T` satisfies the [`Equatable`](https://developer.apple.com/documentation/swift/equatable) protocol makes the use of `==` in the function body valid. `Equatable` appears to be a built-in in Swift, not possible to define otherwise. Like Rust, Swift avoids Java’s and C#'s curiously recurring interface pattern for direct self-reference by introducing a `Self` type. For example, the protocol for having an `Equals` method is: protocol EqualsMethod { func Equals(other: Self) -> Bool } Protocols cannot be parameterized, but declaring "associated types" can be used for the same effect: protocol Node { associatedtype Edge; func Edges() -> [Edge]; } protocol Edge { associatedtype Node; func Nodes() -> [Node]; } func ShortestPath<N: Node, E: Edge>(src: N, dst: N) -> [E] where N.Edge == E, E.Node == N { ... } Swift’s default implementation of generic code is by single compilation with run-time substitution, via "[witness tables](https://www.reddit.com/r/swift/comments/3r4gpt/how_is_swift_generics_implemented/cwlo64w/?st=jkwrobje&sh=6741ba8b)". The compiler is allowed to compile specialized versions of generic code as an optimization, just as we would like to do for Go. ## Earlier Go Designs As noted above, the Go team, and in particular Ian Lance Taylor, has been investigating and discussing possible designs for "generics" since before the open source release. In April 2016, we [published the four main designs](https://go.googlesource.com/proposal/+/master/design/15292-generics.md) we most seriously considered (before the current one). Looking back over the designs and comparing them to the current draft design, it is helpful to focus on four features that varied in the designs over time: syntax, type constraints, type inference, and implementation strategy. **Syntax**. How are generic types, funcs, or methods declared? How are generic types, funcs, or methods used? **Type Constraints**. How are type constraints defined? **Type Inference**. When can explicit function call type instantiations be omitted (inferred by the compiler)? **Implementation**. Is compile-time substitution required? Is run-time substitution required? Are both required? Can the compiler choose one or the other as it sees fit? ### [Type Functions](https://go.googlesource.com/proposal/+/master/design/15292/2010-06-type-functions.md), June 2010 The first design we explored was based on the idea of a "type function." **Syntax.** "Type function" was the name for the syntax for a parameterized type. type Vector(T) []T Every use of a type function had to specify concrete instantiations for the type variables, as in type VectorInt Vector(int) Func definitions introduced type parameters implicitly by use of a type function or explicitly by use of an argument of type "`<name> type`", as in: func Sum(x Vector(T type)) T func Sum(x []T type) T **Constraints.** Type constraints were specified by optional interface names following the type parameter: type PrintableVector(T fmt.Stringer) []T func Print(x T type fmt.Stringer) To allow use of operators like addition in generic code, this proposal relied upon a separate proposal to introduce "operator methods" (as in CLU), which would in turn make them available in interface definitions. **Inference.** There were no function call type instantiations. Instead there was an algorithm for determining the type instantiations, with no explicit fallback when the algorithm failed. **Implementation.** Overall the goal was to enable writing complex type-independent code once, at a run-time cost: the implementation would always compile only a generic version of the code, which would be passed a type descriptor to supply necessary details. This would make generics unsuitable for high-performance uses or even trivial uses like `Min` and `Max`. If type `Vector(T)` defined a method `Read(b []T) (int, error)`, it was unclear how the generic `Read` implementation specialized to byte would necessarily be compatible in calling convention with `io.Reader`. The proposal permitted the idea of unbound type parameters that seemed to depend on unspecified runtime support, producing "generic values". The doc uses as an example: func Unknown() T type x := Unknown() It was not clear exactly what this meant or how it would be implemented. Overall it seemed that the need for the concept of a "generic value" was an indicator that something was not quite right. ### [Generalized Types](https://go.googlesource.com/proposal/+/master/design/15292/2011-03-gen.md), March 2011 The next design we explored was called "generalized types," although type parameters applied equally to types and functions. **Syntax.** A type variable was introduced by the syntax `gen [T]` before a declaration and instantiated by listing the types in square brackets after the declared name. gen[T] type Vector []T type VectorInt Vector[int] gen[T] func Sum(x []T) T gen[T] func Sum(x Vector[T]) T sum := Sum[int]([]int{1,2,3}) gen[T1, T2] MakePair(x T1, y T2) Pair[T1, T2] As an aside, we discussed but ultimately rejected reserving `gen` or `generic` as keywords for Go 1 in anticipation of adopting some proposal like this. It is interesting to note that the current design avoids the need for any such keyword and does not seem to suffer for it. **Constraints.** The type variable could be followed by an interface name: gen [T Stringer] type PrintableVector []T gen [T Stringer] func Print(x T) The proposal suggested adding language-defined method names for operators, so that `Sum` could be written: gen [T] type Number interface { Plus(T) T } gen [T Number[T]] func Sum(x []T) T { var total T for _, v := range x { total = total.Plus(v) } return total } **Inference.** This proposal defined a simple left-to-right greedy unification of the types of the function call arguments with the types of the generic parameter list. The current proposal is non-greedy: it unifies the types, and then verifies that all type parameters were unified to the same type. The reason the earlier proposal used a greedy algorithm was to handle untyped constants; in the current proposal untyped constants are handled by ignoring them in the first pass and doing a second pass if required. **Implementation.** This proposal noted that every actual value in a running Go program would have a concrete type. It eliminated the "generic values" of the previous proposal. This was the first proposal that aimed to support both generic and specialized compilation, with an appropriate choice made by the compiler. (Because the proposal was never implemented, it is unclear whether it would have achieved that goal.) ### [Generalized Types II](https://go.googlesource.com/proposal/+/master/design/15292/2013-10-gen.md), October 2013 This design was an adaptation of the previous design, at that point two years old, with only one significant change. Instead of getting bogged down in specifying interfaces, especially interfaces for operators, the design discarded type constraints entirely. This allowed writing `Sum` with the usual `+` operator instead of a new `.Plus` method: gen[T] func Sum(x []T) T { s := T(0) for _, v := range x { s += v } return s } As such, it was the first generics design that did not call for operator methods as well. Unfortunately, the design did not explain exactly how constraints could be inferred and whether that was even feasible. Worse, if contracts are not written down, there’s no way to ensure that an API does not change its requirements accidentally and therefore break clients unexpectedly. ### [Type Parameters](https://go.googlesource.com/proposal/+/master/design/15292/2013-12-type-params.md), December 2013 This design kept most of the semantics of the previous design but introduced new syntax. It dropped the gen keyword and moved the type-variable-introducing brackets after the func or type keyword, as in: type [T] Vector []T type VectorInt Vector[int] func [T] Sum(x []T) T func [T] Sum(x Vector[T]) T sum := Sum[int]([]int{1,2,3}) func [T1, T2] MakePair(x T1, y T2) Pair[T1, T2] This design retained the implicit constraints of the previous one, but now with a much longer discussion of exactly how to infer restrictions from function bodies. It was still unclear if the approach was workable in practice, and it seemed clearly incomplete. The design noted ominously: > The goal of the restrictions listed above is not to try to handle every possible case. > It is to provide a reasonable and consistent approach to type checking of parameterized functions and preliminary type checking of types used to instantiate those functions. > > It’s possible that future compilers will become more restrictive; a parameterized function that can not be instantiated by any type argument is invalid even if it is never instantiated, but we do not require that every compiler diagnose it. > In other words, it’s possible that even if a package compiles successfully today, it may fail to compile in the future if it defines an invalid parameterized function. Still, after many years of struggling with explicit enumerations of type constraints, "just look at the function body" seemed quite attractive.
design
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/34481-opencoded-defers.md
# Proposal: Low-cost defers through inline code, and extra funcdata to manage the panic case Author(s): Dan Scales, Keith Randall, and Austin Clements (with input from many others, including Russ Cox and Cherry Zhang) Last updated: 2019-09-23 Discussion at https://golang.org/issue/34481 General defer performance discussion at https://golang.org/issue/14939. ## Abstract As of Go 1.13, most `defer` operations take about 35ns (reduced from about 50ns in Go 1.12). In contrast, a direct call takes about 6ns. This gap incentivizes engineers to eliminate `defer` operations from hot code paths, which takes away time from more productive tasks, leads to less maintainable code (e.g., if a `panic` is later introduced, the "optimization" is no longer correct), and discourages people from using a language feature when it would otherwise be an appropriate solution to a problem. We propose a way to make most `defer` calls no more expensive than open-coding the call, hence eliminating the incentives to shy away from using this language feature to its fullest extent. ## Background Go 1.13 implements the `defer` statement by calling into the runtime to push a "defer object" onto the defer chain. Then, in any function that contains `defer` statements, the compiler inserts a call to `runtime.deferreturn` at every function exit point to unwind that function's defers. Both of these cause overhead: the defer object must be populated with function call information (function pointer, arguments, closure information, etc.) when it is added to the chain, and `deferreturn` must find the right defers to unwind, copy out the call information, and invoke the deferred calls. Furthermore, this inhibits compiler optimizations like inlining, since the defer functions are called from the runtime using the defer information. When a function panics, the runtime runs the deferred calls on the defer chain until one of these calls `recover` or it exhausts the chain, resulting in a fatal panic. The stack itself is *not* unwound unless a deferred call recovers. This has the important property that examining the stack from a deferred call run during a panic will include the panicking frame, even if the defer was pushed by an ancestor of the panicking frame. In general, this defer chain is necessary since a function can defer an unbounded or dynamic number of calls that must all run when it returns. For example, a `defer` statement can appear in a loop or an `if` block. This also means that, in general, the defer objects must be heap-allocated, though the runtime uses an allocation pool to reduce the cost of the allocation. This is notably different from exception handling in C++ or Java, where the applicable set of `except` or `finally` blocks can be determined statically at every program counter in a function. In these languages, the non-exception case is typically inlined and exception handling is driven by a side table giving the locations of the `except` and `finally` blocks that apply to each PC. However, while Go's `defer` mechanism permits unbounded calls, the vast majority of functions that use `defer` invoke each `defer` statement at most once, and do not invoke `defer` in a loop. Go 1.13 adds an [optimization](https://golang.org/cl/171758) to stack-allocate defer objects in this case, but they must still be pushed and popped from the defer chain. This applies to 363 out of the 370 static defer sites in the `cmd/go` binary and speeds up this case by 30% relative to heap-allocated defer objects. This proposal combines this insight with the insights used in C++ and Java to make the non-panic case of most `defer` operations no more expensive than the manually open-coded case, while retaining correct `panic` handling. ## Requirements While the common case of defer handling is simple enough, it can interact in often non-obvious ways with things like recursive panics, recover, and stack traces. Here we attempt to enumerate the requirements that any new defer implementation should likely satisfy, in addition to those in the language specification for [Defer statements](https://golang.org/ref/spec#Defer_statements) and [Handling panics](https://golang.org/ref/spec#Handling_panics). 1. Executing a `defer` statement logically pushes a deferred function call onto a per-goroutine stack. Deferred calls are always executed starting from the top of this stack (hence in the reverse order of the execution of `defer` statements). Furthermore, each execution of a `defer` statement corresponds to exactly one deferred call (except in the case of program termination, where a deferred function may not be called at all). 2. Defer calls are executed in one of two ways. Whenever a function call returns normally, the runtime starts popping and executing all existing defer calls for that stack frame only (in reverse order of original execution). Separately, whenever a panic (or a call to Goexit) occurs, the runtime starts popping and executing all existing defer calls for the entire defer stack. The execution of any defer call may be interrupted by a panic within the execution of the defer call. 3. A program may have multiple outstanding panics, since a recursive (second) panic may occur during any of the defer calls being executed during the processing of the first panic. A previous panic is “aborted” if the processing of defers by the new panic reaches the frame where the previous panic was processing defers when the new panic happened. When a defer call returns that did a successful `recover` that applies to a panic, the stack is immediately unwound to the frame which contains the defer that did the recover call, and any remaining defers in that frame are executed. Normal execution continues in the preceding frame (but note that normal execution may actually be continuing a defer call for an outer panic). Any panic that has not been recovered or aborted must still appear on the caller stack. Note that the first panic may never continue its defer processing, if the second panic actually successfully runs all defer calls, but the original panic must appear on the stack during all the processing by the second panic. 4. When a defer call is executed because a function is returning normally (whether there are any outstanding panics or not), the call site of a deferred call must appear to be the function that invoked `defer` to push that function on the defer stack, at the line where that function is returning. A consequence of this is that, if the runtime is executing deferred calls in panic mode and a deferred call recovers, it must unwind the stack immediately after that deferred call returns and before executing another deferred call. 5. When a defer call is executed because of an explicit panic, the call stack of a deferred function must include `runtime.gopanic` and the frame that panicked (and its callers) immediately below the deferred function call. As mentioned, the call stack must also include any outstanding previous panics. If a defer call is executed because of a run-time panic, the same condition applies, except that `runtime.gopanic` does not necessarily need to be on the stack. (In the current gc-go implementation, `runtime.gopanic` does appear on the stack even for run-time panics.) ## Proposal We propose optimizing deferred calls in functions where every `defer` is executed at most once (specifically, a `defer` may be on a conditional path, but is never in a loop in the control-flow graph). In this optimization, the compiler assigns a bit for every `defer` site to indicate whether that defer had been reached or not. The `defer` statement itself simply sets the corresponding bit and stores all necessary arguments in specific stack slots. Then, at every exit point of the function, the compiler open-codes each deferred call, protected by (and clearing) each corresponding bit. For example, the following: ```go defer f1(a) if cond { defer f2(b) } body... ``` would compile to ```go deferBits |= 1<<0 tmpF1 = f1 tmpA = a if cond { deferBits |= 1<<1 tmpF2 = f2 tmpB = b } body... exit: if deferBits & 1<<1 != 0 { deferBits &^= 1<<1 tmpF2(tmpB) } if deferBits & 1<<0 != 0 { deferBits &^= 1<<0 tmpF1(tmpA) } ``` In order to ensure that the value of `deferBits` and all the tmp variables are available in case of a panic, these variables must be allocated explicit stack slots and the stores to deferBits and the tmp variables (`tmpF1`, `tmpA`, etc.) must write the values into these stack slots. In addition, the updates to `deferBits` in the defer exit code must explicitly store the `deferBits` value to the corresponding stack slot. This will ensure that panic processing can determine exactly which defers have been executed so far. However, the defer exit code can still be optimized significantly in many cases. We can refer directly to the `deferBits` and tmpA ‘values’ (in the SSA sense), and these accesses can therefore be optimized in terms of using existing values in registers, propagating constants, etc. Also, if the defers were called unconditionally, then constant propagation may in some cases to eliminate the checks on `deferBits` (because the value of `deferBits` is known statically at the exit point). If there are multiple exits (returns) from the function, we can either duplicate the defer exit code at each exit, or we can have one copy of the defer exit code that is shared among all (or most) of the exits. Note that any sharing of defer-exit code code may lead to less specific line numbers (which don’t indicate the exact exit location) if the user happens to look at the call stack while in a call made by the defer exit code. For any function that contains a defer which could be executed more than once (e.g. occurs in a loop), we will fall back to the current way of handling defers. That is, we will create a defer object at each defer statement and push it on to the defer chain. At function exit, we will call deferreturn to execute an active defer objects for that function. We may similarly revert to the defer chain implementation if there are too many defers or too many function exits. Our goal is to optimize the common cases where current defers overheads show up, which is typically in small functions with only a small number of defers statements. ## Panic processing Because no actual defer records have been created, panic processing is quite different and somewhat more complex in the open-coded approach. When generating the code for a function, the compiler also emits an extra set of `FUNCDATA` information that records information about each of the open-coded defers. For each open-coded defer, the compiler emits `FUNCDATA` that specifies the exact stack locations that store the function pointer and each of the arguments. It also emits the location of the stack slot containing `deferBits`. Since stack frames can get arbitrarily large, the compiler uses a varint encoding for the stack slot offsets. In addition, for all functions with open-coded defers, the compiler adds a small segment of code that does a call to `runtime.deferreturn` and then returns. This code segment is not reachable by the main code of the function, but is used to unwind the stack properly when a panic is successfully recovered. To handle a `panic`, the runtime conceptually walks the defer chain in parallel with the stack in order to interleave execution of pushed defers with defers in open-coded frames. When the runtime encounters an open-coded frame `F` executing function `f`, it executes the following steps. 1. The runtime reads the funcdata for function `f` that contains the open-defer information. 2. Using the information about the location in frame `F` of the stack slot for `deferBits`, the runtime loads the current value of `deferBits` for this frame. The runtime processes each of the active defers, as specified by the value of `deferBits`, in reverse order. 3. For each active defer, the runtime loads the function pointer for the defer call from the appropriate stack slot. It also builds up an argument frame by copying each of the defer arguments from its specified stack slot to the appropriate location in the argument frame. It then updates `deferBits` in its stack slot after masking off the bit for the current defer. Then it uses the function pointer and argument frame to call the deferred function. 4. If the defer call returns normally without doing a recovery, then the runtime continues executing active defer calls for frame F until all active defer calls have finished. 5. If any defer call returns normally but has done a successful recover, then the runtime stops processing defers in the current frame. There may or may not be any remaining defers to process. The runtime then arranges to jump to the `deferreturn` code segment and unwind the stack to frame `F`, by simultaneously setting the PC to the address of the `deferreturn` segment and setting the SP to the appropriate value for frame `F`. The `deferreturn` code segment then calls back into the runtime. The runtime can now process any remaining active defers from frame `F`. But for these defers, the stack has been appropriately unwound and the defer appears to be called directly from function `f`. When all defers for the frame have finished, the deferreturn finishes and the code segment returns from frame F to continue execution. If a deferred call in step 3 itself panics, the runtime starts its normal panic processing again. For any frame with open-coded defers that has already run some defers, the deferBits value at the specified stack slot will always accurately reflect the remaining defers that need to be run. The processing for `runtime.Goexit` is similar. The main difference is that there is no panic happening, so there is no need to check for or do special handling for recovery in `runtime.Goexit`. A panic could happen while running defer functions for `runtime.Goexit`, but that will be handled in `runtime.gopanic`. ## Rationale One other approach that we extensively considered (and prototyped) also has inlined defer code for the normal case, but actual executes the defer exit code directly even in the panic case. Executing the defer exit code in the panic case requires duplication of stack frame F and some complex runtime code to start execution of the defer exit code using this new duplicated frame and to regain control when the defer exit code complete. The required runtime code for this approach is much more architecture-dependent and seems to be much more complex (and possibly fragile). ## Compatibility This proposal does not change any user-facing APIs, and hence satisfies the [compatibility guidelines](https://golang.org/doc/go1compat). ## Implementation An implementation has been mostly done. The change is [here](https://go-review.googlesource.com/c/go/+/190098/6). Comments on the design or implementation are very welcome. Some miscellaneous implementation details: 1. We need to restrict the number of defers in a function to the size of the deferBits bitmask. To minimize code size, we currently make deferBits to be 8 bits, and don’t do open-coded defers if there are more than 8 defers in a function. If there are more than 8 defers in a function, we revert to the standard defer chain implementation. 2. The deferBits variable and defer arguments variables (such as `tmpA`) must be declared (via `OpVarDef`) in the entry block, since the unconditional defer exit code at the bottom of the function will access them, so these variables are live throughout the entire function. (And, of course, they can be accessed by panic processing at any point within the function that might cause a panic.) For any defer argument stack slots that are pointers (or contain pointers), we must initialize those stack slots to zero in the entry block. The initialization is required for garbage collection, which doesn’t know which of these defer arguments are active (i.e. which of the defer sites have been reached, but the corresponding defer call has not yet happened) 3. Because the `deferreturn` code segment is disconnected from the rest of the function, it would not normally indicate that any stack slots are live. However, we want the liveness information at the `deferreturn` call to indicate that all of the stack slots associated with defers (which may include pointers to variables accessed by closures) and all of the return values are live. We must explicitly set the liveness for the `deferreturn` call to be the same as the liveness at the first defer call on the defer exit path.
15292
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/15292/2013-10-gen.md
# Generalized Types In Go This is a proposal for adding generics to Go, written by Ian Lance Taylor in October, 2013. This proposal will not be adopted. It is being presented as an example for what a complete generics proposal must cover. ## Introduction This document describes a possible implementation of generalized types in Go. We introduce a new keyword, `gen`, that declares one or more type parameters: types that are not known at compile time. These type parameters may then be used in other declarations, producing generalized types and functions. Some goals, borrowed from [Garcia et al](https://web.archive.org/web/20170812055356/http://www.crest.iu.edu/publications/prints/2003/comparing_generic_programming03.pdf): * Do not require an explicit relationship between a definition of a generalized function and its use. The function should be callable with any suitable type. * Permit interfaces to express relationships between types of methods, as in a comparison function that takes two parameters of the same unknown type. * Given a generalized type, make it possible to use related types, such as a slice of that type. * Do not require explicit instantiation of generalized functions. * Permit type aliasing of generalized types. ## Background My earlier proposal for generalized types had some flaws. People expect functions that operate on generalized types to be fast. They do not want a reflection based interface in all cases. The question is how to support that without excessively slowing down the compiler. People want to be able to write simple generalized functions like `Sum(v []T) T`, a function that sums the values in the slice `v`. They are prepared to assume that `T` is a numeric type. They don’t want to have to write a set of methods simply to implement `Sum` or the many other similar functions for every numeric type, including their own named numeric types. People want to be able to write the same function to work on both `[]byte` and `string`, without requiring a copy. People want to write functions on generalized types that support simple operations like comparison. That is, they want to write a function that uses a generalized type and compares a value of that type to another value of the same type. That was awkward in my earlier proposal: it required using a form of the curiously recurring template pattern. Go’s use of structural typing means that you can use any type to meet an interface without an explicit declaration. Generalized types should work the same way. ## Proposal We permit package-level type and func declarations to use generalized types. There are no restrictions on how these types may be used within their scope. At compile time each actual use of a generalized type or function is instantiated by replacing the generalized type with some concrete type. This may happen multiple times with different concrete types. A concrete type is only permitted if all the operations used with the generalized types are permitted for the concrete type. How to implement this efficiently is discussed below. ## Syntax Any package-scope type or func declaration may be preceded with the new keyword `gen` followed by a list of type parameter names in square brackets: ``` gen [T] type Vector []T ``` This defines `T` as a type parameter for the generalized type `Vector`. The scope of `Vector` is the same as it would be if `gen` did not appear. A use of a generalized type must provide specific types to use for the type parameters. This is normally done using square brackets following the generalized type. ``` type VectorInt Vector[int] var v1 Vector[int] var v2 Vector[float32] gen [T1, T2] type Pair struct { first T1; second T2 } var v3 Pair[int, string] ``` Type parameters may also be used with functions. ``` gen [T] func SetHead(v Vector[T], e T) T { v[0] = e return e } ``` We permit a modified version of the factoring syntax used with `var`, `type`, and `const` to permit a series of declarations to share the same type parameters. ``` gen [T1, T2] ( type Pair struct { first T1; second T2 } func MakePair(first T1, second T2) Pair { return &Pair{first, second} } ) // Ends gen. ``` References to other names declared within the same `gen` block do not have to specify the type parameters. When the type parameters are omitted, they are implied to simply be the parameters declared for the block. In the above example, `Pair` when used as the result type of `MakePair` is equivalent to `Pair[T1, T2]`. When this syntax is used we require that the entire contents of the block be valid for a given concrete type. The block is instantiated as a whole, not in individual pieces. As with generalized types, we must specify the types when we refer to a generalized function (but see the section on type deduction, below). ``` var MakeIntPair = MakePair[int, int] var IntPairZero = MakeIntPair(0, 0) ``` A generalized type can have methods. ``` gen [T] func (v *Vector[T]) SetHead(e T) T { v[0] = e return e } ``` Of course a method of a generalized type may itself be a generalized function. ``` gen [T, T2] func (v *Vector[T]) Transform(f func(T) T2) Vector[T2] ``` The `gen` keyword may only be used with a type or function. It may only appear in package scope, not within a function. A non-generalized type may not have a generalized method. A `gen` keyword may appear within the scope of another `gen` keyword. In that case, any use of the generalized type or function must specify all the type parameters, starting with the outermost ones. A different way of writing the last example would be: ``` gen [T] ( type Vector []T gen [T2] func (v *Vector[T]) Transform(f func(T) T2) Vector[T2] ) var v Vector[int] var v2 = v.Transform[int, string](strconv.Itoa) ``` Type deduction, described below, would permit omitting the `[int, string]` in the last line, based on the types of `v` and `strconv.Itoa`. Inner type parameters shadow outer ones with the same name, as in other scopes in Go (although it’s hard to see a use for this shadowing). ### A note on syntax While the use of the `gen` keyword fits reasonably well into the existing Go language, the use of square brackets to denote the specific types is new to Go. We have considered a number of different approaches: * Use angle brackets, as in `Pair<int, string>`. This has the advantage of being familiar to C++ and Java programmers. Unfortunately, it means that `f<T>(true)` can be parsed as either a call to function `f<T>` or a comparison of `f<T` (an expression that tests whether `f` is less than `T`) with `(true)`. While it may be possible to construct complex resolution rules, the Go syntax avoids that sort of ambiguity for good reason. * Overload the dot operator again, as in `Vector.int` or `Pair.(int, string)`. This becomes confusing when we see `Vector.(int)`, which could be a type assertion. * We considered using dot but putting the type first, as in `int.Vector` or `(int, string).Pair`. It might be possible to make that work without ambiguity, but putting the types first seems to make the code harder to read. * An earlier version of this proposal used parentheses for names after types, as in `Vector(int)`. However, that proposal was flawed because there was no way to specify types for generalized functions, and extending the parentheses syntax led to `MakePair(int, string)(1, "")` which seems less than ideal. * We considered various different characters, such as backslash, dollar sign, at-sign or sharp. The square brackets grouped the parameters nicely and provide an acceptable visual appearance. The use of square brackets to pick specific versions of generalized types and functions seems appropriate. However, the top-level declarations could work differently. * We could omit the square brackets in a `gen` declaration without ambiguity. * `gen T type Vector []T` * `gen T1, T2 type Pair struct { f1 T1; f2 T2 }` * We could keep the square brackets, but use the existing `type` keyword rather than introducing a new keyword. * `type [T] type Vector []T` I have a mild preference for the syntax described above but I’m OK with other choices as well. ## Type Deduction When calling a function, as opposed to referring to it without calling it, the type parameters may be omitted in some cases. A function call may omit the type parameters when every type parameter is used for a regular parameter, or, in other words, there are no type parameters that are used only for results. In that case the compiler will compare the actual type of the argument `A` with the type of the generalized parameter `P`, examining the arguments from left to right. `A` and `P` must be identical. The first time we see a type parameter in `P`, it will be set to the appropriate portion of `A`. If the type parameter appears again, it must be identical to the actual type at that point. Note that at compile time the argument type may itself be a generalized type, when one generalized function calls another. The type deduction algorithm is the same. A type parameter of `P` may match a type parameter of `A`. Once this match is made, then every subsequent instance of the `P` type parameter must match the same `A` type parameter. When doing type deduction with an untyped constant, the constant does not determine anything about the generalized type. The deduction proceeds with the remaining arguments. If at the end of the deduction the type has not been determined, the untyped constants are re-examined in sequence, and given the type `int`, `rune`, `float64`, or `complex1281 as usual. Type deduction does not support passing an untyped `nil` constant; `nil` may only be used with an explicit type conversion (or, of course, the type parameters may be written explicitly). Type deduction also applies to composite literals, in which the type parameters for a generalized struct type are deduced from the types of the literals. For example, these three variables will have the same type and value. ``` var v1 = MakePair[int, int](0, 0) var v2 = MakePair(0, 0) // [int, int] deduced. var v3 = Pair{0, 0} // [int, int] deduced. ``` To explain the untyped constant rules: ``` gen [T] func Max(a, b T) T { if a < b { return b } return a } var i int var m1 = Max(i, 0) // i causes T to be deduced as int, 0 is // passed as int. var m2 = Max(0, i) // 0 ignored on first pass, i causes // T to be deduced as int, 0 is passed as // int. var m3 = Max(1, 2.5) // 1 and 2.5 ignored on first pass. // On second pass 1 causes T to be deduced // as int. Passing 2.5 is an error. var m4 = Max(2.5, 1) // 2.5 and 1 ignored on first pass. // On second pass 2.5 causes T to be // deduced as float64. 1 converted to // float64. ``` ## Examples A hash table. ``` package hashmap gen [Keytype, Valtype] ( type bucket struct { next *bucket key Keytype val Valtype } type Hashfn func(Keytype) uint type Eqfn func(Keytype, Keytype) bool type Hashmap struct { hashfn Hashfn eqfn Eqfn buckets []bucket entries int } // This function must be called with explicit type parameters, as // there is no way to deduce the value type. For example, // h := hashmap.New[int, string](hashfn, eqfn) func New(hashfn Hashfn, eqfn Eqfn) *Hashmap { return &Hashmap{hashfn, eqfn, make([]buckets, 16), 0} } func (p *Hashmap) Lookup(key Keytype) (val Valtype, found bool) { h := p.hashfn(key) % len(p.buckets) for b := p.buckets[h]; b != nil; b = b.next { if p.eqfn(key, b.key) { return b.val, true } } return } func (p *Hashmap) Insert(key Keytype, val Valtype) (inserted bool) { // Implementation omitted. } ) // Ends gen. ``` Using the hash table. ``` package sample import ( "fmt" "hashmap" "os" ) func hashint(i int) uint { return uint(i) } func eqint(i, j int) bool { return i == j } var v = hashmap.New[int, string](hashint, eqint) func Add(id int, name string) { if !v.Insert(id, name) { fmt.Println(“duplicate id”, id) os.Exit(1) } } func Find(id int) string { val, found := v.Lookup(id) if !found { fmt.Println(“missing id”, id) os.Exit(1) } return val } ``` Sorting a slice given a comparison function. ``` gen [T] ( func SortSlice(s []T, less func(T, T) bool) { sort.Sort(&sorter{s, less}) } type sorter struct { s []T less func(T, T) bool } func (s *sorter) Len() int { return len(s.s) } func (s *sorter) Less(i, j int) bool { return s.less(s[i], s[j]) } func (s *sorter) Swap(i, j int) { s.s[i], s.s[j] = s.s[j], s.s[i] } ) // End gen ``` Sorting a numeric slice (also works for string). ``` // This can be successfully instantiated for any type T that can be // used with <. gen [T] func SortNumericSlice(s []T) { SortSlice(s, func(a, b T) bool { return a < b }) } ``` Merging two channels into one. ``` gen [T] func Merge(a, b <-chan T) <-chan T { c := make(chan T) go func(a, b chan T) { for a != nil && b != nil { select { case v, ok := <-a: if ok { c <- v } else { a = nil } case v, ok := <-b: if ok { c <- v } else { b = nil } } } close(c) }(a, b) return c } ``` Summing a slice. ``` // Works with any type that supports +. gen [T] func Sum(a []T) T { var s T for _, v := range a { s += v } return s } ``` A generic interface. ``` gen [T] type Equaler interface { Equal(T) bool } // Return the index in s of v1. gen [T] func Find(s []T, v1 T) int { eq, eqok := v1.(Equaler[T]) for i, v2 := range s { if eqok { if eq.Equal(v2) { return i } } else if reflect.DeepEqual(v1, v2) { return i } } return -1 } type S []int // Slice equality that treats nil and S{} as equal. func (s1 S) Equal(s2 S) bool { if len(s1) != len(s2) { return false } for i, v1 := range s1 { if v1 != s2[i] { return false } } return true } var i = Find([]S{S{1, 2}}, S{1, 2}) ``` Joining sequences; works for any `T` that supports `len`, `copy` to `[]byte`, and conversion from `[]byte`; in other words, works for `[]byte` and `string`. ``` gen [T] func Join(a []T, sep T) T { if len(a) == 0 { return T([]byte{}) } if len(a) == 1 { return a[0] } n := len(sep) * (len(a) - 1) for _, v := range a { n += len(v) } b := make([]byte, n) bp := copy(b, a[0]) for _, v := range a[1:] { bp += copy(b[bp:], sep) bp += copy(b[bp:], v) } return T(b) } ``` Require generalized types to implement an interface. ``` // A vector of any type that supports the io.Reader interface. gen [T] ( type ReaderVector []T // This function is not used. // It can only be compiled if T is an io.Reader, so instantiating // this block with any other T will fail. func _(t T) { var _ io.Reader = t } ) // Ends gen. ``` ## Implementation When the compiler sees a gen declaration, it must examine the associated types and functions and build a set of constraints on the generalized type. For example, if the type is used with binary `+` as in the `Sum` example, then the type must be a numeric or string type. If the type is used as `a + 1` then it must be numeric. If a type method is called, then the type must support a method with that name that can accept the given argument types. If the type is passed to a function, then it must have a type acceptable to that function. The compiler can do minimal type checking on the generalized types: if the set of constraints on the generalized type can not be satisfied, the program is in error. For example, if we see both `a + 1` and `a + "b"`, where `a` is a variable of the same generalized type, the compiler should issue an error at that point. When the compiler needs to instantiate a generalized type or function, it compares the concrete type with the constraints. If some constraint fails, the instantiation is invalid. The compiler can give an appropriate error (`"cannot use complex64 with SortNumericSlice because complex64 does not support <"`). The ability to give good clear errors for such a case is important, to avoid the C++ cascading error problem. These constraints are used to build a set of methods required for the generalized type. When compiling a generalized function, each local variable of the generalized type (or any type derived from the generalized type) is changed to an interface type. Each use of the generalized type is changed to call a method on the generalized type. Each constraint becomes a method. Calling a generalized function then means passing in an interface type whose methods are built from the constraints. For example, start with the Sum function. ``` gen [T] func Sum(a []T) T { var s T for _, v := range a { s += v } return s } ``` This get rewritten along the lines of ``` type T interface { plus(T) T } type S interface { len() int index(int) T } func GenSum(a S) T { var s T for i := 0; i < a.len(); i++ { v := a.index(i) s = s.plus(v) } return s } ``` This code is compiled as usual. In addition, the compiler generates instantiation templates. These could perhaps be plain text that can be included in the export data. ``` type realT <instantiation of T> func (p realT) plus(a T) T { return p + a.(realT) // return converts realT to T } type realS []realT func (s realS) len() int { return len(s) } func (s realS) index(i int) T { return s[i] // return converts realT to T } ``` When instantiating `Sum` for a new type, the compiler builds and compiles this code for the new type and calls the compiled version of `Sum` with the interface value for the generated interface. As shown above, the methods automatically use type assertions and interface conversion as needed. The actual call to `Sum(s)` will be rewritten as `GenSum(s).(realT)`. The type assertions and interface conversions are checked at compile time and will always succeed. Note that another way to say whether a concrete type may be used to instantiate a generalized function is to ask whether the instantiation templates may be instantiated and compiled without error. More complex cases may of course involve multiple generalized types in a single expression such as a function call. The compiler can arbitrarily pick one value to carry the methods, and the method implementation will use type assertions to implement the call. This works because all the concrete types are known at instantiation time. For cases like `make` where the compiler has no value on which to invoke a method, there are two cases. For a generalized function, the compiler can write the function as a closure. The actual instantiation will pass a special object in the closure value. See the use of make in the next example. ``` gen [T1, T2, T3] func Combine(a []T1, b []T2, f func(T1, T2) T3) []T3 { r := make([]T3, len(a)) for i, v := range a { r[i] = f(v, b[i]) } return r } ``` This will be rewritten as ``` type S1 interface { len() int index(int) T1 } type S2 interface { index(int) T2 } type S3 interface { set(int, T3) } type F interface { call(T1, T2) T3 } type T1 interface{} type T2 interface{} type T3 interface{} type Maker interface { make(int) S3 } func GenCombine(a S1, b S2, f F) S3 { // The maker var has type Maker and is accessed via the // function’s closure. r = maker.make(a.len()) for i := 0; i < a.len(); i++ { v := a.index(i) r.set(i, f.call(v, b.index(i)) } return r } ``` The associated instantiation templates will be ``` type realT1 <instantiation of T1> type realT2 <instantiation of T2> type realT3 <instantiation of T3> type realS1 []realT1 type realS2 []realT2 type realS3 []realT3 type realF func(realT1, realT2) realT3 type realMaker struct{} func (s1 realS1) len() int { return len(s1) } func (s1 realS1) index(i int) T1 { return s1[i] } func (s2 realS2) index(i int) T2 { return s2[i] } func (s3 realS3) set(i int, t3 T3) { s3[i] = t3.(realT3) } func (f realF) call(t1 T1, t2 T2) T3 { return f(t1.(realT1), t2.(realT2)) } func (m realMaker) make(l int) S3 { return make(realT3, l) } ``` A reference to `Combine` will then be built into a closure value with `GenCombine` as the function and a value of the `Maker` interface in the closure. The dynamic type of the `Maker` value will be `realMaker`. (If a function like `make` is invoked in a method on a generalized type, we can’t use a closure, so we instead add an appropriate hidden method on the generalized type.) With this implementation approach we are taking interface types in a different direction. The interface type in Go lets the programmer define methods and then implement them for different types. With generalized types the programmer describes how the interface is used, and the compiler uses that description to define the methods and their implementation. Another example. When a generalized type has methods, those methods need to be instantiated as calls to the generalized methods with appropriate type assertions and conversions. ``` gen [T] ( type Vector []T func (v Vector) Len() int { return len(v) } func (v Vector) Index(i int) T { return v[i] } ) // Ends gen. type Readers interface { Len() int Index(i int) io.Reader } type VectorReader Vector[io.Reader] var _ = make(VectorReader, 0).(Readers) ``` The last statement asserts that `VectorReader[io.Reader]` supports the Readers interface, as of course it should. The `Vector` type implementation will look like this. ``` type T interface{} type S interface { len() int index(i int) T } type V struct { S } func (v V) Len() int { return v.S.len() } func (v V) Index(i int) T { return v.S.index(i) } ``` The instantiation templates will be ``` type realT <instantiation of T> type realS []realT func (s realS) len() { return len(s) } func (s realS) index(i int) T { return s[i] } ``` When this is instantiated with `io.Reader`, the compiler will generate additional methods. ``` func (s realS) Len() int { return V{s}.Len() } func (s realS) Index(i int) io.Reader { return V{s}.Index(i).(io.Reader) } ``` With an example this simple this seems like a pointless runaround. In general, though, the idea is that the bulk of the method implementation will be in the `V` methods, which are compiled once. The `realS` `len` and `index` methods support those `V` methods. The `realS` `Len` and `Index` methods simply call the `V` methods with appropriate type conversions. That ensures that the `Index` method returns `io.Reader` rather than `T` aka `interface{}`, so that `realS` satisfies the `Readers` interface in the original code. Now an example with a variadic method. ``` gen [T] func F(v T) { v.M(1) v.M(“a”, “b”) } ``` This looks odd, but it’s valid for a type with a method `M(...interface{})`. This is rewritten as ``` type T interface { m(...interface{}) // Not the same as T’s method M. } func GF(v T) { v.m(1) v.m(“a”, “b”) } ``` The instantiation templates will be ``` type realT <instantiation of T> func (t realT) m(a ...interface{}) { t.M(a...) } ``` The basic rule is that if the same method is called with different numbers of arguments, it must be instantiated with a variadic method. If it is called with the same number of arguments with different types, it must be instantiated with interface{} arguments. In the general case the instantiation template may need to convert the argument types to the types that the real type’s method accepts. Because generalized types are implemented by interface types, there is no way to write generalized code that detects whether it was instantiated with an interface type. If the code can assume that a generalized function was instantiated by a non-interface type, then it can detect that type using a type switch or type assertion. If it is important to be able to detect whether a generalized function was instantiated with an interface type, some new mechanism will be required. In the above examples I’ve always described a rewritten implementation and instantiation templates. There is of course another implementation method that will be appropriate for simple generalized functions: inline the function. That would most likely be the implementation method of choice for something like a generalized `Max` function. I think this could be handled as a minor variant on traditional function inlinining. In some cases the compiler can determine that only a specific number of concrete types are permitted. For example, the `Sum` function can only be used with types that support that binary `+` operator, which means a numeric or string type. In that case the compiler could choose to instantiate and compile the function for each possible type. Uses of the generalized function would then call the appropriate instantiation. This would be more work when compiling the generalized function, but not much more work. It would mean no extra work for uses of the generalized function. ## Spec changes I don’t think many spec changes are needed other than a new section on generalized types. The syntax of generalized types would have to be described. The implementation details do not need to be in the spec. A generalized function instantiated with concrete types is valid if rewriting the function with the concrete types would produce valid Go code. There is a minor exception to that approach: we would want to permit type assertions and type switches for generalized types as well as for interface types, even if the concrete type is not an interface type. ## Compatibility This approach introduces a new keyword, `gen`. However, this keyword is only permitted in top-level declarations. That means that we could treat it as a new syntactic category, a top-level keyword that is only recognized as such when parsing a `TopLevelDecl`. That would mean that any code that currently compiles with Go 1 would continue to compile with this new proposal, as any existing use of gen at top-level is invalid. We could also maintain Go 1 compatibility by using the existing `type` keyword instead of `gen`. The square brackets used around the generalized type names would make this unambiguous. However, syntactic compatibility is only part of the story. If this proposal is adopted there will be a push toward rewriting certain parts of the standard library to use generalized types. For example, people will want to change the `container` and `sort` packages. A farther reaching change will be changing `io.Writer` to take a generalized type that is either `[]byte` or `string`, and work to push that through the `net` and `os` packages down to the `syscall` package. I do not know whether this work could be done while maintaining Go 1 compatibility. I do not even know if this work should be done, although I’m sure that people will want it. ## Comparison to other languages ### C Generalized types in C are implemented via preprocessor macros. The system described here can be seen as a macro system. However, unlike in C, each generalized function must be complete and compilable by itself. The result is in some ways less powerful than C preprocessor macros, but does not suffer from problems of namespace conflict and does not require a completely separate language (the preprocessor language) for implementation. ### C++ The system described here can be seen as a subset of C++ templates. Go’s very simple name lookup rules mean that there is none of the confusion of dependent vs. non-dependent names. Go’s lack of function overloading removes any concern over just which instance of a name is being used. Together these permit the explicit determination of constraints when compiling a generalized function, whereas in C++ where it’s nearly impossible to determine whether a type may be used to instantiate a template without effectively compiling the instantiated template and looking for errors (or using concepts, proposed for later addition to the language). C++ template metaprogramming uses template specialization, non-type template parameters, variadic templates, and SFINAE to implement a Turing complete language accessible at compile time. This is very powerful but at the same time has serious drawbacks: the template metaprogramming language has a baroque syntax, no variables or non-recursive loops, and is in general completely different from C++ itself. The system described here does not support anything similar to template metaprogramming for Go. I believe this is a feature. I think the right way to implement such features in Go would be to add support in the go tool for writing Go code to generate Go code, most likely using the go/ast package and friends, which is in turn compiled into the final program. This would mean that the metaprogramming language in Go is itself Go. ### Java I believe this system is slightly more powerful than Java generics, in that it permits direct operations on basic types without requiring explicit methods. This system also does not use type erasure. Although the implementation described above does insert type assertions in various places, all the types are fully checked at compile time and those type assertions will always succeed. ## Summary This proposal will not be adopted. It has significant flaws. The factored `gen` syntax is convenient but looks awkward on the page. You wind up with a trailing close parenthesis after a set of function definitions. Indenting all the function definitions looks silly. The description of constraints in the implementation section is imprecise. It's hard to know how well it would work in practice. Can the proposed implementation really handle the possible cases? A type switch that uses cases with generalized types may wind up with identical types in multiple different cases. We need to clearly explain which case is chosen.
15292
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/15292/2016-09-compile-time-functions.md
# Compile-time Functions and First Class Types This is a proposal for adding compile-time functions and first-class types to Go, written by Bryan C. Mills in September, 2016. This proposal will most likely not be adopted. It is being presented as an example for what a complete generics proposal must cover. ## Background This is an alternative to an [earlier proposal](https://github.com/golang/proposal/blob/master/design/15292/2013-12-type-params.md) and subsequent drafts by Ian Lance Taylor. Ian's earlier proposal notes: > [T]he right way to implement such features [as template metaprogramming] in > Go would be to add support in the go tool for writing Go code to generate Go > code […] which is in turn compiled into the final program. This would mean > that the metaprogramming language in Go is itself Go. This proposal is an attempt to drive that observation to its natural conclusion, by adding explicit support for running Go functions over types at compile-time. It results in a variant of Go with deep support for parametric types and functions, despite relatively little addition to the language. This proposal is intended to be Go 1 compatible. If any incompatibilities exist, they are likely to be due to the extension of `TypeName` to include compile-time expressions and/or due to grammar conflicts with the expanded definition of `Declaration`. ## Proposal We introduce a new builtin type, `gotype`, which represents a type within Go program during compilation, and a new token which creates a constant of type `gotype` from a [`Type`](https://golang.org/ref/spec#Type). We permit a subset of Go functions to be called at compile-time. These functions can accept and return values of type `gotype`. The `gotype` values returned from such functions can appear as types within the program. ### Syntax `const`, applied at the start of a [`FunctionDecl`](https://golang.org/ref/spec#FunctionDecl), indicates a declaration of a compile-time function. ℹ There are many reasonable alternatives to the `const` token. We could use a currently-invalid token (such as `::` or `<>`), a new builtin name (such as `static`), or, in fact, nothing at all! In the latter case, any `FunctionDecl` that meets the constraints of a compile-time function would result in a function which could be called at compile time. The new builtin type `gotype` represents a Go type at compile-time. `(type)`, used in place of a [`FunctionBody`](https://golang.org/ref/spec#FunctionBody), [`LiteralValue`](https://golang.org/ref/spec#LiteralValue), or the `Expression` in a [`Conversion`](https://golang.org/ref/spec#Conversion), represents "the type itself". It produces a constant of type `gotype`. The actual syntax for the `(type)` token could be a currently-invalid token (such as `<>` or `{...}`), an existing keyword that cannot currently occur in this position (such as an unparenthesized `type`), or a new builtin non-keyword (such as `itself`, `typeof`, or `gotype`). The `.(type)` syntax already supported in type switches can be used as a general expression within compile-time functions. It returns the `gotype` of the `interface` value to which it is applied. In order to support defining methods on types within compile-time functions, we expand the definition of a [`Declaration`](https://golang.org/ref/spec#Declaration) to include [`FunctionDecl`](https://golang.org/ref/spec#FunctionDecl) and [`MethodDecl`](https://golang.org/ref/spec#MethodDecl), with the restriction that method declarations must occur within the same scope as the corresponding type declaration and before any values of that type are instantiated. For uniformity, we also allow these declarations within ordinary (non-compile-time) functions. ℹ As a possible future extension, we could allow conditional method declarations within a compile-time function before the first use of the type. Expressions of type `gotype` can appear anywhere a [`TypeName`](https://golang.org/ref/spec#TypeName) is valid, including in the parameters or return-values of a compile-time function. The compiler substitutes the concrete type returned by the function in place of the `gotype` expression. `gotype` parameters to a compile-time function may be used in the types of subsequent parameters. ℹ In this proposal, functions whose parameter types depend on other parameters do not have a well-formed Go type, and hence cannot be passed or stored as variables with `func` types. It may be possible to add such [dependent types](https://en.wikipedia.org/wiki/Dependent_type) in the future, but for now it seems prudent to avoid that complexity. ### Semantics Compile-time functions and expressions cannot depend upon values that are not available at compile-time. In particular, they cannot call non-compile-time functions or access variables at package scope. ℹ As a possible future extension, we could allow compile-time functions to read and manipulate package variables. This would enable more `init` functions to be evaluated at compile-time, reducing the run-time cost of package initialization (and allowing Go programs to load more quickly). However, it would potentially remove the useful invariant that all compile-time functions are "pure" functions. The values returned from a call to a compile-time function are [constants](https://golang.org/ref/spec#Constants) if expressions of the corresponding types are otherwise valid as constants. Arguments to compile-time functions can include: * constants (including constants of type `gotype`) * calls to other compile-time functions (even if they do not return constants) * functions declared at package scope * functions and variables declared locally within other compile-time functions * [function literals](https://golang.org/ref/spec#Function_literals), provided that the body of the literal does not refer to the local variables of a run-time function or method It is an error to write a compile-time expression that depends on a value not available at compile-time. Passed-in run-time functions cannot be called directly within the compile-time function to which they are passed, but they can be called by other (run-time) functions and/or methods declared within it. ⚠ Can / should we allow compile-time functions to accept and call other compile-time functions passed as parameters? Run-time functions and methods declared within compile-time functions may refer to local variables of the compile-time function. Calls to compile-time functions from within run-time functions are evaluated at compile-time. (This is a form of [partial evaluation](https://en.wikipedia.org/wiki/Partial_evaluation).) Calls to compile-time functions from other compile-time functions are evaluated when the outer function is called. ⚠ Should we allow compile-time functions that do not involve `gotype` to be called at run-time (with parameters computed at run-time)? Expressions of type `gotype` can only be evaluated at compile-time. ℹ There is an important distinction between "an expression of type `gotype`" and "an expression _whose type is_ an expression of type `gotype`" (a.k.a. "an expression whose type is _a_ `gotype`). The former is always a compile-time expression; the latter is not. If an expression's type is a `gotype` but the concrete type represented by evaluating the `gotype` does not support an operation used in the expression, it is a compile-time error. If the expression occurs within a compile-time function and the expression is not evaluated, there is no error. `gotype` expressions within type and method declarations are only evaluated if the block containing the type declaration is evaluated. (This is analogous to the [SFINAE rule in C++](https://en.cppreference.com/w/cpp/language/sfinae).) A [`TypeSwitchStmt`](https://golang.org/ref/spec#TypeSwitchStmt) on an expression or variable of type `gotype` switches on the concrete type represented by that `gotype`, not the type `gotype` itself. As a consequence, a `TypeSwitchStmt` on a `gotype` cannot bind an `identifier` in the `TypeSwitchGuard`. ⚠ It would be useful in some cases to be able to convert between a `gotype` and a `reflect.Type`, or to otherwise implement many of the `reflect.Type` methods on the `gotype` type. For example, in the `hashmap` example below, the `K` parameter could be eliminated by changing the `hashfn` and `eqfn` parameters to `interface{}` and reflecting over them to discover the key type. Is that worth considering at this point? #### Type names The name of a type declared within a function is local to the function. If a local type is returned (as a `gotype`), it becomes an [unnamed type](https://golang.org/ref/spec#Types). ℹ Local types introduce the possibility of unnamed types with methods. Two unnamed types returned as `gotype` are [identical](https://golang.org/ref/spec#Type_identity) if they were returned by calls to the same function with the same parameters. If the function itself was local to another compile-time function, this applies to the parameters passed to the outermost function that returns the `gotype`. ### Examples ```go // AsWriterTo returns reader if it implements io.WriterTo, // or a wrapper that embeds reader and implements io.WriterTo otherwise. const func AsWriterTo(reader gotype) gotype { switch reader.(type) { case io.WriterTo: return reader default: type WriterTo struct { reader } func (t *WriterTo) WriteTo(w io.Writer) (n int64, err error) { return io.Copy(w, t.reader) } return WriterTo (type) } } const func MakeWriterTo(reader gotype) func(reader) AsWriterTo(reader) { switch reader.(type) { case io.WriterTo: return func(r reader) AsWriterTo(reader) { return r } default: return func(r reader) AsWriterTo(reader) { return AsWriterTo(reader) { r } } } } ``` ```go func redundantButOk(b *bytes.Buffer) io.WriterTo { return MakeWriterTo(*bytes.Buffer)(b) // ok: takes the io.WriterTo case } func maybeUseful(r *io.LimitedReader) io.WriterTo { return MakeWriterTo(*io.LimitedReader)(r) // ok: takes the default case } const func fused(reader gotype) (writerTo gotype, make func(reader) writerTo) { writerTo = AsWriterTo(reader) // ok: gotype var in a compile-time function return writerTo, MakeWriterTo(writerTo) // ok: call of compile-time function with compile-time var } // bad always produces a compile-time error. func bad(i int) io.WriterTo { return MakeWriterTo(int)(i) // error: 'int' does not implement 'io.Reader' } // hiddenError produces a compile-time error only if it is called. const func hiddenError(i int) io.WriterTo { return MakeWriterTo(int)(i) // error: 'int' does not implement 'io.Reader' } ``` ```go const func List(T gotype) gotype { type List struct { element T next *List } return List (type) } type ListInt List(int) var v1 List(int) var v2 List(float) const func MyMap(T1, T2 gotype) gotype { return map[T1]T2 (type) } const func MyChan(T3 gotype) gotype { return chan T3 (type) } var v3 MyMap(int, string) ``` ```go package hashmap const func bucket(K, V gotype) gotype { type bucket struct { next *bucket key K val V } return bucket (type) } const func Hashfn(K gotype) gotype { return func(K) uint (type) } const func Eqfn(K gotype) gotype { return func(K, K) bool (type) } const func Hashmap(K, V gotype, hashfn Hashfn(K), eqfn Eqfn(K)) gotype { type Hashmap struct { buckets []bucket(K, V) entries int } func(p *Hashmap) Lookup (key K) (val V, found bool) { h := hashfn(key) % len(p.buckets) for b := p.buckets[h]; b != nil; b = b.next { if eqfn(key, b.key) { return b.val, true } } } func (p *Hashmap) Insert(key K, val V) (inserted bool) { // Implementation omitted. } return Hashmap (type) } const func New(K, V gotype, hashfn Hashfn(K), eqfn Eqfn(K)) func()*Hashmap(K, V, hashfn, eqfn) { return func () *Hashmap(K, V, hashfn, eqfn) { return &Hashmap(K, V, hashfn, eqfn) { buckets: make([]bucket(K, V), 16), entries: 0, } } } ``` ```go package sample import ( "fmt" "hashmap" "os" ) func hashint(i int) uint { return uint(i) } func eqint(i, j int) bool { return i == j } var v = hashmap.New(int(type), string(type), hashint, eqint) func Add(id int, name string) { if !v.Insert(id, name) { log.Fatal("duplicate id", id) } } func Find(id int) string { val, found := v.Lookup(id) if !found { log.Fatal("missing id", id) } return val } ``` ### Ambiguities The extension of `TypeName` to include calls returning a `gotype` introduces some minor ambiguities in the grammar which must be resolved, particularly when the argument to the `gotype` function is a named constant rather than a `gotype` or another call. The following example illustrates an ambiguity in interface declarations. If `Z` is a type, it declares a method named `Y` with an argument of type `Z`. If `Z` is a constant, it embeds the interface type `Y(Z)` in `X`. ```go interface X { Y(Z) } ``` The compiler can theoretically resolve the ambiguity itself based on the definition of `Z`, but `go/parser` package currently does not do enough analysis to determine the correct abstract syntax tree for this case. To keep the parser relatively simple, we can resolve the ambiguity by requiring parentheses for embedded types derived from expressions, which can never be valid method declarations: ```go interface X { (Y(Z)) } ``` ℹ In the above example, `Z` must be a constant or the name of a type, not a `gotype` literal: the `(type)` in `Z (type)` would already remove the ambiguity. ℹ This problem and the proposed resolution are analogous to the existing ambiguity and workaround for composite literals within `if`, `switch`, and `for` statements. (Search for "parsing ambiguity" in the Go 1.7 spec.) The following example illustrates an ambiguity in expressions. If `Y` is a compile-time function that returns a `gotype`, the expression is a [`Conversion`](https://golang.org/ref/spec#Conversion) of the expression `w` to the type `Y(Z)`. Otherwise, it is a [call](https://golang.org/ref/spec#Calls) to the function `Y(Z)` with [`Arguments`](https://golang.org/ref/spec#Arguments) `w`. ```go var x = Y(Z)(w) ``` Fortunately, the [`go/ast` representation](https://play.golang.org/p/C0W4uMy5ek) for both of these forms is equivalent: a nested `CallExpr`. ℹ As above, this case is only ambiguous if `Z` is a constant or the name of a type. ℹ This ambiguity already appears in the existing grammar for the simpler case of `var x = Y(w)`: whether the subexpression `Y(w)` is parsed as a `Conversion` of `w` to `Y` or a `PrimaryExpr` applying a function `Y` to `w` already depends upon whether `Y` names a type or a function or variable. The ambiguities described here are low-risk: the result of misparsing is an invalid program, not a valid program with unintended behavior. ## Rationale This proposal provides support for parametricity and metaprogramming using a language that is already familiar to Go programmers: a subset of Go itself. The proposed changes to the compiler are extensive (in order to support compile-time evaluation), but the changes to the language itself and to the runtime are relatively minimal: extensions of existing declaration syntax to additional scopes, a token for indicating compile-time functions, a token for hoisting types into values, and the new built-in type `gotype`. The programmer needs to think about which parts of the program execute at compile-time or at run-time, but does not need to learn a whole new language (as opposed to, say, the extensive surface area of the `reflect` or `go/ast` packages or the entirely different language of `text/template`). The potential applications cover a significant fraction of "metaprogramming" use-cases that are currently well-supported only in languages much more complex than Go, and that are not addressed by previous proposals that run closer to conventional "generics" or "templates". The specific language changes may be somewhat more complex than some alternatives (particularly when compared to tools that build on top of `go generate`), but the deployment overhead is substantially lower: instead of preprocessing source files (and potentially iterating over the outputs many times to reach a fix-point of code generation), the programmer need only run the usual `go build` command. That is: this proposal trades a bit more language complexity for a significant reduction in tooling complexity for Go users. With a few additional modest extensions (e.g. compile-time `init` functions), the same mechanism can be used to make Go program initialization more efficient and to move detection of more errors from run-time to compile-time. The principles underlying this proposal are based on existing (if little-used) designs from programming language research: namely, higher-order types, partial evaluation[1][][2][], and dependent function types. [1]: https://www.cs.cmu.edu/~fp/papers/jacm00.pdf [2]: https://www.cs.cmu.edu/~fp/papers/sope98.pdf ## Caveats With this style of metaprogramming, it would be difficult (perhaps infeasible) to add deduction for `gotype` arguments in a subsequent revision of the language in a way that maintains backward-compatibility. ## Compatibility This proposal is intended to be compatible with Go 1. (The author has looked for incompatibilities and not yet found any.) ## Implementation The implementation of `gotype` is straightforward, especially if we decline to add conversions to and from `reflect.Type`. The detection and evaluation of compile-time expressions adds a new algorithm to the compiler, but it should be a straightforward one (a bottom-up analysis of expressions) and is closely related to common compiler optimizations (e.g. constant folding). The export data format would have to be expanded to include definitions of compile-time functions (as I assume it does today for inlinable functions). The bulk of the implementation work is likely to be in support of executing Go functions at compile time: compile-time functions have similar semantics to run-time functions, but (because they are executed at compile time and because they can have dependent types) would need support for a more dynamically-typed evaluation.
15292
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/15292/2011-03-gen.md
# Generalized Types This is a proposal for adding generics to Go, written by Ian Lance Taylor in March, 2011. This proposal will not be adopted. It is being presented as an example for what a complete generics proposal must cover. ## Introduction This document describes a possible implementation of generalized types in Go. We introduce a new keyword, `gen`, which declares one or more type parameters: types that are not known at compile time. These type parameters may then be used in other declarations, producing generalized types and functions. Some goals, borrowed from [Garcia et al](https://web.archive.org/web/20170812055356/http://www.crest.iu.edu/publications/prints/2003/comparing_generic_programming03.pdf): * Do not require an explicit relationship between a definition of a generalized function and its use. The function should be callable with any type that fits the required form. * Permit interfaces to express relationships between types of methods, as in a comparison function that takes two parameters of the same unknown type. * Given a generalized type, make it possible to use related types, such as a slice of that type. * Do not require explicit instantiation of generalized functions. * Permit type aliasing of generalized types. The type parameter introduced by a `gen` declaration is a concept that exists at compile time. Any actual value that exists at runtime has a specific concrete type: an ordinary non-generalized type, or a generalized type that has been instantiated as a concrete type. Generalized functions will be compiled to handle values whose types are supplied at runtime. This is what changes in the language: * There is a new syntax for declaring a type parameter (or parameters) for the scope of one or more declarations. * There is a new syntax for specifying the concrete type(s) to use when using something declared with a type parameter. * There is a new syntax for converting values of concrete type, and untyped constants, to generalized types. Also values of generalized type are permitted in type assertions. * Within a function, we define the operations permitted on values with a generalized type. ## Syntax Any package-scope type or function declaration may be preceded with the new keyword `gen` followed by a list of type parameter names in square brackets: ``` gen [T] type Vector []T ``` This defines `T` as a type parameter for the generalized type `Vector`. The scope of `Vector` is the same as it would be if `gen` did not appear. A use of a generalized type will normally provide specific types to use for the type parameters. This is done using square brackets following the generalized type. ``` type VectorInt Vector[int] var v1 Vector[int] var v2 Vector[float32] gen [T1, T2] type Pair struct { first T1; second T2 } var v3 Pair[int, string] ``` Type parameters may also be used with functions. ``` gen [T] func SetHead(v Vector[T], e T) T { v[0] = e return e } ``` For convenience, we permit a modified version of the factoring syntax used with `var`, `type`, and `const` to permit a series of declarations to share the same type parameters. ``` gen [T1, T2] ( type Pair struct { first T1; second T2 } func MakePair(first T1, second T2) Pair { return &Pair{first, second} } ) ``` References to other names declared within the same gen block do not have to specify the type parameters. When the type parameters are omitted, they are assumed to simply be the parameters declared for the block. In the above example, `Pair` when used as the result type of `MakePair` is equivalent to `Pair[T1, T2]`. As with generalized types, we must specify the types when we refer to a generalized function (but see the section on type deduction, below). ``` var MakeIntPair = MakePair[int, int] var IntPairZero = MakeIntPair(0, 0) ``` A generalized type can have methods. ``` gen [T] func (v *Vector[T]) SetHeadMethod(e T) T { v[0] = e return e } ``` Of course a method of a generalized type may itself be a generalized function. ``` gen [T, T2] func (v *Vector[T]) Transform(f func(T) T2) Vector[T2] ``` The `gen` keyword may only be used with a type or function. It may only appear in package scope, not within a function. One `gen` keyword may appear within the scope of another. In that case, any use of the generalized type or function must specify all the type parameters, starting with the outermost ones. A different way of writing the last example would be: ``` gen [T] ( type Vector []T gen [T2] func (v *Vector[T]) Transform(f func(T) T2) Vector[T2] ) var v Vector[int] var v2 = v.Transform[int, string](f) ``` Type deduction, described below, would permit omitting the `[int, string]` in the last line, based on the types of `v` and `f`. ### A note on syntax While the use of the `gen` keyword fits reasonably well into the existing Go language, the use of square brackets to denote the specific types is new to Go. We have considered a number of different approaches: * Use angle brackets, as in `Pair<int, string>`. This has the advantage of being familiar to C++ and Java programmers. Unfortunately, it means that `f<T>(true)` can be parsed as either a call to function `f<T>` or a comparison of `f<T` (an expression that tests whether `f` is less than `T`) with `(true)`. While it may be possible to construct complex resolution rules, the Go syntax avoids that sort of ambiguity for good reason. * Overload the dot operator again, as in `Vector.int` or `Pair.(int, string)`. This becomes confusing when we see `Vector.(int)`, which could be a type assertion. * We considered using dot but putting the type first, as in `int.Vector` or `(int, string).Pair`. It might be possible to make that work without ambiguity, but putting the types first seems to make the code harder to read. * An earlier version of this proposal used parentheses for names after types, as in `Vector(int)`. However, that proposal was flawed because there was no way to specify types for generalized functions, and extending the parentheses syntax led to `MakePair(int, string)(1, "")` which seems less than ideal. * We considered various different characters, such as backslash, dollar sign, at-sign or sharp. The square brackets grouped the parameters nicely and provide an acceptable visual appearance. ## Type Deduction When calling a function, as opposed to referring to it without calling it, the type parameters may be omitted in some cases. A function call may omit the type parameters when every type parameter is used for a regular parameter, or, in other words, there are no type parameters that are used only for results. In that case the compiler will compare the actual type of the argument (`A`) with the type of the generalized parameter (`P`), examining the arguments from left to right. `A` and `P` must be identical. The first time we see a type parameter in `P`, it will be set to the appropriate portion of `A`. If the type parameter appears again, it must be identical to the actual type at that point. Note that at compile time the argument type may itself be a generalized type. The type deduction algorithm is the same. A type parameter of `P` may match a type parameter of `A`. Once this match is made, then every subsequent instance of the `P` type parameter must match the same `A` type parameter. When doing type deduction with an untyped numeric constant, the constant is given the type `int`, `float64`, or `complex128` as usual. Type deduction does not support passing an untyped `nil` constant; `nil` may only be used with an explicit type conversion (or, of course, the type parameters may be written explicitly). For example, these two variables will have the same type and value. ``` var v1 = MakePair[int, int](0, 0) var v2 = MakePair(0, 0) // [int, int] deduced. ``` ## Constraints The only things that a generalized function can do with a value of generalized type are the operations inherent to the type&mdash;e.g., the `Vector` type can be indexed or sliced. But sometimes we want to be able to say something about the types that are used as part of a larger type. Specifically, we want to say that they must implement a particular interface. So when listing the identifiers following `gen` we permit an optional interface type following the name. ``` gen [T Stringer] type PrintableVector []T ``` Now `PrintableVector` may only be used with types that implement the `Stringer` interface. The interface may itself be a generalized type. The scope of each type parameter starts at the `[`, and so we permit using the type identifier just named with the generalized interface type. ``` // Types that may be compared with some other type. gen [T] type Comparer interface { Compare(T) int // <0, ==0, >0 } // Vector of elements that may be compared with themselves. gen [T Comparer[T]] type SortableVector []T ``` ## Example ``` package hashmap gen [Keytype, Valtype] ( type bucket struct { next *bucket key Keytype val Valtype } type Hashfn func(Keytype) uint type Eqfn func(Keytype, Keytype) bool type Hashmap struct { hashfn Hashfn eqfn Eqfn buckets []bucket entries int } // This function must be called with explicit type parameters, as // there is no way to deduce the value type. For example, // h := hashmap.New[int, string](hashfn, eqfn) func New(hashfn Hashfn, eqfn Eqfn) *Hashmap { return &Hashmap{hashfn, eqfn, make([]buckets, 16), 0} } func (p *Hashmap) Lookup(key Keytype) (val Valtype, found bool) { h := p.hashfn(key) % len(p.buckets) for b := p.buckets[h]; b != nil; b = b.next { if p.eqfn(key, b.key) { return b.val, true } } return } func (p *Hashmap) Insert(key Keytype, val Valtype) (inserted bool) { // Implementation omitted. } ) // Ends gen. package sample import ( “fmt” “hashmap” “os” ) func hashint(i int) uint { return uint(i) } func eqint(i, j int) bool { return i == j } var v = hashmap.New[int, string](hashint, eqint) func Add(id int, name string) { if !v.Insert(id, name) { fmt.Println(“duplicate id”, id) os.Exit(1) } } func Find(id int) string { val, found = v.Lookup(id) if !found { fmt.Println(“missing id”, id) os.Exit(1) } } ``` ## Language spec changes This is an outline of the changes required to the language spec. ### Types A few paragraphs will be added to discuss generalized types. ### Struct types While a struct may use a type parameter as an anonymous field, within generalized code only the generalized definition is considered when resolving field references. That is, given ``` gen [T] type MyGenStruct struct { T } type MyRealStruct { i int } type MyInstStruct MyGenStruct[MyRealStruct] gen [T] func GetI(p *MyGenStruct[T]) int { return p.i // INVALID } func MyGetI(p *MyInstStruct) int { return GetI(p) } ``` the function `GetI` may not refer to the field `i` even though the field exists when called from `MyGetI`. (This restriction is fairly obvious if you think about it, but is explicitly stated for clarity.) ### Type Identity We define type identity for generalized types. Two generalized types are identical if they have the same name and the type parameters are identical. ### Assignability We define assignability for generalized types. A value `x` of generalized type `T1` is assignable to a variable of type `T2` if `T1` and `T2` are identical. A value `x` of concrete type is never assignable to a variable of generalized type: a generalized type coercion is required (see below). Similarly, a value `x` of generalized type is never assignable to a variable of concrete type: a type assertion is required. For example (more details given below): ``` gen [T] func Zero() (z T) { z = 0 // INVALID: concrete to generalized. z = int(0) // INVALID: concrete to generalized. z = 0.[T] // Valid: generalized type coercion. } gen [T] func ToInt(v T) (r int) { r = v // INVALID: generalized to concrete r = int(v) // INVALID: no conversions for gen types r, ok := v.(int) // Valid: generalized type assertion. if !ok { panic(“not int”) } } ``` ### Declarations and scope A new section Generalized declarations is added, consisting of a few paragraphs that describe generalized declarations and the gen syntax. ### Indexes The new syntax `x[T]` for a generalized type or function is defined, where `T` is a type and `x` is the name of some type or function declared within a `gen` scope. ### Type assertions We define type assertions using generalized types. Given `x.(T)` where `x` is a value with generalized type and `T` is a concrete type, the type assertion succeeds if the concrete type of `x` is identical to `T`, or, if `T` is an interface type, the concrete type implements the interface `T`. In other words, pretty much the same as doing a type assertion of a value of interface type. If `x` and `T` are both generalized types, we do the same test using the concrete types of `x` and `T`. In general these assertions must be checked at runtime. ### Generalized type coercions We introduce a new syntax for coercing a value of concrete type to a generalized type. Where `x` is a value with concrete type and `T` is a generalized type, the expression `x.[T]` coerces `x` to the generalized type `T`. The generalized type coercion may succeed or fail, just as with a type assertion. However, it is not a pure type assertion, as we permit `x` to be an untyped constant. The generalized type coercion succeeds if the concrete type matches the generalized type, where any parameters of the generalized type match the appropriate portion of the concrete type. If the same parameter appears more than once in the generalized type, it must match identical types in the concrete type. If the value is an untyped constant, the coercion succeeds if an assignment of that constant to the concrete type would succeed at compile time. ### Calls This section is extended to describe the type deduction algorithm used to avoid explicit type parameters when possible. An implicit generalized type conversion is applied to convert the arguments to the expected generalized type, even though normally values of concrete type are not assignable to variables of generalized type. Type checking ensures that the arguments must be assignable to the concrete type which is either specified or deduced, and so this implicit generalized type conversion will always succeed. When a result parameter has a generalized type, an implicit type assertion is applied to convert back to the type that the caller expects, which may be a concrete type. The type expected by the caller is determined by the type parameters passed to the function, whether determined via type deduction or not. This implicit type assertion will always succeed. For example, in ``` gen [T] func Identity(v T) T { return v } func Call(i int) { j := Identity(i) } ``` the variable `j` gets the type `int`, and an implicit type assertion converts the return value of `Identity[int]` to `int`. ### Conversions Nothing needs to change in this section. I just want to note explicitly that there are no type conversions for generalized types other than the standard conversions that apply to all types. ### Type switches A type switch may be used on a value of generalized type. Type switch cases may include generalized types. The rules are the same as for type assertions. ### For statements A range clause may be used with a value of generalized type, if the generalized type is known to be a slice, array, map or channel. ## Implementation Any actual value in Go will have a concrete type. The implementation issue that arises is how to compile a function that has parameters with generalized type. ### Representation When calling a function that uses type parameters, the type parameters are passed first, as pointers to a runtime type descriptor. The type parameters are thus literally additional parameters to the functions. ### Types In some cases it will be necessary to create a new type at runtime, which means creating a new runtime type descriptor. It will be necessary to ensure that type descriptor comparisons continue to work correctly. For example, the hashmap example above will require creating a new type for each call to `hashmap.New` for the concrete types that are used in the call. The reflect package already creates new runtime type descriptors in the functions `PtrTo`, `ChanOf`, `FuncOf`, etc. Type reflection on a generalized type will return the appropriate runtime type descriptor, which may have been newly created. Calling `Name()` on such a type descriptor will return a name with the appropriate type parameters: e.g, `“Vector[int]”`. ### Variable declarations A local variable in a function may be declared with a generalized type. In the general case, the size of the variable is unknown, and must be retrieved from the type descriptor. Declaring a local variable of unknown size will dynamically allocate zeroed memory of the appropriate size. As an optimization the memory may be allocated on the stack when there is sufficient room. ### Composite literals A generalized type that is defined to be a struct, array, slice, or map type may be used to create a composite literal. The expression has the same generalized type. The elements of the composite literal must follow the assignability rules. ### Selectors When `x` is a value of generalized type that is a struct, `x.f` can refer to a field of that struct. Whether `f` is a field of `x` is known at compile time. The exact offset of the field in the struct value may not be known. When it is not known, the field offset is retrieved from the type descriptor at runtime. Similarly, `x.f` may refer to a method of the type. In this case the method is always known at compile time. As noted above under struct types, if a generalized struct type uses a type parameter as an anonymous field, the compiler does not attempt to look up a field name in the concrete type of the field at runtime. ### Indexes A value of a generalized type that is an array, slice or map may be indexed. Note that when indexing into a map type, the type of the value must be assignable to the map’s key type; in practice this means that if the map’s key type is generalized, the value must itself have the same generalized type. Indexing into a generalized array or slice may require multiplying by the element size found in the type descriptor. Indexing into a generalized map may require a new runtime function. ### Slices A value of a generalized type that is an array or slice may itself be sliced. This operation is essentially the same as a slice of a value of concrete type. ### Type Assertions A type assertion generally requires a runtime check, and in the general case requires comparing two concrete types at runtime, where one of the types is known to instantiate some generalized type. The complexity of the runtime check is linear in the number of tokens in the generalized type, and requires storage space to store type parameters during the check. This check could be inlined into the code, or it could use a general purpose runtime check that compares the concrete type descriptor to a similar representation of the generalized type. ### Calls Function calls can require converting normal values to generalized values. This operation depends on the representation chosen for the generalized value. In the worst case it will be similar to passing a normal value to a function that takes an interface type. When calling a function with type parameters, the type parameters will be passed first, as a pointer to a runtime type descriptor. Function calls can also require converting generalized return values to normal values. This is done via an implicitly inserted type assertion. Depending on the representation, this may not require any actual code to be generated. ### Communication operators We have to implement sending and receiving generalized values for channels of generalized type. ### Assignments We have to implement assignment of generalized values. This will be based on the runtime type descriptor. ### Type switches We have to implement type switches using generalized types. This will mostly likely devolve into a series of if statements using type assertions. ### For statements We have to implement for statements with range clauses over generalized types. This is similar to the indexing and communication operators. ### Select statements We have to implement select on channels of generalized type. ### Return statements We have to implement returning a value of generalized type. ### Specialization of functions This proposal is intended to support compiling a generalized function into code that operates on generalized values. In fact, it requires that this work. ``` package p1 gen [T] func Call(f func (T) T, T) T { return f(T) } package p2 func SliceIdentity(a []int) []int { return a } package p3 var v = p1.Call(p2.SliceIdentity, make([]int, 10)) ``` Here `Call` has to support calling a generalized function. There is no straightforward specialization process that can implement this case. (It could be done if the full source code of p1 and p2 are available either when compiling p3 or at link time; that is how C++ does it, but it is not an approach that fits well with Go.) However, for many cases, this proposal can be implemented using function specialization. Whenever the compiler can use type deduction for a function call, and the types are known concrete types, and the body of the function is available, the compiler can generate a version of the function specialized for those types. This is, therefore, an optional optimization, in effect a form of cross-package inlining, which costs compilation time but improves runtime. ## Methods on builtin types This is an optional addendum to the proposal described above. The proposal does not provide a convenient way to write a function that works on any numeric type. For example, there is no convenient way to write this: ``` gen [T] func SliceAverage(a []T) T { s := T(0) for _, v = range a { s += v } return s / len(a) } ``` It would be nice if that function worked for any numeric function. However, it is not permitted under the proposal described above, because of the use of `+=` and `/`. These operators are not available for every type and therefore are not available for a generalized type. This approach does work: ``` gen [T] type Number interface { Plus(T) T Divide(T) T } gen [T Number[T]] func SliceAverage(a []T) T { s := 0.[T] for _, v = range a { s = s.Plus(v) } return s.Divide(len(a)) } ``` However, this requires writing explicit `Plus` and `Divide` methods for each type you want to use. These methods are themselves boilerplate: ``` func (i MyNum) Plus(v MyNum) MyNum { return i + v } func (i MyNum) Divide(v MyNum) MyNum { return i / v } ``` This proposal does not help with this kind of boilerplate function, because there is no way to use operators with generalized values. There are a few ways to solve this. One way that seems to fit well with Go as extended by this proposal is to declare that for all types that support some language operator, the type has a corresponding method. That is, we say that if the type can be used with `+`, the language defines a method `Plus` (or `Binary+` or whatever) for the type that implements the operation. This method can then be picked up by an interface such as the above, and the standard library can define convenient aggregate interfaces, such as an interface listing all the methods supported by an integer type. Note that it would not help for the standard library to define a `Plus` method for every integer type, as those methods would not carry over to user defined types. ## Operator methods It is of course a smallish step from those language-defined methods to having operator methods, which would permit writing generalized code using operators rather than method calls. For the purposes of using generalized types, however, this is less important than having language defined methods for operators. ## Summary This proposal will not be adopted. It has significant flaws. The factored `gen` syntax is convenient but looks awkward on the page. You wind up with a trailing close parenthesis after a set of function definitions. Indenting all the function definitions looks silly. This proposal doesn't let me write a trivial generalized `Max` function, unless we include operator methods. Even when we include operator methods, `Max` has to be written in terms of a `Less` method. The handling of untyped constants in generalized functions is extremely awkward. They must always use a generalized type coercion. While this proposal is more or less palatable for data structures, it is much weaker for functions. You basically can't do anything with a generalized type, except assign it and call a method on it. Writing standardized algorithms will require developing a whole vocabulary of quasi-standard methods. The proposal doesn't help write functions that work on either `[]byte` or `string`, unless those types get additional operator methods like `Index` and `Len`. Even operator methods don't help with using `range`.
15292
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/15292/2010-06-type-functions.md
# Type Functions This is a proposal for adding generics to Go, written by Ian Lance Taylor in June, 2010. This proposal will not be adopted. It is being presented as an example for what a complete generics proposal must cover. ## Defining a type function We introduce _type functions_. A type function is a named type with zero or more parameters. The syntax for declaring a type function is: ``` type name(param1, param2, ...) definition ``` Each parameter to a type function is simply an identifier. The _definition_ of the type function is any type, just as with an ordinary type declaration. The definition of a type function may use the type parameters any place a type name may appear. ``` type Vector(t) []t ``` ## Using a type function Any use of a type function must provide a value for each type parameter. The value must itself be a type, though in some cases the exact type need not be known at compile time. We say that a specific use of a type function is concrete if all the values passed to the type function are concrete. All predefined types are concrete and all type literals composed using only concrete types are concrete. A concrete type is known statically at compile time. ``` type VectorInt Vector(int) // Concrete. ``` When a type function is used outside of a func or the definition of a type function, it must be concrete. That is, global variables and constants are required to have concrete types. In this example: ``` var v Vector(int) ``` the name of the type of the variable `v` will be `Vector(int)`, and the value of v will have the representation of `[]int`. If `Vector(t)` has any methods, they will be attached to the type of `v` \(methods of type functions are discussed further below\). ## Generic types A type function need not be concrete when used as the type of a function receiver, parameter, or result, or anywhere within a function. A specific use of a type function that is not concrete is known as generic. A generic type is not known at compile time. A generic type is named by using a type function with one or more unbound type parameters, or by writing a type function with parameters attached to generic types. When writing an unbound type parameter, it can be ambiguous whether the intent is to use a concrete type or whether the intent is to use an unbound parameter. This ambiguity is resolved by using the `type` keyword after each unbound type parameter. \(Another way would be to use a different syntax for type variables. For example, `$t`. This has the benefit of keeping the grammar simpler and not needing to worry about where types are introduced vs. used.\) ``` func Bound(v Vector(int)) func Unbound(v Vector(t type)) ``` The `type` keyword may also be used without invoking a type function: ``` func Generic(v t type) t ``` In this example the return type is the same as the parameter type. Examples below show cases where this can be useful. A value (parameter, variable, etc.) with a generic type is represented at runtime as a generic value. A generic value is a dynamic type plus a value of that type. The representation of a generic value is thus the same as the representation of an empty interface value. However, it is important to realize that the dynamic type of a generic value may be an interface type. This of course can never happen with an ordinary interface value. Note that if `x` is a value of type `Vector(t)`, then although `x` is a generic value, the elements of the slice are not. The elements have type `t`, even though that type is not known. That is, boxing a generic value only occurs at the top level. ## Generic type identity Two generic types are identical if they have the same name and the parameters are identical. This can only be determined statically at compile time if the names are the same. For example, within a function, `Vector(t)` is identical to `Vector(t)` if both `t` identifiers denote the same type. `Vector(int)` is never identical to `Vector(float)`. `Vector(t)` may or may not be identical to `Vector(u)`; identity can only be determined at runtime. Checking type identity at runtime is implemented by walking through the definition of each type and comparing each component. At runtime all type parameters are known, so no ambiguity is possible. If any literal or concrete type is different, the types are different. ## Converting a value of concrete type to a generic type Sometimes it is necessary to convert a value of concrete type to a generic type. This is an operation that may fail at run time. This is written as a type assertion: `v.(t)`. This will verify at runtime that the concrete type of `v` is identical to the generic type `t`. \(Open issue: Should we use a different syntax for this?\) \(Open issue: In some cases we will want the ability to convert an untyped constant to a generic type. This would be a runtime operation that would have to implement the rules for conversions between numeric types. How should this conversion be written? Should we simply use `N`, as in `v / 2`? The problem with that syntax is that the runtime conversion can fail in some cases, at least when `N` is not in the range 0 to 127 inclusive. The same objection applies to T(n). That suggests N.(t), but that looks weird.\) \(Open issue: It is possible that we will want the ability to convert a value from a known concrete type to a generic type. This would also require a runtime conversion. I'm not sure whether this is necessary or not. What would be the syntax for this?\) ## Generic value operations A function that uses generic values is only compiled once. This is different from C++ templates. The only operations permitted on a generic value are those implied by its type function. Some operations will require extra work at runtime. ### Declaring a local variable with generic type. This allocates a new generic value with the appropriate dynamic type. Note that in the general case the dynamic type may need to be constructed at runtime, as it may itself be a type function with generic arguments. ### Assigning a generic value As with any assignment, this is only permitted if the types are identical. The value is copied as appropriate. This is much like assignment of values of empty interface type. ### Using a type assertion with a generic value Programs may use type assertions with generic values just as with interface values. The type assertion succeeds if the target type is identical to the value's dynamic type. In general this will require a runtime check of type identity as described above. \(Open issue: Should it be possible to use a type assertion to convert a generic value to a generic type, or only to a concrete type? Converting to a generic type is a somewhat different operation from a standard type assertion. Should it use a different syntax?\) ### Using a type switch with a generic value Programs may use type switches with generic values just as with interface values. ### Using a conversion with a generic value Generic values may only be converted to types with identical underlying types. This is only permitted when the compiler can verify at compile time that the conversion is valid. That is, a conversion to a generic type T is only permitted if the definition of T is identical to the definition of the generic type of the value. ``` var v Vector(t) a := Vector(t)(v) // OK. type MyVector(t) []t b := MyVector(t)(v) // OK. c := MyVector(u)(v) // OK iff u and t are known identical types. d := []int(v) // Not OK. ``` ### Taking the address of a generic value Programs may always take the address of a generic value. If the generic value has type `T(x)` this produces a generic value of type `*T(x)`. The new type may be constructed at runtime. ### Indirecting through a generic value If a generic value has a generic type that is a pointer `*T`, then a program may indirect through the generic value. This will be similar to a call to `reflect.PtrValue.Elem`. The result will be a new generic value of type `T`. ### Indexing or slicing a generic value If a generic value has a generic type that is a slice or array, then a program may index or slice the generic value. This will be similar to a call to `reflect.ArrayValue.Elem` or `reflect.SliceValue.Elem` or `reflect.SliceValue.Slice` or `reflect.MakeSlice`. In particular, the operation will require a multiplication by the size of the element of the slice, where the size will be fetched from the dynamic type. The result will be a generic value of the element type of the slice or array. ### Range over a generic value If a generic value has a generic type that is a slice or array, then a program may use range to loop through the generic value. ### Maps Similarly, if a generic value has a generic type that is a map, programs may index into the map, check whether an index is present, assign a value to the map, range over a map. ### Channels Similarly, if a generic value has a generic type that is a channel, programs may send and receive values of the appropriate generic type, and range over the channel. ### Functions If a generic value has a generic type that is a function, programs may call the function. Where the function has parameters which are generic types, the arguments must have identical generic type or a type assertion much be used. This is similar to `reflect.Call`. ### Interfaces If a generic value has a generic type that is an interface, programs may call methods on the interface. This is much like calling a function. Note that a type assertion on a generic value may return an interface type, unlike a type assertion on an interface value. This in turn means that a double type assertion is meaningful. ``` a.(InterfaceType).(int) ``` ### Structs If a generic value has a generic type that is a struct, programs may get and set struct fields. In general this requires finding the description of the field in the dynamic type to discover the appropriate concrete type and field offsets. ### That is all Operations that are not explicitly permitted for a generic value are forbidden. ### Scope of generic type parameters When a generic type is used, the names of the type parameters have scope. The generic type normally provides the type of some name; the scope of the unbound type parameters is the same as the scope of that name. In cases where the generic type does not provide the type of some name, then the unbound type parameters have no scope. Within the scope of an unbound type parameter, it may be used as a generic type. ``` func Head(v Vector(t type)) { var first t first = v[0] } ``` ### Scopes of function parameters In order to make this work nicely, we change the scope of function receivers, parameters, and results. We now define their scope to start immediately after they are defined, rather than starting in the body of the function. This means that a function parameter may refer to the unbound type parameters of an earlier function parameter. ``` func SetHead(v Vector(t type), e t) t { v[0] = e return e } ``` The main effect of this change in scope will be to change the behaviour of cases where a function parameter has the same name as a global type, and that global type was used to define a subsequent function parameter. \(The alternate notation approach would instead define that the variables only persist for the top-level statement in which they appear, so that ``` func SetHead(v Vector($t), e $t) $t { ... } ``` doesn't have to worry about which t is the declaration (the ML approach). Another alternative is to do what C++ does and explicitly introduce them. ``` generic(t) func SetHead(v Vector(t), e t) t { ... } ] ``` \) ### Function call argument type checking As can be seen by the previous example, it is possible to use generic types to write functions in which two parameters have related types. These types are checked at the point of the function call. If the types at the call site are concrete, the type checking is always done by the compiler. If the types are generic, then the function call is only permitted if the argument types are identical to the parameter types. The arguments are matched against the required types from left to right, determining bindings for the unbound type parameters. Any failure of binding causes the compiler to reject the call with a type error. Any case where one unbound type parameter is matched to a different unbound type parameter causes the compiler to reject the call with a type error. In those cases, the call site must use an explicit type assertion, checked at run time, so that the call can be type checked at compile time. ``` var vi Vector(int) var i int SetHead(vi, 1) // OK SetHead(vi, i) // OK var vt Vector(t) var i1 t SetHead(vt, 1) // OK? Unclear. See above. SetHead(vt, i) // Not OK; needs syntax SetHead(vt, i1) // OK var i2 q // q is another generic type SetHead(vt, q) // Not OK SetHead(vt, q.(t)) // OK (may fail at run time) ``` ### Function result types The result type of a function can be a generic type. The result will be returned to the caller as a generic value. If the call site uses concrete types, then the result type can often be determined at compile time. The compiler will implicitly insert a type assertion to the expected concrete type. This type assertion can not fail, because the function will have ensured that the result has the matching type. In other cases, the result type may be a generic type, in which case the returned generic value will be handled like any other generic value. ### Making one function parameter the same type as another Sometime we want to say that two function parameters have the same type, or that a result parameter has the same type as a function parameter, without specifying the type of that parameter. This can be done like this: ``` func Choose(which bool, a t type, b t) t ``` \(Or func `Choose(which bool, a $t, b $t) $t`\) The argument `a` is passed as generic value and binds the type parameter `t` to `a`'s type. The caller must ensure that `b` has the same type as `a`. `b` will then also be passed as a generic value. The result will be returned as a generic value; it must again have the same type. Another example: ``` type Slice(t) []t func Repeat(x t type, n int) Slice(t) { a := make(Slice(t), n) for i := range a { a[i] = x } return a } ``` \(Or `func Repeat(x $t, n int) []$t { ... }`\) ### Nested generic types It is of course possible for the argument to a generic type to itself be a generic type. The above rules are intended to permit this case. ``` type Pair(a, b) struct { first a second b } func Sum(a Pair(Vector(t type), Vector(t))) Vector(t) ``` Note that the first occurrence of `t` uses the `type` keyword to declare it as an unbound type parameter. The second and third occurrences do not, which means that they are the type whose name is `t`. The scoping rules mean that that `t` is the same as the one bound by the first use of Vector. When this function is called, the type checking will match `t` to the argument to the first `Vector`, and then require that the same `t` appear as the argument to the second `Vector`. ### Unknown generic types Note that it is possible to have a generic value whose type can not be named. This can happen when a result variable has a generic type. ``` func Unknown() t type ``` Now if one writes ``` x := Unknown() ``` then x is a generic value of unknown and unnamed type. About all you can do with such a value is assign it using `:=` and use it in a type assertion or type switch. The only way that `Unknown` could return a value would be to use some sort of conversion. ### Methods on generic types A generic type may have methods. When a generic type is used as a receiver, the arguments must all be simple unbound names. Any time a value of this generic type is created, whether the value is generic or concrete, it will acquire all the methods defined on the generic type. When calling these methods, the receiver will of course be passed as a generic value. ``` func (v Vector(t type)) At(int i) t { return v[i] } func (v Vector(t type)) Set(i int, x t) { v[i] = x } ``` A longer example: ``` package hashmap type bucket(keytype, valtype) struct { next *bucket(keytype, valtype) key keytype val valtype } type Hashfn(keytype) func(keytype) uint type Eqfn(keytype) func(keytype, keytype) bool type Hashmap(keytype, valtype) struct { hashfn Hashfn(keytype) eqfn Eqtype(keytype) buckets []bucket(keytype, valtype) entries int } func New(hashfn Hashfn(keytype type), eqfn Eqfn(keytype), _ valtype type) *Hashmap(keytype, valtype) { return &Hashmap(k, v){hashfn, eqfn, make([]bucket(keytype, valtype), 16), 0} } // Note that the dummy valtype parameter in the New function // exists only to get valtype into the function signature. // This feels wrong. func (p *Hashmap(keytype type, vvaltype type)) Lookup(key keytype) (found bool, val valtype) { h := p.hashfn(key) % len(p.buckets) for b := buckets[h]; b != nil; b = b.next { if p.eqfn(key, b.key) { return true, b.val } } return } ``` In the alternate syntax: ``` package hash type bucket($key, $val) struct { next *bucket($key, val) key $key val $val } type Map($key, $val) struct { hash func($key) uint eq func($key, $key) bool buckets []bucket($key, $val) entries int } func New(hash func($key) uint, eq func($key, $key) bool, _ $val) *Map($key, $val) { return &Map($key, $val){ hash, eq, make([]bucket($key, $val), 16), 0, } } // Again note dummy $val in the arguments to New. ``` ## Concepts In order to make type functions more precise, we can additionally permit the definition of the type function to specify an interface. This means that whenever the type function is used, the argument is required to satisfy the interface. In homage to the proposed but not accepted C++0x notion, we call this a concept. ``` type PrintableVector(t Stringer) []t ``` Now `PrintableVector` may only be used with a type that implements the interface `Stringer`. This in turn means that given a value whose type is the parameter to `PrintableVector`, a program may call the `String` method on that value. ``` func Concat(p PrintableVector(t type)) string { s := "" for _, v := range p { s += v.String() } return s } ``` Attempting to pass `[]int` to `Concat` will cause the compiler to issue a type checking error. But if `MyInt` has a `String` method, then calling `Concat` with `[]MyInt` will succeed. The interface restriction may also be used with a parameter whose type is a generic type: ``` func Print(a t type Stringer) ``` This example is not useful, as it is pretty much equivalent to passing a value of type Stringer, but there is a useful example below. Concepts specified in type functions are type checked as usual. If the compiler does not know statically that the type implements the interface, then the type check fails. In such cases an explicit type assertion is required. ``` func MyConcat(v Vector(t type)) string { if pv, ok := v.(PrintableVector(t)); ok { return Concat(pv) } return "unprintable" } ``` \(Note that this does a type assertion to a generic type. Should it use a different syntax?\) The concept must be an interface type, but it may of course be a generic interface type. When using a generic interface type as a concept, the generic interface type may itself use as an argument the type parameter which it is restricting. ``` type Lesser(t) interface { Less(t) bool } func Min(a, b t type Lesser(t)) t { if a.Less(b) { return a } return b } ``` \(`type Mintype($t Lesser($t)) $t`\) This is complex but useful. OK, the function `Min` is not all that useful, but this looks better when we write ``` func Sort(v Vector(t type Lesser(t))) ``` which can sort any Vector whose element type implements the Lesser interface. ## A note on operator methods You will have noticed that there is no way to use an operator with a generic value. For example, you can not add two generic values together. If we implement operator methods, then it will be possible to use this in conjunction with the interface restrictions to write simple generic code which uses operators. While operator methods are of course a separate extension, I think it's important to ensure that they can work well with generic values. ``` type Addable(t) interface { Binary+(t) t } type AddableSlice(t Addable(t)) []t func Sum(v AddableSlice) t { var sum t for _, v := range v { sum = sum + v } return sum } ``` ## Some comparisons to C++ templates Obviously the big difference between this proposal and C++ templates is that C++ templates are compiled separately. This has various consequences. Some C++ template features that can not be implemented using type functions: * C++ templates permit data structures to be instantiated differently for different component types. * C++ templates may be instantiated for constants, not just for types. * C++ permits specific instantiations for specific types or constants. The advantages of type functions are: * Faster compile time. * No need for two-phase name lookup. Only the scope of the definition is relevant, not the scope of use. * Clear syntax for separating compile-time errors from run-time errors. Avoids complex compile-time error messages at the cost of only detecting some problems at runtime. * Concepts also permit clear compile time errors. In general, C++ templates have the advantages and disadvantages of preprocessor macros. ## Summary This proposal will not be adopted. It's basically terrible. The syntax is confusing: ```MyVector(t)(v)``` looks like two function calls, but it's actually a type conversion to a type function. The notion of an unbound type parameter is confusing, and the syntax (a trailing `type` keyword) only increases that confusion. Types in Go refer to themselves. The discussion of type identity does not discuss this. It means that comparing type identity at run time, such as in a type assertion, requires avoiding loops. Generic type assertions look like ordinary type assertions, but are not constant time. The need to pass an instance of the value type to `hashmap.New` is a symptom of a deeper problem. This proposal is trying to treat generic types like interface types, but interface types have a simple common representation and generic types do not. Value representations should probably be expressed in the type system, not inferred at run time. The proposal suggests that generic functions can be compiled once. It also claims that generic types can have methods. If I write ``` type Vector(t) []t func (v Vector(t)) Read(b []t) (int, error) { return copy(b, v), nil } ``` then `Vector(byte)` should implement `io.Reader`. But `Vector(t).Read` is going to be implemented using a generic value, while `io.Reader` expects a concrete value. Where is the code that translates from the generic value to the concrete value?
15292
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/15292/2013-12-type-params.md
# Type Parameters in Go This is a proposal for adding generics to Go, written by Ian Lance Taylor in December, 2013. This proposal will not be adopted. It is being presented as an example for what a complete generics proposal must cover. ## Introduction This document describes a possible implementation of type parameters in Go. We permit top-level types and functions to use type parameters: types that are not known at compile time. Types and functions that use parameters are called parameterized, as in "a parameterized function." Some goals, borrowed from [Garcia et al](https://web.archive.org/web/20170812055356/http://www.crest.iu.edu/publications/prints/2003/comparing_generic_programming03.pdf): * Do not require an explicit relationship between a definition of a parameterized function and its use. The function should be callable with any suitable type. * Permit interfaces to express relationships between types of methods, as in a comparison method that takes two values of the same parameterized type. * Given a type parameter, make it possible to use related types, such as a slice of that type. * Do not require explicit instantiation of parameterized functions. * Permit type aliasing of parameterized types. ## Background My earlier proposal for generalized types had some flaws. This document is similar to my October 2013 proposal, but with a different terminology and syntax, and many more details on implementation. People expect parameterized functions to be fast. They do not want a reflection based implementation in all cases. The question is how to support that without excessively slowing down the compiler. People want to be able to write simple parameterized functions like `Sum(v []T) T`, a function that returns the sum of the values in the slice `v`. They are prepared to assume that `T` is a numeric type. They don’t want to have to write a set of methods simply to implement Sum or the many other similar functions for every numeric type, including their own named numeric types. People want to be able to write the same function to work on both `[]byte` and `string`, without requiring the bytes to be copied to a new buffer. People want to parameterize functions on types that support simple operations like comparisons. That is, they want to write a function that uses a type parameter and compares a value of that type to another value of the same type. That was awkward in my earlier proposal: it required using a form of the curiously recurring template pattern. Go’s use of structural typing means that a program can use any type to meet an interface without an explicit declaration. Type parameters should work similarly. ## Proposal We permit package-level type and func declarations to use type parameters. There are no restrictions on how these parameters may be used within their scope. At compile time each actual use of a parameterized type or function is instantiated by replacing each type parameter with an ordinary type, called a type argument. A type or function may be instantiated multiple times with different type arguments. A particular type argument is only permitted if all the operations used with the corresponding type parameter are permitted for the type argument. How to implement this efficiently is discussed below. ## Syntax Any package-scope type or func may be followed by one or more type parameter names in square brackets. ``` type [T] List struct { element T; next *List[T] } ``` This defines `T` as a type parameter for the parameterized type `List`. Every use of a parameterized type must provide specific type arguments to use for the type parameters. This is done using square brackets following the type name. In `List`, the `next` field is a pointer to a `List` instantiated with the same type parameter `T`. Examples in this document typically use names like `T` and `T1` for type parameters, but the names can be any identifier. The scope of the type parameter name is only the body of the type or func declaration. Type parameter names are not exported. It is valid, but normally useless, to write a parameterized type or function that does not actually use the type parameter; the effect is that every instantiation is the same. Some more syntax examples: ``` type ListInt List[int] var v1 List[int] var v2 List[float] type ( [T1, T2] MyMap map[T1]T2 [T3] MyChan chan T3 ) var v3 MyMap[int, string] ``` Using a type parameter with a function is similar. ``` func [T] Push(l *List[T], e T) *List[T] { return &List[T]{e, l} } ``` As with parameterized types, we must specify the type arguments when we refer to a parameterized function (but see the section on type deduction, below). ``` var PushInt = Push[int] // Type is func(*List[int], int) *List[int] ``` A parameterized type can have methods. ``` func [T] (v *List[T]) Push(e T) { *v = &List[T]{e, v} } ``` A method of a parameterized type must use the same number of type parameters as the type itself. When a parameterized type is instantiated, all of its methods are automatically instantiated too, with the same type arguments. We do not permit a parameterized method for a non-parameterized type. We do not permit a parameterized method to a non-parameterized interface type. ### A note on syntax The use of square brackets to mark type parameters and the type arguments to use in instantiations is new to Go. We considered a number of different approaches: * Use angle brackets, as in `Vector<int>`. This has the advantage of being familiar to C++ and Java programmers. Unfortunately, it means that `f<T>(true)` can be parsed as either a call to function `f<T>` or a comparison of `f<T` (an expression that tests whether `f` is less than `T`) with `(true)`. While it may be possible to construct complex resolution rules, the Go syntax avoids that sort of ambiguity for good reason. * Overload the dot operator again, as in `Vector.int` or `Map.(int, string)`. This becomes confusing when we see `Vector.(int)`, which could be a type assertion. * We considered using dot but putting the type first, as in `int.Vector` or `(int, string).Map`. It might be possible to make that work without ambiguity, but putting the types first seems to make the code harder to read. * An earlier version of this proposal used parentheses for names after types, as in `Vector(int)`. However, that proposal was flawed because there was no way to specify types for parameterized functions, and extending the parentheses syntax led to `MakePair(int, string)(1, "")` which seems less than ideal. * We considered various different characters, such as backslash, dollar sign, at-sign or sharp. The square brackets grouped the parameters nicely and provide an acceptable visual appearance. * We considered a new keyword, `gen`, with parenthetical grouping of parameterized types and functions within the scope of a single `gen`. The grouping seemed un-Go-like and made indentation confusing. The current syntax is a bit more repetitive for methods of parameterized types, but is easier to understand. ## Semantics There are no restrictions on how parameterized types may be used in a parameterized function. However, the function can only be instantiated with type arguments that support the uses. In some cases the compiler will give an error for a parameterized function that can not be instantiated by any type argument, as described below. Consider this example, which provides the boilerplate for sorting any slice type with a `Less` method. ``` type [T] SortableSlice []T func [T] (v SortableSlice[T]) Len() int { return len(v) } func [T] (v SortableSlice[T]) Swap(i, j int) { v[i], v[j] = v[j], v[i] } func [T] (v SortableSlice[T]) Less(i, j int) bool { return v[i].Less(v[j]) } func [T] (v SortableSlice[T]) Sort() { sort.Sort(v) } ``` We don’t have to declare anywhere that the type parameter `T` has a method `Less`. However, the call of the `Less` method tells the compiler that the type argument to `SortableSlice` must have a `Less` method. This means that trying to use `SortableSlice[int]` would be a compile-time error, since `int` does not have a `Less` method. We can sort types that implement the `<` operator, like `int`, with a different vector type: ``` type [T] PSortableSlice []T func [T] (v PSortableSlice[T]) Len() int { return len(v) } func [T] (v PSortableSlice[T]) Swap(i, j int) { v[i], v[j] = v[j], v[i] } func [T] (v PSortableSlice[T]) Less(i, j int) bool { return v[i] < v[j] } func [T] (v PSortableSlice[T]) Sort() { sort.Sort(v) } ``` The `PSortableSlice` type may only be instantiated with types that can be used with the `<` operator: numeric or string types. It may not be instantiated with a struct type, even if the struct type has a `Less` method. Can we merge SortableSlice and PSortableSlice to have the best of both worlds? Not quite; there is no way to write a parameterized function that supports either a type with a `Less` method or a builtin type. The problem is that `SortableSlice.Less` can not be instantiated for a type without a `Less` method, and there is no way to only instantiate a method for some types but not others. (Technical aside: it may seem that we could merge `SortableSlice` and `PSortableSlice` by having some mechanism to only instantiate a method for some type arguments but not others. However, the result would be to sacrifice compile-time type safety, as using the wrong type would lead to a runtime panic. In Go one can already use interface types and methods and type assertions to select behavior at runtime. There is no need to provide another way to do this using type parameters.) All that said, one can at least write this: ``` type [T] Lessable T func [T] (a Lessable[T]) Less(b T) bool { return a < b } ``` Now one can use `SortableSlice` with a slice v of some builtin type by writing ``` SortableSlice([]Lessable(v)) ``` Note that although `Lessable` looks sort of like an interface, it is really a parameterized type. It may be instantiated by any type for which `Lessable.Less` can be compiled. In other words, one can write `[]Lessable(v)` for a slice of any type that supports the `<` operator. As mentioned above parameterized types can be used just like any other type. In fact, there is a minor enhancement. Ordinarily type assertions and type switches are only permitted for interface types. When writing a parameterized function, type assertions and type switches are permitted for type parameters. This is true even if the function is instantiated with a type argument that is not an interface type. Also, a type switch is permitted to have multiple parameterized type cases even if some of them are the same type after instantiation. The first matching case is used. ### Cycles The instantiation of a parameterized function may not require the instantiation of the same parameterized function with different type parameters. This means that a parameterized function may call itself recursively with the same type parameters, but it may not call itself recursively with different type parameters. This rule applies to both direct and indirect recursion. For example, the following is invalid. If it were valid, it would require the construction of a type at runtime. ``` type [T] S struct { f T } func [T] L(n int, e T) interface{} { if n == 0 { return e } return L(n-1, S[T]{e}) } ``` ## Type Deduction When calling a parameterized function, as opposed to referring to it without calling it, the specific types to use may be omitted in some cases. A function call may omit the type arguments when every type parameter is used for a regular parameter, or, in other words, there are no type parameters that are used only for results. When a call is made to a parameterized function without specifying the type arguments, the compiler will walk through the arguments from left to right, comparing the actual type of the argument `A` with the type of the parameter `P`. If `P` contains type parameters, then `A` and `P` must be identical. The first time we see a type parameter in `P`, it will be set to the appropriate portion of `A`. If the type parameter appears again, it must be identical to the actual type at that point. Note that at compile time the type argument may itself be a parameterized type, when one parameterized function calls another. The type deduction algorithm is the same. A type parameter of `P` may match a type parameter of `A`. Once this match is made, then every subsequent instance of the `P` type parameter must match the same `A` type parameter. When doing type deduction with an argument that is an untyped constant, the constant does not determine anything about the type argument. The deduction proceeds with the remaining function arguments. If at the end of the deduction the type argument has not been determined, the constants that correspond to unknown type arguments are re-examined and given the type `int`, `rune`, `float64`, or `complex128` as usual. Type deduction does not support passing an untyped `nil` constant; `nil` may only be used with an explicit type conversion (or, of course, the type arguments may be written explicitly). When passing a parameterized function `F1` to a non-parameterized function `F2`, type deduction runs the other way around: the type of the corresponding argument of `F2` is used to deduce the type of `F1`. When passing a parameterized function `F1` to a parameterized function `F2`, the type of `F1` is compared to the type of the corresponding argument of `F2`. This may yield specific types for `F1` and/or `F2` type parameters, for which the compiler proceeds as usual. If any of the type arguments of `F1` are not determined, type deduction proceeds with the remaining arguments. At the end of the deduction, the compiler reconsiders `F1` with the final set of types. At that point it is an error if all the type parameters of `F1` are not determined. This is not an iterative algorithm; the compiler only reconsiders `F1` once, it does not build a stack of retries if multiple parameterized functions are passed. Type deduction also applies to composite literals, in which the type arguments for a parameterized composite type are deduced from the types of the literals. Type deduction also applies to type conversions to a parameterized type. The type arguments for the type are deduced from the type of the expression being converted. Examples: ``` func [T] Sum(a, b T) T { return a + b } var v1 = Sum[int](0, 0) var v2 = Sum(0, 0) // [int] deduced type [T] Cons struct { car, cdr T } var v3 = Cons{0, 0} // [int] deduced type [T] Opaque T func [T] (a Opaque[T]) String() string { return "opaque" } var v4 = []Opaque([]int{1}) // Opaque[int] deduced var i int var m1 = Sum(i, 0) // i causes T to be deduced as int, 0 is // passed as int. var m2 = Sum(0, i) // 0 ignored on first pass, i causes T // to be deduced as int, 0 passed as int. var m3 = Sum(1, 2.5) // 1 and 2.5 ignored on first pass. On // second pass 1 causes T to be deduced as // int. Passing 2.5 is an error. var m4 = Sum(2.5, 1) // 2.5 and 1 ignored on first pass. On // second pass 2.5 causes T to be deduced // as float64. 1 converted to float64. func [T1, T2] Transform(s []T1, f func(T1) T2) []T2 var s1 = []int{0, 1, 2} // Below, []int matches []T1 deducing T1 as int. // strconv.Itoa matches T1 as int as required, // T2 deduced as string. Type of s2 is []string. var s2 = Transform(s1, strconv.Itoa) func [T1, T2] Apply(f func(T1) T2, v T1) T2 { return f(v) } func [T] Ident(v T) T { return v } // Below, Ident matches func(T1) T2, but neither T1 nor T2 // are known. The compiler continues. Next i, type int, // matches T1, so T1 is int. The compiler returns to Ident. // T matches T1, which is int, so T is int. Then T matches // T2, so T2 is int. All type arguments are deduced. func F(i int) int { return Apply(Ident, i) } ``` Note that type deduction requires types to be identical. This is stronger than the usual requirement when calling a function, namely that the types are assignable. ``` func [T] Find(s []T, e T) bool type E interface{} var f1 = 0 // Below does not compile. The first argument means that T is // deduced as E. f1 is type int, not E. f1 is assignable to // E, but not identical to it. var f2 = Find([]E{f1}, f1) // Below does compile. Explicit type specification for Find // means that type deduction is not performed. var f3 = Find[E]([]E{f1}, f1) ``` Requiring identity rather than assignability is to avoid any possible confusion about the deduced type. If different types are required when calling a function it is always possible to specify the types explicitly using the square bracket notation. ## Examples A hash table. ``` package hashmap type [K, V] bucket struct { next *bucket key K val V } type [K] Hashfn func(K) uint type [K] Eqfn func(K, K) bool type [K, V] Hashmap struct { hashfn Hashfn[K] eqfn Eqfn[K] buckets []bucket[K, V] entries int } // This function must be called with explicit type arguments, as // there is no way to deduce the value type. For example, // h := hashmap.New[int, string](hashfn, eqfn) func [K, V] New(hashfn Hashfn[K], eqfn Eqfn[K]) *Hashmap[K, V] { // Type parameters of Hashmap deduced as [K, V]. return &Hashmap{hashfn, eqfn, make([]bucket[K, V], 16), 0} } func [K, V] (p *Hashmap[K, V]) Lookup(key K) (val V, found bool) { h := p.hashfn(key) % len(p.buckets) for b := p.buckets[h]; b != nil; b = b.next { if p.eqfn(key, b.key) { return b.val, true } } return } func [K, V] (p *Hashmap[K, V]) Insert(key K, val V) (inserted bool) { // Implementation omitted. } ``` Using the hash table. ``` package sample import ( "fmt" "hashmap" "os" ) func hashint(i int) uint { return uint(i) } func eqint(i, j int) bool { return i == j } var v = hashmap.New[int, string](hashint, eqint) func Add(id int, name string) { if !v.Insert(id, name) { fmt.Println(“duplicate id”, id) os.Exit(1) } } func Find(id int) string { val, found := v.Lookup(id) if !found { fmt.Println(“missing id”, id) os.Exit(1) } return val } ``` Sorting a slice given a comparison function. ``` func [T] SortSlice(s []T, less func(T, T) bool) { sort.Sort(&sorter{s, less}) } type [T] sorter struct { s []T less func(T, T) bool } func [T] (s *sorter[T]) Len() int { return len(s.s) } func [T] (s *sorter[T]) Less(i, j int) bool { return s.less(s[i], s[j]) } func [T] (s *sorter[T]) Swap(i, j int) { s.s[i], s.s[j] = s.s[j], s.s[i] } ``` Sorting a numeric slice (also works for string). ``` // This can be successfully instantiated for any type T that can be // used with <. func [T] SortNumericSlice(s []T) { SortSlice(s, func(a, b T) bool { return a < b }) } ``` Merging two channels into one. ``` func [T] Merge(a, b <-chan T) <-chan T { c := make(chan T) go func() { for a != nil && b != nil { select { case v, ok := <-a: if ok { c <- v } else { a = nil } case v, ok := <-b: if ok { c <- v } else { b = nil } } } close(c) }() return c } ``` Summing a slice. ``` // Works with any type that supports +. func [T] Sum(a []T) T { var s T for _, v := range a { s += v } return s } ``` A generic interface. ``` type [T] Equaler interface { Equal(T) bool } // Return the index in s of v1, or -1 if not found. func [T] Find(s []T, v1 T) int { eq, eqok := v1.(Equaler[T]) for i, v2 := range s { if eqok { if eq.Equal(v2) { return i } } else if reflect.DeepEqual(v1, v2) { return i } } return -1 } type S []int // Slice equality that treats nil and S{} as equal. func (s1 S) Equal(s2 S) bool { if len(s1) != len(s2) { return false } for i, v1 := range s1 { if v1 != s2[i] { return false } } return true } var i = Find([]S{S{1, 2}}, S{1, 2}) ``` Joining sequences; works for any `T` that supports `len`, `copy` to `[]byte`, and conversion from `[]byte`; in other words, works for `[]byte` and `string`. ``` func [T] Join(a []T, sep T) T { if len(a) == 0 { return T([]byte{}) } if len(a) == 1 { return a[0] } n := len(sep) * (len(a) - 1) for _, v := range a { n += len(v) } b := make([]byte, n) bp := copy(b, a[0]) for _, v := range a[1:] { bp += copy(b[bp:], sep) bp += copy(b[bp:], v) } return T(b) } ``` ## Syntax/Semantics Summary That completes the description of the language changes. We now turn to implementation details. When considering this language proposal, consider it in two parts. First, make sure the syntax and semantics are clean, useful, orthogonal, and in the spirit of Go. Second, make sure that the implementation is doable and acceptably efficient. I want to stress the two different parts because the implementation proposal is complex. Do not let the complexity of the implementation influence your view of the syntax and semantics. Most users of Go will not need to understand the implementation. ## Comparison to other languages ### C Type parameters in C are implemented via preprocessor macros. The system described here can be seen as a macro system. However, unlike in C, each parameterized function must be complete and compilable by itself. The result is in some ways less powerful than C preprocessor macros, but does not suffer from problems of namespace conflict and does not require a completely separate language (the preprocessor language) for implementation. ### C++ The system described here can be seen as a subset of C++ templates. Go’s very simple name lookup rules mean that there is none of the confusion of dependent vs. non-dependent names. Go’s lack of function overloading removes any concern over just which instance of a name is being used. Together these permit the explicit accumulation of constraints when compiling a generalized function, whereas in C++ where it’s nearly impossible to determine whether a type may be used to instantiate a template without effectively compiling the instantiated template and looking for errors (or using concepts, proposed for later addition to the language). Also, since instantiating a parameterized types always instantiates all methods, there can’t be any surprises as can arise in C++ when code separate from both the template and the instantiation calls a previously uncalled method. C++ template metaprogramming uses template specialization, non-type template parameters, variadic templates, and SFINAE to implement a Turing complete language accessible at compile time. This is very powerful but at the same time has significant complexities: the template metaprogramming language has a baroque syntax, no variables or non-recursive loops, and is in general completely different from non-template C++. The system described here does not support anything similar to template metaprogramming for Go. I believe this is a feature. I think the right way to implement such features in Go would be to add support in the go tool for writing Go code to generate Go code, most likely using the go/ast package and friends, which is in turn compiled into the final program. This would mean that the metaprogramming language in Go is itself Go. ### Java I believe this system is slightly more powerful than Java generics, in that it permits direct operations on basic types without requiring explicit methods (that is, the methods are in effect generated automatically). This system also does not use type erasure. Type boxing is minimized. On the other hand there is of course no function overloading, and there is nothing like covariant return types. ## Type Checking A parameterized type is valid if there is at least one set of type arguments that can instantiate the parameterized type into a valid non-parameterized type. This means that type checking a parameterized type is the same as type checking a non-parameterized type, but the type parameters are assumed to be valid. ``` type [T] M1 map[T][]byte // Valid. type [T] M2 map[[]byte]T // Invalid. Slices can not // be map keys. ``` A parameterized function is valid if the values of parameterized types are used consistently. Here we describe consistency checking that may be performed while compiling the parameterized function. Further type checking will occur when the function is instantiated. It is not necessary to understand the details of these type checking rules in order to use parameterized functions. The basic idea is simple: a parameterized function can be used by replacing all the type parameters with type arguments. I originally thought it would be useful to describe an exact set of rules so that all compilers would be consistent in rejecting parameterized functions that can never be instantiated by any type argument. However, I now think this becomes too strict. We don’t want to say that a future, smarter, compiler must accept a parameterized function that can never be instantiated even if this set of rules permits it. I don’t think complete consistency of handling of invalid programs is essential. These rules are still useful as a guide to compiler writers. Each parameterized function will use a set of types unknown at compile time. The initial set of those types will be the type parameters. Analyzing the function will add new unknown types. Each unknown type will be annotated to indicate how it is determined from the type parameters. In the following discussion an unknown type will start with `U`, a known type with `K`, either known or unknown with `T`, a variable or expression of unknown type will start with `v`, an expression with either known or unknown type will start with `e`. Type literals that use unknown types produce unknown types. Each identical type literal produces the same unknown type, different type literals produce different unknown types. The new unknown types will be given the obvious annotation: `[]U` is the type of a slice of the already identified type `U`, and so forth. Each unknown type may have one or more restrictions, listed below. * `[]U` * _indexable with value type `U`_ * _sliceable with result type `U`_ * `[N]U` (for some constant expression `N`) * _indexable with value type `U`_ * _sliceable with result type `[]U`_ (`[]U` is a new unknown type) * `*U` * _points to type `U`_ * `map[T1]T2` (assuming either `T1` or `T2` is unknown) * _indexable with value type `T2`_ * _map type with value type `T2`_ * `struct { ... f U ... }` * _has field or method `f` of type `U`_ * _composite_ * `interface { ... F(anything) U ... }` * `func ( ... U ... )` (anything) or `func (anything) ( ... U ...)` * _callable_ * chan `U` * _chan of type `U`_ Each use of an unknown type as the type of a composite literal adds the restriction _composite_. Each expression using a value `v` of unknown type `U` may produce a value of some known type, some previously seen unknown type, or a new unknown type. A use of a value that produces a value of a new unknown type may add a restriction to `U`. * `v.F`, `U.F` * If `U` has the restriction _has field or method `F` of type `U2`_ then the type of this expression is `U2`. * Otherwise a new unknown type `U2` is created annotated as the type of `U.F`, `U` gets the restriction _has field or method `F` of type `U2`_, and the type of the expression is `U2`. * `v[e]` * If `U` has the restriction _indexable with value type `U2`_, then the type of the expression is `U2`. * If the type of `e` is known, and it is not integer, then a new unknown type `U2` is created, `U` gets the restrictions _indexable with value type `U2`_ and _map type with value type `U2`_ and the type of the result is `U2`. * Otherwise a new unknown type `U2` is created annotated as the element type of `U`, `U` gets the restriction _indexable with value type `U2`_, and the type of the result is `U2`. * `e[v]` (where the type of `e` is known) * If the type of `e` is slice, string, array, or pointer to array, then `U` gets the restriction _integral_. * If the type of `e` is a map type, then `U` gets the restriction _comparable_. * Otherwise this is an error, as usual. * `v[e1:e2]` or `v[e1:e2:e3]` * If any of the index expressions have unknown type, those unknown types get the restriction _integral_. * If `U` has the restriction _sliceable with result type `U2`_, then the type of the result is `U2`. * Otherwise a new unknown type `U2` is created annotated as the slice type of `U`, `U` gets the restriction _sliceable with result type `U2`_, and the type of the result is `U2`. (In many cases `U2` is the same as `U`, but not if `U` is an array type.) * `v.(T)` * Does not introduce any restrictions; type of value is T. * `v1(e2)` * This is a function call, not a type conversion. * `U1` gets the restriction _callable_. * Does not introduce any restrictions on the arguments. * If necessary, new unknown types are introduced for the result types, annotated as the type of the corresponding result parameter. * `e1(v2)` * This is a function call, not a type conversion. * If `e1` is known to be a parameterized function, and any of the arguments have unknown type, then any restrictions on `e1`’s type parameters are copied to the unknown types of the corresponding arguments. * `e1(v2...)` * This is the case with an actual ellipsis in the source code. * `e1` is handled as though the ellipsis were not present. * If `U2` does not already have the restriction _sliceable_, a new unknown type `U3` is created, annotated as the element type of `U2`, and `U2` gets the restriction _sliceable with result type `U3`_. * `v1 + e2`, `e2 + v1` * `U1` gets the restriction _addable_. * As usual, the type of the expression is the type of the first operand. * `v1 {-,*,/} e2`, `e2 {-,*,/} v1` * `U1` gets the restriction _numeric_. * Type of expression is type of first operand. * `v1 {%,&,|,^,&^,<<,>>} e2`, `e2 {%,&,|,^,&^,<<,>>} v1` * `U1` gets the restriction _integral_. * Type of expression is type of first operand. * `v1 {==,!=} e2`, `e2 {==,!=} v`1 * `U1` gets the restriction _comparable_; expression has untyped boolean value. * `v1 {<,<=,>,>=} e2`, `e2 {<,<=,>,>=} v1` * `U1` gets the restriction _ordered_; expression has untyped boolean value. * `v1 {&&,||} e2`, `e2 {&&,||} v1` * `U1` gets the restriction _boolean_; type of expression is type of first operand. * `!v` * `U` gets the restriction _boolean_; type of expression is `U`. * &v * Does not introduce any restrictions on `U`. * Type of expression is new unknown type as for type literal `*U`. * `*v` * If `U` has the restriction _points to type `U2`_, then the type of the expression is `U2`. * Otherwise a new unknown type `U2` is created annotated as the element type of `U`, `U` gets the restriction _points to type `U2`_, and the type of the result is `U2`. * `<-v` * If `U` has the restriction _chan of type `U2`_, then the type of the expression is `U2`. * Otherwise a new unknown type `U2` is created annotated as the element type of `U`, `U` gets the restriction _chan of type `U2`_, and the type of the result is `U2`. * `U(e)` * This is a type conversion, not a function call. * If `e` has a known type `K`, `U` gets the restriction _convertible from `K`_. * The type of the expression is `U`. * `T(v)` * This is a type conversion, not a function call. * If `T` is a known type, `U` gets the restriction _convertible to `T`_. * The type of the expression is `T`. Some statements introduce restrictions on the types of the expressions that appear in them. * `v <- e` * If `U` does not already have a restriction _chan of type `U2`_, then a new type `U2` is created, annotated as the element type of `U`, and `U` gets the restriction _chan of type `U2`_. * `v++`, `v--` * `U` gets the restriction numeric. * `v = e` (may be part of tuple assignment) * If `e` has a known type `K`, `U` gets the restriction _assignable from `K`_. * `e = v` (may be part of tuple assignment) * If `e` has a known type `K`, `U` gets the restriction _assignable to `K`_. * `e1 op= e2` * Treated as `e1 = e1 op e2`. * return e * If return type is known, treated as an assignment to a value of the return type. The goal of the restrictions listed above is not to try to handle every possible case. It is to provide a reasonable and consistent approach to type checking of parameterized functions and preliminary type checking of types used to instantiate those functions. It’s possible that future compilers will become more restrictive; a parameterized function that can not be instantiated by any type argument is invalid even if it is never instantiated, but we do not require that every compiler diagnose it. In other words, it’s possible that even if a package compiles successfully today, it may fail to compile in the future if it defines an invalid parameterized function. The complete list of possible restrictions is: * _addable_ * _integral_ * _numeric_ * _boolean_ * _comparable_ * _ordered_ * _callable_ * _composite_ * _points to type `U`_ * _indexable with value type `U`_ * _sliceable with value type `U`_ * _map type with value type `U`_ * _has field or method `F` of type `U`_ * _chan of type `U`_ * _convertible from `U`_ * _convertible to `U`_ * _assignable from `U`_ * _assignable to `U`_ Some restrictions may not appear on the same type. If some unknown type has an invalid pair of restrictions, the parameterized function is invalid. * _addable_, _integral_, _numeric_ are invalid if combined with any of * _boolean_, _callable_, _composite_, _points to_, _indexable_, _sliceable_, _map type_, _chan of_. * boolean is invalid if combined with any of * _comparable_, _ordered_, _callable_, _composite_, _points to_, _indexable_, _sliceable_, _map type_, _chan of_. * _comparable_ is invalid if combined with _callable_. * _ordered_ is invalid if combined with any of * _callable_, _composite_, _points to_, _map type_, _chan of_. * _callable_ is invalid if combined with any of * _composite_, _points to_, _indexable_, _sliceable_, _map type_, _chan of_. * _composite_ is invalid if combined with any of * _points to_, _chan of_. * _points to_ is invalid if combined with any of * _indexable_, _sliceable_, _map type_, _chan of_. * _indexable_, _sliceable_, _map type_ are invalid if combined with _chan of_. If one of the type parameters, not some generated unknown type, has the restriction assignable from `T` or assignable to `T`, where `T` is a known named type, then the parameterized function is invalid. This restriction is intended to catch simple errors, since in general there will be only one possible type argument. If necessary such code can be written using a type assertion. As mentioned earlier, type checking an instantiation of a parameterized function is conceptually straightforward: replace all the type parameters with the type arguments and make sure that the result type checks correctly. That said, the set of restrictions computed for the type parameters can be used to produce more informative error messages at instantiation time. In fact, not all the restrictions are used when compiling the parameterized function, but they will still be useful at instantiation time. ## Implementation This section describes a possible implementation that yields a good balance between compilation time and execution time. The proposal in this section is only a suggestion. In general there are various possible implementations that yield the same syntax and semantics. For example, it is always possible to implement parameterized functions by generating a new copy of the function for each instantiation, where the new function is created by replacing the type parameters with the type arguments. This approach would yield the most efficient execution time at the cost of considerable extra compile time and increased code size. It’s likely to be a good choice for parameterized functions that are small enough to inline, but it would be a poor tradeoff in most other cases. This section describes one possible implementation with better tradeoffs. Type checking a parameterized function produces a list of unknown types, as described above. Create a new interface type for each unknown type. For each use of a value of that unknown type, add a method to the interface, and rewrite the use to be a call to the method. Compile the resulting function. Callers of the function will see a list of unknown types with corresponding interfaces, with a description for each method. The unknown types will all be annotated to indicate how they are derived from the type arguments. Given the type arguments used to instantiate the function, the annotations are sufficient to determine the real type corresponding to each unknown type. For each unknown type, the caller will construct a new copy of the type argument. For each method description for that unknown type, the caller will compile a method for the new type. The resulting type will satisfy the interface type that corresponds to the unknown type. If the type argument is itself an interface type, the new copy of the type will be a struct type with a single member that is the type argument, so that the new copy can have its own methods. (This will require slight but obvious adjustments in the instantiation templates shown below.) If the type argument is a pointer type, we grant a special exception to permit its copy to have methods. The call to the parameterized function will be compiled as a conversion from the arguments to the corresponding new types, and a type assertion of the results from the interface types to the type arguments. We will call the unknown types `Un`, the interface types created while compiling the parameterized function `In`, the type arguments used in the instantiation `An`, and the newly created corresponding types `Bn`. Each `Bn` will be created as though the compiler saw `type Bn An` followed by appropriate method definitions (modified as described above for interface and pointer types). To show that this approach will work, we need to show the following: * Each operation using a value of unknown type can be implemented as a call to a method `M` on an interface type `I`. * We can describe each `M` for each `I` in such a way that we can instantiate the methods for any valid type argument; for simplicity we can describe these methods as templates in the form of Go code, and we call them _instantiation templates_. * All valid type arguments will yield valid method implementations. * All invalid type arguments will yield some invalid method implementation, thus causing an appropriate compilation error. (Frankly this description does not really show that; I’d be happy to see counter-examples.) ### Simple expressions Simple expressions turn out to be easy. For example, consider the expression `v.F` where `v` has some unknown type `U1`, and the expression has the unknown type `U2`. Compiling the original function will generate interface types `I1` and `I2`. Add a method `$FieldF` to `I1` (here I’m using `$` to indicate that this is not a user-callable method; the actual name will be generated by the compiler and never seen by the user). Compile `v.F` as `v.$FieldF()` (while compiling the code, `v` has type `I1`). Write out an instantiation template like this: ``` func (b1 *B1) $FieldF() I2 { return B2(A1(*b1).F) } ``` When the compiler instantiates the parameterized function, it knows the type arguments that correspond to `U1` and `U2`. It has defined new names for those type arguments, `B1` and `B2`, so that it has something to attach methods to. The instantiation template is used to define the method `$FieldF` by simply compiling the method in a scope such that `A1`, `B1`, and `B2` refer to the appropriate types. The conversion of `*b1` (type `B1`) will always succeed, as `B1` is simply a new name for `A1`. The reference to field (or method) `F` will succeed exactly when `B1` has a field (or method) `F`; that is the correct semantics for the expression `v.F` in the original parameterized function. The conversion to type `B2` will succeed when `F` has the type `A2`. The conversion of the return value from type `B2` to type `I2` will always succeed, as `B2` implements `I2` by construction. Returning to the parameterized function, the type of `v.$FieldF()` is `I2`, which is correct since all references to the unknown type `U2` are compiled to use the interface type `I2`. An expression that uses two operands will take the second operand as a parameter of the appropriate interface type. The instantiation template will use a type assertion to convert the interface type to the appropriate type argument. For example, `v1[v2]`, where both expressions have unknown type, will be converted to `v1.$Index(v2)` and the instantiation template will be ``` func (b1 *B1) $Index(i2 I2) I3 { return B3(A1(*b1)[A2(*i2.(*B2))]) } ``` The type conversions get admittedly messy, but the basic idea is as above: convert the `Bn` values to the type arguments `An`, perform the operation, convert back to `Bn`, and finally return as type `In`. The method takes an argument of type `I2` as that is what the parameterized function will use; the type assertion to `*B2` will always succeed. This same general procedure works for all simple expressions: index expressions, slice expressions, relational operators, arithmetic operators, indirection expressions, channel receives, method expressions, method values, conversions. To be clear, each expression is handled independently, regardless of how it appears in the original source code. That is, `a + b - c` will be translated into two method calls, something like `a.$Plus(b).$Minus(c)` and each method will have its own instantiation template. ### Untyped constants Expressions involving untyped constants may be implemented by creating a specific method for the specific constants. That is, we can compile `v + 10` as `v.$Add10()`, with an instantiation template ``` func (b1 *B1) $Add10() I1 { return B1(A1(*b1) + 10) } ``` Another possibility would be to compile it as `v.$AddX(10)` and ``` func (b1 *B1) $AddX(x int64) { return B1(A1(*b1) + A1(x)) } ``` However, this approach in general will require adding some checks in the instantiation template so that code like `v + 1.5` is rejected if the type argument of `v` is not a floating point or complex type. ### Logical operators The logical operators `&&` and `||` will have to be expanded in the compiled form of the parameterized function so that the operands will be evaluated only when appropriate. That is, we can not simply replace `&&` and `||` of values of unknown types with method calls, but must expand them into if statements while retaining the correct order of evaluation for the rest of the expression. In the compiler this can be done by rewriting them using a compiler-internal version of the C `?:` ternary operator. ### Address operator The address operator requires some additional attention. It must be combined with the expression whose address is being taken. For example, if the parameterized function has the expression `&v[i]`, the compiler must generate a `$AddrI` method, with an instantiation template like ``` func (b1 *B1) $AddrI(i2 I2) I3 { return B3(&A1(*b1)[A2(i2.(*B2))]) } ``` ### Type assertions Type assertions are conceptually simple, but as they are permitted for values of unknown type they require some additional attention in the instantiation template. Code like `v.(K)`, where `K` is a known type, will be compiled to a method call with no parameters, and the instantiation template will look like ``` func (b1 B1) $ConvK() K { a1 := A1(b1) var e interface{} = a1 return e.(K) } ``` Introducing `e` avoids an invalid type assertion of a non-interface type. For `v.(U2)` where `U2` is an unknown type, the instantiation template will be similar: ``` func (b1 B1) $ConvU() I2 { a1 := A1(b1) var e interface{} = a1 return B2(e.(A2)) } ``` This will behave correctly whether `A2` is an interface or a non-interface type. ### Function calls A call to a function of known type requires adding implicit conversions from the unknown types to the known types. Those conversions will be implemented by method calls as described above. Only conversions valid for function calls should be accepted; these are the set of conversions valid for assignment statements, described below. A call to a function of unknown type can be implemented as a method call on the interface type holding the function value. Multiple methods may be required if the function is called multiple times with different unknown types, or with different numbers of arguments for a variadic function. In each case the instantiation template will simply be a call of the function, with the appropriate conversions to the type arguments of the arguments of unknown type. A function call of the form `F1(F2())` where neither function is known may need a method all by itself, since there is no way to know how many results `F2` returns. ### Composite literals A composite literal of a known type with values of an unknown type can be handled by inserting implicit type conversions to the appropriate known type. A composite literal of an unknown type can not be handled using the mechanisms described above. The problem is that there is no interface type where we can attach a method to create the composite literal. We need some value of type `Bn` with a method for us to call, but in the general case there may not be any such value. To implement this we require that the instantiation place a value of an appropriate interface type in the function’s closure. This can always be done as generalized functions only occur at top-level, so they do not have any other closure (function literals are discussed below). We compile the code to refer to a value `$imaker` in the closure, with type `Imaker`. The instantiation will place a value with the appropriate type `Bmaker` in the function instantiation's closure. The value is irrelevant as long as it has the right type. The methods of `Bmaker` will, of course, be those of `Imaker`. Each different composite literal in the parameterized function will be a method of `Imaker`. A composite literal of an unknown type without keys can then be implemented as a method of `Imaker` whose instantiation template simply returns the composite literal, as though it were an operator with a large number of operands. A composite literal of an unknown type with keys is trickier. The compiler must examine all the keys. * If any of the keys are expressions or constants rather than simple names, this can not be a struct literal. We can generate a method that passes all the keys and values, and the instantiation template can be the composite literal using those keys and values. In this case if one of the keys is an undefined name, we can give an error while compiling the parameterized function. * Otherwise, if any of the names are not defined, this must be a struct literal. We can generate a method that passes the values, and the instantiation template can be the composite literal with the literal names and the value arguments. * Otherwise, we call a method passing all the keys and values. The instantiation template is the composite literal with the key and value arguments. If the type argument is a struct, the generated method will ignore the key values passed in. For example, if the parameterized function uses the composite literal `U{f: g}` and there is a local variable named `f`, this is compiled into `imaker.$CompLit1(f, g)`, and the instantiation template is ``` func (bm Bmaker) $CompLit1(f I1, g I2) I3 { return bm.$CompLit2(A1(f.(B1)), A2(g.(B2))) } func (Bmaker) $CompLit2(f A1, g A2) I3 { return B3(A3{f: g}) } ``` If `A3`, the type argument for `U`, is a struct, then the parameter `f` is unused and the `f` in the composite literal refers to the field `f` of `A3` (it is an error if no such field exists). If `A3` is not a struct, then `f` must be an appropriate key type for `A3` and the value is used. ### Function literals A function literal of known type may be compiled just like any other parameterized function. If a maker variable is required for constructs like composite literals, it may be passed from the enclosing function’s closure to the function literal’s closure. A function literal of unknown type requires that the function have a maker variable, as for composite literals, above. The function literal is compiled as a parameterized function, and parameters of unknown type are received as interface types as we are describing. The type of the function literal will itself be an unknown type, and will have corresponding real and interface types just like any other unknown type. Creating the function literal value requires calling a method on the maker variable. That method will create a function literal of known type that simply calls the compiled form of the function literal. For example: ``` func [T] Counter() func() T { var c T return func() T { c++ return c } } ``` This is compiled using a maker variable in the closure. The unknown type `T` will get an interface type, called here `I1`; the unknown type `func() T` will get the interface type `I2`. The compiled form of the function will call a method on the maker variable, passing a closure, something along the lines of ``` type CounterTClosure struct { c *I1 } func CounterT() I2 { var c I1 closure := CounterTClosure{&c} return $bmaker.$fnlit1(closure) } ``` The function literal will get its own compiled form along the lines of ``` func fnlit1(closure CounterTClosure) I1 { (*closure.c).$Inc() return *closure.c } ``` The compiled form of the function literal does not have to correspond to any particular function signature, so it’s fine to pass the closure as an ordinary parameter. The compiler will also generate instantiation templates for callers of `Counter`. ``` func (Bmaker) $fnlit1(closure struct { c *I1}) I2 { return func() A1 { i1 := fnlit1(closure) b1 := i1.(B1) return A1(b1) } } func (b1 *B1) $Inc() { a1 := A1(*b1) a1++ *b1 = B1(a1) } ``` This instantiation template will be compiled with the type argument `A1` and its method-bearing copy `B1`. The call to `Counter` will use an automatically inserted type assertion to convert from `I2` to the type argument `B2` aka `func() A1`. This gives us a function literal of the required type, and tracing through the calls above shows that the function literal behaves as it should. ### Statements Many statements require no special attention when compiling a parameterized function. A send statement is compiled as a method on the channel, much like a receive expression. An increment or decrement statement is compiled as a method on the value, as shown above. A switch statement may require calling a method for equality comparison, just like the `==` operator. #### Assignment statements Assignment statements are straightforward to implement but require a bit of care to implement the proper type checking. When compiling the parameterized function it's impossible to know which types may be assigned to any specific unknown type. The type checking could be done using annotations of the form _`U1` must be assignable to `U2`_, but here I’ll outline a method that requires only instantiation templates. Assignment from a value of one unknown type to the same unknown type is just an ordinary interface assignment. Otherwise assignment is a method on the left-hand-side value (which must of course be addressable), where the method is specific to the type on the right hand side. ``` func (b1 *B1) $AssignI2(i2 I2) { var a1 A1 = A2(i2.(B2)) *b1 = B1(a1) } ``` The idea here is to convert the unknown type on the right hand side back to its type argument `A2`, and then assign it to a variable of the type argument `A1`. If that assignment is not valid, the instantiation template can not be compiled with the type arguments, and the compiler will give an error. Otherwise the assignment is made. Return statements are implemented similarly, assigning values to result parameters. The code that calls the parameterized function will handle the type conversions at the point of the call. #### Range clauses A for statement with a range clause may not know anything about the type over which it is ranging. This means that range clauses must in general be implemented using compiler built-in functions that are not accessible to ordinary programs. These will be similar to the runtime functions that the compiler already uses. A statement: ``` for v1 := range v2 {} ``` could be compiled as something like: ``` for v1, it, f := v2.$init(); !f; v1, f = v2.$next(it) {} ``` with instantiation templates that invoke compiler built-in functions: ``` func (b2 B2) $init() (I1, I3, bool) { return $iterinit(A2(b2)) } func (b2 B2) $next(I3) (I1, bool) { return $iternext(A2(b2), I3.(A3)) } ``` Here I’ve introduced another unknown type `I3` to represent the current iteration state. If the compiler knows something specific about the unknown type, then more efficient techniques can be used. For example, a range over a slice could be written using `$Len` and `$Index` methods. #### Type switches Type switches, like type assertions, require some attention because the value being switched on may have a non-interface type argument. The instantiation method will implement the type switch proper, and pass back the index of the select case. The parameterized function will do a switch on that index to choose the code to execute. ``` func [T] Classify(v T) string { switch v.(type) { case []byte: return “slice” case string: return “string” default: return “unknown” } } ``` The parameterized function is compiled as ``` func ClassifyT(v I1) string { switch v.$Type1() { case 0: return “slice” case 1: return “string” case 2: return “unknown” } } ``` The instantiation template will be ``` func (b1 B1) $Type1() int { var e interface{} = A1(b1) switch e.(type) { case []byte: return 0 case string return 1 default return 2 } } ``` The instantiation template will have to be compiled in an unusual way: it will have to permit duplicate types. That is because a type switch that uses unknown types in the cases may wind up with the same type in multiple cases. If that happens the first matching case should be used. #### Select statements Select statements will be implemented much like type switches. The select statement proper will be in the instantiation template. It will accept channels and values to send as required. It will return an index indicating which case was chosen, and a receive value (an empty interface) and a `bool` value. The effect will be fairly similar to `reflect.Select`. ### Built-in functions Most built-in functions when called with unknown types are simply methods on their first argument: `append`, `cap`, `close`, `complex`, `copy`, `delete`, `imag`, `len`, `real`. Other built-in functions require no special handling for parameterized functions: `panic`, `print`, `println`, `recover`. The built-in functions `make` and `new` will be implemented as methods on a special maker variable, as described above under composite literals. ### Methods of parameterized types A parameterized type may have methods, and those methods may have arguments and results of unknown type. Any instantiation of the parameterized type must have methods with the appropriate type arguments. That means that the compiler must generate instantiation templates that will serve as the methods of the type instantiation. Those templates will call the compiled form of the method with the appropriate interface types. ``` type [T] Vector []T func [T] (v Vector[T]) Len() int { return len(v) } func [T] (v Vector[T]) Index(i int) T { return v[i] } type Readers interface { Len() int Index(i int) io.Reader } type VectorReader struct { Vector[io.Reader] } var _ = VectorReader{}.(Readers) ``` In this example, the type `VectorReader` inherits the methods of the embedded field `Vector[io.Reader]` and therefore implements the non-parameterized interface type `Readers`. When implementing this, the compiler will assign interface types for the unknown types `T` and `[]T`; here those types will be `I1` and `I2`, respectively. The methods of the parameterized type Vector will be compiled as ordinary functions: ``` func $VectorLen(i2 I2) int { return i2.$len() } func $VectorIndex(i2 I2, i int) I1 { return i2.$index(i) } ``` The compiler will generate instantiation templates for the methods: ``` func (v Vector) Len() int { return $VectorLen(I2(v)) } func (v Vector) Index(i int) A1 { return A1($VectorIndex(I2(v), i).(B1)) } ``` The compiler will also generate instantiation templates for the methods of the type `B2` that corresponds to the unknown type `[]T`. ``` func (b2 B2) $len() int { return len(A2(b2)) } func (b2 B2) $index(i int) I1 { return B1(A2(b2)[i]) } ``` With an example this simple there is a lot of effort for no real gain, but this does show how the compiler can use the instantiation templates to define methods of the correct instantiated type while the bulk of the work is still done by the parameterized code using interface types. ### Implementation summary I believe that covers all aspects of the language and shows how they may be implemented in a manner that is reasonably efficient both in compile time and execution time. There will be code bloat in that instantiation templates may be compiled multiple times for the same type, but the templates are, in general, small. Most are only a few instructions. There will be run time cost in that many operations will require a method call rather than be done inline. This cost will normally be small. Where it is significant, it will always be possible to manually instantiate the function for the desired type argument. While the implementation technique described here is general and covers all cases, real compilers are likely to implement a blend of techniques. Small parameterized functions will simply be inlined whenever they are called. Parameterized functions that only permit a few types, such as the `Sum` or `Join` examples above, may simply be compiled once for each possible type in the package where they are defined, with callers being compiled to simply call the appropriate instantiation. Implementing type parameters using interface methods shows that type parameters can be viewed as implicit interfaces. Rather than explicitly defining the methods of a type and then calling those methods, type parameters implicitly define an interface by the way in which values of that type are used. In order to get good stack tracebacks and a less confusing implementation of `runtime.Caller`, it will probably be desirable to, by default, ignore the methods generated from instantiation templates when unwinding the stack. However, it might be best if they could influence the reporting of the parameterized function in a stack backtrace, so that it could indicate that types being used. I don’t yet know if that would be helpful or feasible. ## Deployment This proposal is backward compatible with Go 1, in that all Go 1 programs will continue to compile and run identically if this proposal is adopted. That leads to the following proposal. * Add support for type parameters to a future Go release 1.n, but require a command line option to use them. This will let people experiment with the new facility. * Add easy support for that command line option to the go tool. * Add a `// +build` constraint for the command line option. * Try out modified versions of standard packages where it seems useful, putting the new versions under the exp directory. * Decide whether to keep the facility for Go 2, in which the standard packages would be updated. In the standard library, the most obvious place where type parameters would be used is to introduce compile-time-type-safe containers, like `container/list` but with the type of the elements known at compile time. It would also be natural to add to the `sort` package to make it easier to sort slices with less boilerplate. Other new packages would be `algorithms` (find the max/min/average of a collection, transform a collection using a function), `channels` (merge channels into one, multiplex one channel into many), `maps` (copy a map). Type parameters could be used to partially unify the `bytes` and `strings` packages. However, the implementation would be based on using an unknown type that could be either `[]byte` or `string`. Values of unknown type are passed as interface values. Neither `[]byte` nor `string` fits in an interface value, so the values would have be passed by taking their address. Most of the functions in the package are fairly simple; one would only want to unify them if they could be inlined, or if escape analysis were smart enough to avoid pushing the values into the heap, or if the compiler were smart enough to see that only two types would work and to compile both separately. Similar considerations apply to supporting a parameterized `Writer` interface that accepts either `[]byte` or `string`. On the other hand, if the compiler has the appropriate optimizations, it would be convenient to write unified implementations for `Write` and `WriteString` methods. The perhaps surprising conclusion is that type parameters permit new kinds of packages, but need not lead to significant changes in existing packages. Go does after all already support generalized programming, using interfaces, and the existing packages were designed around that fact. In general they already work well. Adding type parameters does not change that. It opens up the ability to write new kinds of packages, ones that have not been written to date because they are not well supported by interfaces. ## Summary I think this is the best proposal so far. However, it will not be adopted. The syntax still needs work. A type is defined as `type [T] Vector []T` but is used as `Vector[int]`, which means that the brackets are on the left in the definition but on the right in the use. It would be much nicer to write `type Vector[T] []T`, but that is ambiguous with an array declaration. That suggests the possibility of using double square brackets, as in `Vector[[int]]`, or perhaps some other character(s). The type deduction rules are too complex. We want people to be able to easily use a `Transform` function, but the rules required to make that work without explicitly specifying type parameters are very complex. The rules for untyped constants are also rather hard to follow. We need type deduction rules that are clear and obvious, so that there is no confusion as to which type is being used. The implementation description is interesting but very complicated. Is any compiler really going to implement all that? It seems likely that any initial implementation would just use macro expansion, and unclear whether it would ever move beyond that. The result would be increased compile times and code bloat.
36460
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/36460/all_pattern.txt
# This example illustrates the relationship between the 'all' pattern and # the dependencies of the main module. # 'go list -deps' lists transitive imports of non-tests in the main module. $ go1.14rc1 list -f '{{with .Module}}{{.Path}}{{end}}' -deps ./... | sort -u example.com/a example.com/b example.com/main # 'go list -deps -test' lists transitive imports of tests and non-tests in the # main module. $ go1.14rc1 list -f '{{with .Module}}{{.Path}}{{end}}' -deps -test ./... | sort -u example.com/a example.com/b example.com/main example.com/t example.com/u # 'go list all' lists the fixpoint of iterating 'go list -deps -test' starting # with the packages in the main module. $ go1.14rc1 list -f '{{with .Module}}{{.Path}}{{end}}' all | sort -u example.com/a example.com/b example.com/c example.com/main example.com/t example.com/u example.com/w $ go1.14rc1 list -f '{{with .Module}}{{.Path}}{{end}}' -deps -test $(go1.14rc1 list -deps -test ./... | grep -v '[ .]') | sort -u example.com/a example.com/b example.com/c example.com/main example.com/t example.com/u example.com/w # 'go mod vendor' copies in only the packages transitively imported by the main # module. As a result, the 'all' and '...' patterns report fewer packages when # using '-mod=vendor'. $ go1.14rc1 mod vendor $ go1.14rc1 list -mod=vendor all example.com/a example.com/b example.com/main example.com/t example.com/u -- go.mod -- module example.com/main go 1.14 require ( example.com/a v0.1.0 example.com/b v0.1.0 example.com/t v0.1.0 ) replace ( example.com/a v0.1.0 => ./a example.com/b v0.1.0 => ./b example.com/c v0.1.0 => ./c example.com/t v0.1.0 => ./t example.com/u v0.1.0 => ./u example.com/w v0.1.0 => ./w ) -- main.go -- package main import _ "example.com/a" func main() {} -- main_test.go -- package main_test import _ "example.com/t" -- a/go.mod -- module example.com/a go 1.14 require ( example.com/b v0.1.0 example.com/c v0.1.0 ) -- a/a.go -- package x import _ "example.com/b" -- a/a_test.go -- package x_test import _ "example.com/c" -- b/go.mod -- module example.com/b go 1.14 -- b/b.go -- package b -- c/go.mod -- module example.com/c go 1.14 -- c/c.go -- package c -- t/go.mod -- module example.com/t go 1.14 require ( example.com/u v0.1.0 example.com/w v0.1.0 ) -- t/t.go -- package t import _ "example.com/u" -- t/t_test.go -- package t_test import _ "example.com/w" -- u/go.mod -- module example.com/u go 1.14 -- u/u.go -- package u -- w/go.mod -- module example.com/w go 1.14 -- w/w.go -- package w
36460
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/36460/registry_incompatibility.txt
# This example illustrates a case in which a seemingly-irrelevant requirements # in one module fixes an incompatibility with a package in another. # # Two packages that do not import each other may interact via a third (mutual) # dependency, so their module requirements must be respected even if those # requirements do not directly correspond to package imports. # Before discovering the import of package c, we depend on b v1.0.0. $ go1.14rc1 list -m b b v1.0.0 => ./b0 # When we import package c, we must update the selected version of b according # to c's requirements, _even though_ neither package imports the other. # Otherwise, the program will panic at run time. $ go1.14rc1 build c go: found c in c v1.0.0 $ go1.14rc1 list -m b b v1.0.1 => ./b1 -- go.mod -- module main go 1.15 require ( a v1.0.0 b v1.0.0 d v1.0.0 ) replace ( a v1.0.0 => ./a b v1.0.0 => ./b0 b v1.0.1 => ./b1 c v1.0.0 => ./c d v1.0.0 => ./d ) -- main.go -- package main import ( _ "a" // Adding an import of c should increase the selected version of b to 1.0.1 // in order to avoid a registration collision caused by a bug in b 1.0.0. // Module b is not otherwise relevant to package c or its containing module. _ "c" ) func main() {} -- a/go.mod -- module a go 1.15 require b v1.0.0 -- a/a.go -- package a import _ "b" -- b0/go.mod -- module b go 1.15 require d v1.0.0 -- b0/b.go -- package b import "d" func init() { d.Register("c") } // This is a bug that breaks package c. -- b1/go.mod -- module b go 1.15 require d v1.0.0 -- b1/b.go -- package b import "d" func init() { d.Register("b") } // The bug has been fixed. -- c/go.mod -- module c require ( b v1.0.1 d v1.0.0 ) -- c/c.go -- package c import "d" func init() { d.Register("c") } -- c/tidy/tidy.go -- // +build tidy-only package tidy // Maintain a false dependency on b v1.0.1, to prevent b v1.0.0 // from erroneously registering itself with our path if anything // that imports us also imports package b. import _ "b" -- d/go.mod -- module d go 1.15 -- d/d.go -- package d var registered = map[string]bool{} func Register(key string) { if registered[key] { panic("duplicate registation for " + key) } registered[key] = true }
12800
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/12800/sweep-flow.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" viewBox="0 0 626 164" stroke-miterlimit="10" id="svg2" inkscape:version="0.48.4 r9939" width="100%" height="100%" sodipodi:docname="sweep-flow.svg" style="fill:none;stroke:none"> <metadata id="metadata189"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> </cc:Work> </rdf:RDF> </metadata> <defs id="defs187" /> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview185" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.37288834" inkscape:cx="416" inkscape:cy="28" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg2" /> <clipPath id="p.0"> <path d="m 0,0 1024,0 0,768 L 0,768 0,0 z" clip-rule="nonzero" id="path5" inkscape:connector-curvature="0" /> </clipPath> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path11" d="m 224,88 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path13" d="m 224,88 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path15" d="m 224,129.1458 -2.24918,-2.24915 2.24918,6.17954 2.24918,-6.17954 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path17" d="m 168,88 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path19" d="m 168,88 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path21" d="m 168,129.1458 -2.24918,-2.24915 2.24918,6.17954 2.24918,-6.17954 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path23" d="m 512,8 0,152" /> <path style="stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path25" d="m 512,8 0,152" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path27" d="m 312,88 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path29" d="m 312,88 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path31" d="m 312,129.1458 -2.24918,-2.24915 2.24918,6.17954 2.24918,-6.17954 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path33" d="m 368,88 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path35" d="m 368,88 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path37" d="m 368,129.1458 -2.24918,-2.24915 2.24918,6.17954 2.24918,-6.17954 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path39" d="m 424,88 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path41" d="m 424,88 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path43" d="m 424,129.1458 -2.24915,-2.24915 2.24915,6.17954 2.24915,-6.17954 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path45" d="m 480,88 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path47" d="m 480,88 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path49" d="m 480,129.1458 -2.24915,-2.24915 2.24915,6.17954 2.24915,-6.17954 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path51" d="m 288,40 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path53" d="m 288,40 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path55" d="M 288,81.1458 285.75082,78.89665 288,85.07619 290.24918,78.89665 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path57" d="m 320,40 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path59" d="m 320,40 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path61" d="M 320,81.1458 317.75082,78.89665 320,85.07619 322.24918,78.89665 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path63" d="m 352,40 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path65" d="m 352,40 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path67" d="M 352,81.1458 349.75082,78.89665 352,85.07619 354.24918,78.89665 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path69" d="m 384,40 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path71" d="m 384,40 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path73" d="M 384,81.1458 381.75082,78.89665 384,85.07619 386.24918,78.89665 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path75" d="m 0,19 128,0 0,40 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path77" d="m 10.40625,45.91998 0,-13.59375 2.71875,0 3.21875,9.625 q 0.4375,1.34375 0.64063,2.01562 0.23437,-0.75 0.73437,-2.1875 l 3.25,-9.45312 2.42188,0 0,13.59375 -1.73438,0 0,-11.39063 -3.95312,11.39063 -1.625,0 -3.9375,-11.57813 0,11.57813 -1.73438,0 z M 32.2283,44.70123 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 L 25.50955,38.8731 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 Q 32.2907,45.40435 32.2282,44.70123 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.06321,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 6.24393,0 0,-13.59375 1.67188,0 0,7.75 3.95312,-4.01563 2.15625,0 -3.76562,3.65625 4.14062,6.20313 -2.0625,0 -3.25,-5.03125 -1.17187,1.125 0,3.90625 -1.67188,0 z m 16.04268,0 -1.54688,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70313,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32812,1.03125 0.53125,0.65625 0.82813,1.59375 0.29687,0.9375 0.29687,2 0,2.53125 -1.25,3.92188 -1.25,1.375 -3,1.375 -1.75,0 -2.73437,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79688,1.28125 2.14063,1.28125 1.09375,0 1.89062,-0.9375 0.79688,-0.95313 0.79688,-2.84375 0,-1.92188 -0.76563,-2.84375 -0.76562,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89062,0.95313 -0.79688,0.95312 -0.79688,2.75 z m 8.8601,-6.6875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85938 1.67187,0 0,9.85938 -1.67187,0 z m 7.78544,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52706,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 L 91.85405,38.8731 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 Q 98.6352,45.40435 98.5727,44.70123 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07885,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path79" d="m 144,0 112,0 0,32 -112,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path81" d="m 180.52133,26.91998 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.06323,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57812,-1.04687 1.0625,-1.375 0.48437,-0.34375 1.07812,-0.34375 0.84375,0 1.71875,0.54688 l -0.57812,1.54687 q -0.60938,-0.35937 -1.23438,-0.35937 -0.54687,0 -0.98437,0.32812 -0.42188,0.32813 -0.60938,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67187,0 z m 6.24393,0 0,-13.59375 1.67187,0 0,7.75 3.95313,-4.01563 2.15625,0 -3.76563,3.65625 4.14063,6.20313 -2.0625,0 -3.25,-5.03125 -1.17188,1.125 0,3.90625 -1.67187,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path83" d="m 256,8 0,152" /> <path style="stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path85" d="m 256,8 0,152" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path87" d="m 144,40 112,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path89" d="m 144,40 98.29166,0" /> <path style="fill:#0000ff;fill-rule:evenodd;stroke:#0000ff;stroke-width:4;stroke-linecap:butt" inkscape:connector-curvature="0" id="path91" d="M 242.29166,40 237.79331,44.49832 250.15241,40 237.79331,35.50168 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path93" d="m 256,40 136,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path95" d="m 256,40 120.84003,0" /> <path style="fill:#0000ff;fill-rule:nonzero;stroke:#0000ff;stroke-width:4;stroke-linecap:butt" inkscape:connector-curvature="0" id="path97" d="m 390,40 c 0,3.63403 -2.94595,6.57999 -6.57999,6.57999 -3.63403,0 -6.58001,-2.94596 -6.58001,-6.57999 0,-3.63403 2.94598,-6.57999 6.58001,-6.57999 C 387.05405,33.42001 390,36.36597 390,40 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path99" d="m 384,40 128,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path101" d="m 384,40 114.29169,0" /> <path style="fill:#0000ff;fill-rule:evenodd;stroke:#0000ff;stroke-width:4;stroke-linecap:butt" inkscape:connector-curvature="0" id="path103" d="M 498.2916,40 493.79331,44.49832 506.15238,40 493.79331,35.50168 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path105" d="m 384,0 128,0 0,32 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path107" d="m 428.52136,26.91998 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97827,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.06323,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57812,-1.04687 1.0625,-1.375 0.48437,-0.34375 1.07812,-0.34375 0.84375,0 1.71875,0.54688 l -0.57812,1.54687 q -0.60938,-0.35937 -1.23438,-0.35937 -0.54687,0 -0.98437,0.32812 -0.42188,0.32813 -0.60938,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67187,0 z m 6.24389,0 0,-13.59375 1.67188,0 0,7.75 3.95312,-4.01563 2.15625,0 -3.76562,3.65625 4.14062,6.20313 -2.0625,0 -3.25,-5.03125 -1.17187,1.125 0,3.90625 -1.67188,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path109" d="m 256,0 136,0 0,32 -136,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path111" d="m 297.614,23.9825 1.65625,-0.26562 q 0.14062,1 0.76562,1.53125 0.64063,0.51562 1.78125,0.51562 1.15625,0 1.70313,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48438,-0.89062 -0.34375,-0.21875 -1.70312,-0.5625 -1.84375,-0.46875 -2.5625,-0.79688 -0.70313,-0.34375 -1.07813,-0.9375 -0.35937,-0.60937 -0.35937,-1.32812 0,-0.65625 0.29687,-1.21875 0.3125,-0.5625 0.82813,-0.9375 0.39062,-0.28125 1.0625,-0.48438 0.67187,-0.20316 1.4375,-0.20316 1.17187,0 2.04687,0.34379 0.875,0.32812 1.28125,0.90625 0.42188,0.5625 0.57813,1.51562 l -1.625,0.21875 q -0.10938,-0.75 -0.65625,-1.17187 -0.53125,-0.4375 -1.5,-0.4375 -1.15625,0 -1.64063,0.39062 -0.48437,0.375 -0.48437,0.875 0,0.32813 0.20312,0.59375 0.20313,0.26563 0.64063,0.4375 0.25,0.0937 1.46875,0.4375 1.76562,0.46875 2.46875,0.76563 0.70312,0.29687 1.09375,0.875 0.40625,0.57812 0.40625,1.4375 0,0.82812 -0.48438,1.57812 -0.48437,0.73438 -1.40625,1.14063 -0.92187,0.39062 -2.07812,0.39062 -1.92188,0 -2.9375,-0.79687 -1,-0.79688 -1.28125,-2.35938 z m 11.82812,2.9375 -3.01562,-9.85937 1.71875,0 1.5625,5.6875 0.59375,2.125 q 0.0312,-0.15625 0.5,-2.03125 l 1.57812,-5.78125 1.71875,0 1.46875,5.71875 0.48438,1.89062 0.57812,-1.90625 1.6875,-5.70312 1.625,0 -3.07812,9.85937 -1.73438,0 -1.57812,-5.90625 -0.375,-1.67187 -2,7.57812 -1.73438,0 z m 18.39484,-3.17187 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82812 -2.8125,0.82812 -2.15625,0 -3.42188,-1.32812 -1.26562,-1.32813 -1.26562,-3.73438 0,-2.48437 1.26562,-3.85937 1.28125,-1.37504 3.32813,-1.37504 1.98437,0 3.23437,1.34379 1.25,1.34375 1.25,3.79687 0,0.14063 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48438 0.82813,0.85937 2.0625,0.85937 0.90625,0 1.54688,-0.46875 0.65625,-0.48437 1.04687,-1.54687 z m -5.48437,-2.70313 5.5,0 q -0.10938,-1.23437 -0.625,-1.85937 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76562 -0.85937,2.04687 z m 15.86007,2.70313 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82812 -2.8125,0.82812 -2.15625,0 -3.42188,-1.32812 -1.26562,-1.32813 -1.26562,-3.73438 0,-2.48437 1.26562,-3.85937 1.28125,-1.37504 3.32813,-1.37504 1.98437,0 3.23437,1.34379 1.25,1.34375 1.25,3.79687 0,0.14063 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48438 0.82813,0.85937 2.0625,0.85937 0.90625,0 1.54688,-0.46875 0.65625,-0.48437 1.04687,-1.54687 z m -5.48437,-2.70313 5.5,0 q -0.10938,-1.23437 -0.625,-1.85937 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76562 -0.85937,2.04687 z m 9.11007,9.65625 0,-13.64062 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20313,-1.125 0.6875,-0.37504 1.64062,-0.37504 1.26563,0 2.23438,0.65628 0.96875,0.64063 1.45312,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54687,2.73437 -0.54688,1.20313 -1.57813,1.84375 -1.03125,0.64063 -2.17187,0.64063 -0.84375,0 -1.51563,-0.34375 -0.65625,-0.35938 -1.07812,-0.89063 l 0,4.79688 -1.67188,0 z m 1.51563,-8.65625 q 0,1.90625 0.76562,2.8125 0.78125,0.90625 1.875,0.90625 1.10938,0 1.89063,-0.9375 0.79687,-0.9375 0.79687,-2.92187 0,-1.875 -0.78125,-2.8125 -0.76562,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89062,1 -0.8125,1 -0.8125,2.89062 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path113" d="m 256,88 256,0" /> <path style="stroke:#8e7cc3;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path115" d="m 256,88 240.84003,0" /> <path style="fill:#8e7cc3;fill-rule:nonzero;stroke:#8e7cc3;stroke-width:4;stroke-linecap:butt" inkscape:connector-curvature="0" id="path117" d="m 510,88 c 0,3.63403 -2.94598,6.57999 -6.58002,6.57999 -3.63403,0 -6.57995,-2.94596 -6.57995,-6.57999 0,-3.63403 2.94592,-6.57999 6.57995,-6.57999 C 507.05402,81.42001 510,84.36597 510,88 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path119" d="m 0,67 128,0 0,40 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path121" d="m 10.5625,93.91998 0,-13.59375 9.17188,0 0,1.59375 -7.375,0 0,4.21875 6.375,0 0,1.60937 -6.375,0 0,6.17188 -1.79688,0 z m 11.06786,0 0,-9.85938 1.5,0 0,1.5 q 0.57812,-1.04687 1.0625,-1.375 0.48437,-0.34375 1.07812,-0.34375 0.84375,0 1.71875,0.54688 l -0.57812,1.54687 q -0.60938,-0.35937 -1.23438,-0.35937 -0.54687,0 -0.98437,0.32812 -0.42188,0.32813 -0.60938,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67187,0 z m 12.9783,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42187,-1.32813 -1.26563,-1.32812 -1.26563,-3.73437 0,-2.48438 1.26563,-3.85938 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48437 0.82812,0.85938 2.0625,0.85938 0.90625,0 1.54687,-0.46875 0.65625,-0.48438 1.04688,-1.54688 z m -5.48438,-2.70312 5.5,0 q -0.10937,-1.23438 -0.625,-1.85938 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76563 -0.85938,2.04688 z m 15.86009,2.70312 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42188,-1.32813 -1.26562,-1.32812 -1.26562,-3.73437 0,-2.48438 1.26562,-3.85938 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48437 0.82813,0.85938 2.0625,0.85938 0.90625,0 1.54688,-0.46875 0.65625,-0.48438 1.04687,-1.54688 z M 39.5,88.04498 l 5.5,0 q -0.10938,-1.23438 -0.625,-1.85938 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76563 -0.85937,2.04688 z m 14.26215,5.875 0,-13.59375 1.67187,0 0,13.59375 -1.67187,0 z m 4.19169,-11.6875 0,-1.90625 1.67188,0 0,1.90625 -1.67188,0 z m 0,11.6875 0,-9.85938 1.67188,0 0,9.85938 -1.67188,0 z m 3.45732,-2.9375 1.65625,-0.26563 q 0.14063,1 0.76563,1.53125 0.64062,0.51563 1.78125,0.51563 1.15625,0 1.70312,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48437,-0.89063 -0.34375,-0.21875 -1.70313,-0.5625 -1.84375,-0.46875 -2.5625,-0.79687 -0.70312,-0.34375 -1.07812,-0.9375 -0.35938,-0.60938 -0.35938,-1.32813 0,-0.65625 0.29688,-1.21875 0.3125,-0.5625 0.82812,-0.9375 0.39063,-0.28125 1.0625,-0.48437 0.67188,-0.20313 1.4375,-0.20313 1.17188,0 2.04688,0.34375 0.875,0.32813 1.28125,0.90625 0.42187,0.5625 0.57812,1.51563 l -1.625,0.21875 q -0.10937,-0.75 -0.65625,-1.17188 -0.53125,-0.4375 -1.5,-0.4375 -1.15625,0 -1.64062,0.39063 -0.48438,0.375 -0.48438,0.875 0,0.32812 0.20313,0.59375 0.20312,0.26562 0.64062,0.4375 0.25,0.0937 1.46875,0.4375 1.76563,0.46875 2.46875,0.76562 0.70313,0.29688 1.09375,0.875 0.40625,0.57813 0.40625,1.4375 0,0.82813 -0.48437,1.57813 -0.48438,0.73437 -1.40625,1.14062 -0.92188,0.39063 -2.07813,0.39063 -1.92187,0 -2.9375,-0.79688 -1,-0.79687 -1.28125,-2.35937 z m 13.65625,1.4375 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 0.85518,-1.4375 1.65625,-0.26563 q 0.14063,1 0.76563,1.53125 0.64062,0.51563 1.78125,0.51563 1.15625,0 1.70312,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48437,-0.89063 -0.34375,-0.21875 -1.70313,-0.5625 -1.84375,-0.46875 -2.5625,-0.79687 -0.70312,-0.34375 -1.07812,-0.9375 -0.35938,-0.60938 -0.35938,-1.32813 0,-0.65625 0.29688,-1.21875 0.3125,-0.5625 0.82812,-0.9375 0.39063,-0.28125 1.0625,-0.48437 0.67188,-0.20313 1.4375,-0.20313 1.17188,0 2.04688,0.34375 0.875,0.32813 1.28125,0.90625 0.42187,0.5625 0.57812,1.51563 l -1.625,0.21875 q -0.10937,-0.75 -0.65625,-1.17188 -0.53125,-0.4375 -1.5,-0.4375 -1.15625,0 -1.64062,0.39063 -0.48438,0.375 -0.48438,0.875 0,0.32812 0.20313,0.59375 0.20312,0.26562 0.64062,0.4375 0.25,0.0937 1.46875,0.4375 1.76563,0.46875 2.46875,0.76562 0.70313,0.29688 1.09375,0.875 0.40625,0.57813 0.40625,1.4375 0,0.82813 -0.48437,1.57813 -0.48438,0.73437 -1.40625,1.14062 -0.92188,0.39063 -2.07813,0.39063 -1.92187,0 -2.9375,-0.79688 -1,-0.79687 -1.28125,-2.35937 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path123" d="m 144,88 112,0" /> <path style="stroke:#8e7cc3;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path125" d="m 144,88 96.84,0" /> <path style="fill:#8e7cc3;fill-rule:nonzero;stroke:#8e7cc3;stroke-width:4;stroke-linecap:butt" inkscape:connector-curvature="0" id="path127" d="m 254,88 c 0,3.63403 -2.94595,6.57999 -6.57999,6.57999 -3.63403,0 -6.58001,-2.94596 -6.58001,-6.57999 0,-3.63403 2.94598,-6.57999 6.58001,-6.57999 C 251.05405,81.42001 254,84.36597 254,88 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path129" d="m 0,115 128,0 0,40 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path131" d="m 10.51563,141.91998 0,-13.59375 1.8125,0 0,5.57812 7.0625,0 0,-5.57812 1.79687,0 0,13.59375 -1.79687,0 0,-6.40625 -7.0625,0 0,6.40625 -1.8125,0 z m 19.95732,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42187,-1.32813 -1.26563,-1.32812 -1.26563,-3.73437 0,-2.48438 1.26563,-3.85938 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48437 0.82812,0.85938 2.0625,0.85938 0.90625,0 1.54687,-0.46875 0.65625,-0.48438 1.04688,-1.54688 z m -5.48438,-2.70312 5.5,0 q -0.10937,-1.23438 -0.625,-1.85938 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76563 -0.85938,2.04688 z m 15.54759,4.65625 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.07884,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20313,-1.125 0.6875,-0.375 1.64062,-0.375 1.26563,0 2.23438,0.65625 0.96875,0.64063 1.45312,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54687,2.73437 -0.54688,1.20313 -1.57813,1.84375 -1.03125,0.64063 -2.17187,0.64063 -0.84375,0 -1.51563,-0.34375 -0.65625,-0.35938 -1.07812,-0.89063 l 0,4.79688 -1.67188,0 z m 1.51563,-8.65625 q 0,1.90625 0.76562,2.8125 0.78125,0.90625 1.875,0.90625 1.10938,0 1.89063,-0.9375 0.79687,-0.9375 0.79687,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76562,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89062,1 -0.8125,1 -0.8125,2.89063 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path133" d="m 144,136 480,0" /> <path style="stroke:#cc4125;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path135" d="m 144,136 480,0" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path137" d="m 256,96 256,0 0,32 -256,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path139" d="m 358.29498,122.91998 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97833,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.04758,4.9375 0,-13.59375 1.67187,0 0,13.59375 -1.67187,0 z m 4.1448,0 0,-13.59375 1.67188,0 0,13.59375 -1.67188,0 z m 3.55109,-4.92188 q 0,-2.73437 1.53125,-4.0625 1.26562,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29687,1.32813 1.29687,3.67188 0,1.90625 -0.57812,3 -0.5625,1.07812 -1.65625,1.6875 -1.07813,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32813 -1.28125,-1.32812 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89063 0.82812,2.82813 0.82813,0.9375 2.07813,0.9375 1.25,0 2.0625,-0.9375 0.82812,-0.95313 0.82812,-2.89063 0,-1.82812 -0.82812,-2.76562 -0.82813,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07813,0.9375 -0.82812,0.9375 -0.82812,2.82812 z m 15.71948,1.3125 1.64062,0.21875 q -0.26562,1.6875 -1.375,2.65625 -1.10937,0.95313 -2.73437,0.95313 -2.01563,0 -3.25,-1.3125 -1.21875,-1.32813 -1.21875,-3.79688 0,-1.59375 0.51562,-2.78125 0.53125,-1.20312 1.60938,-1.79687 1.09375,-0.60938 2.35937,-0.60938 1.60938,0 2.625,0.8125 1.01563,0.8125 1.3125,2.3125 l -1.625,0.25 q -0.23437,-1 -0.82812,-1.5 -0.59375,-0.5 -1.42188,-0.5 -1.26562,0 -2.0625,0.90625 -0.78125,0.90625 -0.78125,2.85938 0,1.98437 0.76563,2.89062 0.76562,0.89063 1.98437,0.89063 0.98438,0 1.64063,-0.59375 0.65625,-0.60938 0.84375,-1.85938 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path141" d="m 144,96 112,0 0,32 -112,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path143" d="m 174.29498,122.91998 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97833,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.04758,4.9375 0,-13.59375 1.67187,0 0,13.59375 -1.67187,0 z m 4.1448,0 0,-13.59375 1.67188,0 0,13.59375 -1.67188,0 z m 3.55109,-4.92188 q 0,-2.73437 1.53125,-4.0625 1.26562,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29687,1.32813 1.29687,3.67188 0,1.90625 -0.57812,3 -0.5625,1.07812 -1.65625,1.6875 -1.07813,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32813 -1.28125,-1.32812 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89063 0.82812,2.82813 0.82813,0.9375 2.07813,0.9375 1.25,0 2.0625,-0.9375 0.82812,-0.95313 0.82812,-2.89063 0,-1.82812 -0.82812,-2.76562 -0.82813,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07813,0.9375 -0.82812,0.9375 -0.82812,2.82812 z m 15.71948,1.3125 1.64062,0.21875 q -0.26562,1.6875 -1.375,2.65625 -1.10937,0.95313 -2.73437,0.95313 -2.01563,0 -3.25,-1.3125 -1.21875,-1.32813 -1.21875,-3.79688 0,-1.59375 0.51562,-2.78125 0.53125,-1.20312 1.60938,-1.79687 1.09375,-0.60938 2.35937,-0.60938 1.60938,0 2.625,0.8125 1.01563,0.8125 1.3125,2.3125 l -1.625,0.25 q -0.23437,-1 -0.82812,-1.5 -0.59375,-0.5 -1.42188,-0.5 -1.26562,0 -2.0625,0.90625 -0.78125,0.90625 -0.78125,2.85938 0,1.98437 0.76563,2.89062 0.76562,0.89063 1.98437,0.89063 0.98438,0 1.64063,-0.59375 0.65625,-0.60938 0.84375,-1.85938 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path145" d="m 568,88 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path147" d="m 568,88 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path149" d="m 568,129.1458 -2.24915,-2.24915 2.24915,6.17954 2.24915,-6.17954 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path151" d="m 544,40 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path153" d="m 544,40 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path155" d="M 544,81.1458 541.75085,78.89665 544,85.07619 546.24915,78.89665 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path157" d="m 576,40 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path159" d="m 576,40 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path161" d="M 576,81.1458 573.75085,78.89665 576,85.07619 578.24915,78.89665 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path163" d="m 608,40 0,48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path165" d="m 608,40 0,41.14584" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path167" d="M 608,81.1458 605.75085,78.89665 608,85.07619 610.24915,78.89665 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path169" d="m 512,40 112,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path171" d="m 512,40 112,0" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path173" d="m 512,0 112,0 0,32 -112,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path175" d="m 541.614,23.98248 1.65625,-0.26563 q 0.14063,1 0.76563,1.53125 0.64062,0.51563 1.78125,0.51563 1.15625,0 1.70312,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48437,-0.89063 -0.34375,-0.21875 -1.70313,-0.5625 -1.84375,-0.46875 -2.5625,-0.79687 -0.70312,-0.34375 -1.07812,-0.9375 -0.35938,-0.60938 -0.35938,-1.32813 0,-0.65625 0.29688,-1.21875 0.3125,-0.5625 0.82812,-0.9375 0.39063,-0.28125 1.0625,-0.48437 0.67188,-0.20313 1.4375,-0.20313 1.17188,0 2.04688,0.34375 0.875,0.32813 1.28125,0.90625 0.42187,0.5625 0.57812,1.51563 l -1.625,0.21875 q -0.10937,-0.75 -0.65625,-1.17188 -0.53125,-0.4375 -1.5,-0.4375 -1.15625,0 -1.64062,0.39063 -0.48438,0.375 -0.48438,0.875 0,0.32812 0.20313,0.59375 0.20312,0.26562 0.64062,0.4375 0.25,0.0937 1.46875,0.4375 1.76563,0.46875 2.46875,0.76562 0.70313,0.29688 1.09375,0.875 0.40625,0.57813 0.40625,1.4375 0,0.82813 -0.48437,1.57813 -0.48438,0.73437 -1.40625,1.14062 -0.92188,0.39063 -2.07813,0.39063 -1.92187,0 -2.9375,-0.79688 -1,-0.79687 -1.28125,-2.35937 z m 11.82813,2.9375 -3.01563,-9.85938 1.71875,0 1.5625,5.6875 0.59375,2.125 q 0.0312,-0.15625 0.5,-2.03125 l 1.57813,-5.78125 1.71875,0 1.46875,5.71875 0.48437,1.89063 0.57813,-1.90625 1.6875,-5.70313 1.625,0 -3.07813,9.85938 -1.73437,0 -1.57813,-5.90625 -0.375,-1.67188 -2,7.57813 -1.73437,0 z m 18.39483,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42188,-1.32813 -1.26562,-1.32812 -1.26562,-3.73437 0,-2.48438 1.26562,-3.85938 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48437 0.82813,0.85938 2.0625,0.85938 0.90625,0 1.54688,-0.46875 0.65625,-0.48438 1.04687,-1.54688 z m -5.48437,-2.70312 5.5,0 q -0.10938,-1.23438 -0.625,-1.85938 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76563 -0.85937,2.04688 z m 15.86004,2.70312 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42188,-1.32813 -1.26562,-1.32812 -1.26562,-3.73437 0,-2.48438 1.26562,-3.85938 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48437 0.82813,0.85938 2.0625,0.85938 0.90625,0 1.54688,-0.46875 0.65625,-0.48438 1.04687,-1.54688 z m -5.48437,-2.70312 5.5,0 q -0.10938,-1.23438 -0.625,-1.85938 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76563 -0.85937,2.04688 z m 9.1101,9.65625 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20313,-1.125 0.6875,-0.375 1.64062,-0.375 1.26563,0 2.23438,0.65625 0.96875,0.64063 1.45312,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54687,2.73437 -0.54688,1.20313 -1.57813,1.84375 -1.03125,0.64063 -2.17187,0.64063 -0.84375,0 -1.51563,-0.34375 -0.65625,-0.35938 -1.07812,-0.89063 l 0,4.79688 -1.67188,0 z m 1.51563,-8.65625 q 0,1.90625 0.76562,2.8125 0.78125,0.90625 1.875,0.90625 1.10938,0 1.89063,-0.9375 0.79687,-0.9375 0.79687,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76562,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89062,1 -0.8125,1 -0.8125,2.89063 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path177" d="m 512,88 112,0" /> <path style="stroke:#8e7cc3;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path179" d="m 512,88 112,0" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path181" d="m 512,96 112,0 0,32 -112,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path183" d="m 542.295,122.91998 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97833,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.04761,4.9375 0,-13.59375 1.67187,0 0,13.59375 -1.67187,0 z m 4.14477,0 0,-13.59375 1.67188,0 0,13.59375 -1.67188,0 z m 3.55109,-4.92188 q 0,-2.73437 1.53125,-4.0625 1.26562,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29687,1.32813 1.29687,3.67188 0,1.90625 -0.57812,3 -0.5625,1.07812 -1.65625,1.6875 -1.07813,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32813 -1.28125,-1.32812 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89063 0.82812,2.82813 0.82813,0.9375 2.07813,0.9375 1.25,0 2.0625,-0.9375 0.82812,-0.95313 0.82812,-2.89063 0,-1.82812 -0.82812,-2.76562 -0.82813,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07813,0.9375 -0.82812,0.9375 -0.82812,2.82812 z m 15.71948,1.3125 1.64062,0.21875 q -0.26562,1.6875 -1.375,2.65625 -1.10937,0.95313 -2.73437,0.95313 -2.01563,0 -3.25,-1.3125 -1.21875,-1.32813 -1.21875,-3.79688 0,-1.59375 0.51562,-2.78125 0.53125,-1.20312 1.60938,-1.79687 1.09375,-0.60938 2.35937,-0.60938 1.60938,0 2.625,0.8125 1.01563,0.8125 1.3125,2.3125 l -1.625,0.25 q -0.23437,-1 -0.82812,-1.5 -0.59375,-0.5 -1.42188,-0.5 -1.26562,0 -2.0625,0.90625 -0.78125,0.90625 -0.78125,2.85938 0,1.98437 0.76563,2.89062 0.76562,0.89063 1.98437,0.89063 0.98438,0 1.64063,-0.59375 0.65625,-0.60938 0.84375,-1.85938 z" /> </svg>
12800
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/12800/convert
#!/bin/sh set -e for base in sparse dense sweep-flow mark-flow plan; do inkscape --export-png=$base.png $base.svg done
12800
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/12800/dense.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" viewBox="0 0 689 161" stroke-miterlimit="10" id="svg2" inkscape:version="0.48.4 r9939" width="100%" height="100%" sodipodi:docname="dense.svg" style="fill:none;stroke:none"> <metadata id="metadata231"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> </cc:Work> </rdf:RDF> </metadata> <defs id="defs229" /> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview227" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.26367188" inkscape:cx="352" inkscape:cy="105" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg2" /> <clipPath id="p.0"> <path d="m 0,0 1024,0 0,768 L 0,768 0,0 z" clip-rule="nonzero" id="path5" inkscape:connector-curvature="0" /> </clipPath> <path style="fill:#d9ead3;fill-rule:nonzero" inkscape:connector-curvature="0" id="path11" d="m 144,8 256,0 0,64 -256,0 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path13" d="m 144,8 256,0 0,64 -256,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path15" d="m 144,0 88,0 0,40 -88,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path17" d="m 153.85938,22.54498 1.6875,-0.14063 q 0.125,1.01563 0.5625,1.67188 0.4375,0.65625 1.35937,1.0625 0.9375,0.40625 2.09375,0.40625 1.03125,0 1.8125,-0.3125 0.79688,-0.3125 1.1875,-0.84375 0.39063,-0.53125 0.39063,-1.15625 0,-0.64063 -0.375,-1.10938 -0.375,-0.48437 -1.23438,-0.8125 -0.54687,-0.21875 -2.42187,-0.65625 -1.875,-0.45312 -2.625,-0.85937 -0.96875,-0.51563 -1.45313,-1.26563 -0.46875,-0.75 -0.46875,-1.6875 0,-1.03125 0.57813,-1.92187 0.59375,-0.90625 1.70312,-1.35938 1.125,-0.46875 2.5,-0.46875 1.51563,0 2.67188,0.48438 1.15625,0.48437 1.76562,1.4375 0.625,0.9375 0.67188,2.14062 l -1.71875,0.125 q -0.14063,-1.28125 -0.95313,-1.9375 -0.79687,-0.67187 -2.35937,-0.67187 -1.625,0 -2.375,0.60937 -0.75,0.59375 -0.75,1.4375 0,0.73438 0.53125,1.20313 0.51562,0.46875 2.70312,0.96875 2.20313,0.5 3.01563,0.875 1.1875,0.54687 1.75,1.39062 0.57812,0.82813 0.57812,1.92188 0,1.09375 -0.625,2.0625 -0.625,0.95312 -1.79687,1.48437 -1.15625,0.53125 -2.60938,0.53125 -1.84375,0 -3.09375,-0.53125 -1.25,-0.54687 -1.96875,-1.625 -0.70312,-1.07812 -0.73437,-2.45312 z m 12.8342,8.15625 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 15.29758,3.65625 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07886,4.9375 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14063,-1.625 0.89062,0 1.64062,0.32813 0.75,0.3125 1.10938,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67188,0 0,-6 q 0,-1.01563 -0.20312,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17188,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76562,0.67188 -0.76562,2.57813 l 0,5.375 -1.67188,0 z m 21.38715,0 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path19" d="m 144,8 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path21" d="m 144,8 0,64" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path23" d="m 272,8 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path25" d="m 272,8 0,64" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path27" d="m 272,0 88,0 0,40 -88,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path29" d="m 281.85938,22.54498 1.6875,-0.14063 q 0.125,1.01563 0.5625,1.67188 0.4375,0.65625 1.35937,1.0625 0.9375,0.40625 2.09375,0.40625 1.03125,0 1.8125,-0.3125 0.79688,-0.3125 1.1875,-0.84375 0.39063,-0.53125 0.39063,-1.15625 0,-0.64063 -0.375,-1.10938 -0.375,-0.48437 -1.23438,-0.8125 -0.54687,-0.21875 -2.42187,-0.65625 -1.875,-0.45312 -2.625,-0.85937 -0.96875,-0.51563 -1.45313,-1.26563 -0.46875,-0.75 -0.46875,-1.6875 0,-1.03125 0.57813,-1.92187 0.59375,-0.90625 1.70312,-1.35938 1.125,-0.46875 2.5,-0.46875 1.51563,0 2.67188,0.48438 1.15625,0.48437 1.76562,1.4375 0.625,0.9375 0.67188,2.14062 l -1.71875,0.125 q -0.14063,-1.28125 -0.95313,-1.9375 -0.79687,-0.67187 -2.35937,-0.67187 -1.625,0 -2.375,0.60937 -0.75,0.59375 -0.75,1.4375 0,0.73438 0.53125,1.20313 0.51562,0.46875 2.70312,0.96875 2.20313,0.5 3.01563,0.875 1.1875,0.54687 1.75,1.39062 0.57812,0.82813 0.57812,1.92188 0,1.09375 -0.625,2.0625 -0.625,0.95312 -1.79687,1.48437 -1.15625,0.53125 -2.60938,0.53125 -1.84375,0 -3.09375,-0.53125 -1.25,-0.54687 -1.96875,-1.625 -0.70312,-1.07812 -0.73437,-2.45312 z m 12.8342,8.15625 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 15.29758,3.65625 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07886,4.9375 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14063,-1.625 0.89062,0 1.64062,0.32813 0.75,0.3125 1.10938,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67188,0 0,-6 q 0,-1.01563 -0.20312,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17188,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76562,0.67188 -0.76562,2.57813 l 0,5.375 -1.67188,0 z m 23.87152,-1.60938 0,1.60938 -8.98437,0 q -0.0156,-0.60938 0.1875,-1.15625 0.34375,-0.92188 1.09375,-1.8125 0.76562,-0.89063 2.1875,-2.0625 2.21875,-1.8125 3,-2.875 0.78125,-1.0625 0.78125,-2.01563 0,-0.98437 -0.71875,-1.67187 -0.70313,-0.6875 -1.84375,-0.6875 -1.20313,0 -1.9375,0.73437 -0.71875,0.71875 -0.71875,2 l -1.71875,-0.17187 q 0.17187,-1.92188 1.32812,-2.92188 1.15625,-1.01562 3.09375,-1.01562 1.95313,0 3.09375,1.09375 1.14063,1.07812 1.14063,2.6875 0,0.8125 -0.34375,1.60937 -0.32813,0.78125 -1.10938,1.65625 -0.76562,0.85938 -2.5625,2.39063 -1.5,1.26562 -1.9375,1.71875 -0.42187,0.4375 -0.70312,0.89062 l 6.67187,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path31" d="m 400,8 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path33" d="m 400,8 0,64" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path35" d="m 0,20 144,0 0,40 -144,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path37" d="m 10.51562,46.91998 0,-13.59375 1.8125,0 0,5.57812 7.0625,0 0,-5.57812 1.79688,0 0,13.59375 -1.79688,0 0,-6.40625 -7.0625,0 0,6.40625 -1.8125,0 z m 19.95732,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42188,-1.32813 -1.26562,-1.32812 -1.26562,-3.73437 0,-2.48438 1.26562,-3.85938 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48437 0.82813,0.85938 2.0625,0.85938 0.90625,0 1.54688,-0.46875 0.65625,-0.48438 1.04687,-1.54688 z m -5.48437,-2.70312 5.5,0 q -0.10938,-1.23438 -0.625,-1.85938 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76563 -0.85937,2.04688 z m 15.54759,4.65625 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 L 33.81741,39.8731 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07885,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z M 45.99,42.04498 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path39" d="m 400,16 40,0 0,40 -40,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path41" d="m 410.71875,42.91998 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path43" d="m 144,50.50113 0,0 C 144,44.70151 148.70151,40 154.50113,40 l 42.99774,0 0,0 c 2.78506,0 5.45608,1.10635 7.42541,3.07571 C 206.89364,45.04504 208,47.71607 208,50.50113 l 0,10.99774 0,0 C 208,67.29849 203.29849,72 197.49887,72 l -42.99774,0 C 148.70151,72 144,67.29849 144,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path45" d="m 144,50.50113 0,0 C 144,44.70151 148.70151,40 154.50113,40 l 42.99774,0 0,0 c 2.78506,0 5.45608,1.10635 7.42541,3.07571 C 206.89364,45.04504 208,47.71607 208,50.50113 l 0,10.99774 0,0 C 208,67.29849 203.29849,72 197.49887,72 l -42.99774,0 C 148.70151,72 144,67.29849 144,61.49887 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path47" d="m 208,50.50113 0,0 C 208,44.70151 212.70151,40 218.50113,40 l 42.99774,0 0,0 c 2.78506,0 5.45608,1.10635 7.42541,3.07571 C 270.89364,45.04504 272,47.71607 272,50.50113 l 0,10.99774 0,0 C 272,67.29849 267.29849,72 261.49887,72 l -42.99774,0 C 212.70151,72 208,67.29849 208,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path49" d="m 208,50.50113 0,0 C 208,44.70151 212.70151,40 218.50113,40 l 42.99774,0 0,0 c 2.78506,0 5.45608,1.10635 7.42541,3.07571 C 270.89364,45.04504 272,47.71607 272,50.50113 l 0,10.99774 0,0 C 272,67.29849 267.29849,72 261.49887,72 l -42.99774,0 C 212.70151,72 208,67.29849 208,61.49887 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path51" d="m 272,45.25055 0,0 C 272,42.35077 274.35077,40 277.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 287.44681,42.52252 288,43.85803 288,45.25055 l 0,21.4989 C 288,69.64923 285.64923,72 282.74945,72 l -5.4989,0 C 274.35077,72 272,69.64923 272,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path53" d="m 272,45.25055 0,0 C 272,42.35077 274.35077,40 277.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 287.44681,42.52252 288,43.85803 288,45.25055 l 0,21.4989 C 288,69.64923 285.64923,72 282.74945,72 l -5.4989,0 C 274.35077,72 272,69.64923 272,66.74945 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path55" d="m 288,45.25055 0,0 C 288,42.35077 290.35077,40 293.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 303.44681,42.52252 304,43.85803 304,45.25055 l 0,21.4989 C 304,69.64923 301.64923,72 298.74945,72 l -5.4989,0 C 290.35077,72 288,69.64923 288,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path57" d="m 288,45.25055 0,0 C 288,42.35077 290.35077,40 293.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 303.44681,42.52252 304,43.85803 304,45.25055 l 0,21.4989 C 304,69.64923 301.64923,72 298.74945,72 l -5.4989,0 C 290.35077,72 288,69.64923 288,66.74945 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path59" d="m 304,45.25055 0,0 C 304,42.35077 306.35077,40 309.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 319.44681,42.52252 320,43.85803 320,45.25055 l 0,21.4989 C 320,69.64923 317.64923,72 314.74945,72 l -5.4989,0 C 306.35077,72 304,69.64923 304,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path61" d="m 304,45.25055 0,0 C 304,42.35077 306.35077,40 309.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 319.44681,42.52252 320,43.85803 320,45.25055 l 0,21.4989 C 320,69.64923 317.64923,72 314.74945,72 l -5.4989,0 C 306.35077,72 304,69.64923 304,66.74945 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path63" d="m 320,45.25055 0,0 C 320,42.35077 322.35077,40 325.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 335.44681,42.52252 336,43.85803 336,45.25055 l 0,21.4989 C 336,69.64923 333.64923,72 330.74945,72 l -5.4989,0 C 322.35077,72 320,69.64923 320,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path65" d="m 320,45.25055 0,0 C 320,42.35077 322.35077,40 325.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 335.44681,42.52252 336,43.85803 336,45.25055 l 0,21.4989 C 336,69.64923 333.64923,72 330.74945,72 l -5.4989,0 C 322.35077,72 320,69.64923 320,66.74945 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path67" d="m 336,45.25055 0,0 C 336,42.35077 338.35077,40 341.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 351.44681,42.52252 352,43.85803 352,45.25055 l 0,21.4989 C 352,69.64923 349.64923,72 346.74945,72 l -5.4989,0 C 338.35077,72 336,69.64923 336,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path69" d="m 336,45.25055 0,0 C 336,42.35077 338.35077,40 341.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 351.44681,42.52252 352,43.85803 352,45.25055 l 0,21.4989 C 352,69.64923 349.64923,72 346.74945,72 l -5.4989,0 C 338.35077,72 336,69.64923 336,66.74945 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path71" d="m 352,45.25055 0,0 C 352,42.35077 354.35077,40 357.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 367.44684,42.52252 368,43.85803 368,45.25055 l 0,21.4989 C 368,69.64923 365.64923,72 362.74945,72 l -5.4989,0 C 354.35077,72 352,69.64923 352,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path73" d="m 352,45.25055 0,0 C 352,42.35077 354.35077,40 357.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 367.44684,42.52252 368,43.85803 368,45.25055 l 0,21.4989 C 368,69.64923 365.64923,72 362.74945,72 l -5.4989,0 C 354.35077,72 352,69.64923 352,66.74945 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path75" d="m 368,45.25055 0,0 C 368,42.35077 370.35077,40 373.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 383.44684,42.52252 384,43.85803 384,45.25055 l 0,21.4989 C 384,69.64923 381.64923,72 378.74945,72 l -5.4989,0 C 370.35077,72 368,69.64923 368,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path77" d="m 368,45.25055 0,0 C 368,42.35077 370.35077,40 373.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 383.44684,42.52252 384,43.85803 384,45.25055 l 0,21.4989 C 384,69.64923 381.64923,72 378.74945,72 l -5.4989,0 C 370.35077,72 368,69.64923 368,66.74945 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path79" d="m 384,45.25055 0,0 C 384,42.35077 386.35077,40 389.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 399.44684,42.52252 400,43.85803 400,45.25055 l 0,21.4989 C 400,69.64923 397.64923,72 394.74945,72 l -5.4989,0 C 386.35077,72 384,69.64923 384,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path81" d="m 384,45.25055 0,0 C 384,42.35077 386.35077,40 389.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 399.44684,42.52252 400,43.85803 400,45.25055 l 0,21.4989 C 400,69.64923 397.64923,72 394.74945,72 l -5.4989,0 C 386.35077,72 384,69.64923 384,66.74945 z" /> <path style="fill:#d9ead3;fill-rule:nonzero" inkscape:connector-curvature="0" id="path83" d="m 432,8 256,0 0,64 -256,0 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path85" d="m 432,8 256,0 0,64 -256,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path87" d="m 432,0 88,0 0,40 -88,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path89" d="m 441.8594,22.54498 1.6875,-0.14063 q 0.125,1.01563 0.5625,1.67188 0.4375,0.65625 1.35938,1.0625 0.9375,0.40625 2.09375,0.40625 1.03125,0 1.8125,-0.3125 0.79687,-0.3125 1.1875,-0.84375 0.39062,-0.53125 0.39062,-1.15625 0,-0.64063 -0.375,-1.10938 -0.375,-0.48437 -1.23437,-0.8125 -0.54688,-0.21875 -2.42188,-0.65625 -1.875,-0.45312 -2.625,-0.85937 -0.96875,-0.51563 -1.45312,-1.26563 -0.46875,-0.75 -0.46875,-1.6875 0,-1.03125 0.57812,-1.92187 0.59375,-0.90625 1.70313,-1.35938 1.125,-0.46875 2.5,-0.46875 1.51562,0 2.67187,0.48438 1.15625,0.48437 1.76563,1.4375 0.625,0.9375 0.67187,2.14062 l -1.71875,0.125 q -0.14062,-1.28125 -0.95312,-1.9375 -0.79688,-0.67187 -2.35938,-0.67187 -1.625,0 -2.375,0.60937 -0.75,0.59375 -0.75,1.4375 0,0.73438 0.53125,1.20313 0.51563,0.46875 2.70313,0.96875 2.20312,0.5 3.01562,0.875 1.1875,0.54687 1.75,1.39062 0.57813,0.82813 0.57813,1.92188 0,1.09375 -0.625,2.0625 -0.625,0.95312 -1.79688,1.48437 -1.15625,0.53125 -2.60937,0.53125 -1.84375,0 -3.09375,-0.53125 -1.25,-0.54687 -1.96875,-1.625 -0.70313,-1.07812 -0.73438,-2.45312 z m 12.83423,8.15625 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 15.29755,3.65625 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07886,4.9375 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14063,-1.625 0.89062,0 1.64062,0.32813 0.75,0.3125 1.10938,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67188,0 0,-6 q 0,-1.01563 -0.20312,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17188,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76562,0.67188 -0.76562,2.57813 l 0,5.375 -1.67188,0 z m 15.76215,0 0,-13.59375 1.84375,0 7.14062,10.67187 0,-10.67187 1.71875,0 0,13.59375 -1.84375,0 -7.14062,-10.6875 0,10.6875 -1.71875,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path91" d="m 560,8 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path93" d="m 560,8 0,64" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path95" d="m 560,0 128,0 0,40 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path97" d="m 569.8594,22.54498 1.6875,-0.14063 q 0.125,1.01563 0.5625,1.67188 0.4375,0.65625 1.35938,1.0625 0.9375,0.40625 2.09375,0.40625 1.03125,0 1.8125,-0.3125 0.79687,-0.3125 1.1875,-0.84375 0.39062,-0.53125 0.39062,-1.15625 0,-0.64063 -0.375,-1.10938 -0.375,-0.48437 -1.23437,-0.8125 -0.54688,-0.21875 -2.42188,-0.65625 -1.875,-0.45312 -2.625,-0.85937 -0.96875,-0.51563 -1.45312,-1.26563 -0.46875,-0.75 -0.46875,-1.6875 0,-1.03125 0.57812,-1.92187 0.59375,-0.90625 1.70313,-1.35938 1.125,-0.46875 2.5,-0.46875 1.51562,0 2.67187,0.48438 1.15625,0.48437 1.76563,1.4375 0.625,0.9375 0.67187,2.14062 l -1.71875,0.125 q -0.14062,-1.28125 -0.95312,-1.9375 -0.79688,-0.67187 -2.35938,-0.67187 -1.625,0 -2.375,0.60937 -0.75,0.59375 -0.75,1.4375 0,0.73438 0.53125,1.20313 0.51563,0.46875 2.70313,0.96875 2.20312,0.5 3.01562,0.875 1.1875,0.54687 1.75,1.39062 0.57813,0.82813 0.57813,1.92188 0,1.09375 -0.625,2.0625 -0.625,0.95312 -1.79688,1.48437 -1.15625,0.53125 -2.60937,0.53125 -1.84375,0 -3.09375,-0.53125 -1.25,-0.54687 -1.96875,-1.625 -0.70313,-1.07812 -0.73438,-2.45312 z m 12.83423,8.15625 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 15.29755,3.65625 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07886,4.9375 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14063,-1.625 0.89062,0 1.64062,0.32813 0.75,0.3125 1.10938,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67188,0 0,-6 q 0,-1.01563 -0.20312,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17188,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76562,0.67188 -0.76562,2.57813 l 0,5.375 -1.67188,0 z m 15.76215,0 0,-13.59375 1.84375,0 7.14062,10.67187 0,-10.67187 1.71875,0 0,13.59375 -1.84375,0 -7.14062,-10.6875 0,10.6875 -1.71875,0 z m 16.78546,-2.20313 0,-3.71875 -3.70313,0 0,-1.5625 3.70313,0 0,-3.70312 1.57812,0 0,3.70312 3.6875,0 0,1.5625 -3.6875,0 0,3.71875 -1.57812,0 z m 13.20746,2.20313 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path99" d="m 432,50.50113 0,0 C 432,44.70151 436.70154,40 442.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 464,67.29849 459.29846,72 453.4989,72 l -10.9978,0 C 436.70154,72 432,67.29849 432,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path101" d="m 432,50.50113 0,0 C 432,44.70151 436.70154,40 442.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 464,67.29849 459.29846,72 453.4989,72 l -10.9978,0 C 436.70154,72 432,67.29849 432,61.49887 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path103" d="m 528,50.50113 0,0 C 528,44.70151 532.70154,40 538.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 560,67.29849 555.29846,72 549.4989,72 l -10.9978,0 C 532.70154,72 528,67.29849 528,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path105" d="m 528,50.50113 0,0 C 528,44.70151 532.70154,40 538.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 560,67.29849 555.29846,72 549.4989,72 l -10.9978,0 C 532.70154,72 528,67.29849 528,61.49887 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path107" d="m 560,45.25055 0,0 C 560,42.35077 562.35077,40 565.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 575.44684,42.52252 576,43.85803 576,45.25055 l 0,21.4989 C 576,69.64923 573.64923,72 570.74945,72 l -5.4989,0 C 562.35077,72 560,69.64923 560,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path109" d="m 560,45.25055 0,0 C 560,42.35077 562.35077,40 565.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 575.44684,42.52252 576,43.85803 576,45.25055 l 0,21.4989 C 576,69.64923 573.64923,72 570.74945,72 l -5.4989,0 C 562.35077,72 560,69.64923 560,66.74945 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path111" d="m 576,45.25055 0,0 C 576,42.35077 578.35077,40 581.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 591.44684,42.52252 592,43.85803 592,45.25055 l 0,21.4989 C 592,69.64923 589.64923,72 586.74945,72 l -5.4989,0 C 578.35077,72 576,69.64923 576,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path113" d="m 576,45.25055 0,0 C 576,42.35077 578.35077,40 581.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 591.44684,42.52252 592,43.85803 592,45.25055 l 0,21.4989 C 592,69.64923 589.64923,72 586.74945,72 l -5.4989,0 C 578.35077,72 576,69.64923 576,66.74945 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path115" d="m 592,45.25055 0,0 C 592,42.35077 594.35077,40 597.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 607.44684,42.52252 608,43.85803 608,45.25055 l 0,21.4989 C 608,69.64923 605.64923,72 602.74945,72 l -5.4989,0 C 594.35077,72 592,69.64923 592,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path117" d="m 592,45.25055 0,0 C 592,42.35077 594.35077,40 597.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 607.44684,42.52252 608,43.85803 608,45.25055 l 0,21.4989 C 608,69.64923 605.64923,72 602.74945,72 l -5.4989,0 C 594.35077,72 592,69.64923 592,66.74945 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path119" d="m 608,45.25055 0,0 C 608,42.35077 610.35077,40 613.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 623.44684,42.52252 624,43.85803 624,45.25055 l 0,21.4989 C 624,69.64923 621.64923,72 618.74945,72 l -5.4989,0 C 610.35077,72 608,69.64923 608,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path121" d="m 608,45.25055 0,0 C 608,42.35077 610.35077,40 613.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 623.44684,42.52252 624,43.85803 624,45.25055 l 0,21.4989 C 624,69.64923 621.64923,72 618.74945,72 l -5.4989,0 C 610.35077,72 608,69.64923 608,66.74945 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path123" d="m 624,45.25055 0,0 C 624,42.35077 626.35077,40 629.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 639.44684,42.52252 640,43.85803 640,45.25055 l 0,21.4989 C 640,69.64923 637.64923,72 634.74945,72 l -5.4989,0 C 626.35077,72 624,69.64923 624,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path125" d="m 624,45.25055 0,0 C 624,42.35077 626.35077,40 629.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 639.44684,42.52252 640,43.85803 640,45.25055 l 0,21.4989 C 640,69.64923 637.64923,72 634.74945,72 l -5.4989,0 C 626.35077,72 624,69.64923 624,66.74945 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path127" d="m 640,45.25055 0,0 C 640,42.35077 642.35077,40 645.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 655.44684,42.52252 656,43.85803 656,45.25055 l 0,21.4989 C 656,69.64923 653.64923,72 650.74945,72 l -5.4989,0 C 642.35077,72 640,69.64923 640,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path129" d="m 640,45.25055 0,0 C 640,42.35077 642.35077,40 645.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 655.44684,42.52252 656,43.85803 656,45.25055 l 0,21.4989 C 656,69.64923 653.64923,72 650.74945,72 l -5.4989,0 C 642.35077,72 640,69.64923 640,66.74945 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path131" d="m 688,8 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path133" d="m 688,8 0,64" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path135" d="m 656,45.25055 0,0 C 656,42.35077 658.35077,40 661.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 671.44684,42.52252 672,43.85803 672,45.25055 l 0,21.4989 C 672,69.64923 669.64923,72 666.74945,72 l -5.4989,0 C 658.35077,72 656,69.64923 656,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path137" d="m 656,45.25055 0,0 C 656,42.35077 658.35077,40 661.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 671.44684,42.52252 672,43.85803 672,45.25055 l 0,21.4989 C 672,69.64923 669.64923,72 666.74945,72 l -5.4989,0 C 658.35077,72 656,69.64923 656,66.74945 z" /> <path style="fill:#cfe2f3;fill-rule:nonzero" inkscape:connector-curvature="0" id="path139" d="m 288,128 16,0 0,24 -16,0 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path141" d="m 288,128 16,0 0,24 -16,0 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path143" d="m 672,45.25055 0,0 C 672,42.35077 674.35077,40 677.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 687.44684,42.52252 688,43.85803 688,45.25055 l 0,21.4989 C 688,69.64923 685.64923,72 682.74945,72 l -5.4989,0 C 674.35077,72 672,69.64923 672,66.74945 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path145" d="m 672,45.25055 0,0 C 672,42.35077 674.35077,40 677.25055,40 l 5.4989,0 0,0 c 1.39252,0 2.72803,0.55319 3.71271,1.53784 C 687.44684,42.52252 688,43.85803 688,45.25055 l 0,21.4989 C 688,69.64923 685.64923,72 682.74945,72 l -5.4989,0 C 674.35077,72 672,69.64923 672,66.74945 z" /> <path style="fill:#cfe2f3;fill-rule:nonzero" inkscape:connector-curvature="0" id="path147" d="m 176,128 8,0 0,24 -8,0 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path149" d="m 176,128 8,0 0,24 -8,0 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path151" d="m 464,50.50113 0,0 C 464,44.70151 468.70154,40 474.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 496,67.29849 491.29846,72 485.4989,72 l -10.9978,0 C 468.70154,72 464,67.29849 464,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path153" d="m 464,50.50113 0,0 C 464,44.70151 468.70154,40 474.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 496,67.29849 491.29846,72 485.4989,72 l -10.9978,0 C 468.70154,72 464,67.29849 464,61.49887 z" /> <path style="fill:#c9daf8;fill-rule:nonzero" inkscape:connector-curvature="0" id="path155" d="m 144,120 256,0 0,40 -256,0 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path157" d="m 144,120 256,0 0,40 -256,0 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path159" d="m 496,50.50113 0,0 C 496,44.70151 500.70154,40 506.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 528,67.29849 523.29846,72 517.4989,72 l -10.9978,0 C 500.70154,72 496,67.29849 496,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path161" d="m 496,50.50113 0,0 C 496,44.70151 500.70154,40 506.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 528,67.29849 523.29846,72 517.4989,72 l -10.9978,0 C 500.70154,72 496,67.29849 496,61.49887 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path163" d="m 144,120 144,0 0,40 -144,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path165" d="m 160.07812,146.91998 -1.67187,0 0,-10.64063 q -0.59375,0.57813 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 4.07886,-6.70313 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98437,-0.79687 2.46875,-0.79687 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70312 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79687,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95313,-1.10937 -1.15625,0 -1.82812,0.98437 -0.875,1.23438 -0.875,4.59375 z m 14.95382,6.70313 -1.67187,0 0,-10.64063 q -0.59375,0.57813 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 10.37571,0 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z m 4.07885,-6.70313 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98438,-0.79687 2.46875,-0.79687 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70312 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79688,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95312,-1.10937 -1.15625,0 -1.82813,0.98437 -0.875,1.23438 -0.875,4.59375 z m 8.65699,0 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98437,-0.79687 2.46875,-0.79687 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70312 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79687,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95313,-1.10937 -1.15625,0 -1.82812,0.98437 -0.875,1.23438 -0.875,4.59375 z m 14.95382,6.70313 -1.67187,0 0,-10.64063 q -0.59375,0.57813 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 4.07883,-6.70313 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98437,-0.79687 2.46875,-0.79687 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70312 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79687,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95313,-1.10937 -1.15625,0 -1.82812,0.98437 -0.875,1.23438 -0.875,4.59375 z m 14.95386,6.70313 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z m 10.37573,0 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path167" d="m 0,120 144,0 0,40 -144,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path169" d="m 10.40625,146.91998 0,-13.59375 2.71875,0 3.21875,9.625 q 0.4375,1.34375 0.64062,2.01562 0.23438,-0.75 0.73438,-2.1875 l 3.25,-9.45312 2.42187,0 0,13.59375 -1.73437,0 0,-11.39063 -3.95313,11.39063 -1.625,0 -3.9375,-11.57813 0,11.57813 -1.73437,0 z m 21.82205,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.06321,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 6.24393,0 0,-13.59375 1.67188,0 0,7.75 3.95312,-4.01563 2.15625,0 -3.76562,3.65625 4.14062,6.20313 -2.0625,0 -3.25,-5.03125 -1.17187,1.125 0,3.90625 -1.67188,0 z m 16.04268,0 -1.54688,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70313,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32812,1.03125 0.53125,0.65625 0.82813,1.59375 0.29687,0.9375 0.29687,2 0,2.53125 -1.25,3.92188 -1.25,1.375 -3,1.375 -1.75,0 -2.73437,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79688,1.28125 2.14063,1.28125 1.09375,0 1.89062,-0.9375 0.79688,-0.95313 0.79688,-2.84375 0,-1.92188 -0.76563,-2.84375 -0.76562,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89062,0.95313 -0.79688,0.95312 -0.79688,2.75 z m 8.8601,-6.6875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85938 1.67187,0 0,9.85938 -1.67187,0 z m 7.78544,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52706,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97828,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85936,0.3125 -1.84374,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03123,-0.25 2.98436,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17186,0 -1.73436,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.24999,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73436,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96874,0 1.71874,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.07886,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 8.18823,1.9375 1.65625,-0.26563 q 0.14063,1 0.76563,1.53125 0.64062,0.51563 1.78125,0.51563 1.15625,0 1.70312,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48437,-0.89063 -0.34375,-0.21875 -1.70313,-0.5625 -1.84375,-0.46875 -2.5625,-0.79687 -0.70312,-0.34375 -1.07812,-0.9375 -0.35938,-0.60938 -0.35938,-1.32813 0,-0.65625 0.29688,-1.21875 0.3125,-0.5625 0.82812,-0.9375 0.39063,-0.28125 1.0625,-0.48437 0.67188,-0.20313 1.4375,-0.20313 1.17188,0 2.04688,0.34375 0.875,0.32813 1.28125,0.90625 0.42187,0.5625 0.57812,1.51563 l -1.625,0.21875 q -0.10937,-0.75 -0.65625,-1.17188 -0.53125,-0.4375 -1.5,-0.4375 -1.15625,0 -1.64062,0.39063 -0.48438,0.375 -0.48438,0.875 0,0.32812 0.20313,0.59375 0.20312,0.26562 0.64062,0.4375 0.25,0.0937 1.46875,0.4375 1.76563,0.46875 2.46875,0.76562 0.70313,0.29688 1.09375,0.875 0.40625,0.57813 0.40625,1.4375 0,0.82813 -0.48437,1.57813 -0.48438,0.73437 -1.40625,1.14062 -0.92188,0.39063 -2.07813,0.39063 -1.92187,0 -2.9375,-0.79688 -1,-0.79687 -1.28125,-2.35937 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path171" d="m 256,112 40,0 0,40 -40,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path173" d="m 266.71875,138.91998 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18332,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path175" d="m 160,72 0,56" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path177" d="m 160,72 0,49.14584" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path179" d="m 160,121.1458 -2.24918,-2.24915 2.24918,6.17954 2.24918,-6.17954 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path181" d="m 280,120 144,0 0,40 -144,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path183" d="m 296.07812,146.91998 -1.67187,0 0,-10.64063 q -0.59375,0.57813 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 4.07886,-6.70313 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98437,-0.79687 2.46875,-0.79687 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70312 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79687,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95313,-1.10937 -1.15625,0 -1.82812,0.98437 -0.875,1.23438 -0.875,4.59375 z m 8.65695,0 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98437,-0.79687 2.46875,-0.79687 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70312 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79687,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95313,-1.10937 -1.15625,0 -1.82812,0.98437 -0.875,1.23438 -0.875,4.59375 z m 8.65695,0 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98438,-0.79687 2.46875,-0.79687 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70312 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79688,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95312,-1.10937 -1.15625,0 -1.82813,0.98437 -0.875,1.23438 -0.875,4.59375 z m 8.65698,0 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98438,-0.79687 2.46875,-0.79687 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70312 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79688,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95312,-1.10937 -1.15625,0 -1.82813,0.98437 -0.875,1.23438 -0.875,4.59375 z m 8.65699,0 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98437,-0.79687 2.46875,-0.79687 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70312 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79687,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95313,-1.10937 -1.15625,0 -1.82812,0.98437 -0.875,1.23438 -0.875,4.59375 z m 14.95379,6.70313 -1.67187,0 0,-10.64063 q -0.59375,0.57813 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 10.37573,0 -1.67187,0 0,-10.64063 q -0.59375,0.57813 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path185" d="m 368,112 40,0 0,40 -40,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path187" d="m 378.71875,138.91998 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path189" d="m 568,72 0,22.99976 -272,0 L 296,128" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path191" d="m 568,72 0,22.99976 -272,0 0,26.14608" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path193" d="m 296,121.1458 -2.24918,-2.24915 2.24918,6.17954 2.24918,-6.17954 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path195" d="m 280,72 0,15.00015 -100,0 L 180,128" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path197" d="m 280,72 0,15.00015 -100,0 0,34.14569" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path199" d="m 180,121.1458 -2.24918,-2.24915 2.24918,6.17954 2.24918,-6.17954 z" /> <path style="fill:#cfe2f3;fill-rule:nonzero" inkscape:connector-curvature="0" id="path201" d="m 496,128 16,0 0,24 -16,0 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path203" d="m 496,128 16,0 0,24 -16,0 z" /> <path style="fill:#c9daf8;fill-rule:nonzero" inkscape:connector-curvature="0" id="path205" d="m 432,120 256,0 0,40 -256,0 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path207" d="m 432,120 256,0 0,40 -256,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path209" d="m 488,120 144,0 0,40 -144,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path211" d="m 504.0781,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z m 10.37573,0 -1.67187,0 0,-10.64063 q -0.59375,0.57813 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 10.37573,0 -1.67187,0 0,-10.64063 q -0.59375,0.57813 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 4.0788,-6.70313 q 0,-2.42187 0.5,-3.89062 0.5,-1.46875 1.46875,-2.26563 0.98438,-0.79687 2.46875,-0.79687 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82812 0.84375,2.01562 0.3125,1.1875 0.3125,3.21875 0,2.39063 -0.5,3.85938 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79687 -2.46875,0.79687 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70312 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45313 0.79688,1.10937 1.9375,1.10937 1.15625,0 1.9375,-1.10937 0.78125,-1.125 0.78125,-4.45313 0,-3.35937 -0.78125,-4.46875 -0.78125,-1.10937 -1.95312,-1.10937 -1.15625,0 -1.82813,0.98437 -0.875,1.23438 -0.875,4.59375 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path213" d="m 536,112 40,0 0,40 -40,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path215" d="m 546.71875,138.91998 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path217" d="m 464,112 40,0 0,40 -40,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path219" d="m 474.71875,138.91998 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path221" d="m 448,72 0,32.00009 56,0 L 504,128" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path223" d="m 448,72 0,32.00009 56,0 0,17.14575" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path225" d="m 504,121.1458 -2.24915,-2.24915 2.24915,6.17954 2.24915,-6.17954 z" /> </svg>
12800
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/12800/plan.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" viewBox="0 0 562 162" stroke-miterlimit="10" id="svg2" inkscape:version="0.48.4 r9939" width="100%" height="100%" sodipodi:docname="plan.svg" style="fill:none;stroke:none"> <metadata id="metadata57"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> </cc:Work> </rdf:RDF> </metadata> <defs id="defs55" /> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview53" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.26367188" inkscape:cx="353" inkscape:cy="-15" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg2" /> <clipPath id="p.0"> <path d="m 0,0 1024,0 0,768 L 0,768 0,0 z" clip-rule="nonzero" id="path5" inkscape:connector-curvature="0" /> </clipPath> <path style="fill:#c9daf8;fill-rule:nonzero" inkscape:connector-curvature="0" id="path11" d="m 1,9.00015 0,0 C 1,4.58178 4.58179,1 9.00015,1 l 239.9997,0 c 2.12177,0 4.15665,0.84286 5.65696,2.34318 1.50033,1.50034 2.3432,3.5352 2.3432,5.65697 l 0,31.99969 c 0,4.41837 -3.58179,8.00016 -8.00016,8.00016 l -239.9997,0 0,0 C 4.58179,49 1,45.41821 1,40.99984 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path13" d="m 1,9.00015 0,0 C 1,4.58178 4.58179,1 9.00015,1 l 239.9997,0 c 2.12177,0 4.15665,0.84286 5.65696,2.34318 1.50033,1.50034 2.3432,3.5352 2.3432,5.65697 l 0,31.99969 c 0,4.41837 -3.58179,8.00016 -8.00016,8.00016 l -239.9997,0 0,0 C 4.58179,49 1,45.41821 1,40.99984 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path15" d="m 44.93057,31.92 0,-13.59375 4.6875,0 q 1.57812,0 2.42187,0.1875 1.15625,0.26562 1.98438,0.96875 1.07812,0.92187 1.60937,2.34375 0.53125,1.40625 0.53125,3.21875 0,1.54687 -0.35937,2.75 -0.35938,1.1875 -0.92188,1.98437 -0.5625,0.78125 -1.23437,1.23438 -0.67188,0.4375 -1.625,0.67187 Q 51.07119,31.92 49.83682,31.92 l -4.90625,0 z m 1.79687,-1.60938 2.90625,0 q 1.34375,0 2.10938,-0.25 0.76562,-0.25 1.21875,-0.70312 0.64062,-0.64063 1,-1.71875 0.35937,-1.07813 0.35937,-2.625 0,-2.125 -0.70312,-3.26563 Q 52.91494,20.59187 51.91494,20.20125 51.19619,19.92 49.58682,19.92 l -2.85938,0 0,10.39062 z m 18.20733,-1.5625 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42187,-1.32813 -1.26563,-1.32812 -1.26563,-3.73437 0,-2.48438 1.26563,-3.85938 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48437 0.82812,0.85938 2.0625,0.85938 0.90625,0 1.54687,-0.46875 0.65625,-0.48438 1.04688,-1.54688 z m -5.48438,-2.70312 5.5,0 q -0.10937,-1.23438 -0.625,-1.85938 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76563 -0.85938,2.04688 z m 9.11009,5.875 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14063,-1.625 0.89062,0 1.64062,0.32813 0.75,0.3125 1.10938,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67188,0 0,-6 q 0,-1.01563 -0.20312,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17188,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76562,0.67188 -0.76562,2.57813 l 0,5.375 -1.67188,0 z m 9.70385,-2.9375 1.65625,-0.26563 q 0.14062,1 0.76562,1.53125 0.64063,0.51563 1.78125,0.51563 1.15625,0 1.70313,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48438,-0.89063 -0.34375,-0.21875 -1.70312,-0.5625 -1.84375,-0.46875 -2.5625,-0.79687 -0.70313,-0.34375 -1.07813,-0.9375 -0.35937,-0.60938 -0.35937,-1.32813 0,-0.65625 0.29687,-1.21875 0.3125,-0.5625 0.82813,-0.9375 0.39062,-0.28125 1.0625,-0.48437 0.67187,-0.20313 1.4375,-0.20313 1.17187,0 2.04687,0.34375 0.875,0.32813 1.28125,0.90625 0.42188,0.5625 0.57813,1.51563 l -1.625,0.21875 q -0.10938,-0.75 -0.65625,-1.17188 -0.53125,-0.4375 -1.5,-0.4375 -1.15625,0 -1.64063,0.39063 -0.48437,0.375 -0.48437,0.875 0,0.32812 0.20312,0.59375 0.20313,0.26562 0.64063,0.4375 0.25,0.0937 1.46875,0.4375 1.76562,0.46875 2.46875,0.76562 0.70312,0.29688 1.09375,0.875 0.40625,0.57813 0.40625,1.4375 0,0.82813 -0.48438,1.57813 -0.48437,0.73437 -1.40625,1.14062 -0.92187,0.39063 -2.07812,0.39063 -1.92188,0 -2.9375,-0.79688 -1,-0.79687 -1.28125,-2.35937 z m 16.75,-0.23438 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42187,-1.32813 -1.26563,-1.32812 -1.26563,-3.73437 0,-2.48438 1.26563,-3.85938 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48437 0.82812,0.85938 2.0625,0.85938 0.90625,0 1.54687,-0.46875 0.65625,-0.48438 1.04688,-1.54688 z m -5.48438,-2.70312 5.5,0 q -0.10937,-1.23438 -0.625,-1.85938 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76563 -0.85938,2.04688 z m 14.29338,5.875 0,-9.85938 1.5,0 0,1.39063 q 0.45313,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76563,-0.45313 1.09375,0 1.79687,0.45313 0.70313,0.45312 0.98438,1.28125 1.17187,-1.73438 3.04687,-1.73438 1.46875,0 2.25,0.8125 0.79688,0.8125 0.79688,2.5 l 0,6.76563 -1.67188,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42187,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67187,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70313,0 -1.3125,0.375 -0.59375,0.35937 -0.85938,1.07812 -0.26562,0.71875 -0.26562,2.0625 l 0,5.10938 -1.67188,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.06323,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 6.24393,0 0,-13.59375 1.67187,0 0,7.75 3.95313,-4.01563 2.15625,0 -3.76563,3.65625 4.14063,6.20313 -2.0625,0 -3.25,-5.03125 -1.17188,1.125 0,3.90625 -1.67187,0 z m 16.04266,0 -1.54687,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70312,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32813,1.03125 0.53125,0.65625 0.82812,1.59375 0.29688,0.9375 0.29688,2 0,2.53125 -1.25,3.92188 -1.25,1.375 -3,1.375 -1.75,0 -2.73438,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79687,1.28125 2.14062,1.28125 1.09375,0 1.89063,-0.9375 0.79687,-0.95313 0.79687,-2.84375 0,-1.92188 -0.76562,-2.84375 -0.76563,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89063,0.95313 -0.79687,0.95312 -0.79687,2.75 z m 8.8601,-6.6875 0,-1.90625 1.67188,0 0,1.90625 -1.67188,0 z m 0,11.6875 0,-9.85938 1.67188,0 0,9.85938 -1.67188,0 z m 7.78543,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52707,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45313,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76563,-0.45313 1.09375,0 1.79687,0.45313 0.70313,0.45312 0.98438,1.28125 1.17187,-1.73438 3.04687,-1.73438 1.46875,0 2.25,0.8125 0.79688,0.8125 0.79688,2.5 l 0,6.76563 -1.67188,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42187,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67187,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70313,0 -1.3125,0.375 -0.59375,0.35937 -0.85938,1.07812 -0.26562,0.71875 -0.26562,2.0625 l 0,5.10938 -1.67188,0 z m 21.97831,-1.21875 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07883,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 8.18823,1.9375 1.65625,-0.26563 q 0.14063,1 0.76563,1.53125 0.64062,0.51563 1.78125,0.51563 1.15625,0 1.70312,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48437,-0.89063 -0.34375,-0.21875 -1.70313,-0.5625 -1.84375,-0.46875 -2.5625,-0.79687 -0.70312,-0.34375 -1.07812,-0.9375 -0.35938,-0.60938 -0.35938,-1.32813 0,-0.65625 0.29688,-1.21875 0.3125,-0.5625 0.82812,-0.9375 0.39063,-0.28125 1.0625,-0.48437 0.67188,-0.20313 1.4375,-0.20313 1.17188,0 2.04688,0.34375 0.875,0.32813 1.28125,0.90625 0.42187,0.5625 0.57812,1.51563 l -1.625,0.21875 q -0.10937,-0.75 -0.65625,-1.17188 -0.53125,-0.4375 -1.5,-0.4375 -1.15625,0 -1.64062,0.39063 -0.48438,0.375 -0.48438,0.875 0,0.32812 0.20313,0.59375 0.20312,0.26562 0.64062,0.4375 0.25,0.0937 1.46875,0.4375 1.76563,0.46875 2.46875,0.76562 0.70313,0.29688 1.09375,0.875 0.40625,0.57813 0.40625,1.4375 0,0.82813 -0.48437,1.57813 -0.48438,0.73437 -1.40625,1.14062 -0.92188,0.39063 -2.07813,0.39063 -1.92187,0 -2.9375,-0.79688 -1,-0.79687 -1.28125,-2.35937 z" /> <path style="fill:#c9daf8;fill-rule:nonzero" inkscape:connector-curvature="0" id="path17" d="m 305,121.00015 0,0 C 305,116.58178 308.58179,113 313.00015,113 l 239.99966,0 c 2.12177,0 4.15668,0.84286 5.65699,2.3432 1.5003,1.5003 2.3432,3.53518 2.3432,5.65695 l 0,31.99969 C 561,157.41821 557.41821,161 552.99981,161 l -239.99966,0 0,0 C 308.58179,161 305,157.41821 305,152.99984 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path19" d="m 305,121.00015 0,0 C 305,116.58178 308.58179,113 313.00015,113 l 239.99966,0 c 2.12177,0 4.15668,0.84286 5.65699,2.3432 1.5003,1.5003 2.3432,3.53518 2.3432,5.65695 l 0,31.99969 C 561,157.41821 557.41821,161 552.99981,161 l -239.99966,0 0,0 C 308.58179,161 305,157.41821 305,152.99984 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path21" d="m 344.1536,139.545 1.6875,-0.14062 q 0.125,1.01562 0.5625,1.67187 0.4375,0.65625 1.35937,1.0625 0.9375,0.40625 2.09375,0.40625 1.03125,0 1.8125,-0.3125 0.79688,-0.3125 1.1875,-0.84375 0.39066,-0.53125 0.39066,-1.15625 0,-0.64062 -0.37503,-1.10937 -0.375,-0.48438 -1.23438,-0.8125 -0.54687,-0.21875 -2.42187,-0.65625 -1.875,-0.45313 -2.625,-0.85938 -0.96875,-0.51562 -1.45313,-1.26562 -0.46875,-0.75 -0.46875,-1.6875 0,-1.03125 0.57813,-1.92188 0.59375,-0.90625 1.70312,-1.35937 1.125,-0.46875 2.5,-0.46875 1.51563,0 2.67188,0.48437 1.15628,0.48438 1.76566,1.4375 0.625,0.9375 0.67187,2.14063 l -1.71878,0.125 q -0.14063,-1.28125 -0.95313,-1.9375 -0.79687,-0.67188 -2.35937,-0.67188 -1.625,0 -2.375,0.60938 -0.75,0.59375 -0.75,1.4375 0,0.73437 0.53125,1.20312 0.51562,0.46875 2.70312,0.96875 2.20313,0.5 3.01563,0.875 1.18753,0.54688 1.75003,1.39063 0.57813,0.82812 0.57813,1.92187 0,1.09375 -0.625,2.0625 -0.625,0.95313 -1.79691,1.48438 -1.15625,0.53125 -2.60938,0.53125 -1.84375,0 -3.09375,-0.53125 -1.25,-0.54688 -1.96875,-1.625 -0.70312,-1.07813 -0.73437,-2.45313 z m 14.66232,4.375 -3.01562,-9.85937 1.71875,0 1.5625,5.6875 0.59375,2.125 q 0.0312,-0.15625 0.5,-2.03125 l 1.57812,-5.78125 1.71875,0 1.46875,5.71875 0.48438,1.89062 0.57812,-1.90625 1.6875,-5.70312 1.625,0 -3.07812,9.85937 -1.73438,0 -1.57812,-5.90625 -0.375,-1.67187 -2,7.57812 -1.73438,0 z m 18.39484,-3.17187 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82812 -2.8125,0.82812 -2.15625,0 -3.42187,-1.32812 -1.26563,-1.32813 -1.26563,-3.73438 0,-2.48437 1.26563,-3.85937 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79687 0,0.14063 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48438 0.82812,0.85937 2.0625,0.85937 0.90625,0 1.54687,-0.46875 0.65625,-0.48437 1.04688,-1.54687 z m -5.48438,-2.70313 5.5,0 q -0.10937,-1.23437 -0.625,-1.85937 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76562 -0.85938,2.04687 z m 15.86011,2.70313 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82812 -2.8125,0.82812 -2.15625,0 -3.42188,-1.32812 -1.26562,-1.32813 -1.26562,-3.73438 0,-2.48437 1.26562,-3.85937 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79687 0,0.14063 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48438 0.82813,0.85937 2.0625,0.85937 0.90625,0 1.54688,-0.46875 0.65625,-0.48437 1.04687,-1.54687 z m -5.48437,-2.70313 5.5,0 q -0.10938,-1.23437 -0.625,-1.85937 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76562 -0.85937,2.04687 z m 9.11004,9.65625 0,-13.64062 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20313,-1.125 0.6875,-0.375 1.64062,-0.375 1.26563,0 2.23438,0.65625 0.96875,0.64062 1.45312,1.82812 0.5,1.1875 0.5,2.59375 0,1.51563 -0.54687,2.73438 -0.54688,1.20312 -1.57813,1.84375 -1.03125,0.64062 -2.17187,0.64062 -0.84375,0 -1.51563,-0.34375 -0.65625,-0.35937 -1.07812,-0.89062 l 0,4.79687 -1.67188,0 z m 1.51563,-8.65625 q 0,1.90625 0.76562,2.8125 0.78125,0.90625 1.875,0.90625 1.10938,0 1.89063,-0.9375 0.79687,-0.9375 0.79687,-2.92187 0,-1.875 -0.78125,-2.8125 -0.76562,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89062,1 -0.8125,1 -0.8125,2.89062 z m 8.21948,0.79688 0,-1.6875 5.125,0 0,1.6875 -5.125,0 z m 7.25958,4.07812 0,-8.54687 -1.48437,0 0,-1.3125 1.48437,0 0,-1.04688 q 0,-0.98437 0.17188,-1.46875 0.23437,-0.65625 0.84375,-1.04687 0.60937,-0.40625 1.70312,-0.40625 0.70313,0 1.5625,0.15625 l -0.25,1.46875 q -0.51562,-0.0937 -0.98437,-0.0937 -0.76563,0 -1.07813,0.32812 -0.3125,0.3125 -0.3125,1.20313 l 0,0.90625 1.92188,0 0,1.3125 -1.92188,0 0,8.54687 -1.65625,0 z m 4.76142,0 0,-9.85937 1.5,0 0,1.5 q 0.57812,-1.04688 1.0625,-1.375 0.48437,-0.34375 1.07812,-0.34375 0.84375,0 1.71875,0.54687 l -0.57812,1.54688 q -0.60938,-0.35938 -1.23438,-0.35938 -0.54687,0 -0.98437,0.32813 -0.42188,0.32812 -0.60938,0.90625 -0.28125,0.89062 -0.28125,1.95312 l 0,5.15625 -1.67187,0 z m 12.97827,-3.17187 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82812 -2.8125,0.82812 -2.15625,0 -3.42187,-1.32812 -1.26563,-1.32813 -1.26563,-3.73438 0,-2.48437 1.26563,-3.85937 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79687 0,0.14063 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48438 0.82812,0.85937 2.0625,0.85937 0.90625,0 1.54687,-0.46875 0.65625,-0.48437 1.04688,-1.54687 z m -5.48438,-2.70313 5.5,0 q -0.10937,-1.23437 -0.625,-1.85937 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76562 -0.85938,2.04687 z m 15.86011,2.70313 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82812 -2.8125,0.82812 -2.15625,0 -3.42187,-1.32812 -1.26563,-1.32813 -1.26563,-3.73438 0,-2.48437 1.26563,-3.85937 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79687 0,0.14063 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48438 0.82812,0.85937 2.0625,0.85937 0.90625,0 1.54687,-0.46875 0.65625,-0.48437 1.04688,-1.54687 z m -5.48438,-2.70313 5.5,0 q -0.10937,-1.23437 -0.625,-1.85937 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76562 -0.85938,2.04687 z m 20.7309,4.65625 q -0.9375,0.79688 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79687 -0.875,-2.03125 0,-0.73437 0.32812,-1.32812 0.32813,-0.59375 0.85938,-0.95313 0.53125,-0.35937 1.20312,-0.54687 0.5,-0.14063 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57813 0,-0.34375 0,-0.4375 0,-1.01562 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23437 q 0.23437,-1.04688 0.73437,-1.6875 0.51563,-0.64063 1.46875,-0.98438 0.96875,-0.35937 2.25,-0.35937 1.26563,0 2.04688,0.29687 0.78125,0.29688 1.15625,0.75 0.375,0.45313 0.51562,1.14063 0.0937,0.42187 0.0937,1.53125 l 0,2.23437 q 0,2.32813 0.0937,2.95313 0.10938,0.60937 0.4375,1.17187 l -1.75,0 q -0.26562,-0.51562 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35938 -2.73437,0.625 -1.03125,0.14063 -1.45313,0.32813 -0.42187,0.1875 -0.65625,0.54687 -0.23437,0.35938 -0.23437,0.79688 0,0.67187 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42188 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57812 0.26562,-1.67187 l 0,-0.60938 z m 4.04761,4.9375 0,-13.59375 1.67188,0 0,13.59375 -1.67188,0 z m 4.14478,0 0,-13.59375 1.67187,0 0,13.59375 -1.67187,0 z m 3.55108,-4.92187 q 0,-2.73438 1.53125,-4.0625 1.26563,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29688,1.32812 1.29688,3.67187 0,1.90625 -0.57813,3 -0.5625,1.07813 -1.65625,1.6875 -1.07812,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32812 -1.28125,-1.32813 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89062 0.82813,2.82812 0.82812,0.9375 2.07812,0.9375 1.25,0 2.0625,-0.9375 0.82813,-0.95312 0.82813,-2.89062 0,-1.82813 -0.82813,-2.76563 -0.82812,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07812,0.9375 -0.82813,0.9375 -0.82813,2.82813 z m 15.71949,1.3125 1.64062,0.21875 q -0.26562,1.6875 -1.375,2.65625 -1.10937,0.95312 -2.73437,0.95312 -2.01563,0 -3.25,-1.3125 -1.21875,-1.32812 -1.21875,-3.79687 0,-1.59375 0.51562,-2.78125 0.53125,-1.20313 1.60938,-1.79688 1.09375,-0.60937 2.35937,-0.60937 1.60938,0 2.625,0.8125 1.01563,0.8125 1.3125,2.3125 l -1.625,0.25 q -0.23437,-1 -0.82812,-1.5 -0.59375,-0.5 -1.42188,-0.5 -1.26562,0 -2.0625,0.90625 -0.78125,0.90625 -0.78125,2.85937 0,1.98438 0.76563,2.89063 0.76562,0.89062 1.98437,0.89062 0.98438,0 1.64063,-0.59375 0.65625,-0.60937 0.84375,-1.85937 z m 9.32812,2.39062 q -0.9375,0.79688 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79687 -0.875,-2.03125 0,-0.73437 0.32813,-1.32812 0.32812,-0.59375 0.85937,-0.95313 0.53125,-0.35937 1.20313,-0.54687 0.5,-0.14063 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57813 0,-0.34375 0,-0.4375 0,-1.01562 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23437 q 0.23438,-1.04688 0.73438,-1.6875 0.51562,-0.64063 1.46875,-0.98438 0.96875,-0.35937 2.25,-0.35937 1.26562,0 2.04687,0.29687 0.78125,0.29688 1.15625,0.75 0.375,0.45313 0.51563,1.14063 0.0937,0.42187 0.0937,1.53125 l 0,2.23437 q 0,2.32813 0.0937,2.95313 0.10937,0.60937 0.4375,1.17187 l -1.75,0 q -0.26563,-0.51562 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35938 -2.73438,0.625 -1.03125,0.14063 -1.45312,0.32813 -0.42188,0.1875 -0.65625,0.54687 -0.23438,0.35938 -0.23438,0.79688 0,0.67187 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42188 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57812 0.26563,-1.67187 l 0,-0.60938 z m 7.7351,3.4375 0.23438,1.48438 q -0.70313,0.14062 -1.26563,0.14062 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29687 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98437 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92187 0.0937,0.20313 0.29687,0.32813 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.54267,-10.1875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85937 1.67187,0 0,9.85937 -1.67187,0 z m 3.50421,-4.92187 q 0,-2.73438 1.53125,-4.0625 1.26562,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29687,1.32812 1.29687,3.67187 0,1.90625 -0.57812,3 -0.5625,1.07813 -1.65625,1.6875 -1.07813,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32812 -1.28125,-1.32813 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89062 0.82812,2.82812 0.82813,0.9375 2.07813,0.9375 1.25,0 2.0625,-0.9375 0.82812,-0.95312 0.82812,-2.89062 0,-1.82813 -0.82812,-2.76563 -0.82813,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07813,0.9375 -0.82812,0.9375 -0.82812,2.82813 z m 9.28192,4.92187 0,-9.85937 1.5,0 0,1.40625 q 1.09375,-1.625 3.14062,-1.625 0.89063,0 1.64063,0.32812 0.75,0.3125 1.10937,0.84375 0.375,0.51563 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67187,0 0,-6 q 0,-1.01562 -0.20313,-1.51562 -0.1875,-0.51563 -0.6875,-0.8125 -0.5,-0.29688 -1.17187,-0.29688 -1.0625,0 -1.84375,0.67188 -0.76563,0.67187 -0.76563,2.57812 l 0,5.375 -1.67187,0 z" /> <path style="fill:#c9daf8;fill-rule:nonzero" inkscape:connector-curvature="0" id="path23" d="m 305,9.00015 0,0 C 305,4.58178 308.58179,1 313.00015,1 l 239.99966,0 c 2.12177,0 4.15668,0.84286 5.65699,2.34318 C 560.1571,4.84352 561,6.87838 561,9.00015 l 0,31.99969 C 561,45.41821 557.41821,49 552.99981,49 l -239.99966,0 0,0 C 308.58179,49 305,45.41821 305,40.99984 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path25" d="m 305,9.00015 0,0 C 305,4.58178 308.58179,1 313.00015,1 l 239.99966,0 c 2.12177,0 4.15668,0.84286 5.65699,2.34318 C 560.1571,4.84352 561,6.87838 561,9.00015 l 0,31.99969 C 561,45.41821 557.41821,49 552.99981,49 l -239.99966,0 0,0 C 308.58179,49 305,45.41821 305,40.99984 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path27" d="m 324.0519,31.92 0,-13.59375 9.84375,0 0,1.59375 -8.04688,0 0,4.17187 7.53125,0 0,1.59375 -7.53125,0 0,4.625 8.35938,0 0,1.60938 -10.15625,0 z m 18.63107,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 3.78195,5.75 1.60937,0.25 q 0.10938,0.75 0.57813,1.09375 0.60937,0.45312 1.6875,0.45312 1.17187,0 1.79687,-0.46875 0.625,-0.45312 0.85938,-1.28125 0.125,-0.51562 0.10937,-2.15625 -1.09375,1.29688 -2.71875,1.29688 -2.03125,0 -3.15625,-1.46875 -1.10937,-1.46875 -1.10937,-3.51563 0,-1.40625 0.51562,-2.59375 0.51563,-1.20312 1.48438,-1.84375 0.96875,-0.65625 2.26562,-0.65625 1.75,0 2.87504,1.40625 l 0,-1.1875 1.54687,0 0,8.51563 q 0,2.3125 -0.46875,3.26562 -0.46875,0.96875 -1.48441,1.51563 -1.01562,0.5625 -2.5,0.5625 -1.76562,0 -2.85937,-0.79688 -1.07813,-0.79687 -1.03125,-2.39062 z m 1.375,-5.92188 q 0,1.95313 0.76562,2.84375 0.78125,0.89063 1.9375,0.89063 1.14063,0 1.92188,-0.89063 0.78128,-0.89062 0.78128,-2.78125 0,-1.8125 -0.81253,-2.71875 -0.79688,-0.92187 -1.92188,-0.92187 -1.10937,0 -1.89062,0.90625 -0.78125,0.89062 -0.78125,2.67187 z m 16.04758,1.9375 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42187,-1.32813 Q 356.45,29.4825 356.45,27.07625 q 0,-2.48438 1.26563,-3.85938 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48437 0.82812,0.85938 2.0625,0.85938 0.90625,0 1.54687,-0.46875 0.65625,-0.48438 1.04688,-1.54688 z m -5.48438,-2.70312 5.5,0 q -0.10937,-1.23438 -0.625,-1.85938 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76563 -0.85938,2.04688 z m 9.09448,5.875 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 17.86475,0 0,-1.45313 q -1.14063,1.67188 -3.125,1.67188 -0.85938,0 -1.625,-0.32813 -0.75,-0.34375 -1.125,-0.84375 -0.35938,-0.5 -0.51563,-1.23437 -0.0937,-0.5 -0.0937,-1.5625 l 0,-6.10938 1.67188,0 0,5.46875 q 0,1.3125 0.0937,1.76563 0.15625,0.65625 0.67187,1.03125 0.51563,0.375 1.26563,0.375 0.75,0 1.40625,-0.375 0.65625,-0.39063 0.92187,-1.04688 0.28125,-0.67187 0.28125,-1.9375 l 0,-5.28125 1.67188,0 0,9.85938 -1.5,0 z m 3.92261,0 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14062,-1.625 0.89063,0 1.64063,0.32813 0.75,0.3125 1.10937,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67187,0 0,-6 q 0,-1.01563 -0.20313,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17187,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76563,0.67188 -0.76563,2.57813 l 0,5.375 -1.67187,0 z m 10.37567,0 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97833,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.06323,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57812,-1.04687 1.0625,-1.375 0.48437,-0.34375 1.07812,-0.34375 0.84375,0 1.71875,0.54688 l -0.57812,1.54687 q -0.60938,-0.35937 -1.23438,-0.35937 -0.54687,0 -0.98437,0.32812 -0.42188,0.32813 -0.60938,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67187,0 z m 6.2439,0 0,-13.59375 1.67187,0 0,7.75 3.95313,-4.01563 2.15625,0 -3.76563,3.65625 4.14063,6.20313 -2.0625,0 -3.25,-5.03125 -1.17188,1.125 0,3.90625 -1.67187,0 z m 16.0625,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42187,-1.32813 -1.26563,-1.32812 -1.26563,-3.73437 0,-2.48438 1.26563,-3.85938 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48437 0.82812,0.85938 2.0625,0.85938 0.90625,0 1.54687,-0.46875 0.65625,-0.48438 1.04688,-1.54688 z m -5.48438,-2.70312 5.5,0 q -0.10937,-1.23438 -0.625,-1.85938 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76563 -0.85938,2.04688 z m 15.50073,5.875 0,-1.25 q -0.9375,1.46875 -2.75,1.46875 -1.17187,0 -2.17187,-0.64063 -0.98438,-0.65625 -1.53125,-1.8125 -0.53125,-1.17187 -0.53125,-2.6875 0,-1.46875 0.48437,-2.67187 0.5,-1.20313 1.46875,-1.84375 0.98438,-0.64063 2.20313,-0.64063 0.89062,0 1.57812,0.375 0.70313,0.375 1.14063,0.98438 l 0,-4.875 1.65625,0 0,13.59375 -1.54688,0 z m -5.28125,-4.92188 q 0,1.89063 0.79688,2.82813 0.8125,0.9375 1.89062,0.9375 1.09375,0 1.85938,-0.89063 0.76562,-0.89062 0.76562,-2.73437 0,-2.01563 -0.78125,-2.95313 -0.78125,-0.95312 -1.92187,-0.95312 -1.10938,0 -1.85938,0.90625 -0.75,0.90625 -0.75,2.85937 z m 13.77777,1.98438 1.65625,-0.26563 q 0.14063,1 0.76563,1.53125 0.64062,0.51563 1.78125,0.51563 1.15625,0 1.70312,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48437,-0.89063 -0.34375,-0.21875 -1.70313,-0.5625 -1.84375,-0.46875 -2.5625,-0.79687 -0.70312,-0.34375 -1.07812,-0.9375 -0.35938,-0.60938 -0.35938,-1.32813 0,-0.65625 0.29688,-1.21875 0.3125,-0.5625 0.82812,-0.9375 0.39063,-0.28125 1.0625,-0.48437 0.67188,-0.20313 1.4375,-0.20313 1.17188,0 2.04688,0.34375 0.875,0.32813 1.28125,0.90625 0.42187,0.5625 0.57812,1.51563 l -1.625,0.21875 q -0.10937,-0.75 -0.65625,-1.17188 -0.53125,-0.4375 -1.5,-0.4375 -1.15625,0 -1.64062,0.39063 -0.48438,0.375 -0.48438,0.875 0,0.32812 0.20313,0.59375 0.20312,0.26562 0.64062,0.4375 0.25,0.0937 1.46875,0.4375 1.76563,0.46875 2.46875,0.76562 0.70313,0.29688 1.09375,0.875 0.40625,0.57813 0.40625,1.4375 0,0.82813 -0.48437,1.57813 -0.48438,0.73437 -1.40625,1.14062 -0.92188,0.39063 -2.07813,0.39063 -1.92187,0 -2.9375,-0.79688 -1,-0.79687 -1.28125,-2.35937 z m 10,6.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20313,-1.125 0.6875,-0.375 1.64062,-0.375 1.26563,0 2.23438,0.65625 0.96875,0.64063 1.45312,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54687,2.73437 -0.54688,1.20313 -1.57813,1.84375 -1.03125,0.64063 -2.17187,0.64063 -0.84375,0 -1.51563,-0.34375 -0.65625,-0.35938 -1.07812,-0.89063 l 0,4.79688 -1.67188,0 z m 1.51563,-8.65625 q 0,1.90625 0.76562,2.8125 0.78125,0.90625 1.875,0.90625 1.10938,0 1.89063,-0.9375 0.79687,-0.9375 0.79687,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76562,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89062,1 -0.8125,1 -0.8125,2.89063 z m 15.29754,3.65625 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.07886,4.9375 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14062,-1.625 0.89063,0 1.64063,0.32813 0.75,0.3125 1.10937,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67187,0 0,-6 q 0,-1.01563 -0.20313,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17187,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76563,0.67188 -0.76563,2.57813 l 0,5.375 -1.67187,0 z m 15.96527,0 0,-8.54688 -1.48438,0 0,-1.3125 1.48438,0 0,-1.04687 q 0,-0.98438 0.17187,-1.46875 0.23438,-0.65625 0.84375,-1.04688 0.60938,-0.40625 1.70313,-0.40625 0.70312,0 1.5625,0.15625 l -0.25,1.46875 q -0.51563,-0.0937 -0.98438,-0.0937 -0.76562,0 -1.07812,0.32813 -0.3125,0.3125 -0.3125,1.20312 l 0,0.90625 1.92187,0 0,1.3125 -1.92187,0 0,8.54688 -1.65625,0 z m 4.76141,0 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 12.97833,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42188,-1.32813 -1.26562,-1.32812 -1.26562,-3.73437 0,-2.48438 1.26562,-3.85938 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48437 0.82813,0.85938 2.0625,0.85938 0.90625,0 1.54688,-0.46875 0.65625,-0.48438 1.04687,-1.54688 z m -5.48437,-2.70312 5.5,0 q -0.10938,-1.23438 -0.625,-1.85938 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76563 -0.85937,2.04688 z m 15.86011,2.70312 1.71875,0.21875 q -0.40625,1.5 -1.51563,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42187,-1.32813 -1.26563,-1.32812 -1.26563,-3.73437 0,-2.48438 1.26563,-3.85938 1.28125,-1.375 3.32812,-1.375 1.98438,0 3.23438,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92188,2.48437 0.82812,0.85938 2.0625,0.85938 0.90625,0 1.54687,-0.46875 0.65625,-0.48438 1.04688,-1.54688 z M 535.588,26.045 l 5.5,0 q -0.10937,-1.23438 -0.625,-1.85938 -0.79687,-0.96875 -2.07812,-0.96875 -1.14063,0 -1.9375,0.78125 -0.78125,0.76563 -0.85938,2.04688 z" /> <path style="fill:#c9daf8;fill-rule:nonzero" inkscape:connector-curvature="0" id="path29" d="m 1,121.00015 0,0 C 1,116.58178 4.58179,113 9.00015,113 l 239.9997,0 c 2.12177,0 4.15665,0.84286 5.65696,2.3432 1.50033,1.5003 2.3432,3.53518 2.3432,5.65695 l 0,31.99969 c 0,4.41837 -3.58179,8.00016 -8.00016,8.00016 l -239.9997,0 0,0 C 4.58179,161 1,157.41821 1,152.99984 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path31" d="m 1,121.00015 0,0 C 1,116.58178 4.58179,113 9.00015,113 l 239.9997,0 c 2.12177,0 4.15665,0.84286 5.65696,2.3432 1.50033,1.5003 2.3432,3.53518 2.3432,5.65695 l 0,31.99969 c 0,4.41837 -3.58179,8.00016 -8.00016,8.00016 l -239.9997,0 0,0 C 4.58179,161 1,157.41821 1,152.99984 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path33" d="m 20.59587,143.92 0,-13.59375 1.8125,0 0,5.57813 7.0625,0 0,-5.57813 1.79687,0 0,13.59375 -1.79687,0 0,-6.40625 -7.0625,0 0,6.40625 -1.8125,0 z m 19.95732,-3.17187 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82812 -2.8125,0.82812 -2.15625,0 -3.42188,-1.32812 -1.26562,-1.32813 -1.26562,-3.73438 0,-2.48437 1.26562,-3.85937 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79687 0,0.14063 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48438 0.82813,0.85937 2.0625,0.85937 0.90625,0 1.54688,-0.46875 0.65625,-0.48437 1.04687,-1.54687 z m -5.48437,-2.70313 5.5,0 q -0.10938,-1.23437 -0.625,-1.85937 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76562 -0.85937,2.04687 z m 15.54759,4.65625 q -0.9375,0.79688 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79687 -0.875,-2.03125 0,-0.73437 0.32812,-1.32812 0.32813,-0.59375 0.85938,-0.95313 0.53125,-0.35937 1.20312,-0.54687 0.5,-0.14063 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57813 0,-0.34375 0,-0.4375 0,-1.01562 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23437 q 0.23437,-1.04688 0.73437,-1.6875 0.51563,-0.64063 1.46875,-0.98438 0.96875,-0.35937 2.25,-0.35937 1.26563,0 2.04688,0.29687 0.78125,0.29688 1.15625,0.75 0.375,0.45313 0.51562,1.14063 0.0937,0.42187 0.0937,1.53125 l 0,2.23437 q 0,2.32813 0.0937,2.95313 0.10938,0.60937 0.4375,1.17187 l -1.75,0 q -0.26562,-0.51562 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35938 -2.73437,0.625 -1.03125,0.14063 -1.45313,0.32813 -0.42187,0.1875 -0.65625,0.54687 -0.23437,0.35938 -0.23437,0.79688 0,0.67187 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42188 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57812 0.26562,-1.67187 l 0,-0.60938 z m 4.07885,8.71875 0,-13.64062 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64062 1.45313,1.82812 0.5,1.1875 0.5,2.59375 0,1.51563 -0.54688,2.73438 -0.54687,1.20312 -1.57812,1.84375 -1.03125,0.64062 -2.17188,0.64062 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35937 -1.07813,-0.89062 l 0,4.79687 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92187 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89062 z m 15.59027,4.875 -1.54687,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32812 2.70312,-1.32812 0.90625,0 1.71875,0.375 0.8125,0.35937 1.32813,1.03125 0.53125,0.65625 0.82812,1.59375 0.29688,0.9375 0.29688,2 0,2.53125 -1.25,3.92187 -1.25,1.375 -3,1.375 -1.75,0 -2.73438,-1.45312 l 0,1.23437 z m -0.0156,-5 q 0,1.76563 0.46875,2.5625 0.79687,1.28125 2.14062,1.28125 1.09375,0 1.89063,-0.9375 0.79687,-0.95312 0.79687,-2.84375 0,-1.92187 -0.76562,-2.84375 -0.76563,-0.92187 -1.84375,-0.92187 -1.09375,0 -1.89063,0.95312 -0.79687,0.95313 -0.79687,2.75 z m 8.86009,-6.6875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85937 1.67187,0 0,9.85937 -1.67187,0 z m 7.78544,-1.5 0.23438,1.48438 q -0.70313,0.14062 -1.26563,0.14062 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29687 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98437 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92187 0.0937,0.20313 0.29687,0.32813 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52706,1.5 0,-9.85937 1.5,0 0,1.39062 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45312 1.76562,-0.45312 1.09375,0 1.79688,0.45312 0.70312,0.45313 0.98439,1.28125 1.17187,-1.73437 3.04687,-1.73437 1.46875,0 2.25,0.8125 0.79688,0.8125 0.79688,2.5 l 0,6.76562 -1.67188,0 0,-6.20312 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45313 -0.59375,-0.71875 -0.42187,-0.26563 -1,-0.26563 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67189,0 0,-6.40625 q 0,-1.10937 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35938 -0.85937,1.07813 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10937 -1.67187,0 z m 21.97831,-1.21875 q -0.9375,0.79688 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79687 -0.875,-2.03125 0,-0.73437 0.32813,-1.32812 0.32812,-0.59375 0.85937,-0.95313 0.53125,-0.35937 1.20313,-0.54687 0.5,-0.14063 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57813 0,-0.34375 0,-0.4375 0,-1.01562 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23437 q 0.23438,-1.04688 0.73438,-1.6875 0.51562,-0.64063 1.46875,-0.98438 0.96875,-0.35937 2.25,-0.35937 1.26562,0 2.04687,0.29687 0.78125,0.29688 1.15625,0.75 0.375,0.45313 0.51563,1.14063 0.0937,0.42187 0.0937,1.53125 l 0,2.23437 q 0,2.32813 0.0937,2.95313 0.10937,0.60937 0.4375,1.17187 l -1.75,0 q -0.26563,-0.51562 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35938 -2.73438,0.625 -1.03125,0.14063 -1.45312,0.32813 -0.42188,0.1875 -0.65625,0.54687 -0.23438,0.35938 -0.23438,0.79688 0,0.67187 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42188 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57812 0.26563,-1.67187 l 0,-0.60938 z m 4.07883,8.71875 0,-13.64062 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64062 1.45313,1.82812 0.5,1.1875 0.5,2.59375 0,1.51563 -0.54688,2.73438 -0.54687,1.20312 -1.57812,1.84375 -1.03125,0.64062 -2.17188,0.64062 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35937 -1.07813,-0.89062 l 0,4.79687 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92187 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89062 z m 13.4184,-0.0469 q 0,-2.73438 1.53125,-4.0625 1.26562,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29687,1.32812 1.29687,3.67187 0,1.90625 -0.57812,3 -0.5625,1.07813 -1.65625,1.6875 -1.07813,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32812 -1.28125,-1.32813 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89062 0.82812,2.82812 0.82813,0.9375 2.07813,0.9375 1.25,0 2.0625,-0.9375 0.82812,-0.95312 0.82812,-2.89062 0,-1.82813 -0.82812,-2.76563 -0.82813,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07813,0.9375 -0.82812,0.9375 -0.82812,2.82813 z m 9.28198,8.70312 0,-13.64062 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64062 1.45313,1.82812 0.5,1.1875 0.5,2.59375 0,1.51563 -0.54688,2.73438 -0.54687,1.20312 -1.57812,1.84375 -1.03125,0.64062 -2.17188,0.64062 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35937 -1.07813,-0.89062 l 0,4.79687 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92187 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89062 z m 12.51633,3.375 0.23438,1.48438 q -0.70313,0.14062 -1.26563,0.14062 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29687 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98437 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92187 0.0937,0.20313 0.29687,0.32813 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.5427,-10.1875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85937 1.67187,0 0,9.85937 -1.67187,0 z m 4.12918,0 0,-9.85937 1.5,0 0,1.39062 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45312 1.76562,-0.45312 1.09375,0 1.79688,0.45312 0.70312,0.45313 0.98437,1.28125 1.17188,-1.73437 3.04688,-1.73437 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76562 -1.67187,0 0,-6.20312 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45313 -0.59375,-0.71875 -0.42188,-0.26563 -1,-0.26563 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10937 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35938 -0.85937,1.07813 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10937 -1.67187,0 z m 15.55642,-11.6875 0,-1.90625 1.67188,0 0,1.90625 -1.67188,0 z m 0,11.6875 0,-9.85937 1.67188,0 0,9.85937 -1.67188,0 z m 3.25422,0 0,-1.35937 6.26562,-7.1875 q -1.0625,0.0469 -1.875,0.0469 l -4.01562,0 0,-1.35937 8.04687,0 0,1.10937 -5.34375,6.25 -1.01562,1.14063 q 1.10937,-0.0781 2.09375,-0.0781 l 4.5625,0 0,1.4375 -8.71875,0 z m 16.64062,-1.21875 q -0.9375,0.79688 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79687 -0.875,-2.03125 0,-0.73437 0.32813,-1.32812 0.32812,-0.59375 0.85937,-0.95313 0.53125,-0.35937 1.20313,-0.54687 0.5,-0.14063 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57813 0,-0.34375 0,-0.4375 0,-1.01562 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23437 q 0.23438,-1.04688 0.73438,-1.6875 0.51562,-0.64063 1.46875,-0.98438 0.96875,-0.35937 2.25,-0.35937 1.26562,0 2.04687,0.29687 0.78125,0.29688 1.15625,0.75 0.375,0.45313 0.51563,1.14063 0.0937,0.42187 0.0937,1.53125 l 0,2.23437 q 0,2.32813 0.0937,2.95313 0.10937,0.60937 0.4375,1.17187 l -1.75,0 q -0.26563,-0.51562 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35938 -2.73438,0.625 -1.03125,0.14063 -1.45312,0.32813 -0.42188,0.1875 -0.65625,0.54687 -0.23438,0.35938 -0.23438,0.79688 0,0.67187 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42188 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57812 0.26563,-1.67187 l 0,-0.60938 z m 7.73507,3.4375 0.23438,1.48438 q -0.70313,0.14062 -1.26563,0.14062 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29687 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98437 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92187 0.0937,0.20313 0.29687,0.32813 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.5427,-10.1875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85937 1.67187,0 0,9.85937 -1.67187,0 z m 3.50418,-4.92187 q 0,-2.73438 1.53125,-4.0625 1.26562,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29687,1.32812 1.29687,3.67187 0,1.90625 -0.57812,3 -0.5625,1.07813 -1.65625,1.6875 -1.07813,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32812 -1.28125,-1.32813 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89062 0.82812,2.82812 0.82813,0.9375 2.07813,0.9375 1.25,0 2.0625,-0.9375 0.82812,-0.95312 0.82812,-2.89062 0,-1.82813 -0.82812,-2.76563 -0.82813,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07813,0.9375 -0.82812,0.9375 -0.82812,2.82813 z m 9.28198,4.92187 0,-9.85937 1.5,0 0,1.40625 q 1.09375,-1.625 3.14062,-1.625 0.89063,0 1.64063,0.32812 0.75,0.3125 1.10937,0.84375 0.375,0.51563 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67187,0 0,-6 q 0,-1.01562 -0.20313,-1.51562 -0.1875,-0.51563 -0.6875,-0.8125 -0.5,-0.29688 -1.17187,-0.29688 -1.0625,0 -1.84375,0.67188 -0.76563,0.67187 -0.76563,2.57812 l 0,5.375 -1.67187,0 z m 9.70383,-2.9375 1.65625,-0.26562 q 0.14062,1 0.76562,1.53125 0.64063,0.51562 1.78125,0.51562 1.15625,0 1.70313,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48438,-0.89062 -0.34375,-0.21875 -1.70312,-0.5625 -1.84375,-0.46875 -2.5625,-0.79688 -0.70313,-0.34375 -1.07813,-0.9375 -0.35937,-0.60937 -0.35937,-1.32812 0,-0.65625 0.29687,-1.21875 0.3125,-0.5625 0.82813,-0.9375 0.39062,-0.28125 1.0625,-0.48438 0.67187,-0.20312 1.4375,-0.20312 1.17187,0 2.04687,0.34375 0.875,0.32812 1.28125,0.90625 0.42188,0.5625 0.57813,1.51562 l -1.625,0.21875 q -0.10938,-0.75 -0.65625,-1.17187 -0.53125,-0.4375 -1.5,-0.4375 -1.15625,0 -1.64063,0.39062 -0.48437,0.375 -0.48437,0.875 0,0.32813 0.20312,0.59375 0.20313,0.26563 0.64063,0.4375 0.25,0.0937 1.46875,0.4375 1.76562,0.46875 2.46875,0.76563 0.70312,0.29687 1.09375,0.875 0.40625,0.57812 0.40625,1.4375 0,0.82812 -0.48438,1.57812 -0.48437,0.73438 -1.40625,1.14063 -0.92187,0.39062 -2.07812,0.39062 -1.92188,0 -2.9375,-0.79687 -1,-0.79688 -1.28125,-2.35938 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path35" d="m 433,49 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path37" d="m 433,49 0,52" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path39" d="M 429.69653,101 433,110.0762 436.30346,101 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path41" d="m 129,49 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path43" d="m 129,49 0,52" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path45" d="M 125.69653,101 129,110.0762 132.30346,101 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path47" d="m 425,97 16,0 0,16 -16,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path49" d="m 129,49 c 0,12 76,18 152,24 76,6 152,12 152,24" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path51" d="m 129,49 c 0,12 76,18 152,24 76,6 152,12 152,24" /> </svg>
12800
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/12800/mark-flow.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" viewBox="0 0 674 256" stroke-miterlimit="10" id="svg2" inkscape:version="0.48.4 r9939" width="100%" height="100%" sodipodi:docname="mark-flow.svg" style="fill:none;stroke:none"> <metadata id="metadata159"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> </cc:Work> </rdf:RDF> </metadata> <defs id="defs157" /> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="640" inkscape:window-height="480" id="namedview155" showgrid="false" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.26367188" inkscape:cx="448" inkscape:cy="28" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="0" inkscape:current-layer="svg2" /> <clipPath id="p.0"> <path d="m 0,0 1024,0 0,768 L 0,768 0,0 z" clip-rule="nonzero" id="path5" inkscape:connector-curvature="0" /> </clipPath> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path11" d="M 576,180 576,36" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path13" d="M 576,180 576,42.85417" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path15" d="m 576,42.85417 2.24915,2.24918 L 576,38.9238 l -2.24915,6.17955 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path17" d="M 640,180 640,36" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path19" d="M 640,180 640,42.85417" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path21" d="m 640,42.85417 2.24915,2.24918 L 640,38.9238 l -2.24915,6.17955 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path23" d="m 320,132 0,-96" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path25" d="m 320,132 0,-89.14583" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path27" d="m 320,42.85417 2.24918,2.24918 L 320,38.9238 l -2.24918,6.17955 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path29" d="m 384,132 0,-96" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path31" d="m 384,132 0,-89.14583" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path33" d="m 384,42.85417 2.24918,2.24918 L 384,38.9238 l -2.24918,6.17955 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path35" d="m 448,132 0,-96" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path37" d="m 448,132 0,-89.14583" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path39" d="m 448,42.85417 2.24915,2.24918 L 448,38.9238 l -2.24918,6.17955 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path41" d="m 504,132 0,-96" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path43" d="m 504,132 0,-89.14583" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path45" d="m 504,42.85417 2.24915,2.24918 L 504,38.9238 l -2.24915,6.17955 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path47" d="m 200,84 0,-48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path49" d="m 200,84 0,-41.14583" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path51" d="m 200,42.85417 2.24918,2.24918 L 200,38.9238 l -2.24918,6.17955 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path53" d="m 256,84 0,-48" /> <path style="stroke:#cccccc;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path55" d="m 256,84 0,-41.14583" /> <path style="fill:#cccccc;fill-rule:evenodd;stroke:#cccccc;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path57" d="m 256,42.85417 2.24918,2.24918 L 256,38.9238 l -2.24918,6.17955 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path59" d="m 544,4 0,248" /> <path style="stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path61" d="m 544,4 0,248" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path63" d="m 0,111 176,0 0,40 -176,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path65" d="m 10.40625,137.91998 0,-13.59375 2.71875,0 3.21875,9.625 q 0.4375,1.34375 0.640625,2.01562 0.234375,-0.75 0.734375,-2.1875 l 3.25,-9.45312 2.421875,0 0,13.59375 -1.734375,0 0,-11.39063 -3.953125,11.39063 -1.625,0 -3.9375,-11.57813 0,11.57813 -1.734375,0 z m 21.822052,-1.21875 q -0.9375,0.79687 -1.796875,1.125 -0.859375,0.3125 -1.84375,0.3125 -1.609375,0 -2.484375,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.328125,-1.32813 0.328125,-0.59375 0.859375,-0.95312 0.53125,-0.35938 1.203125,-0.54688 0.5,-0.14062 1.484375,-0.25 2.03125,-0.25 2.984375,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.640625,-0.5625 -1.90625,-0.5625 -1.171875,0 -1.734375,0.40625 -0.5625,0.40625 -0.828125,1.46875 l -1.640625,-0.23438 q 0.234375,-1.04687 0.734375,-1.6875 0.515625,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.265625,0 2.046875,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.515625,1.14062 0.09375,0.42188 0.09375,1.53125 l 0,2.23438 q 0,2.32812 0.09375,2.95312 0.109375,0.60938 0.4375,1.17188 l -1.75,0 q -0.265625,-0.51563 -0.328125,-1.21875 z m -0.140625,-3.71875 q -0.90625,0.35937 -2.734375,0.625 -1.03125,0.14062 -1.453125,0.32812 -0.421875,0.1875 -0.65625,0.54688 -0.234375,0.35937 -0.234375,0.79687 0,0.67188 0.5,1.125 0.515625,0.4375 1.484375,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.109375,-1.15625 0.265625,-0.57813 0.265625,-1.67188 l 0,-0.60937 z m 4.063213,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 6.24393,0 0,-13.59375 1.67188,0 0,7.75 3.95312,-4.01563 2.15625,0 -3.76562,3.65625 4.14062,6.20313 -2.0625,0 -3.25,-5.03125 -1.17187,1.125 0,3.90625 -1.67188,0 z m 16.04268,0 -1.54687,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70312,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32812,1.03125 0.53125,0.65625 0.82813,1.59375 0.29687,0.9375 0.29687,2 0,2.53125 -1.25,3.92188 -1.24999,1.375 -2.99999,1.375 -1.75,0 -2.73438,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79687,1.28125 2.14062,1.28125 1.09375,0 1.89063,-0.9375 0.79687,-0.95313 0.79687,-2.84375 0,-1.92188 -0.76562,-2.84375 -0.76563,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89063,0.95313 -0.79687,0.95312 -0.79687,2.75 z m 8.86009,-6.6875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85938 1.67187,0 0,9.85938 -1.67187,0 z m 7.78544,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52706,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07885,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 14.24652,4.875 0,-13.59375 1.84375,0 7.14063,10.67187 0,-10.67187 1.71875,0 0,13.59375 -1.84375,0 -7.14063,-10.6875 0,10.6875 -1.71875,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path67" d="m 176,92 112,0 0,32 -112,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path69" d="m 212.52133,118.91998 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.06323,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57812,-1.04687 1.0625,-1.375 0.48437,-0.34375 1.07812,-0.34375 0.84375,0 1.71875,0.54688 l -0.57812,1.54687 q -0.60938,-0.35937 -1.23438,-0.35937 -0.54687,0 -0.98437,0.32812 -0.42188,0.32813 -0.60938,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67187,0 z m 6.24393,0 0,-13.59375 1.67187,0 0,7.75 3.95313,-4.01563 2.15625,0 -3.76563,3.65625 4.14063,6.20313 -2.0625,0 -3.25,-5.03125 -1.17188,1.125 0,3.90625 -1.67187,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path71" d="m 288,4 0,248" /> <path style="stroke:#000000;stroke-width:8;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path73" d="m 288,4 0,248" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path75" d="m 176,132 112,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path77" d="m 176,132 98.29166,0" /> <path style="fill:#0000ff;fill-rule:evenodd;stroke:#0000ff;stroke-width:4;stroke-linecap:butt" inkscape:connector-curvature="0" id="path79" d="m 274.29166,132 -4.49835,4.49832 12.3591,-4.49832 -12.3591,-4.49832 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path81" d="m 288,132 256,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path83" d="m 288,132 240.84003,0" /> <path style="fill:#0000ff;fill-rule:nonzero;stroke:#0000ff;stroke-width:4;stroke-linecap:butt" inkscape:connector-curvature="0" id="path85" d="m 542,132 c 0,3.63403 -2.94598,6.57999 -6.58002,6.57999 -3.63403,0 -6.57995,-2.94596 -6.57995,-6.57999 0,-3.63403 2.94592,-6.57999 6.57995,-6.57999 3.63404,0 6.58002,2.94596 6.58002,6.57999 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path87" d="m 288,92 256,0 0,32 -256,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path89" d="m 390.29498,118.91998 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97833,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.04758,4.9375 0,-13.59375 1.67187,0 0,13.59375 -1.67187,0 z m 4.1448,0 0,-13.59375 1.67188,0 0,13.59375 -1.67188,0 z m 3.55109,-4.92188 q 0,-2.73437 1.53125,-4.0625 1.26562,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29687,1.32813 1.29687,3.67188 0,1.90625 -0.57812,3 -0.5625,1.07812 -1.65625,1.6875 -1.07813,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32813 -1.28125,-1.32812 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89063 0.82812,2.82813 0.82813,0.9375 2.07813,0.9375 1.25,0 2.0625,-0.9375 0.82812,-0.95313 0.82812,-2.89063 0,-1.82812 -0.82812,-2.76562 -0.82813,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07813,0.9375 -0.82812,0.9375 -0.82812,2.82812 z m 15.71948,1.3125 1.64062,0.21875 q -0.26562,1.6875 -1.375,2.65625 -1.10937,0.95313 -2.73437,0.95313 -2.01563,0 -3.25,-1.3125 -1.21875,-1.32813 -1.21875,-3.79688 0,-1.59375 0.51562,-2.78125 0.53125,-1.20312 1.60938,-1.79687 1.09375,-0.60938 2.35937,-0.60938 1.60938,0 2.625,0.8125 1.01563,0.8125 1.3125,2.3125 l -1.625,0.25 q -0.23437,-1 -0.82812,-1.5 -0.59375,-0.5 -1.42188,-0.5 -1.26562,0 -2.0625,0.90625 -0.78125,0.90625 -0.78125,2.85938 0,1.98437 0.76563,2.89062 0.76562,0.89063 1.98437,0.89063 0.98438,0 1.64063,-0.59375 0.65625,-0.60938 0.84375,-1.85938 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path91" d="m 0,159 176,0 0,40 -176,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path93" d="m 10.40625,185.91998 0,-13.59375 2.71875,0 3.21875,9.625 q 0.4375,1.34375 0.640625,2.01562 0.234375,-0.75 0.734375,-2.1875 l 3.25,-9.45312 2.421875,0 0,13.59375 -1.734375,0 0,-11.39063 -3.953125,11.39063 -1.625,0 -3.9375,-11.57813 0,11.57813 -1.734375,0 z m 21.822052,-1.21875 q -0.9375,0.79687 -1.796875,1.125 -0.859375,0.3125 -1.84375,0.3125 -1.609375,0 -2.484375,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.328125,-1.32813 0.328125,-0.59375 0.859375,-0.95312 0.53125,-0.35938 1.203125,-0.54688 0.5,-0.14062 1.484375,-0.25 2.03125,-0.25 2.984375,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.640625,-0.5625 -1.90625,-0.5625 -1.171875,0 -1.734375,0.40625 -0.5625,0.40625 -0.828125,1.46875 l -1.640625,-0.23438 q 0.234375,-1.04687 0.734375,-1.6875 0.515625,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.265625,0 2.046875,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.515625,1.14062 0.09375,0.42188 0.09375,1.53125 l 0,2.23438 q 0,2.32812 0.09375,2.95312 0.109375,0.60938 0.4375,1.17188 l -1.75,0 q -0.265625,-0.51563 -0.328125,-1.21875 z m -0.140625,-3.71875 q -0.90625,0.35937 -2.734375,0.625 -1.03125,0.14062 -1.453125,0.32812 -0.421875,0.1875 -0.65625,0.54688 -0.234375,0.35937 -0.234375,0.79687 0,0.67188 0.5,1.125 0.515625,0.4375 1.484375,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.109375,-1.15625 0.265625,-0.57813 0.265625,-1.67188 l 0,-0.60937 z m 4.063213,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 6.24393,0 0,-13.59375 1.67188,0 0,7.75 3.95312,-4.01563 2.15625,0 -3.76562,3.65625 4.14062,6.20313 -2.0625,0 -3.25,-5.03125 -1.17187,1.125 0,3.90625 -1.67188,0 z m 16.04268,0 -1.54687,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70312,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32812,1.03125 0.53125,0.65625 0.82813,1.59375 0.29687,0.9375 0.29687,2 0,2.53125 -1.25,3.92188 -1.24999,1.375 -2.99999,1.375 -1.75,0 -2.73438,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79687,1.28125 2.14062,1.28125 1.09375,0 1.89063,-0.9375 0.79687,-0.95313 0.79687,-2.84375 0,-1.92188 -0.76562,-2.84375 -0.76563,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89063,0.95313 -0.79687,0.95312 -0.79687,2.75 z m 8.86009,-6.6875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85938 1.67187,0 0,9.85938 -1.67187,0 z m 7.78544,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52706,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07885,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 14.24652,4.875 0,-13.59375 1.84375,0 7.14063,10.67187 0,-10.67187 1.71875,0 0,13.59375 -1.84375,0 -7.14063,-10.6875 0,10.6875 -1.71875,0 z m 16.78545,-2.20313 0,-3.71875 -3.70313,0 0,-1.5625 3.70313,0 0,-3.70312 1.57812,0 0,3.70312 3.6875,0 0,1.5625 -3.6875,0 0,3.71875 -1.57812,0 z m 13.20746,2.20313 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path95" d="m 0,207 176,0 0,40 -176,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path97" d="m 10.40625,233.91998 0,-13.59375 2.71875,0 3.21875,9.625 q 0.4375,1.34375 0.640625,2.01562 0.234375,-0.75 0.734375,-2.1875 l 3.25,-9.45312 2.421875,0 0,13.59375 -1.734375,0 0,-11.39063 -3.953125,11.39063 -1.625,0 -3.9375,-11.57813 0,11.57813 -1.734375,0 z m 21.822052,-1.21875 q -0.9375,0.79687 -1.796875,1.125 -0.859375,0.3125 -1.84375,0.3125 -1.609375,0 -2.484375,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.328125,-1.32813 0.328125,-0.59375 0.859375,-0.95312 0.53125,-0.35938 1.203125,-0.54688 0.5,-0.14062 1.484375,-0.25 2.03125,-0.25 2.984375,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.640625,-0.5625 -1.90625,-0.5625 -1.171875,0 -1.734375,0.40625 -0.5625,0.40625 -0.828125,1.46875 l -1.640625,-0.23438 q 0.234375,-1.04687 0.734375,-1.6875 0.515625,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.265625,0 2.046875,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.515625,1.14062 0.09375,0.42188 0.09375,1.53125 l 0,2.23438 q 0,2.32812 0.09375,2.95312 0.109375,0.60938 0.4375,1.17188 l -1.75,0 q -0.265625,-0.51563 -0.328125,-1.21875 z m -0.140625,-3.71875 q -0.90625,0.35937 -2.734375,0.625 -1.03125,0.14062 -1.453125,0.32812 -0.421875,0.1875 -0.65625,0.54688 -0.234375,0.35937 -0.234375,0.79687 0,0.67188 0.5,1.125 0.515625,0.4375 1.484375,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.109375,-1.15625 0.265625,-0.57813 0.265625,-1.67188 l 0,-0.60937 z m 4.063213,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 6.24393,0 0,-13.59375 1.67188,0 0,7.75 3.95312,-4.01563 2.15625,0 -3.76562,3.65625 4.14062,6.20313 -2.0625,0 -3.25,-5.03125 -1.17187,1.125 0,3.90625 -1.67188,0 z m 16.04268,0 -1.54687,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70312,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32812,1.03125 0.53125,0.65625 0.82813,1.59375 0.29687,0.9375 0.29687,2 0,2.53125 -1.25,3.92188 -1.24999,1.375 -2.99999,1.375 -1.75,0 -2.73438,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79687,1.28125 2.14062,1.28125 1.09375,0 1.89063,-0.9375 0.79687,-0.95313 0.79687,-2.84375 0,-1.92188 -0.76562,-2.84375 -0.76563,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89063,0.95313 -0.79687,0.95312 -0.79687,2.75 z m 8.86009,-6.6875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85938 1.67187,0 0,9.85938 -1.67187,0 z m 7.78544,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52706,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07885,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 14.24652,4.875 0,-13.59375 1.84375,0 7.14063,10.67187 0,-10.67187 1.71875,0 0,13.59375 -1.84375,0 -7.14063,-10.6875 0,10.6875 -1.71875,0 z m 16.78545,-2.20313 0,-3.71875 -3.70313,0 0,-1.5625 3.70313,0 0,-3.70312 1.57812,0 0,3.70312 3.6875,0 0,1.5625 -3.6875,0 0,3.71875 -1.57812,0 z m 15.69183,0.59375 0,1.60938 -8.98437,0 q -0.0156,-0.60938 0.1875,-1.15625 0.34375,-0.92188 1.09375,-1.8125 0.76562,-0.89063 2.1875,-2.0625 2.21875,-1.8125 3,-2.875 0.78125,-1.0625 0.78125,-2.01563 0,-0.98437 -0.71875,-1.67187 -0.70313,-0.6875 -1.84375,-0.6875 -1.20313,0 -1.9375,0.73437 -0.71875,0.71875 -0.71875,2 l -1.71875,-0.17187 q 0.17187,-1.92188 1.32812,-2.92188 1.15625,-1.01562 3.09375,-1.01562 1.95313,0 3.09375,1.09375 1.14063,1.07812 1.14063,2.6875 0,0.8125 -0.34375,1.60937 -0.32813,0.78125 -1.10938,1.65625 -0.76562,0.85938 -2.5625,2.39063 -1.5,1.26562 -1.9375,1.71875 -0.42187,0.4375 -0.70312,0.89062 l 6.67187,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path99" d="m 0,63 176,0 0,40 -176,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path101" d="m 10.40625,89.92 0,-13.59375 2.71875,0 3.21875,9.625 q 0.4375,1.34375 0.640625,2.01562 0.234375,-0.75 0.734375,-2.1875 l 3.25,-9.45312 2.421875,0 0,13.59375 -1.734375,0 0,-11.39063 -3.953125,11.39063 -1.625,0 -3.9375,-11.57813 0,11.57813 -1.734375,0 z m 21.822052,-1.21875 q -0.9375,0.79687 -1.796875,1.125 -0.859375,0.3125 -1.84375,0.3125 -1.609375,0 -2.484375,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.328125,-1.32813 0.328125,-0.59375 0.859375,-0.95312 0.53125,-0.35938 1.203125,-0.54688 0.5,-0.14062 1.484375,-0.25 2.03125,-0.25 2.984375,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.640625,-0.5625 -1.90625,-0.5625 -1.171875,0 -1.734375,0.40625 -0.5625,0.40625 -0.828125,1.46875 l -1.640625,-0.23438 q 0.234375,-1.04687 0.734375,-1.6875 0.515625,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.265625,0 2.046875,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.515625,1.14062 0.09375,0.42188 0.09375,1.53125 l 0,2.23438 q 0,2.32812 0.09375,2.95312 0.109375,0.60938 0.4375,1.17188 l -1.75,0 Q 32.290802,89.40437 32.228302,88.70125 z M 32.087677,84.9825 q -0.90625,0.35937 -2.734375,0.625 -1.03125,0.14062 -1.453125,0.32812 -0.421875,0.1875 -0.65625,0.54688 -0.234375,0.35937 -0.234375,0.79687 0,0.67188 0.5,1.125 0.515625,0.4375 1.484375,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.109375,-1.15625 0.265625,-0.57813 0.265625,-1.67188 l 0,-0.60937 z m 4.063213,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 6.24393,0 0,-13.59375 1.67188,0 0,7.75 3.95312,-4.01563 2.15625,0 -3.76562,3.65625 4.14062,6.20313 -2.0625,0 -3.25,-5.03125 -1.17187,1.125 0,3.90625 -1.67188,0 z m 16.04268,0 -1.54687,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70312,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32812,1.03125 0.53125,0.65625 0.82813,1.59375 0.29687,0.9375 0.29687,2 0,2.53125 -1.25,3.92188 -1.24999,1.375 -2.99999,1.375 -1.75,0 -2.73438,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79687,1.28125 2.14062,1.28125 1.09375,0 1.89063,-0.9375 0.79687,-0.95313 0.79687,-2.84375 0,-1.92188 -0.76562,-2.84375 -0.76563,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89063,0.95313 -0.79687,0.95312 -0.79687,2.75 z m 8.86009,-6.6875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85938 1.67187,0 0,9.85938 -1.67187,0 z m 7.78544,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52706,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 Q 98.63519,89.40437 98.57269,88.70125 z M 98.43216,84.9825 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07885,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 14.24652,4.875 0,-13.59375 1.84375,0 7.14063,10.67187 0,-10.67187 1.71875,0 0,13.59375 -1.84375,0 -7.14063,-10.6875 0,10.6875 -1.71875,0 z m 12.6292,-4.07813 0,-1.6875 5.125,0 0,1.6875 -5.125,0 z m 12.68142,4.07813 -1.67187,0 0,-10.64063 q -0.59375,0.57813 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path103" d="m 176,84 112,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path105" d="m 176,84 96.84,0" /> <path style="fill:#0000ff;fill-rule:nonzero;stroke:#0000ff;stroke-width:4;stroke-linecap:butt" inkscape:connector-curvature="0" id="path107" d="m 286,84 c 0,3.63403 -2.94595,6.58 -6.57999,6.58 -3.63403,0 -6.58001,-2.94597 -6.58001,-6.58 0,-3.63403 2.94598,-6.58 6.58001,-6.58 C 283.05405,77.42 286,80.36597 286,84 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path109" d="m 176,44 112,0 0,32 -112,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path111" d="m 206.29498,70.92 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97833,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.04758,4.9375 0,-13.59375 1.67187,0 0,13.59375 -1.67187,0 z m 4.1448,0 0,-13.59375 1.67188,0 0,13.59375 -1.67188,0 z m 3.55109,-4.92188 q 0,-2.73437 1.53125,-4.0625 1.26562,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29687,1.32813 1.29687,3.67188 0,1.90625 -0.57812,3 -0.5625,1.07812 -1.65625,1.6875 -1.07813,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32813 -1.28125,-1.32812 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89063 0.82812,2.82813 0.82813,0.9375 2.07813,0.9375 1.25,0 2.0625,-0.9375 0.82812,-0.95313 0.82812,-2.89063 0,-1.82812 -0.82812,-2.76562 -0.82813,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07813,0.9375 -0.82812,0.9375 -0.82812,2.82812 z m 15.71948,1.3125 1.64062,0.21875 q -0.26562,1.6875 -1.375,2.65625 -1.10937,0.95313 -2.73437,0.95313 -2.01563,0 -3.25,-1.3125 -1.21875,-1.32813 -1.21875,-3.79688 0,-1.59375 0.51562,-2.78125 0.53125,-1.20312 1.60938,-1.79687 1.09375,-0.60938 2.35937,-0.60938 1.60938,0 2.625,0.8125 1.01563,0.8125 1.3125,2.3125 l -1.625,0.25 q -0.23437,-1 -0.82812,-1.5 -0.59375,-0.5 -1.42188,-0.5 -1.26562,0 -2.0625,0.90625 -0.78125,0.90625 -0.78125,2.85938 0,1.98437 0.76563,2.89062 0.76562,0.89063 1.98437,0.89063 0.98438,0 1.64063,-0.59375 0.65625,-0.60938 0.84375,-1.85938 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path113" d="m 432,180 112,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path115" d="m 432,180 98.29169,0" /> <path style="fill:#0000ff;fill-rule:evenodd;stroke:#0000ff;stroke-width:4;stroke-linecap:butt" inkscape:connector-curvature="0" id="path117" d="m 530.2916,180 -4.49829,4.49832 L 538.15238,180 525.79331,175.50168 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path119" d="m 432,140 112,0 0,32 -112,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path121" d="m 468.52136,166.91998 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97827,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.06323,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57812,-1.04687 1.0625,-1.375 0.48437,-0.34375 1.07812,-0.34375 0.84375,0 1.71875,0.54688 l -0.57812,1.54687 q -0.60938,-0.35937 -1.23438,-0.35937 -0.54687,0 -0.98437,0.32812 -0.42188,0.32813 -0.60938,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67187,0 z m 6.24389,0 0,-13.59375 1.67188,0 0,7.75 3.95312,-4.01563 2.15625,0 -3.76562,3.65625 4.14062,6.20313 -2.0625,0 -3.25,-5.03125 -1.17187,1.125 0,3.90625 -1.67188,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path123" d="m 288,180 144,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:4, 12" inkscape:connector-curvature="0" id="path125" d="m 288,180 144,0" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path127" d="m 288,140 144,0 0,32 -144,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path129" d="m 313.54813,166.91998 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14063,-1.625 0.89062,0 1.64062,0.32813 0.75,0.3125 1.10938,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67188,0 0,-6 q 0,-1.01563 -0.20312,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17188,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76562,0.67188 -0.76562,2.57813 l 0,5.375 -1.67188,0 z m 17.1257,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42188,-1.32813 -1.26562,-1.32812 -1.26562,-3.73437 0,-2.48438 1.26562,-3.85938 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48437 0.82813,0.85938 2.0625,0.85938 0.90625,0 1.54688,-0.46875 0.65625,-0.48438 1.04687,-1.54688 z m -5.48437,-2.70312 5.5,0 q -0.10938,-1.23438 -0.625,-1.85938 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76563 -0.85937,2.04688 z m 10.93823,5.875 -3.01563,-9.85938 1.71875,0 1.5625,5.6875 0.59375,2.125 q 0.0312,-0.15625 0.5,-2.03125 l 1.57813,-5.78125 1.71875,0 1.46875,5.71875 0.48437,1.89063 0.57813,-1.90625 1.6875,-5.70313 1.625,0 -3.07813,9.85938 -1.73437,0 -1.57813,-5.90625 -0.375,-1.67188 -2,7.57813 -1.73437,0 z m 18.375,0 -1.54688,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70313,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32812,1.03125 0.53125,0.65625 0.82813,1.59375 0.29687,0.9375 0.29687,2 0,2.53125 -1.25,3.92188 -1.25,1.375 -3,1.375 -1.75,0 -2.73437,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79688,1.28125 2.14063,1.28125 1.09375,0 1.89062,-0.9375 0.79688,-0.95313 0.79688,-2.84375 0,-1.92188 -0.76563,-2.84375 -0.76562,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89062,0.95313 -0.79688,0.95312 -0.79688,2.75 z m 8.86008,-6.6875 0,-1.90625 1.67188,0 0,1.90625 -1.67188,0 z m 0,11.6875 0,-9.85938 1.67188,0 0,9.85938 -1.67188,0 z m 7.78546,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52704,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45313,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76563,-0.45313 1.09375,0 1.79687,0.45313 0.70313,0.45312 0.98438,1.28125 1.17187,-1.73438 3.04687,-1.73438 1.46875,0 2.25,0.8125 0.79688,0.8125 0.79688,2.5 l 0,6.76563 -1.67188,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42187,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67187,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70313,0 -1.3125,0.375 -0.59375,0.35937 -0.85938,1.07812 -0.26562,0.71875 -0.26562,2.0625 l 0,5.10938 -1.67188,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.07886,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path131" d="m 544,180 128,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path133" d="m 544,180 128,0" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path135" d="m 544,140 128,0 0,32 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path137" d="m 582.295,166.91998 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.97833,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.04761,4.9375 0,-13.59375 1.67187,0 0,13.59375 -1.67187,0 z m 4.14477,0 0,-13.59375 1.67188,0 0,13.59375 -1.67188,0 z m 3.55109,-4.92188 q 0,-2.73437 1.53125,-4.0625 1.26562,-1.09375 3.09375,-1.09375 2.03125,0 3.3125,1.34375 1.29687,1.32813 1.29687,3.67188 0,1.90625 -0.57812,3 -0.5625,1.07812 -1.65625,1.6875 -1.07813,0.59375 -2.375,0.59375 -2.0625,0 -3.34375,-1.32813 -1.28125,-1.32812 -1.28125,-3.8125 z m 1.71875,0 q 0,1.89063 0.82812,2.82813 0.82813,0.9375 2.07813,0.9375 1.25,0 2.0625,-0.9375 0.82812,-0.95313 0.82812,-2.89063 0,-1.82812 -0.82812,-2.76562 -0.82813,-0.9375 -2.0625,-0.9375 -1.25,0 -2.07813,0.9375 -0.82812,0.9375 -0.82812,2.82812 z m 15.71948,1.3125 1.64062,0.21875 q -0.26562,1.6875 -1.375,2.65625 -1.10937,0.95313 -2.73437,0.95313 -2.01563,0 -3.25,-1.3125 -1.21875,-1.32813 -1.21875,-3.79688 0,-1.59375 0.51562,-2.78125 0.53125,-1.20312 1.60938,-1.79687 1.09375,-0.60938 2.35937,-0.60938 1.60938,0 2.625,0.8125 1.01563,0.8125 1.3125,2.3125 l -1.625,0.25 q -0.23437,-1 -0.82812,-1.5 -0.59375,-0.5 -1.42188,-0.5 -1.26562,0 -2.0625,0.90625 -0.78125,0.90625 -0.78125,2.85938 0,1.98437 0.76563,2.89062 0.76562,0.89063 1.98437,0.89063 0.98438,0 1.64063,-0.59375 0.65625,-0.60938 0.84375,-1.85938 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path139" d="m 544,188 128,0 0,32 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path141" d="m 561.5481,214.91998 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14062,-1.625 0.89063,0 1.64063,0.32813 0.75,0.3125 1.10937,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67187,0 0,-6 q 0,-1.01563 -0.20313,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17187,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76563,0.67188 -0.76563,2.57813 l 0,5.375 -1.67187,0 z m 17.12573,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42188,-1.32813 -1.26562,-1.32812 -1.26562,-3.73437 0,-2.48438 1.26562,-3.85938 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48437 0.82813,0.85938 2.0625,0.85938 0.90625,0 1.54688,-0.46875 0.65625,-0.48438 1.04687,-1.54688 z m -5.48437,-2.70312 5.5,0 q -0.10938,-1.23438 -0.625,-1.85938 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76563 -0.85937,2.04688 z m 10.93823,5.875 -3.01563,-9.85938 1.71875,0 1.5625,5.6875 0.59375,2.125 q 0.0312,-0.15625 0.5,-2.03125 l 1.57813,-5.78125 1.71875,0 1.46875,5.71875 0.48437,1.89063 0.57813,-1.90625 1.6875,-5.70313 1.625,0 -3.07813,9.85938 -1.73437,0 -1.57813,-5.90625 -0.375,-1.67188 -2,7.57813 -1.73437,0 z m 18.375,0 -1.54688,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70313,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32812,1.03125 0.53125,0.65625 0.82813,1.59375 0.29687,0.9375 0.29687,2 0,2.53125 -1.25,3.92188 -1.25,1.375 -3,1.375 -1.75,0 -2.73437,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79688,1.28125 2.14063,1.28125 1.09375,0 1.89062,-0.9375 0.79688,-0.95313 0.79688,-2.84375 0,-1.92188 -0.76563,-2.84375 -0.76562,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89062,0.95313 -0.79688,0.95312 -0.79688,2.75 z m 8.86011,-6.6875 0,-1.90625 1.67188,0 0,1.90625 -1.67188,0 z m 0,11.6875 0,-9.85938 1.67188,0 0,9.85938 -1.67188,0 z m 7.7854,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.5271,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45313,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76563,-0.45313 1.09375,0 1.79687,0.45313 0.70313,0.45312 0.98438,1.28125 1.17187,-1.73438 3.04687,-1.73438 1.46875,0 2.25,0.8125 0.79688,0.8125 0.79688,2.5 l 0,6.76563 -1.67188,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42187,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67187,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70313,0 -1.3125,0.375 -0.59375,0.35937 -0.85938,1.07812 -0.26562,0.71875 -0.26562,2.0625 l 0,5.10938 -1.67188,0 z m 21.97827,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.07885,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20313,-1.125 0.6875,-0.375 1.64062,-0.375 1.26563,0 2.23438,0.65625 0.96875,0.64063 1.45312,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54687,2.73437 -0.54688,1.20313 -1.57813,1.84375 -1.03125,0.64063 -2.17187,0.64063 -0.84375,0 -1.51563,-0.34375 -0.65625,-0.35938 -1.07812,-0.89063 l 0,4.79688 -1.67188,0 z m 1.51563,-8.65625 q 0,1.90625 0.76562,2.8125 0.78125,0.90625 1.875,0.90625 1.10938,0 1.89063,-0.9375 0.79687,-0.9375 0.79687,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76562,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89062,1 -0.8125,1 -0.8125,2.89063 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path143" d="m 544,228 128,0" /> <path style="stroke:#0000ff;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round;stroke-dasharray:4, 12" inkscape:connector-curvature="0" id="path145" d="m 544,228 128,0" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path147" d="m 176,36 496,0" /> <path style="stroke:#cc4125;stroke-width:4;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path149" d="m 176,36 496,0" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path151" d="m 0,15 176,0 0,40 -176,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path153" d="m 10.515625,41.92 0,-13.59375 1.8125,0 0,5.57812 7.0625,0 0,-5.57812 1.796875,0 0,13.59375 -1.796875,0 0,-6.40625 -7.0625,0 0,6.40625 -1.8125,0 z m 19.957321,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.515625,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.421875,-1.32813 -1.265625,-1.32812 -1.265625,-3.73437 0,-2.48438 1.265625,-3.85938 1.28125,-1.375 3.328125,-1.375 1.984375,0 3.234375,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.01563,0.4375 l -7.34375,0 q 0.09375,1.625 0.921875,2.48437 0.828125,0.85938 2.0625,0.85938 0.90625,0 1.546875,-0.46875 0.65625,-0.48438 1.046875,-1.54688 z m -5.484375,-2.70312 5.5,0 q -0.109375,-1.23438 -0.625,-1.85938 -0.796875,-0.96875 -2.078125,-0.96875 -1.140625,0 -1.9375,0.78125 -0.78125,0.76563 -0.859375,2.04688 z m 15.547589,4.65625 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.609377,0 -2.484377,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.328125,-1.32813 0.328125,-0.59375 0.859375,-0.95312 0.53125,-0.35938 1.203125,-0.54688 0.500002,-0.14062 1.484372,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.562497,0.40625 -0.828122,1.46875 l -1.640625,-0.23438 q 0.234375,-1.04687 0.734375,-1.6875 0.515625,-0.64062 1.468752,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 Q 40.59856,41.40437 40.53606,40.70125 z M 40.39554,36.9825 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.421877,0.1875 -0.656252,0.54688 -0.234375,0.35937 -0.234375,0.79687 0,0.67188 0.5,1.125 0.515627,0.4375 1.484377,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.07884,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z M 45.99,37.045 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z" /> </svg>
12800
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/12800/sparse.svg
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <svg xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" version="1.1" viewBox="0 0 688 192" stroke-miterlimit="10" id="svg2" inkscape:version="0.48.4 r9939" width="100%" height="100%" sodipodi:docname="sparse.svg" style="fill:none;stroke:none"> <metadata id="metadata223"> <rdf:RDF> <cc:Work rdf:about=""> <dc:format>image/svg+xml</dc:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> </cc:Work> </rdf:RDF> </metadata> <defs id="defs221" /> <sodipodi:namedview pagecolor="#ffffff" bordercolor="#666666" borderopacity="1" objecttolerance="10" gridtolerance="10" guidetolerance="10" inkscape:pageopacity="0" inkscape:pageshadow="2" inkscape:window-width="1920" inkscape:window-height="1147" id="namedview219" showgrid="true" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:zoom="0.74577668" inkscape:cx="591.79683" inkscape:cy="70.743973" inkscape:window-x="0" inkscape:window-y="0" inkscape:window-maximized="1" inkscape:current-layer="svg2"> <inkscape:grid type="xygrid" id="grid3200" empspacing="5" visible="true" enabled="true" snapvisiblegridlinesonly="true" originx="-176px" originy="-248px" /> </sodipodi:namedview> <clipPath id="p.0"> <path d="m 0,0 1024,0 0,768 L 0,768 0,0 z" clip-rule="nonzero" id="path5" inkscape:connector-curvature="0" /> </clipPath> <path style="fill:#d9ead3;fill-rule:nonzero" inkscape:connector-curvature="0" id="path11" d="m 128,8 512,0 0,64 -512,0 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path13" d="m 128,8 512,0 0,64 -512,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path15" d="m 128,0 88,0 0,40 -88,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path17" d="m 137.85938,22.54498 1.6875,-0.14063 q 0.125,1.01563 0.5625,1.67188 0.4375,0.65625 1.35937,1.0625 0.9375,0.40625 2.09375,0.40625 1.03125,0 1.8125,-0.3125 0.79688,-0.3125 1.1875,-0.84375 0.39063,-0.53125 0.39063,-1.15625 0,-0.64063 -0.375,-1.10938 -0.375,-0.48437 -1.23438,-0.8125 -0.54687,-0.21875 -2.42187,-0.65625 -1.875,-0.45312 -2.625,-0.85937 -0.96875,-0.51563 -1.45313,-1.26563 -0.46875,-0.75 -0.46875,-1.6875 0,-1.03125 0.57813,-1.92187 0.59375,-0.90625 1.70312,-1.35938 1.125,-0.46875 2.5,-0.46875 1.51563,0 2.67188,0.48438 1.15625,0.48437 1.76562,1.4375 0.625,0.9375 0.67188,2.14062 l -1.71875,0.125 q -0.14063,-1.28125 -0.95313,-1.9375 -0.79687,-0.67187 -2.35937,-0.67187 -1.625,0 -2.375,0.60937 -0.75,0.59375 -0.75,1.4375 0,0.73438 0.53125,1.20313 0.51562,0.46875 2.70312,0.96875 2.20313,0.5 3.01563,0.875 1.1875,0.54687 1.75,1.39062 0.57812,0.82813 0.57812,1.92188 0,1.09375 -0.625,2.0625 -0.625,0.95312 -1.79687,1.48437 -1.15625,0.53125 -2.60938,0.53125 -1.84375,0 -3.09375,-0.53125 -1.25,-0.54687 -1.96875,-1.625 -0.70312,-1.07812 -0.73437,-2.45312 z m 12.8342,8.15625 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 15.29758,3.65625 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07886,4.9375 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14063,-1.625 0.89062,0 1.64062,0.32813 0.75,0.3125 1.10938,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67188,0 0,-6 q 0,-1.01563 -0.20312,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17188,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76562,0.67188 -0.76562,2.57813 l 0,5.375 -1.67188,0 z m 21.38715,0 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path19" d="m 128,8 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path21" d="m 128,8 0,64" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path23" d="m 384,8 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path25" d="m 384,8 0,64" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path27" d="m 384,0 88,0 0,40 -88,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path29" d="m 393.8594,22.54498 1.6875,-0.14063 q 0.125,1.01563 0.5625,1.67188 0.4375,0.65625 1.35938,1.0625 0.9375,0.40625 2.09375,0.40625 1.03125,0 1.8125,-0.3125 0.79687,-0.3125 1.1875,-0.84375 0.39062,-0.53125 0.39062,-1.15625 0,-0.64063 -0.375,-1.10938 -0.375,-0.48437 -1.23437,-0.8125 -0.54688,-0.21875 -2.42188,-0.65625 -1.875,-0.45312 -2.625,-0.85937 -0.96875,-0.51563 -1.45312,-1.26563 -0.46875,-0.75 -0.46875,-1.6875 0,-1.03125 0.57812,-1.92187 0.59375,-0.90625 1.70313,-1.35938 1.125,-0.46875 2.5,-0.46875 1.51562,0 2.67187,0.48438 1.15625,0.48437 1.76563,1.4375 0.625,0.9375 0.67187,2.14062 l -1.71875,0.125 q -0.14062,-1.28125 -0.95312,-1.9375 -0.79688,-0.67187 -2.35938,-0.67187 -1.625,0 -2.375,0.60937 -0.75,0.59375 -0.75,1.4375 0,0.73438 0.53125,1.20313 0.51563,0.46875 2.70313,0.96875 2.20312,0.5 3.01562,0.875 1.1875,0.54687 1.75,1.39062 0.57813,0.82813 0.57813,1.92188 0,1.09375 -0.625,2.0625 -0.625,0.95312 -1.79688,1.48437 -1.15625,0.53125 -2.60937,0.53125 -1.84375,0 -3.09375,-0.53125 -1.25,-0.54687 -1.96875,-1.625 -0.70313,-1.07812 -0.73438,-2.45312 z m 12.83423,8.15625 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z m 1.51562,-8.65625 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 15.29755,3.65625 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07886,4.9375 0,-9.85938 1.5,0 0,1.40625 q 1.09375,-1.625 3.14063,-1.625 0.89062,0 1.64062,0.32813 0.75,0.3125 1.10938,0.84375 0.375,0.51562 0.53125,1.21875 0.0937,0.46875 0.0937,1.625 l 0,6.0625 -1.67188,0 0,-6 q 0,-1.01563 -0.20312,-1.51563 -0.1875,-0.51562 -0.6875,-0.8125 -0.5,-0.29687 -1.17188,-0.29687 -1.0625,0 -1.84375,0.67187 -0.76562,0.67188 -0.76562,2.57813 l 0,5.375 -1.67188,0 z m 23.87152,-1.60938 0,1.60938 -8.98437,0 q -0.0156,-0.60938 0.1875,-1.15625 0.34375,-0.92188 1.09375,-1.8125 0.76562,-0.89063 2.1875,-2.0625 2.21875,-1.8125 3,-2.875 0.78125,-1.0625 0.78125,-2.01563 0,-0.98437 -0.71875,-1.67187 -0.70313,-0.6875 -1.84375,-0.6875 -1.20313,0 -1.9375,0.73437 -0.71875,0.71875 -0.71875,2 l -1.71875,-0.17187 q 0.17187,-1.92188 1.32812,-2.92188 1.15625,-1.01562 3.09375,-1.01562 1.95313,0 3.09375,1.09375 1.14063,1.07812 1.14063,2.6875 0,0.8125 -0.34375,1.60937 -0.32813,0.78125 -1.10938,1.65625 -0.76562,0.85938 -2.5625,2.39063 -1.5,1.26562 -1.9375,1.71875 -0.42187,0.4375 -0.70312,0.89062 l 6.67187,0 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path31" d="m 640,8 0,64" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path33" d="m 640,8 0,64" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path35" d="m 0,20 128,0 0,40 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path37" d="m 10.51562,46.91998 0,-13.59375 1.8125,0 0,5.57812 7.0625,0 0,-5.57812 1.79688,0 0,13.59375 -1.79688,0 0,-6.40625 -7.0625,0 0,6.40625 -1.8125,0 z m 19.95732,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42188,-1.32813 -1.26562,-1.32812 -1.26562,-3.73437 0,-2.48438 1.26562,-3.85938 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48437 0.82813,0.85938 2.0625,0.85938 0.90625,0 1.54688,-0.46875 0.65625,-0.48438 1.04687,-1.54688 z m -5.48437,-2.70312 5.5,0 q -0.10938,-1.23438 -0.625,-1.85938 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76563 -0.85937,2.04688 z m 15.54759,4.65625 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 L 33.81741,39.8731 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07885,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z M 45.99,42.04498 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path39" d="m 384,88 0,32" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path41" d="m 384,100 0,8" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path43" d="M 387.30347,100 384,90.9238 380.69654,100 z" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path45" d="M 380.69653,108 384,117.0762 387.30346,108 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path47" d="m 0,120 128,0 0,40 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path49" d="m 10.51562,146.91998 0,-13.59375 1.8125,0 0,5.57812 7.0625,0 0,-5.57812 1.79688,0 0,13.59375 -1.79688,0 0,-6.40625 -7.0625,0 0,6.40625 -1.8125,0 z m 19.95732,-3.17188 1.71875,0.21875 q -0.40625,1.5 -1.51562,2.34375 -1.09375,0.82813 -2.8125,0.82813 -2.15625,0 -3.42188,-1.32813 -1.26562,-1.32812 -1.26562,-3.73437 0,-2.48438 1.26562,-3.85938 1.28125,-1.375 3.32813,-1.375 1.98437,0 3.23437,1.34375 1.25,1.34375 1.25,3.79688 0,0.14062 -0.0156,0.4375 l -7.34375,0 q 0.0937,1.625 0.92187,2.48437 0.82813,0.85938 2.0625,0.85938 0.90625,0 1.54688,-0.46875 0.65625,-0.48438 1.04687,-1.54688 z m -5.48437,-2.70312 5.5,0 q -0.10938,-1.23438 -0.625,-1.85938 -0.79688,-0.96875 -2.07813,-0.96875 -1.14062,0 -1.9375,0.78125 -0.78125,0.76563 -0.85937,2.04688 z m 15.54759,4.65625 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07885,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20312,-1.125 0.6875,-0.375 1.64063,-0.375 1.26562,0 2.23437,0.65625 0.96875,0.64063 1.45313,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54688,2.73437 -0.54687,1.20313 -1.57812,1.84375 -1.03125,0.64063 -2.17188,0.64063 -0.84375,0 -1.51562,-0.34375 -0.65625,-0.35938 -1.07813,-0.89063 l 0,4.79688 -1.67187,0 z M 45.99,142.04498 q 0,1.90625 0.76563,2.8125 0.78125,0.90625 1.875,0.90625 1.10937,0 1.89062,-0.9375 0.79688,-0.9375 0.79688,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76563,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89063,1 -0.8125,1 -0.8125,2.89063 z m 15.59027,4.875 -1.54687,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70312,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32813,1.03125 0.53125,0.65625 0.82812,1.59375 0.29688,0.9375 0.29688,2 0,2.53125 -1.25,3.92188 -1.25,1.375 -3,1.375 -1.75,0 -2.73438,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79687,1.28125 2.14062,1.28125 1.09375,0 1.89063,-0.9375 0.79687,-0.95313 0.79687,-2.84375 0,-1.92188 -0.76562,-2.84375 -0.76563,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89063,0.95313 -0.79687,0.95312 -0.79687,2.75 z m 8.86009,-6.6875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85938 1.67187,0 0,9.85938 -1.67187,0 z m 7.78544,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 1.52706,1.5 0,-9.85938 1.5,0 0,1.39063 q 0.45312,-0.71875 1.21875,-1.15625 0.78125,-0.45313 1.76562,-0.45313 1.09375,0 1.79688,0.45313 0.70312,0.45312 0.98437,1.28125 1.17188,-1.73438 3.04688,-1.73438 1.46875,0 2.25,0.8125 0.79687,0.8125 0.79687,2.5 l 0,6.76563 -1.67187,0 0,-6.20313 q 0,-1 -0.15625,-1.4375 -0.15625,-0.45312 -0.59375,-0.71875 -0.42188,-0.26562 -1,-0.26562 -1.03125,0 -1.71875,0.6875 -0.6875,0.6875 -0.6875,2.21875 l 0,5.71875 -1.67188,0 0,-6.40625 q 0,-1.10938 -0.40625,-1.65625 -0.40625,-0.5625 -1.34375,-0.5625 -0.70312,0 -1.3125,0.375 -0.59375,0.35937 -0.85937,1.07812 -0.26563,0.71875 -0.26563,2.0625 l 0,5.10938 -1.67187,0 z m 21.9783,-1.21875 q -0.9375,0.79687 -1.79688,1.125 -0.85937,0.3125 -1.84375,0.3125 -1.60937,0 -2.48437,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32812,-1.32813 0.32813,-0.59375 0.85938,-0.95312 0.53125,-0.35938 1.20312,-0.54688 0.5,-0.14062 1.48438,-0.25 2.03125,-0.25 2.98437,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64062,-0.5625 -1.90625,-0.5625 -1.17187,0 -1.73437,0.40625 -0.5625,0.40625 -0.82813,1.46875 l -1.64062,-0.23438 q 0.23437,-1.04687 0.73437,-1.6875 0.51563,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26563,0 2.04688,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51562,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10938,0.60938 0.4375,1.17188 l -1.75,0 q -0.26562,-0.51563 -0.32812,-1.21875 z m -0.14063,-3.71875 q -0.90625,0.35937 -2.73437,0.625 -1.03125,0.14062 -1.45313,0.32812 -0.42187,0.1875 -0.65625,0.54688 -0.23437,0.35937 -0.23437,0.79687 0,0.67188 0.5,1.125 0.51562,0.4375 1.48437,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10938,-1.15625 0.26562,-0.57813 0.26562,-1.67188 l 0,-0.60937 z m 4.07883,8.71875 0,-13.64063 1.53125,0 0,1.28125 q 0.53125,-0.75 1.20313,-1.125 0.6875,-0.375 1.64062,-0.375 1.26563,0 2.23438,0.65625 0.96875,0.64063 1.45312,1.82813 0.5,1.1875 0.5,2.59375 0,1.51562 -0.54687,2.73437 -0.54688,1.20313 -1.57813,1.84375 -1.03125,0.64063 -2.17187,0.64063 -0.84375,0 -1.51563,-0.34375 -0.65625,-0.35938 -1.07812,-0.89063 l 0,4.79688 -1.67188,0 z m 1.51563,-8.65625 q 0,1.90625 0.76562,2.8125 0.78125,0.90625 1.875,0.90625 1.10938,0 1.89063,-0.9375 0.79687,-0.9375 0.79687,-2.92188 0,-1.875 -0.78125,-2.8125 -0.76562,-0.9375 -1.84375,-0.9375 -1.0625,0 -1.89062,1 -0.8125,1 -0.8125,2.89063 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path51" d="m 648,16 40,0 0,40 -40,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path53" d="m 658.71875,42.91998 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z m 5.18329,0 0,-1.90625 1.90625,0 0,1.90625 -1.90625,0 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path55" d="m 128,50.50113 0,0 C 128,44.70151 132.70151,40 138.50113,40 l 106.99774,0 c 2.78506,0 5.45608,1.10635 7.42541,3.07571 C 254.89364,45.04504 256,47.71607 256,50.50113 l 0,10.99774 0,0 C 256,67.29849 251.29849,72 245.49887,72 L 138.50113,72 C 132.70151,72 128,67.29849 128,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path57" d="m 128,50.50113 0,0 C 128,44.70151 132.70151,40 138.50113,40 l 106.99774,0 c 2.78506,0 5.45608,1.10635 7.42541,3.07571 C 254.89364,45.04504 256,47.71607 256,50.50113 l 0,10.99774 0,0 C 256,67.29849 251.29849,72 245.49887,72 L 138.50113,72 C 132.70151,72 128,67.29849 128,61.49887 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path59" d="m 256,50.50113 0,0 C 256,44.70151 260.70151,40 266.50113,40 l 106.99777,0 c 2.78503,0 5.45605,1.10635 7.42541,3.07571 1.9693,1.96933 3.07569,4.64036 3.07569,7.42542 l 0,10.99774 0,0 C 384,67.29849 379.29846,72 373.4989,72 L 266.50113,72 C 260.70151,72 256,67.29849 256,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path61" d="m 256,50.50113 0,0 C 256,44.70151 260.70151,40 266.50113,40 l 106.99777,0 c 2.78503,0 5.45605,1.10635 7.42541,3.07571 1.9693,1.96933 3.07569,4.64036 3.07569,7.42542 l 0,10.99774 0,0 C 384,67.29849 379.29846,72 373.4989,72 L 266.50113,72 C 260.70151,72 256,67.29849 256,61.49887 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path63" d="m 384,50.50113 0,0 C 384,44.70151 388.70154,40 394.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 416,67.29849 411.29846,72 405.4989,72 l -10.9978,0 C 388.70154,72 384,67.29849 384,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path65" d="m 384,50.50113 0,0 C 384,44.70151 388.70154,40 394.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 416,67.29849 411.29846,72 405.4989,72 l -10.9978,0 C 388.70154,72 384,67.29849 384,61.49887 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path67" d="m 416,50.50113 0,0 C 416,44.70151 420.70154,40 426.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 448,67.29849 443.29846,72 437.4989,72 l -10.9978,0 C 420.70154,72 416,67.29849 416,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path69" d="m 416,50.50113 0,0 C 416,44.70151 420.70154,40 426.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 448,67.29849 443.29846,72 437.4989,72 l -10.9978,0 C 420.70154,72 416,67.29849 416,61.49887 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path71" d="m 448,50.50113 0,0 C 448,44.70151 452.70154,40 458.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 480,67.29849 475.29846,72 469.4989,72 l -10.9978,0 C 452.70154,72 448,67.29849 448,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path73" d="m 448,50.50113 0,0 C 448,44.70151 452.70154,40 458.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 480,67.29849 475.29846,72 469.4989,72 l -10.9978,0 C 452.70154,72 448,67.29849 448,61.49887 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path75" d="m 128,120 128,0 0,40 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path77" d="m 147.19952,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path79" d="m 151.27838,140.21686 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65698,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65695,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z m 14.95383,6.70312 -1.67187,0 0,-10.64062 q -0.59375,0.57812 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85937 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 10.37573,0 -1.67187,0 0,-10.64062 q -0.59375,0.57812 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85937 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 10.37573,0 -1.67187,0 0,-10.64062 q -0.59375,0.57812 -1.57813,1.15625 -0.98437,0.5625 -1.76562,0.85937 l 0,-1.625 q 1.40625,-0.65625 2.45312,-1.59375 1.04688,-0.9375 1.48438,-1.8125 l 1.07812,0 0,13.65625 z m 10.37571,0 -1.67188,0 0,-10.64062 q -0.59375,0.57812 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85937 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z m 4.07882,-6.70312 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65699,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98437,-0.79688 2.46875,-0.79688 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70313 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79687,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95313,-1.10938 -1.15625,0 -1.82812,0.98438 -0.875,1.23437 -0.875,4.59375 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path81" d="m 256,120 128,0 0,40 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path83" d="m 268.90265,140.21686 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98437,-0.79688 2.46875,-0.79688 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70313 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79687,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95313,-1.10938 -1.15625,0 -1.82812,0.98438 -0.875,1.23437 -0.875,4.59375 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path85" d="m 279.27838,140.21686 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65698,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65695,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65696,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98437,-0.79688 2.46875,-0.79688 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70313 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79687,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95313,-1.10938 -1.15625,0 -1.82812,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65698,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98437,-0.79688 2.46875,-0.79688 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70313 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79687,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95313,-1.10938 -1.15625,0 -1.82812,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65698,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98437,-0.79688 2.46875,-0.79688 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70313 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79687,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95313,-1.10938 -1.15625,0 -1.82812,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65698,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65692,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z m 8.65698,0 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98438,-0.79688 2.46875,-0.79688 1.09375,0 1.92188,0.4375 0.82812,0.4375 1.35937,1.28125 0.54688,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48437,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07812,-1.40625 -1.35938,-1.70313 -1.35938,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79688,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95312,-1.10938 -1.15625,0 -1.82813,0.98438 -0.875,1.23437 -0.875,4.59375 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path87" d="m 376,120 48,0 0,40 -48,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path89" d="m 396.7024,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path91" d="m 407.0781,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path93" d="m 408,120 48,0 0,40 -48,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path95" d="m 428.7024,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path97" d="m 439.0781,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path99" d="m 440,120 48,0 0,40 -48,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path101" d="m 454.4055,140.21686 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98437,-0.79688 2.46875,-0.79688 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70313 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79687,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95313,-1.10938 -1.15625,0 -1.82812,0.98438 -0.875,1.23437 -0.875,4.59375 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path103" d="m 471.0781,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path105" d="m 480,50.50113 0,0 C 480,44.70151 484.70154,40 490.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 512,67.29849 507.29846,72 501.4989,72 l -10.9978,0 C 484.70154,72 480,67.29849 480,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path107" d="m 480,50.50113 0,0 C 480,44.70151 484.70154,40 490.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 512,67.29849 507.29846,72 501.4989,72 l -10.9978,0 C 484.70154,72 480,67.29849 480,61.49887 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path109" d="m 512,50.50113 0,0 C 512,44.70151 516.70154,40 522.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 544,67.29849 539.29846,72 533.4989,72 l -10.9978,0 C 516.70154,72 512,67.29849 512,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path111" d="m 512,50.50113 0,0 C 512,44.70151 516.70154,40 522.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 544,67.29849 539.29846,72 533.4989,72 l -10.9978,0 C 516.70154,72 512,67.29849 512,61.49887 z" /> <path style="fill:#efefef;fill-rule:nonzero" inkscape:connector-curvature="0" id="path113" d="m 544,50.50113 0,0 C 544,44.70151 548.70154,40 554.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 576,67.29849 571.29846,72 565.4989,72 l -10.9978,0 C 548.70154,72 544,67.29849 544,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path115" d="m 544,50.50113 0,0 C 544,44.70151 548.70154,40 554.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 576,67.29849 571.29846,72 565.4989,72 l -10.9978,0 C 548.70154,72 544,67.29849 544,61.49887 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path117" d="m 576,50.50113 0,0 C 576,44.70151 580.70154,40 586.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 608,67.29849 603.29846,72 597.4989,72 l -10.9978,0 C 580.70154,72 576,67.29849 576,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path119" d="m 576,50.50113 0,0 C 576,44.70151 580.70154,40 586.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 608,67.29849 603.29846,72 597.4989,72 l -10.9978,0 C 580.70154,72 576,67.29849 576,61.49887 z" /> <path style="fill:#666666;fill-rule:nonzero" inkscape:connector-curvature="0" id="path121" d="m 608,50.50113 0,0 C 608,44.70151 612.70154,40 618.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 640,67.29849 635.29846,72 629.4989,72 l -10.9978,0 C 612.70154,72 608,67.29849 608,61.49887 z" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path123" d="m 608,50.50113 0,0 C 608,44.70151 612.70154,40 618.5011,40 l 10.9978,0 0,0 c 2.78504,0 5.45606,1.10635 7.42542,3.07571 1.9693,1.96933 3.07568,4.64036 3.07568,7.42542 l 0,10.99774 0,0 C 640,67.29849 635.29846,72 629.4989,72 l -10.9978,0 C 612.70154,72 608,67.29849 608,61.49887 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path125" d="m 472,120 48,0 0,40 -48,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path127" d="m 486.4055,140.21686 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98437,-0.79688 2.46875,-0.79688 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70313 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79687,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95313,-1.10938 -1.15625,0 -1.82812,0.98438 -0.875,1.23437 -0.875,4.59375 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path129" d="m 503.0781,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path131" d="m 504,120 48,0 0,40 -48,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path133" d="m 524.7024,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path135" d="m 535.0781,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path137" d="m 536,120 48,0 0,40 -48,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path139" d="m 550.4055,140.21686 q 0,-2.42188 0.5,-3.89063 0.5,-1.46875 1.46875,-2.26562 0.98437,-0.79688 2.46875,-0.79688 1.09375,0 1.92187,0.4375 0.82813,0.4375 1.35938,1.28125 0.54687,0.82813 0.84375,2.01563 0.3125,1.1875 0.3125,3.21875 0,2.39062 -0.5,3.85937 -0.48438,1.46875 -1.46875,2.28125 -0.96875,0.79688 -2.46875,0.79688 -1.96875,0 -3.07813,-1.40625 -1.35937,-1.70313 -1.35937,-5.53125 z m 1.71875,0 q 0,3.34375 0.78125,4.45312 0.79687,1.10938 1.9375,1.10938 1.15625,0 1.9375,-1.10938 0.78125,-1.125 0.78125,-4.45312 0,-3.35938 -0.78125,-4.46875 -0.78125,-1.10938 -1.95313,-1.10938 -1.15625,0 -1.82812,0.98438 -0.875,1.23437 -0.875,4.59375 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path141" d="m 567.0781,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path143" d="m 568,120 48,0 0,40 -48,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path145" d="m 588.7024,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path147" d="m 599.0781,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path149" d="m 600,120 48,0 0,40 -48,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path151" d="m 620.7024,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#999999;fill-rule:nonzero" inkscape:connector-curvature="0" id="path153" d="m 631.0781,146.91998 -1.67188,0 0,-10.64063 q -0.59375,0.57813 -1.57812,1.15625 -0.98438,0.5625 -1.76563,0.85938 l 0,-1.625 q 1.40625,-0.65625 2.45313,-1.59375 1.04687,-0.9375 1.48437,-1.8125 l 1.07813,0 0,13.65625 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path155" d="m 0,152 128,0 0,40 -128,0 z" /> <path style="fill:#000000;fill-rule:nonzero" inkscape:connector-curvature="0" id="path157" d="m 10.40625,178.91998 0,-13.59375 2.71875,0 3.21875,9.625 q 0.4375,1.34375 0.64062,2.01562 0.23438,-0.75 0.73438,-2.1875 l 3.25,-9.45312 2.42187,0 0,13.59375 -1.73437,0 0,-11.39063 -3.95313,11.39063 -1.625,0 -3.9375,-11.57813 0,11.57813 -1.73437,0 z m 21.82205,-1.21875 q -0.9375,0.79687 -1.79687,1.125 -0.85938,0.3125 -1.84375,0.3125 -1.60938,0 -2.48438,-0.78125 -0.875,-0.79688 -0.875,-2.03125 0,-0.73438 0.32813,-1.32813 0.32812,-0.59375 0.85937,-0.95312 0.53125,-0.35938 1.20313,-0.54688 0.5,-0.14062 1.48437,-0.25 2.03125,-0.25 2.98438,-0.57812 0,-0.34375 0,-0.4375 0,-1.01563 -0.46875,-1.4375 -0.64063,-0.5625 -1.90625,-0.5625 -1.17188,0 -1.73438,0.40625 -0.5625,0.40625 -0.82812,1.46875 l -1.64063,-0.23438 q 0.23438,-1.04687 0.73438,-1.6875 0.51562,-0.64062 1.46875,-0.98437 0.96875,-0.35938 2.25,-0.35938 1.26562,0 2.04687,0.29688 0.78125,0.29687 1.15625,0.75 0.375,0.45312 0.51563,1.14062 0.0937,0.42188 0.0937,1.53125 l 0,2.23438 q 0,2.32812 0.0937,2.95312 0.10937,0.60938 0.4375,1.17188 l -1.75,0 q -0.26563,-0.51563 -0.32813,-1.21875 z m -0.14062,-3.71875 q -0.90625,0.35937 -2.73438,0.625 -1.03125,0.14062 -1.45312,0.32812 -0.42188,0.1875 -0.65625,0.54688 -0.23438,0.35937 -0.23438,0.79687 0,0.67188 0.5,1.125 0.51563,0.4375 1.48438,0.4375 0.96875,0 1.71875,-0.42187 0.75,-0.4375 1.10937,-1.15625 0.26563,-0.57813 0.26563,-1.67188 l 0,-0.60937 z m 4.06321,4.9375 0,-9.85938 1.5,0 0,1.5 q 0.57813,-1.04687 1.0625,-1.375 0.48438,-0.34375 1.07813,-0.34375 0.84375,0 1.71875,0.54688 l -0.57813,1.54687 q -0.60937,-0.35937 -1.23437,-0.35937 -0.54688,0 -0.98438,0.32812 -0.42187,0.32813 -0.60937,0.90625 -0.28125,0.89063 -0.28125,1.95313 l 0,5.15625 -1.67188,0 z m 6.24393,0 0,-13.59375 1.67188,0 0,7.75 3.95312,-4.01563 2.15625,0 -3.76562,3.65625 4.14062,6.20313 -2.0625,0 -3.25,-5.03125 -1.17187,1.125 0,3.90625 -1.67188,0 z m 16.04268,0 -1.54688,0 0,-13.59375 1.65625,0 0,4.84375 q 1.0625,-1.32813 2.70313,-1.32813 0.90625,0 1.71875,0.375 0.8125,0.35938 1.32812,1.03125 0.53125,0.65625 0.82813,1.59375 0.29687,0.9375 0.29687,2 0,2.53125 -1.25,3.92188 -1.25,1.375 -3,1.375 -1.75,0 -2.73437,-1.45313 l 0,1.23438 z m -0.0156,-5 q 0,1.76562 0.46875,2.5625 0.79688,1.28125 2.14063,1.28125 1.09375,0 1.89062,-0.9375 0.79688,-0.95313 0.79688,-2.84375 0,-1.92188 -0.76563,-2.84375 -0.76562,-0.92188 -1.84375,-0.92188 -1.09375,0 -1.89062,0.95313 -0.79688,0.95312 -0.79688,2.75 z m 8.8601,-6.6875 0,-1.90625 1.67187,0 0,1.90625 -1.67187,0 z m 0,11.6875 0,-9.85938 1.67187,0 0,9.85938 -1.67187,0 z m 7.78544,-1.5 0.23438,1.48437 q -0.70313,0.14063 -1.26563,0.14063 -0.90625,0 -1.40625,-0.28125 -0.5,-0.29688 -0.70312,-0.75 -0.20313,-0.46875 -0.20313,-1.98438 l 0,-5.65625 -1.23437,0 0,-1.3125 1.23437,0 0,-2.4375 1.65625,-1 0,3.4375 1.6875,0 0,1.3125 -1.6875,0 0,5.75 q 0,0.71875 0.0781,0.92188 0.0937,0.20312 0.29687,0.32812 0.20313,0.125 0.57813,0.125 0.26562,0 0.73437,-0.0781 z m 0.85518,-1.4375 1.65625,-0.26563 q 0.14063,1 0.76563,1.53125 0.64062,0.51563 1.78126,0.51563 1.15625,0 1.70313,-0.46875 0.5625,-0.46875 0.5625,-1.09375 0,-0.5625 -0.48438,-0.89063 -0.34375,-0.21875 -1.70312,-0.5625 -1.84377,-0.46875 -2.56252,-0.79687 -0.70312,-0.34375 -1.07812,-0.9375 -0.35938,-0.60938 -0.35938,-1.32813 0,-0.65625 0.29688,-1.21875 0.3125,-0.5625 0.82812,-0.9375 0.39063,-0.28125 1.0625,-0.48437 0.67188,-0.20313 1.4375,-0.20313 1.17189,0 2.04689,0.34375 0.875,0.32813 1.28125,0.90625 0.42188,0.5625 0.57813,1.51563 l -1.625,0.21875 q -0.10938,-0.75 -0.65625,-1.17188 -0.53125,-0.4375 -1.50002,-0.4375 -1.15625,0 -1.64062,0.39063 -0.48438,0.375 -0.48438,0.875 0,0.32812 0.20313,0.59375 0.20312,0.26562 0.64062,0.4375 0.25,0.0937 1.46877,0.4375 1.76562,0.46875 2.46875,0.76562 0.70312,0.29688 1.09375,0.875 0.40625,0.57813 0.40625,1.4375 0,0.82813 -0.48438,1.57813 -0.48437,0.73437 -1.40625,1.14062 -0.92187,0.39063 -2.07812,0.39063 -1.92189,0 -2.93752,-0.79688 -1,-0.79687 -1.28125,-2.35937 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path159" d="m 147.749,183.99786 0.0315,-16" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path161" d="m 147.749,183.99786 0.018,-9.14584" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path163" d="m 147.767,174.85202 2.24475,2.2536 -2.237,-6.18396 -2.26135,6.17511 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path165" d="m 273.248,183.9984 0.0315,-15.96851" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path167" d="m 273.248,183.9984 0.018,-9.11435" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path169" d="m 273.26596,174.88406 2.24472,2.2536 -2.23697,-6.18396 -2.26135,6.17508 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path171" d="M 395.7185,183.9685 395.75,167.99999" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path173" d="m 395.7185,183.9685 0.0179,-9.11435" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path175" d="m 395.7365,174.85416 2.24469,2.2536 -2.23694,-6.18396 -2.26135,6.17508 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path177" d="m 427.69183,183.9685 0.0315,-15.96851" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path179" d="m 427.69183,183.9685 0.0179,-9.11435" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path181" d="m 427.7098,174.85416 2.24475,2.2536 -2.237,-6.18396 -2.26135,6.17508 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path183" d="m 459.66504,184 0.0315,-15.96851" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path185" d="m 459.66504,184 0.018,-9.11435" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path187" d="m 459.68304,174.88565 2.24475,2.2536 -2.237,-6.18396 -2.26135,6.17508 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path189" d="m 491.63837,183.9685 0.0315,-15.96851" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path191" d="m 491.63837,183.9685 0.0179,-9.11435" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path193" d="m 491.6564,174.85416 2.24469,2.2536 -2.23694,-6.18396 -2.26135,6.17508 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path195" d="m 523.61163,183.9685 0.0315,-15.96851" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path197" d="m 523.61163,183.9685 0.0179,-9.11435" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path199" d="m 523.6296,174.85416 2.24475,2.2536 -2.23694,-6.18396 -2.26135,6.17508 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path201" d="m 555.5849,184 0.0315,-15.96851" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path203" d="m 555.5849,184 0.0179,-9.11435" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path205" d="m 555.60284,174.88565 2.24475,2.2536 -2.237,-6.18396 -2.26135,6.17508 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path207" d="m 587.5582,183.9685 0.0315,-15.96851" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path209" d="m 587.5582,183.9685 0.0179,-9.11435" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path211" d="m 587.57623,174.85416 2.24469,2.2536 -2.23694,-6.18396 -2.26135,6.17508 z" /> <path style="fill:#000000;fill-opacity:0;fill-rule:nonzero" inkscape:connector-curvature="0" id="path213" d="m 619.5315,184 0.0315,-15.96851" /> <path style="stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round" inkscape:connector-curvature="0" id="path215" d="m 619.5315,184 0.0179,-9.11435" /> <path style="fill:#000000;fill-rule:evenodd;stroke:#000000;stroke-width:2;stroke-linecap:butt" inkscape:connector-curvature="0" id="path217" d="m 619.5495,174.88565 2.24469,2.2536 -2.23694,-6.18396 -2.26135,6.17508 z" /> </svg>
6282
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/6282/slicebench_test.go
// Copyright 2016 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // package slicebench implements tests to support the analysis in proposal 6282. // It compares the performance of multi-dimensional slices implemented using a // single slice and using a struct type. package slicebench import ( "math" "math/rand" "testing" ) var ( m = 300 n = 400 k = 200 lda = k ldb = k ldc = n ) var a, b, c []float64 var A, B, C Dense var aStore, bStore, cStore []float64 // data storage for the variables above func init() { // Initialize the matrices to random data. aStore = make([]float64, m*lda) for i := range a { aStore[i] = rand.Float64() } bStore = make([]float64, n*ldb) for i := range b { bStore[i] = rand.Float64() } cStore = make([]float64, n*ldc) for i := range c { cStore[i] = rand.Float64() } a = make([]float64, len(aStore)) copy(a, aStore) b = make([]float64, len(bStore)) copy(b, bStore) c = make([]float64, len(cStore)) copy(c, cStore) // The struct types use the single slices as underlying data. A = Dense{lda, m, k, a} B = Dense{lda, n, k, b} C = Dense{lda, m, n, c} } // resetSlices resets the data to their original (randomly generated) values. // The Dense values share the same undelying data as the single slices, so this // works for both single slice and struct representations. func resetSlices(be *testing.B) { copy(a, aStore) copy(b, bStore) copy(c, cStore) be.ResetTimer() } // BenchmarkNaiveSlices measures a naive implementation of C += A * B^T using // the single slice representation. func BenchmarkNaiveSlices(be *testing.B) { resetSlices(be) for t := 0; t < be.N; t++ { for i := 0; i < m; i++ { for j := 0; j < n; j++ { var t float64 for l := 0; l < k; l++ { t += a[i*lda+l] * b[j*lda+l] } c[i*ldc+j] += t } } } } // Dense represents a two-dimensional slice with the specified sizes. type Dense struct { stride int rows int cols int data []float64 } // At returns the element at row i and column j. func (d *Dense) At(i, j int) float64 { if uint(i) >= uint(d.rows) { panic("rows out of bounds") } if uint(j) >= uint(d.cols) { panic("cols out of bounds") } return d.data[i*d.stride+j] } // AddSet adds v to the current value at row i and column j. func (d *Dense) AddSet(i, j int, v float64) { if uint(i) >= uint(d.rows) { panic("rows out of bounds") } if uint(j) >= uint(d.cols) { panic("cols out of bounds") } d.data[i*d.stride+j] += v } // BenchmarkAddSet measures a naive implementation of C += A * B^T using // the Dense representation. func BenchmarkAddSet(be *testing.B) { resetSlices(be) for t := 0; t < be.N; t++ { for i := 0; i < m; i++ { for j := 0; j < n; j++ { var t float64 for l := 0; l < k; l++ { t += A.At(i, l) * B.At(j, l) } C.AddSet(i, j, t) } } } } // AtNP gets the value at row i and column j without panicking if a bounds check // fails. func (d *Dense) AtNP(i, j int) float64 { if uint(i) >= uint(d.rows) { // Corrupt a value in data so the bounds check still has an effect if it // fails. This way, the method can be in-lined but the bounds checks are // not trivially removable. d.data[0] = math.NaN() } if uint(j) >= uint(d.cols) { d.data[0] = math.NaN() } return d.data[i*d.stride+j] } // AddSetNP adds v to the current value at row i and column j without panicking if // a bounds check fails. func (d *Dense) AddSetNP(i, j int, v float64) { if uint(i) >= uint(d.rows) { // See comment in AtNP. d.data[0] = math.NaN() } if uint(j) >= uint(d.cols) { d.data[0] = math.NaN() } d.data[i*d.stride+j] += v } // BenchmarkAddSetNP measures C += A * B^T using the Dense representation with // calls to methods that do not panic. This simulates a compiler that can inline // the normal At and Set methods. func BenchmarkAddSetNP(be *testing.B) { resetSlices(be) for t := 0; t < be.N; t++ { for i := 0; i < m; i++ { for j := 0; j < n; j++ { var t float64 for l := 0; l < k; l++ { t += A.AtNP(i, l) * B.AtNP(j, l) } C.AddSetNP(i, j, t) } } } } // AtNB gets the value at row i and column j without performing any bounds checking. func (d *Dense) AtNB(i, j int) float64 { return d.data[i*d.stride+j] } // AddSetNB adds v to the current value at row i and column j without performing // any bounds checking. func (d *Dense) AddSetNB(i, j int, v float64) { d.data[i*d.stride+j] += v } // BenchmarkAddSetNB measures C += A * B^T using the Dense representation with // calls to methods that do not check bounds. This simulates a compiler that can // prove the bounds checks redundant and eliminate them. func BenchmarkAddSetNB(be *testing.B) { resetSlices(be) for t := 0; t < be.N; t++ { for i := 0; i < m; i++ { for j := 0; j < n; j++ { var t float64 for l := 0; l < k; l++ { t += A.AtNB(i, l) * B.AtNB(j, l) } C.AddSetNB(i, j, t) } } } } // BenchmarkSliceOpt measures an optimized implementation of C += A * B^T using // the single slice representation. func BenchmarkSliceOpt(be *testing.B) { resetSlices(be) for t := 0; t < be.N; t++ { for i := 0; i < m; i++ { as := a[i*lda : i*lda+k] cs := c[i*ldc : i*ldc+n] for j := 0; j < n; j++ { bs := b[j*lda : j*lda+k] var t float64 for l, v := range as { t += v * bs[l] } cs[j] += t } } } } // RowViewNB gets the specified row of the Dense without checking bounds. func (d *Dense) RowViewNB(i int) []float64 { return d.data[i*d.stride : i*d.stride+d.cols] } // BenchmarkDenseOpt measures an optimized implementation of C += A * B^T using // the Dense representation. func BenchmarkDenseOpt(be *testing.B) { resetSlices(be) for t := 0; t < be.N; t++ { for i := 0; i < m; i++ { as := A.RowViewNB(i) cs := C.RowViewNB(i) for j := 0; j < n; j++ { bs := b[j*lda:] var t float64 for l, v := range as { t += v * bs[l] } cs[j] += t } } } }
44167
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/44167/svg2png.bash
#!/bin/bash for input in *.svg; do output=${input%.*}.png google-chrome --headless --window-size=1920,1080 --disable-gpu --screenshot $input convert screenshot.png -trim $output done rm screenshot.png
44167
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/44167/README.md
# Design document The GC pacer design document is generated from the `.src.md` file in this directory. It contains LaTeX formulas which Markdown cannot render, so they're rendered by an external open-source tool, [md-latex](https://github.com/mknyszek/md-tools). Then, because Gitiles' markdown viewer can't render SVGs, run ``` ./svg2png.bash cd pacer-plots ./svg2png.bash cd .. ``` And go back and replace all instances of SVG with PNG in the final document. Note that `svg2png.bash` requires both ImageMagick and Google Chrome.
44167
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/44167/gc-pacer-redesign.src.md
# GC Pacer Redesign Author: Michael Knyszek Updated: 8 February 2021 ## Abstract Go's tracing garbage collector runs concurrently with the application, and thus requires an algorithm to determine when to start a new cycle. In the runtime, this algorithm is referred to as the pacer. Until now, the garbage collector has framed this process as an optimization problem, utilizing a proportional controller to achieve a desired stopping-point (that is, the cycle completes just as the heap reaches a certain size) as well as a desired CPU utilization. While this approach has served Go well for a long time, it has accrued many corner cases due to resolved issues, as well as a backlog of unresolved issues. I propose redesigning the garbage collector's pacer from the ground up to capture the things it does well and eliminate the problems that have been discovered. More specifically, I propose: 1. Including all non-heap sources of GC work (stacks, globals) in pacing decisions. 1. Reframing the pacing problem as a search problem, 1. Extending the hard heap goal to the worst-case heap goal of the next GC, (1) will resolve long-standing issues with small heap sizes, allowing the Go garbage collector to scale *down* and act more predictably in general. (2) will eliminate offset error present in the current design, will allow turning off GC assists in the steady-state, and will enable clearer designs for setting memory limits on Go applications. (3) will enable smooth and consistent response to large changes in the live heap size with large `GOGC` values. ## Background Since version 1.5 Go has had a tracing mark-sweep garbage collector (GC) that is able to execute concurrently with user goroutines. The garbage collector manages several goroutines called "workers" to carry out its task. A key problem in concurrent garbage collection is deciding when to begin, such that the work is complete "on time." Timeliness, today, is defined by the optimization of two goals: 1. The heap size relative to the live heap at the end of the last cycle, and 1. A target CPU utilization for the garbage collector while it is active. These two goals are tightly related. If a garbage collection cycle starts too late, for instance, it may consume more CPU to avoid missing its target. If a cycle begins too early, it may end too early, resulting in GC cycles happening more often than expected. Go's garbage collector sets a fixed target of 30% CPU utilization (25% from GC workers, with 5% from user goroutines donating their time to assist) while the GC is active. It also offers a parameter to allow the user to set their own memory use and CPU trade-off: `GOGC`. `GOGC` is a percent overhead describing how much *additional* memory (over the live heap) the garbage collector may use. A higher `GOGC` value indicates that the garbage collector may use more memory, setting the target heap size higher, and conversely a lower `GOGC` value sets the target heap size lower. The process of deciding when a garbage collection should start given these parameters has often been called "pacing" in the Go runtime. To attempt to reach its goals, Go's "pacer" utilizes a proportional controller to decide when to start a garbage collection cycle. The controller attempts to find the correct point to begin directly, given an error term that captures the two aforementioned optimization goals. It's worth noting that the optimization goals are defined for some steady-state. Today, the steady-state is implicitly defined as: constant allocation rate, constant heap size, and constant heap composition (hence, constant mark rate). The pacer expects the application to settle on some average global behavior across GC cycles. However, the GC is still robust to transient application states. When the GC is in some transient state, the pacer is often operating with stale information, and is actively trying to find the new steady-state. To avoid issues with memory blow-up, among other things, the GC makes allocating goroutines donate their time to assist the garbage collector, proportionally to the amount of memory that they allocate. This GC assist system keeps memory use stable in unstable conditions, at the expense of user CPU time and latency. The GC assist system operates by dynamically computing an assist ratio. The assist ratio is the slope of a curve in the space of allocation time and GC work time, a curve that the application is required to stay under. This assist ratio is then used as a conversion factor between the amount a goroutine has allocated, and how much GC assist work it should do. Meanwhile, GC workers generate assist credit from the work that they do and place it in a global pool that allocating goroutines may steal from to avoid having to assist. ## Motivation Since version 1.5, the pacer has gone through several minor tweaks and changes in order to resolve issues, usually adding special cases and making its behavior more difficult to understand, though resolving the motivating problem. Meanwhile, more issues have been cropping up that are diagnosed but more difficult to tackle in the existing design. Most of these issues are listed in the [GC pacer meta-issue](https://github.com/golang/go/issues/42430). Even more fundamentally, the proportional controller at the center of the pacer is demonstrably unable to completely eliminate error in its scheduling, a well-known issue with proportional-only controllers. Another significant motivator, beyond resolving latent issues, is that the Go runtime lacks facilities for dealing with finite memory limits. While the `GOGC` mechanism works quite well and has served Go for a long time, it falls short when there's a hard memory limit. For instance, a consequence of `GOGC` that often surprises new gophers coming from languages like Java, is that if `GOGC` is 100, then Go really needs 2x more memory than the peak live heap size. The garbage collector will *not* automatically run more aggressively as it approaches some memory limit, leading to out-of-memory errors. Conversely, users that know they'll have a fixed amount of memory up-front are unable to take advantage of it if their live heap is usually small. Users have taken to fooling the GC into thinking more memory is live than their application actually needs in order to let the application allocate more memory in between garbage collections. Simply increasing `GOGC` doesn't tend to work in this scenario either because of the previous problem: if the live heap spikes suddenly, `GOGC` will result in much more memory being used overall. See issue [#42430](https://github.com/golang/go/issues/42430) for more details. The current pacer is not designed with these use-cases in mind. ## Design ### Definitions ```render-latex \begin{aligned} \gamma & = 1+\frac{GOGC}{100} \\ S_n & = \textrm{bytes of memory allocated to goroutine stacks at the beginning of the mark phase of GC } n \\ G_n & = \textrm{bytes of memory dedicated to scannable global variables at the beginning of the mark phase of GC } n \\ M_n & = \textrm{bytes of memory marked live after GC } n \end{aligned} ``` There is some nuance to these definitions. Firstly, `$\gamma$` is used in place of `GOGC` because it makes the math easier to understand. Secondly, `$S_n$` may vary throughout the sweep phase, but effectively becomes fixed once a GC cycle starts. Stacks may not shrink, only grow during this time, so there's a chance any value used by the runtime during a GC cycle will be stale. `$S_n$` also includes space that may not be actively used for the stack. That is, if an 8 KiB goroutine stack is actually only 2 KiB high (and thus only 2 KiB is actually scannable), for consistency's sake the stack's height will be considered 8 KiB. Both of these estimates introduce the potential for skew. In general, however, stacks are roots in the GC and will be some of the first sources of work for the GC, so the estimate should be fairly close. If that turns out not to be true in practice, it is possible, though tricky to track goroutine stack heights more accurately, though there must necessarily always be some imprecision because actual scannable stack height is rapidly changing. Thirdly, `$G_n$` acts similarly to `$S_n$`. The amount of global memory in a Go program can change while the application is running because of the `plugin` package. This action is relatively rare compared to a change in the size of stacks. Because of this rarity, I propose allowing a bit of skew. At worst (as we'll see later) the pacer will overshoot a little bit. Lastly, `$M_n$` is the amount of heap memory known to be live to the runtime the *instant* after a garbage collection cycle completes. Intuitively, it is the bottom of the classic GC sawtooth pattern. ### Heap goal Like in the [previous definition of the pacer](https://docs.google.com/document/d/1wmjrocXIWTr1JxU-3EQBI6BK6KgtiFArkG47XK73xIQ/edit#heading=h.poxawxtiwajr), the runtime sets some target heap size for the GC cycle based on `GOGC`. Intuitively, this target heap size is the targeted heap size at the top of the classic GC sawtooth pattern. The definition I propose is very similar, except it includes non-heap sources of GC work. Let `$N_n$` be the heap goal for GC `$n$` ("N" stands for "Next GC"). ```render-latex N_n = \gamma M_{n-1} + S_n + G_n ``` The old definition makes the assumption that non-heap sources of GC work are negligible. In practice, that is often not true, such as with small heaps. This definition says that we're trading off not just heap memory, but *all* memory that influences the garbage collector's CPU consumption. From a philospical standpoint wherein `GOGC` is intended to be a knob controlling the trade-off between CPU resources and memory footprint, this definition is more accurate. This change has one large user-visible ramification: the default `GOGC`, in most cases, will use slightly more memory than before. This change will inevitably cause some friction, but I believe the change is worth it. It unlocks the ability to scale *down* to heaps smaller than 4 MiB (the origin of this limit is directly tied to this lack of accounting). It also unlocks better behavior in applications with many, or large goroutine stacks, or very many globals. That GC work is now accounted for, leading to fewer surprises. ### Deciding when to trigger a GC Unlike the current pacer, I propose that instead of finding the right point to start a GC such that the runtime reaches some target in the steady-state, that the pacer instead searches for a value that is more fundamental, though more indirect. Before continuing I want take a moment to point out some very fundamental and necessary assumptions made in both this design and the current pacer. Here, we are taking a "macro-economic" view of the Go garbage collector. The actual behavior of the application at the "micro" level is all about individual allocations, but the pacer is concerned not with the moment-to-moment behavior of the application. Instead, it concerns itself with broad aggregate patterns. And evidently, this abstraction is useful. Most programs are not wildly unpredictable in their behavior; in fact it's somewhat of a challenge to write a useful application that non-trivially has unpredictable memory allocation behavior, thanks to the law of large numbers. This observation is why it is useful to talk about the steady-state of an application *at all*. The pacer concerns itself with two notions of time: the time it takes to allocate from the GC trigger point to the heap goal and the time it takes to find and perform all outstanding GC work. These are only *notions* of time because the pacer's job is to make them happen in the *same* amount of time, relative to a wall clock. Since in the steady-state the amount of GC work (broadly speaking) stays fixed, the pacer is then concerned with figuring out how early it should start such that it meets its goal. Because they should happen in the *same* amount of time, this question of "how early" is answered in "bytes allocated so far." So what's this more fundamental value? Suppose we model a Go program as such: the world is split in two while a GC is active: the application is either spending time on itself and potentially allocating, or on performing GC work. This model is "zero-sum," in a sense: if more time is spent on GC work, then less time is necessarily spent on the application and vice versa. Given this model, suppose we had two measures of program behavior during a GC cycle: how often the application is allocating, and how rapidly the GC can scan and mark memory. Note that these measure are *not* peak throughput. They are a measure of the rates, in actuality, of allocation and GC work happens during a GC. To give them a concrete unit, let's say they're bytes per cpu-seconds per core. The idea with this unit is to have some generalized, aggregate notion of this behavior, independent of available CPU resources. We'll see why this is important shortly. Lets call these rates `$a$` and `$s$` respectively. In the steady-state, these rates aren't changing, so we can use them to predict when to start a garbage collection. Coming back to our model, some amount of CPU time is going to go to each of these activities. Let's say our target GC CPU utilization in the steady-state is `$u_t$`. If `$C$` is the number of CPU cores available and `$t$` is some wall-clock time window, then `$a(1-u_t)Ct$` bytes will be allocated and `$s u_t Ct$` bytes will be scanned in that window. Notice that *ratio* of "bytes allocated" to "bytes scanned" is constant in the steady-state in this model, because both `$a$` and `$s$` are constant. Let's call this ratio `$r$`. To make things a little more general, let's make `$r$` also a function of utilization `$u$`, because part of the Go garbage collector's design is the ability to dynamically change CPU utilization to keep it on-pace. ```render-latex r(u) = \frac{a(1-u)Ct}{suCt} ``` The big idea here is that this value, `$r(u)$` is a *conversion rate* between these two notions of time. Consider the following: in the steady-state, the runtime can perfectly back out the correct time to start a GC cycle, given that it knows exactly how much work it needs to do. Let `$T_n$` be the trigger point for GC cycle `$n$`. Let `$P_n$` be the size of the live *scannable* heap at the end of GC `$n$`. More precisely, `$P_n$` is the subset of `$M_n$` that contains pointers. Why include only pointer-ful memory? Because GC work is dominated by the cost of the scan loop, and each pointer that is found is marked; memory containing Go types without pointers are never touched, and so are totally ignored by the GC. Furthermore, this *does* include non-pointers in pointer-ful memory, because scanning over those is a significant cost in GC, enough so that GC is roughly proportional to it, not just the number of pointer slots. In the steady-state, the size of the scannable heap should not change, so `$P_n$` remains constant. ```render-latex T_n = N_n - r(u_t)(P_{n-1} + S_n + G_n) ``` That's nice, but we don't know `$r$` while the runtime is executing. And worse, it could *change* over time. But if the Go runtime can somehow accurately estimate and predict `$r$` then it can find a steady-state. Suppose we had some prediction of `$r$` for GC cycle `$n$` called `$r_n$`. Then, our trigger condition is a simple extension of the formula above. Let `$A$` be the size of the Go live heap at any given time. `$A$` is thus monotonically increasing during a GC cycle, and then instantaneously drops at the end of the GC cycle. In essence `$A$` *is* the classic GC sawtooth pattern. ```render-latex A \ge N_n - r_n(u_t)(P_{n-1} + S_n + G_n) ``` Note that this formula is in fact a *condition* and not a predetermined trigger point, like the trigger ratio. In fact, this formula could transform into the previous formula for `$T_n$` if it were not for the fact that `$S_n$` actively changes during a GC cycle, since the rest of the values are constant for each GC cycle. A big question remains: how do we predict `$r$`? To answer that, we first need to determine how to measure `$r$` at all. I propose a straightforward approximation: each GC cycle, take the amount of memory allocated, divide it by the amount of memory scanned, and scale it from the actual GC CPU utilization to the target GC CPU utilization. Note that this scaling factor is necessary because we want our trigger to use an `$r$` value that is at the target utilization, such that the GC is given enough time to *only* use that amount of CPU. This note is a key aspect of the proposal and will come up later. What does this scaling factor look like? Recall that because of our model, any value of `$r$` has a `$1-u$` factor in the numerator and a `$u$` factor in the denominator. Scaling from one utilization to another is as simple as switching out factors. Let `$\hat{A}_n$` be the actual peak live heap size at the end of a GC cycle (as opposed to `$N_n$`, which is only a target). Let `$u_n$` be the GC CPU utilization over cycle `$n$` and `$u_t$` be the target utilization. Altogether, ```render-latex r_{measured} \textrm{ for GC } n = \frac{\hat{A}_n - T_n}{M_n + S_n + G_n}\frac{(1-u_t)u_n}{(1-u_n)u_t} ``` Now that we have a way to measure `$r$`, we could use this value directly as our prediction. But I fear that using it directly has the potential to introduce a significant amount of noise, so smoothing over transient changes to this value is desirable. To do so, I propose using this measurement as the set-point for a proportional-integral (PI) controller. This means that the PI controller is always chasing whatever value was measured for each GC cycle. In a steady-state with only small changes, this means the PI controller acts as a smoothing function. The advantage of a PI controller over a proportional controller is that it guarantees that steady-state error will be driven to zero. Note that the current GC pacer has issues with offset error. It may also find the wrong point on the isocline of GC CPU utilization and peak heap size because the error term can go to zero even if both targets are missed. The disadvantage of a PI controller, however, is that it oscillates and may overshoot significantly on its way to reaching a steady value. This disadvantage could be mitigated by overdamping the controller, but I propose we tune it using the tried-and-tested standard Ziegler-Nichols method. In simulations (see [the simulations section](#simulations)) this tuning tends to work well. It's worth noting that PI (more generally, PID controllers) have a lot of years of research and use behind them, and this design lets us take advantage of that and tune the pacer further if need be. Why a PI controller and not a PID controller? Firstly, PI controllers are simpler to reason about. Secondly, the derivative term in a PID controller tends to be sensitive to high-frequency noise, and the entire point here is to smooth over noise. Furthermore, the advantage of the derivative term is a shorter rise time, but simulations show that the rise time is roughly 1 GC cycle, so I don't think there's much reason to include it. Adding the derivative term though is trivial once the rest of the design is in place, so the door is always open. By focusing on this `$r$` value, we've now reframed the pacing problem as a search problem instead of an optimization problem. That raises question: are we still reaching our optimization goals? And how do GC assists fit into this picture? The good news is that we're always triggering for the right CPU utilization. Because `$r$` being scaled for the *target* GC CPU utilization and `$r$` picks the trigger, the pacer will naturally start at a point that will generate a certain utilization in the steady-state. Following from this fact, there is no longer any reason to have the target GC CPU utilization be 30%. Originally, in the design for the current pacer, the target GC CPU utilization, began at 25%, with GC assists always *extending* from that, so in the steady-state there would be no GC assists. However, because the pacer was structured to solve an optimization problem, it required feedback from both directions. That is, it needed to know whether it was actinng too aggressively *or* not aggressively enough. This feedback could only be obtained by actually performing GC assists. But with this design, that's no longer necessary. The target CPU utilization can completely exclude GC assists in the steady-state with a mitigated risk of bad behavior. As a result, I propose the target utilization be reduced once again to 25%, eliminating GC assists in the steady-state (that's not out-pacing the GC), and potentially improving application latency as a result. #### Idle-priority background GC workers Idle-priority GC workers are extra workers that run if the application isn't utilizing all `GOMAXPROCS` worth of parallelism. The scheduler schedules "low priority" background workers on any additional CPU resources, and this ultimately skews utilization measurements in the GC. In today's pacer, they're somewhat accounted for. In general, the idle workers skew toward undershoot: because the pacer is not explicitly aware of the idle workers, GC cycles will complete sooner than it might expect. However if a GC cycle completes early, then in theory the current pacer will simply adjust. From its perspective, scanning and marking objects was just faster than expected. The new proposed design must also account for them somehow. I propose including idle priority worker CPU utilization in both the measured utilization, `$u_n$`, and the target utilization, `$u_t$`, in each GC cycle. In this way, the only difference between the two terms remains GC assist utilization, and while idle worker CPU utilization remains stable, the pacer may effectively account for it. Unfortunately this does mean idle-priority GC worker utilization becomes part of the definition of a GC steady-state, making it slightly more fragile. The good news is that that was already true. Due to other issues with idle-priority GC workers, it may be worth revisiting them as a concept, but they do appear to legitimately help certain applications, particularly those that spend a significant chunk of time blocked on I/O, yet spend some significant chunk of their time awake allocating memory. ### Smoothing out GC assists This discussion of GC assists brings us to the existing issues around pacing decisions made *while* the GC is active (which I will refer to as the "GC assist pacer" below). For the most part, this system works very well, and is able to smooth over small hiccups in performance, due to noise from the underlying platform or elsewhere. Unfortunately, there's one place where it doesn't do so well: the hard heap goal. Currently, the GC assist pacer prevents memory blow-up in pathological cases by ramping up assists once either the GC has found more work than it expected (i.e. the live scannable heap has grown) or the GC is behind and the application's heap size has exceeded the heap goal. In both of these cases, it sets a somewhat arbitrarily defined hard limit at 1.1x the heap goal. The problem with this policy is that high `GOGC` values create the opportunity for very large changes in live heap size, because the GC has quite a lot of runway (consider an application with `GOGC=51100` has a steady-state live heap of size 10 MiB and suddenly all the memory it allocates is live). In this case, the GC assist pacer is going to find all this new live memory and panic: the rate of assists will begin to skyrocket. This particular problem impedes the adoption of any sort of target heap size, or configurable minimum heap size. One can imagine a small live heap with a large target heap size as having a large *effective* `GOGC` value, so it reduces to exactly the same case. To deal with this, I propose modifying the GC assist policy to set a hard heap goal of `$\gamma N_n$`. The intuition behind this goal is that if *all* the memory allocated in this GC cycle turns out to be live, the *next* GC cycle will end up using that much memory *anyway*, so we let it slide. But this hard goal need not be used for actually pacing GC assists other than in extreme cases. In fact, it must not, because an assist ratio computed from this hard heap goal and the worst-case scan work turns out to be extremely loose, leading to the GC assist pacer consistently missing the heap goal in some steady-states. So, I propose an alternative calculation for the assist ratio. I believe that the assist ratio must always pass through the heap goal, since otherwise there's no guarantee that the GC meets its heap goal in the steady-state (which is a fundamental property of the pacer in Go's existing GC design). However, there's no reason why the ratio itself needs to change dramatically when there's more GC work than expected. In fact, the preferable case is that it does not, because that lends itself to a much more even distribution of GC assist work across the cycle. So, I propose that the assist ratio be an extrapolation of the current steady-state assist ratio, with the exception that it now include non-heap GC work as the rest of this document does. That is, ```render-latex \begin{aligned} \textrm{max scan work} & = T_n + S_n + G_n \\ \textrm{extrapolated runway} & = \frac{N_n - T_n}{P_{n-1} + S_n + G_n} (T_n + S_n + G_n) \\ \textrm{assist ratio} & = \frac{\textrm{extrapolated runway}}{\textrm{max scan work}} \end{aligned} ``` This definition is intentially roundabout. The assist ratio changes dynamically as the amount of GC work left decreases and the amount of memory allocated increases. This responsiveness is what allows the pacing mechanism to be so robust. Today, the assist ratio is calculated by computing the remaining heap runway and the remaining expected GC work, and dividing the former by the latter. But of course, that's not possible if there's more GC work than expected, since then the assist ratio could go negative, which is meaningless. So that's the purpose defining the "max scan work" and "extrapolated runway": these are worst-case values that are always safe to subtract from, such that we can maintain roughly the same assist ratio throughout the cycle (assuming no hiccups). One minor details is that the "extrapolated runway" needs to be capped at the hard heap goal to prevent breaking that promise, though in practice this will almost. The hard heap goal is such a loose bound that it's really only useful in pathological cases, but it's still necessary to ensure robustness. A key point in this choice is that the GC assist pacer will *only* respond to changes in allocation behavior and scan rate, not changes in the *size* of the live heap. This point seems minor, but it means the GC assist pacer's function is much simpler and more predictable. ## Remaining unanswered questions Not every problem listed in issue [#42430](https://github.com/golang/go/issues/42430) is resolved by this design, though many are. Notable exclusions are: 1. Mark assists are front-loaded in a GC cycle. 1. The hard heap goal isn't actually hard in some circumstances. 1. Existing trigger limits to prevent unbounded memory growth. (1) is difficult to resolve without special cases and arbitrary heuristics, and I think in practice it's OK; the system was fairly robust and will now be more so to this kind of noise. That doesn't mean that it shouldn't be revisited, but it's not quite as big as the other problems, so I leave it outside the scope of this proposal. (2) is also tricky and somewhat orthogonal. I believe the path forward there involves better scheduling of fractional GC workers, which are currently very loosely scheduled. This design has made me realize how important dedicated GC workers are to progress, and how GC assists are a back-up mechanism. I believe that the fundamental problem there lies with the fact that fractional GC workers don't provide that sort of consistent progress. For (3), I propose we retain the limits, translated to the current design. For reference, these limits are `$0.95 (\gamma - 1)$` as the upper-bound on the trigger ratio, and `$0.6 (\gamma - 1)$` as the lower-bound. The upper bound exists to prevent ever starting the GC too late in low-activity scenarios. It may cause consistent undershoot, but prevents issues in GC pacer calculations by preventing the calculated runway from ever being too low. The upper-bound may need to be revisited when considering a configurable target heap size. The lower bound exists to prevent the application from causing excessive memory growth due to floating garbage as the application's allocation rate increases. Before that limit was installed, it wasn't very easy for an application to allocate hard enough for that to happen. The lower bound probably should be revisited, but I leave that outside of the scope of this document. To translate them to the current design, I propose we simply modify the trigger condition to include these limits. It's not important to put these limits in the rest of the pacer because it no longer tries to compute the trigger point ahead of time. ### Initial conditions Like today, the pacer has to start somewhere for the first GC. I propose we carry forward what we already do today: set the trigger point at 7/8ths of the first heap goal, which will always be the minimum heap size. If GC 1 is the first GC, then in terms of the math above, we choose to avoid defining `$M_0$`, and instead directly define ```render-latex \begin{aligned} N_1 & = \textrm{minimum heap size} \\ T_1 & = \frac{7}{8} N_1 \\ P_0 & = 0 \end{aligned} ``` The definition of `$P_0$` is necessary for the GC assist pacer. Furthermore, the PI controller's state will be initialized to zero otherwise. These choices are somewhat arbitrary, but the fact is that the pacer has no knowledge of the progam's past behavior for the first GC. Naturally the behavior of the GC will always be a little odd, but it should, in general, stabilize quite quickly (note that this is the case in each scenario for the [simulations](#simulations). ## A note about CPU utilization This document uses the term "GC CPU utilization" quite frequently, but so far has refrained from defining exactly how it's measured. Before doing that, let's define CPU utilization over a GC mark phase, as it's been used so far. First, let's define the mark phase: it is the period of wall-clock time between the end of sweep termination and the start of mark termination. In the mark phase, the process will have access to some total number of CPU-seconds of execution time. This CPU time can then be divided into "time spent doing GC work" and "time spent doing anything else." GC CPU utilization is then defined as a proportion of that total CPU time that is spent doing GC work. This definition seems straightforward enough but in reality it's more complicated. Measuring CPU time on most platforms is tricky, so what Go does today is an approximation: take the wall-clock time of the GC mark phase, multiply it by `GOMAXPROCS`. Call this $`T`$. Take 25% of that (representing the dedicated GC workers) and add total amount of time all goroutines spend in GC assists. The latter is computed directly, but is just the difference between the start and end time in the critical section; it does not try to account for context switches forced by the underlying system, or anything like that. Now take this value we just computed and divide it by `$T$`. That's our GC CPU utilization. This approximation is mostly accurate in the common case, but is prone to skew in various scenarios, such as when the system is CPU-starved. This fact can be problematic, but I believe it is largely orthogonal to the content of this document; we can work on improving this approximation without having to change any of this design. It already assumes that we have a good measure of CPU utilization. ## Alternatives considered The alternatives considered for this design basically boil down to its individual components. For instance, I considered grouping stacks and globals into the current formulation of the pacer, but that adds another condition to the definition of the steady-state: stacks and globals do not change. That makes the steady-state more fragile. I also considered a design that was similar, but computed everything in terms of an "effective" `GOGC`, and "converted" that back to `GOGC` for pacing purposes (that is, what would the heap trigger have been had the expected amount of live memory been correct?). This formulation is similar to how Austin formulated the experimental `SetMaxHeap` API. Austin suggested I avoid this formulation because math involving `GOGC` tends to have to work around infinities. A good example of this is if `runtime.GC` is called while `GOGC` is off: the runtime has to "fake" a very large `GOGC` value in the pacer. By using a ratio of rates that's more grounded in actual application behavior the trickiness of the math is avoided. I also considered not using a PI controller and just using the measured `$r$` value directly, assuming it doesn't change across GC cycles, but that method is prone to noise. ## Justification Pros: - The steady-state is now independent of the amount of GC work to be done. - Steady-state mark assist drops to zero if not allocating too heavily (a likely latency improvement in many scenarios) (see the "high `GOGC`" scenario in [simulations](#simulations)). - GC amortization includes non-heap GC work, and responds well in those cases. - Eliminates offset error present in the existing design. Cons: - Definition of `GOGC` has changed slightly, so a `GOGC` of 100 will use slightly more memory in nearly all cases. - `$r$` is a little bit unintuitive. ## Implementation This pacer redesign will be implemented by Michael Knyszek. 1. The existing pacer will be refactored into a form fit for simulation. 1. A comprehensive simulation-based test suite will be written for the pacer. 1. The existing pacer will be swapped out with the new implementation. The purpose of the simulation infrastructure is to make the pacer, in general, more testable. This lets us write regression test cases based on real-life problems we encounter and confirm that they don't break going forward. Furthermore, with fairly large changes to the Go compiler and runtime in the pipeline, it's especially important to reduce the risk of this change as much as possible. ## Go 1 backwards compatibility This change will not modify any user-visible APIs, but may have surprising effects on application behavior. The two "most" incompatible changes in this proposal are the redefinition of the heap goal to include non-heap sources of GC work, since that directly influences the meaning of `GOGC`, and the change in target GC CPU utilization. These two factors together mean that, by default and on average, Go applications will use slightly more memory than before. To obtain previous levels of memory usage, users may be required to tune down `GOGC` lower manually, but the overall result should be more consistent, more predictable, and more efficient. ## Simulations In order to show the effectiveness of the new pacer and compare it to the current one, I modeled both the existing pacer and the new pacer and simulated both in a variety of scenarios. The code used to run these simulations and generate the plots below may be found at [github.com/mknyszek/pacer-model](https://github.com/mknyszek/pacer-model). ### Assumptions and caveats The model of each pacer is fairly detailed, and takes into account most details like allocations made during a GC being marked. The one big assumption it makes, however, is that the behavior of the application while a GC cycle is running is perfectly smooth, such that the GC assist pacer is perfectly paced according to the initial assist ratio. In practice, this is close to true, but it's worth accounting for the more extreme cases. (TODO: Show simulations that inject some noise into the GC assist pacer.) Another caveat with the simulation is the graph of "R value" (that is, `$r_n$`), and "Alloc/scan ratio." The latter is well-defined for all simulations (it's a part of the input) but the former is not a concept used in the current pacer. So for simulations of the current pacer, the "R value" is backed out from the trigger ratio: we know the runway, we know the *expected* scan work for the target utilization, so we can compute the `$r_n$` that the trigger point encodes. ### Results **Perfectly steady heap size.** The simplest possible scenario. Current pacer: ![](44167/pacer-plots/old-steady.png) New pacer: ![](44167/pacer-plots/new-steady.png) Notes: - The current pacer doesn't seem to find the right utilization. - Both pacers do reasonably well at meeting the heap goal. **Jittery heap size and alloc/scan ratio.** A mostly steady-state heap with a slight jitter added to both live heap size and the alloc/scan ratio. Current pacer: ![](44167/pacer-plots/old-jitter-alloc.png) New pacer: ![](44167/pacer-plots/new-jitter-alloc.png) Notes: - Both pacers are resilient to a small amount of noise. **Small step in alloc/scan ratio.** This scenario demonstrates the transitions between two steady-states, that are not far from one another. Current pacer: ![](44167/pacer-plots/old-step-alloc.png) New pacer: ![](44167/pacer-plots/new-step-alloc.png) Notes: - Both pacers react to the change in alloc/scan rate. - Clear oscillations in utilization visible for the new pacer. **Large step in alloc/scan ratio.** This scenario demonstrates the transitions between two steady-states, that are further from one another. Current pacer: ![](44167/pacer-plots/old-heavy-step-alloc.png) New pacer: ![](44167/pacer-plots/new-heavy-step-alloc.png) Notes: - The old pacer consistently overshoots the heap size post-step. - The new pacer minimizes overshoot. **Large step in heap size with a high `GOGC` value.** This scenario demonstrates the "high `GOGC` problem" described in the [GC pacer meta-issue](https://github.com/golang/go/issues/42430). Current pacer: ![](44167/pacer-plots/old-high-GOGC.png) New pacer: ![](44167/pacer-plots/new-high-GOGC.png) Notes: - The new pacer's heap size stabilizes faster than the old pacer's. - The new pacer has a spike in overshoot; this is *by design*. - The new pacer's utilization is independent of this heap size spike. - The old pacer has a clear spike in utilization. **Oscillating alloc/scan ratio.** This scenario demonstrates an oscillating alloc/scan ratio. This scenario is interesting because it shows a somewhat extreme case where a steady-state is never actually reached for any amount of time. However, this is not a realistic scenario. Current pacer: ![](44167/pacer-plots/old-osc-alloc.png) New pacer: ![](44167/pacer-plots/new-osc-alloc.png) Notes: - The new pacer tracks the oscillations worse than the old pacer. This is likely due to the error never settling, so the PI controller is always overshooting. **Large amount of goroutine stacks.** This scenario demonstrates the "heap amortization problem" described in the [GC pacer meta-issue](https://github.com/golang/go/issues/42430) for goroutine stacks. Current pacer: ![](44167/pacer-plots/old-big-stacks.png) New pacer: ![](44167/pacer-plots/new-big-stacks.png) Notes: - The old pacer consistently overshoots because it's underestimating the amount of work it has to do. - The new pacer uses more memory, since the heap goal is now proportional to stack space, but it stabilizes and is otherwise sane. **Large amount of global variables.** This scenario demonstrates the "heap amortization problem" described in the [GC pacer meta-issue](https://github.com/golang/go/issues/42430) for global variables. Current pacer: ![](44167/pacer-plots/old-big-globals.png) New pacer: ![](44167/pacer-plots/new-big-globals.png) Notes: - This is essentially identical to the stack space case. **High alloc/scan ratio.** This scenario shows the behavior of each pacer in the face of a very high alloc/scan ratio, with jitter applied to both the live heap size and the alloc/scan ratio. Current pacer: ![](44167/pacer-plots/old-heavy-jitter-alloc.png) New pacer: ![](44167/pacer-plots/new-heavy-jitter-alloc.png) Notes: - In the face of a very high allocation rate, the old pacer consistently overshoots, though both maintain a similar GC CPU utilization.
24543
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/24543/safe-points-everywhere.md
# Proposal: Safe-points everywhere for non-cooperative goroutine preemption Author(s): Austin Clements Last updated: 2018-03-26 (extracted from general proposal 2019-01-17) Discussion at https://golang.org/issue/24543. ## Introduction Up to and including Go 1.10, Go has used cooperative preemption with safe-points only at function calls. We propose that the Go implementation switch to *non-cooperative* preemption. The background and rationale for this proposal are detailed in the [top-level proposal document](../24543-non-cooperative-preemption.md). This document details a specific approach to non-cooperative preemption based on constructing stack and register maps at (essentially) every instruction. ## Proposal I propose that we implement fully non-cooperative preemption by recording enough metadata to allow safe-points (almost) everywhere. To do this, we would modify the compiler to produce register maps in addition to stack maps, and to emit these for as many program counters as possible. The runtime would use a signal (or `GetThreadContext` on Windows, or a note on Plan9) to retrieve each thread's register state, from which it could get the stack and register map for the interrupted PC. The garbage collector would then treat live pointers in registers just as it treats live pointers on the stack. Certain instructions cannot be safe-points, so if a signal occurs at such a point, the runtime would simply resume the thread and try again later. The compiler just needs to make *most* instructions safe-points. To @minux's credit, he suggested this in [the very first reply](https://github.com/golang/go/issues/10958#issuecomment-105678822) to [#10958](https://golang.org/issue/10958). At the time we thought adding safe-points everywhere would be too difficult and that the overhead of explicit loop preemption would be lower than it turned out to be. Many other garbage-collected languages use explicit safe-points on back-edges, or they use forward-simulation to reach a safe-point. Partly, it's possible for Go to support safe-points everywhere because Go's GC already must have excellent support for interior pointers; in many languages, interior pointers never appear at a safe-point. ## Encoding of stack and register maps In the implementation for Go 1.11, register maps are encoded using the exact same encoding as argument and locals maps. Unlike argument and locals maps, which are indexed together in a single PCDATA stream, the register maps are indexed by a separate PCDATA stream because changes to the register map tend not to correlate with changes to the arguments and locals maps. Curiously, the significant majority of the space overhead from this scheme is from the PCDATA stream that indexes into the register map. The actual register map FUNCDATA is relatively small, suggesting that functions have relatively few distinct register maps, but change between them frequently. ### Alternates considered/attempted Biasing the register allocator to allocate pointers and scalars from different registers to reduce the number of unique maps and possibly reduce the number of map changes would seem like an easy improvement. However, it had very little effect. Similarly, adding "slop" to the register maps by allowing the liveness of a register to extend between its last use and next clobber slightly reduced the number of register map changes, but only slightly. The one successful alternate tried was to Huffman-code the delta stream, which roughly halved the size of the metadata. In this scheme, the register maps are encoded in a single bit stream per function that alternates between PC delta (as a positive offset from the previous PC), and register map delta (as an XOR from the previous register map). The two deltas are Huffman coded with separate Huffman tables, and the Huffman tables are shared across the entire binary. It may be even more effective to interleave the stack map changes into the same stream, since this would allow the PC deltas to be shared. This change was too invasive to implement for Go 1.11, but may be worth attempting for Go 1.12. ## Other uses of stack/register maps ### Heap dump analysis Having safe-points everywhere fixes problems with heap dump analysis from core files, which currently has to use conservative heuristics to identify live pointers in active call frames. ### Call injection Having safe-points everywhere also allows some function calls to be safely injected at runtime. This is useful in at least two situations: 1. To handle synchronous signals, such as nil-pointer dereferences, the runtime injects a call to `runtime.sigpanic` at the location of the fault. However, since there isn't usually a call at this location, the stack map may be inaccurate, which leads to complicated interactions between defers, escape analysis, and traceback handling. Having safe-points everywhere could simplify this. 2. Debugger function calls ([#21678](https://golang.org/issue/21678)). Currently it's essentially impossible for a debugger to dynamically invoke a Go function call because of poor interactions with stack scanning and the garbage collector. Having stack and register maps everywhere would make this significantly more viable, since a function call could be injected nearly anywhere without making the stack un-scannable. ## Testing The primary danger of this approach is its potential for a long bug tail, since the coverage of safe-points in regular testing will decrease substantially. In addition to standard testing, I propose checking the generated liveness maps using static analysis of binaries. This tool would look for pointer dereferences or stores with a write barrier to indicate that a value is a pointer and would check the flow of that value through all possible paths. It would report anywhere a value transitioned from dead/scalar to live pointer and anywhere a value was used both like a pointer and like a scalar. In effect, this tool would simulate the program to answer the question "for every two points in time A < B, are there allocations reachable from the liveness map at time B that were not reachable at time A and were not allocated between A and B?" Most likely this static analysis tool could be written atop the existing [golang.org/x/arch](https://godoc.org/golang.org/x/arch) packages. These are the same packages used by, for example, `go tool objdump`, and handle most heavy-lifting of decoding the binary itself. ## Other considerations **Space overhead.** Traditionally, the main concern with having safe-points everywhere is the overhead of saving the stack/register maps. A very preliminary implementation of register maps and safe-points everywhere increased binary size by ~10%. However, this left several obvious optimizations on the table. Work by Stichmoth, et al. [1] further suggests that this overhead can be significantly curtailed with simple compression techniques. **Decoupling stack-move points from GC safe-points.** Because of the details of the current implementation, these are (essentially) the same. By decoupling these and only allowing stack growth and shrinking at function entry, stack copying would not need to adjust registers. This keeps stack copying simpler. It also enables better compiler optimizations and more safe-points since the compiler need not mark a register as a live pointer if it knows there's another live pointer to the object. Likewise, registers that are known to be derived from pointer arguments can be marked as scalar as long as those arguments are live. Such optimizations are possible because of Go's non-moving collector. This also prevents stack moving from observing (and crashing on) transient small-valued pointers that the compiler constructs when it knows an offset from a potentially-nil pointer will be small. **Assembly.** By default, the runtime cannot safely preempt assembly code since it won't know what registers contain pointers. As a follow-on to the work on safe-points everywhere, we should audit assembly in the standard library for non-preemptible loops and annotate them with register maps. In most cases this should be trivial since most assembly never constructs a pointer that isn't shadowed by an argument, so it can simply claim there are no pointers in registers. We should also document in the Go assembly guide how to do this for user code. ## Compatibility This proposal introduces no new APIs, so it is Go 1 compatible. ## Implementation Austin Clements (@aclements) plans to implement register and stack maps everywhere for Go 1.11. This will enable some low-risk uses in the short term, such as debugger function calls. Debugging and testing of register and stack maps can continue into the Go 1.11 freeze, including building the static analysis tool. Then, for Go 1.12, Austin will implement safe-points everywhere atop the register and stacks maps. ## References [1] James M. Stichnoth, Guei-Yuan Lueh, and Michał Cierniak. 1999. Support for garbage collection at every instruction in a Java compiler. In *Proceedings of the ACM SIGPLAN 1999 conference on Programming language design and implementation* (PLDI '99). ACM, New York, NY, USA, 118–127.
24543
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/24543/conservative-inner-frame.md
# Proposal: Conservative inner-frame scanning for non-cooperative goroutine preemption Author(s): Austin Clements Last updated: 2019-01-21 Discussion at https://golang.org/issue/24543. ## Introduction Up to and including Go 1.10, Go has used cooperative preemption with safe-points only at function calls. We propose that the Go implementation switch to *non-cooperative* preemption. The background and rationale for this proposal are detailed in the [top-level proposal document](../24543-non-cooperative-preemption.md). This document details a specific approach to non-cooperative preemption that uses conservative GC techniques to find live pointers in the inner-most frame of a preempted goroutine. ## Proposal I propose that Go use POSIX signals (or equivalent) to interrupt running goroutines and capture their CPU state. If a goroutine is interrupted at a point that must be GC atomic, as detailed in ["Handling unsafe-points"](../24543-non-cooperative-preemption.md#handling-unsafe-points) in the top-level proposal, the runtime can simply let the goroutine resume and try again later. This leaves the problem of how to find local GC roots—live pointers on the stack—of a preempted goroutine. Currently, the Go compiler records *stack maps* at every call site that tell the Go runtime where live pointers are in the call's stack frame. Since Go currently only preempts at function calls, this is sufficient to find all live pointers on the stack at any cooperative preemption point. But an interrupted goroutine is unlikely to have a liveness map at the interrupted instruction. I propose that when a goroutine is preempted non-cooperatively, the garbage collector scan the inner-most stack frame and registers of that goroutine *conservatively*, treating anything that could be a valid heap pointer as a heap pointer, while using the existing call-site stack maps to precisely scan all other frames. ## Rationale Compared to the alternative proposal of [emitting liveness maps for every instruction](safe-points-everywhere.md), this proposal is far simpler to implement and much less likely to have a long bug tail. It will also make binaries about 5% smaller. The Go 1.11 compiler began emitting stack and register maps in support of non-cooperative preemption as well as debugger call injection, but this increased binary sizes by about 5%. This proposal will allow us to roll that back. This approach has the usual problems of conservative GC, but in a severely limited scope. In particular, it can cause heap allocations to remain live longer than they should ("GC leaks"). However, unlike conservatively scanning the whole stack (or the whole heap), it's unlikely that any incorrectly retained objects would last more than one GC cycle because the inner frame typically changes rapidly. Hence, it's unlikely that an inner frame would remain the inner frame across multiple cycles. Furthermore, this can be combined with cooperative preemption to further reduce the chances of retaining a dead object. Neither stack scan preemption nor scheduler preemption have tight time bounds, so the runtime can wait for a cooperative preemption before falling back to non-cooperative preemption. STW preemptions have a tight time bound, but don't scan the stack, and hence can use non-cooperative preemption immediately. ### Stack shrinking Currently, the garbage collector triggers stack shrinking during stack scanning, but this will have to change if stack scanning may not have precise liveness information. With this proposal, stack shrinking must happen only at cooperative preemption points. One approach is to have stack scanning mark stacks that should be shrunk, but defer the shrinking until the next cooperative preemption. ### Debugger call injection Currently, debugger call injection support depends on the liveness maps emitted at every instruction by Go 1.11. This is necessary in case a GC or stack growth happens during an injected call. If we remove these, the runtime will need a different approach to call injection. One possibility is to leave the interrupted frame in a "conservative" state, and to start a new stack allocation for the injected call. This way, if the stack needs to be grown during the injected call, only the stack below the call injection needs to be moved, and the runtime will have precise liveness information for this region of the stack. Another possibility is for the injected call to start on a new goroutine, though this complicates passing stack pointers from a stopped frame, which is likely to be a common need. ### Scheduler preemptions We will focus first on STW and stack scan preemptions, since these are where cooperative preemption is more likely to cause issues in production code. However, it's worth considering how this mechanism can be used for scheduler preemptions. Preemptions for STWs and stack scans are temporary, and hence cause little trouble if a pointer's lifetime is extended by conservative scanning. Scheduler preemptions, on the other hand, last longer and hence may keep leaked pointers live for longer, though they are still bounded. Hence, we may wish to bias scheduler preemptions toward cooperative preemption. Furthermore, since a goroutine that has been preempted non-cooperatively must record its complete register set, it requires more state than a cooperatively-preempted goroutine, which only needs to record a few registers. STWs and stack scans can cause at most GOMAXPROCS goroutines to be in a preempted state simultaneously, while scheduler preemptions could in principle preempt all runnable goroutines, and hence require significantly more space for register sets. The simplest way to implement this is to leave preempted goroutines in the signal handler, but that would consume an OS thread for each preempted goroutine, which is probably not acceptable for scheduler preemptions. Barring this, the runtime needs to explicitly save the relevant register state. It may be possible to store the register state on the stack of the preempted goroutine itself, which would require no additional memory or resources like OS threads. If this is not possible, this is another reason to bias scheduler preemptions toward cooperative preemption. ## Compatibility This proposal introduces no new APIs, so it is Go 1 compatible. ## Implementation Austin Clements plans to implement this proposal for Go 1.13. The rough implementation steps are: 1. Make stack shrinking occur synchronously, decoupling it from stack scanning. 2. Implement conservative frame scanning support. 3. Implement general support for asynchronous injection of calls using non-cooperative preemption. 4. Use asynchronous injection to inject STW and stack scan operations. 5. Re-implement debug call injection to not depend on liveness maps. 6. Remove liveness maps except at call sites. 7. Implement non-cooperative scheduler preemption support.
48409
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/48409/svg2png.bash
#!/bin/bash for input in *.svg; do output=${input%.*}.png google-chrome --headless --window-size=1920,1080 --disable-gpu --screenshot $input convert screenshot.png -trim $output done rm screenshot.png
48409
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/48409/README.md
# Design document The memory limit design document is generated from the `.src.md` file in this directory. It contains LaTeX formulas which Markdown cannot render, so they're rendered by an external open-source tool, [md-latex](https://github.com/mknyszek/md-tools). Then, because Gitiles' markdown viewer can't render SVGs, run ``` ./svg2png.bash ``` And go back and replace all instances of SVG with PNG in the final document. Note that `svg2png.bash` requires both ImageMagick and Google Chrome.
48409
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/proposal/design/48409/soft-memory-limit.src.md
# Proposal: Soft memory limit Author: Michael Knyszek Date: 15 September 2021 ## Summary This document proposes a new option for tuning the behavior of the Go garbage collector by setting a soft memory limit on the total amount of memory that Go uses. This option comes in two flavors: a new `runtime/debug` function called `SetMemoryLimit` and a `GOMEMLIMIT` environment variable. This new option gives applications better control over their resource economy. It empowers users to: * Better utilize the memory that they already have, * Confidently decrease their memory limits, knowing Go will respect them, * Avoid unsupported forms of garbage collection tuning like heap ballasts. ## Motivation Go famously offers a single option for tuning the Go garbage collector: `GOGC` (or `runtime/debug.SetGCPercent`). This option offers a direct tradeoff between CPU and memory: it directly dictates the amount of memory overhead available to the garbage collector. Less memory overhead means more frequent garbage collection cycles, and more CPU spent on GC. More memory overhead means less frequent cycles and more CPU for the application. This option has carried the Go project well for a long time. However, years of experience has produced a meaningful amount of evidence suggesting that `GOGC` is not enough. A direct tradeoff isn't always possible, because memory is not fungible relative to CPU resources. Consider an application that runs as a service or a daemon. In these cases, out-of-memory errors often arise due to transient spikes in applications' heap sizes. Today, Go does not respect users' memory limits. As a result, the Go community has developed various patterns for dealing with out-of-memory errors. In scenarios where out-of-memory errors are acceptable (to varying degrees), Go users choose to live with these errors, restarting their service regularly, instead of reducing `GOGC`. Reducing `GOGC` directly impacts users' productivity metrics, metrics whose behavior is largely governed by steady-state behavior, not transients, so this course of action is undesirable. In scenarios where out-of-memory errors are unacceptable, a similar situation occurs. Users are unwilling to increase GOGC to achieve productivity improvements, even though in the steady-state they may actually have that memory available to them. They pick an overly conservative value to reduce the chance of an out-of-memory condition in transient states, but this choice leaves productivity on the table. This out-of-memory avoidance led to the Go community developing its own homegrown garbage collector tuning. The first example of such tuning is the heap ballast. In order to increase their productivity metrics while also avoiding out-of-memory errors, users sometimes pick a low `GOGC` value, and fool the GC into thinking that there's a fixed amount of memory live. This solution elegantly scales with `GOGC`: as the real live heap increases, the impact of that fixed set decreases, and `GOGC`'s contribution to the heap size dominates. In effect, `GOGC` is larger when the heap is smaller, and smaller (down to its actual value) when the heap is larger. Unfortunately, this solution is not portable across platforms, and is not guaranteed to continue to work as the Go runtime changes. Furthermore, users are forced to do complex calculations and estimate runtime overheads in order to pick a heap ballast size that aligns with their memory limits. The second example of such tuning is calling `runtime/debug.FreeOSMemory` at some regular interval, forcing a garbage collection to trigger sooner, usually to respect some memory limit. This case is much more dangerous, because calling it too frequently can lead a process to entirely freeze up, spending all its time on garbage collection. Working with it takes careful consideration and experimentation to be both effective and avoid serious repercussions. Both of these situations, dealing with out-of-memory errors and homegrown garbage collection tuning, have a straightforward solution that other platforms (like Java and TCMalloc) already provide its users: a configurable memory limit, enforced by the Go runtime. A memory limit would give the Go runtime the information it needs to both respect users' memory limits, and allow them to optionally use that memory always, to cut back the cost of garbage collection. ## Non-goals 1. Accounting for and react to memory outside the Go runtime, such as: * Co-tenant processes in a container, * C/C++ memory, and * Kernel memory counted against the process. Dealing with and reacting to memory used by other processes, and even to memory within the process governed by the semantics of a completely different programming language, is an incredibly hard problem and often requires a coordinated effort. It's outside of the scope of the Go runtime to solve this problem for everyone, but I believe the Go runtime has an important role to play in supporting these worthwhile efforts. 1. Eliminate out-of-memory errors in 100% of cases. Whatever policy this API adheres to is going to fail for some use-case, and that's OK. The policy can be tweaked and improved upon as time goes on, but it's impossible for us to create a solution that is all things to all people without a tremendous amount of toil for our team (by e.g. exposing lots of tuning knobs). On top of this, any such solution is likely to become difficult to use at all. The best we can do is make life better for as many users as possible. ## Detailed design The design of a memory soft limit consists of four parts: an API, mechanisms to enforce the soft limit, and guidance through thorough documentation, and telemetry for identifying issues in production. ### API ```go package runtime/debug // SetMemoryLimit provides the runtime with a soft memory limit. // // The runtime undertakes several processes to try to respect this // memory limit, including adjustments to the frequency of garbage // collections and returning memory to the underlying system more // aggressively. This limit will be respected even if GOGC=off (or, // if SetGCPercent(-1) is executed). // // The input limit is provided as bytes, and is intended to include // all memory that the Go runtime has direct control over. In other // words, runtime.MemStats.Sys - runtime.MemStats.HeapReleased. // // This limit does not account for memory external to Go, such as // memory managed by the underlying system on behalf of the process, // or memory managed by non-Go code inside the same process. // // A zero limit or a limit that's lower than the amount of memory // used by the Go runtime may cause the garbage collector to run // nearly continuously. However, the application may still make // progress. // // See https://golang.org/doc/gc-ergonomics for a detailed guide // explaining the soft memory limit as well as a variety of common // use-cases and scenarios. // // SetMemoryLimit returns the previously set memory limit. // By default, the limit is math.MaxInt64. // A negative input does not adjust the limit, and allows for // retrieval of the currently set memory limit. func SetMemoryLimit(limit int64) int64 ``` Note that the soft limit is expressed in terms of the total amount of memory used by the Go runtime. This choice means that enforcement of the soft memory limit by the GC must account for additional memory use such as heap metadata and fragmentation. It also means that the runtime is responsible for any idle heap memory above the limit, i.e. any memory that is currently unused by the Go runtime, but has not been returned to the operating system. As a result, the Go runtime's memory scavenger must also participate in enforcement. This choice is a departure from similar APIs in other languages (including the experimental `SetMaxHeap` [patch](https://golang.org/cl/46751)), whose limits only include space occupied by heap objects themselves. To reduce confusion and help facilitate understanding, each class of memory that is accounted for will be precisely listed in the documentation. In addition, the soft memory limit can be set directly via an environment variable that all Go programs recognize: `GOMEMLIMIT`. For ease-of-use, I propose `GOMEMLIMIT` accept either an integer value in bytes, or a string such as "8GiB." More specifically, an integer followed by one of several recognized unit strings, without spaces. I propose supporting "B," "KiB," "MiB," "GiB," and "TiB" indicating the power-of-two versions of each. Similarly, I propose supporting "KB," "MB," "GB," and "TB," which refer to their power-of-ten counterparts. ### Enforcement #### Garbage collection In order to ensure the runtime maintains the soft memory limit, it needs to trigger at a point such that the total heap memory used does not exceed the soft limit. Because the Go garbage collector's memory use is defined entirely in terms of the heap goal, altering its definition is sufficient to ensure that a memory limit is enforced. However, the heap goal is defined in terms of object bytes, while the memory limit includes a much broader variety of memory classes, necessitating a conversion function between the two. To compute the heap limit `$\hat{L}$` from the soft memory limit `$L$`, I propose the following calculation: ```render-latex \hat{L} = L - (T - F - A) ``` `$T$` is the total amount of memory mapped by the Go runtime. `$F$` is the amount of free and unscavenged memory the Go runtime is holding. `$A$` is the number of bytes in allocated heap objects at the time `$\hat{L}$` is computed. The second term, `$(T - F - A)$`, represents the sum of non-heap overheads. Free and unscavenged memory is specifically excluded because this is memory that the runtime might use in the near future, and the scavenger is specifically instructed to leave the memory up to the heap goal unscavenged. Failing to exclude free and unscavenged memory could lead to a very poor accounting of non-heap overheads. With `$\hat{L}$` fully defined, our heap goal for cycle `$n$` (`$N_n$`) is a straightforward extension of the existing one. Where * `$M_n$` is equal to bytes marked at the end of GC n's mark phase * `$S_n$` is equal to stack bytes at the beginning of GC n's mark phase * `$G_n$` is equal to bytes of globals at the beginning of GC n's mark phase * `$\gamma$` is equal to `$1+\frac{GOGC}{100}$` then ```render-latex N_n = min(\hat{L}, \gamma(M_{n-1})+S_n+G_n) ``` Over the course of a GC cycle, non-heap overheads remain stable because the mostly increase monotonically. However, the GC needs to be responsive to any change in non-heap overheads. Therefore, I propose a more heavy-weight recomputation of the heap goal every time its needed, as opposed to computing it only once per cycle. This also means the GC trigger point needs to be dynamically recomputable. This check will create additional overheads, but they're likely to be low, as the GC's internal statistics are updated only on slow paths. The nice thing about this definition of `$\hat{L}$` is that it's fairly robust to changes to the Go GC, since total mapped memory, free and unscavenged memory, and bytes allocated in objects, are fairly fundamental properties (especially to any tracing GC design). #### Death spirals As the live heap grows toward `$\hat{L}$`, the Go garbage collector is going to stray from the tradeoff defined by `GOGC`, and will trigger more and more often to reach its goal. Left unchecked, the Go garbage collector will eventually run continuously, and increase its utilization as its runway disappears. Eventually, the application will fail to make progress. This process is referred to as a death spiral. One way to deal with this situation is to place a limit on the amount of total CPU utilization of the garbage collector. If the garbage collector were to execute and exceed that limit at any point, it will instead let the application proceed, even if that means missing its goal and breaching the memory limit. I propose we do exactly this, but rather than provide another knob for determining the maximum fraction of CPU time, I believe that we should simply pick a reasonable default based on `GOGC`. I propose that we pick 50% as the default fraction. This fraction is reasonable and conservative since most applications won't come close to this threshold in normal execution. To implement this policy, I propose a leaky bucket mechanism inspired by a tool called `jvmquake` developed by [Netflix for killing Java service instances](https://netflixtechblog.medium.com/introducing-jvmquake-ec944c60ba70) that could fall into a death spiral. To summarize, the mechanism consists of a conceptual bucket with a capacity, and that bucket accumulates GC CPU time. At the same time, the bucket is drained by mutator CPU time. Should the ratio of GC CPU time to mutator CPU time exceed 1:1 for some time (determined by the bucket's capacity) then the bucket's contents will tend toward infinity. At the point in which the bucket's contents exceed its capacity, `jvmquake` would kill the target service instance. In this case instead of killing the process, the garbage collector will deliberately prevent user goroutines from assisting the garbage collector in order to prevent the bucket from overflowing. The purpose of the bucket is to allow brief spikes in GC CPU utilization. Otherwise, anomalous situations could cause unnecessary missed assists that make GC assist pacing less smooth. A reasonable bucket capacity will have to be chosen empirically, as it should be large enough to accommodate worst-case pause times but not too large such that a 100% GC CPU utilization spike could cause the program to become unresponsive for more than about a second. 1 CPU-second per `GOMAXPROCS` seems like a reasonable place to start. Unfortunately, 50% is not always a reasonable choice for small values of `GOGC`. Consider an application running with `GOGC=10`: an overall 50% GC CPU utilization limit for `GOGC=10` is likely going to be always active, leading to significant overshoot. This high utilization is due to the fact that the Go GC at `GOGC=10` will reach the point at which it may no longer start a GC much sooner than, say `GOGC=100`. At that point, the GC has no option but to increase utilization to meet its goal. Because it will then be capped at increasing utilization, the GC will have no choice but to use more memory and overshoot. As a result, this effectively creates a minimum `GOGC` value: below a certain `GOGC`, the runtime will be effectively acting as if the `GOGC` value was higher. For now, I consider this acceptable. #### Returning memory to the platform In the context of maintaining a memory limit, it's critical that the Go runtime return memory to the underlying platform as a part of that process. Today, the Go runtime returns memory to the system with a background goroutine called the scavenger, which paces itself to consume around 1% of 1 CPU. This pacing is conservative, but necessarily so: the scavenger must synchronize with any goroutine allocating pages of memory from the heap, so this pacing is generally a slight underestimate as it fails to include synchronization overheads from any concurrent allocating goroutines. Currently, the scavenger's goal is to return free memory to the platform until it reaches the heap goal, accounting for page-level fragmentation and a fixed 10% overhead to avoid paging costs. In the context of a memory limit, I propose that the scavenger's goal becomes that limit. Then, the scavenger should pace itself more aggressively as the runtime's memory use approaches the limit. I propose it does so using a proportional-integral controller whose input is the difference between the memory limit and the memory used by Go, and whose output is the CPU utilization target of the background scavenger. This will make the background scavenger more reliable. However, the background scavenger likely won't return memory to the OS promptly enough for the memory limit, so in addition, I propose having span allocations eagerly return memory to the OS to stay under the limit. The time a goroutine spends in this will also count toward the 50% GC CPU limit described in the [Death spirals](#death-spirals) section. #### Alternative approaches considered ##### Enforcement The conversion function from the memory limit to the heap limit described in this section is the result of an impedance mismatch between how the GC pacer views memory and how the memory limit is defined (i.e. how the platform views memory). An alternative approach would be to resolve this impedance mismatch. One way to do so would be to define the memory limit in terms of heap object bytes. As discussed in the [API section](#api) however, this makes for a poor user experience. Another way is to redefine the GC pacer's view of memory to include other memory sources. Let's focus on the most significant of these: fragmentation. Suppose we redefined the heap goal and the garbage collector's pacing to be based on the spans containing objects, rather than the objects themselves. This definition is straightforward to implement: marked memory is defined as the sum total of memory used spans containing marked objects, and the heap is considered to grow each time a fresh span is allocated. Unfortunately, this redefinition comes with two major caveats that make it very risky. The first is that the definition of the GC steady-state, upon which much of the pacer's intuition is built, now also depends on the degree of fragmentation, making it a less fragile state in practice. The second is that most heaps will have an inflated size. Consider a situation where we start with a very dense heap. After some time, most of the objects die, but there's still at least one object alive in each span that previously contained a live object. With the redefinition, the overall heap will grow to the same size despite much less memory being alive. In contrast, the existing definition will cause the heap to grow only only to a multiple of the actual live objects memory, and it's very unlikely that it will go beyond the spans already in-use. ##### Returning memory to the platform If returning memory to the OS eagerly becomes a significant performance issue, a reasonable alternative could be to crank up the background scavenger's CPU usage in response to growing memory pressure. This needs more thought, but given that it would now be controlled by a controller, its CPU usage will be more reliable, and this is an option we can keep in mind. One benefit of this option is that it may impact latency less prominently. ### Documentation Alongside this new feature I plan to create a new document in the doc directory of the Go repository entitled "Go GC Ergonomics." The purpose of this document is four-fold: * Provide Go users with a high-level, but accurate mental and visual model of how the Go GC and scavenger behave with varying GOGC and GOMEMLIMIT settings. * Address common use-cases and provide advice, to promote good practice for each setting. * Break down how Go accounts for memory in excruciating detail. Often memory-related documentation is frustratingly imprecise, making every user's job much more difficult. * Describe how to identify and diagnose issues related to the GC through runtime metrics. While Hyrum's Law guarantees that the API will be used in unexpected ways, at least a central and complete living document will exist to help users better understand what it is that their code is doing. ### Telemetry Identifying issues with the garbage collector becomes even more important with new ways to interact with it. While the Go runtime already exposes metrics that could aid in identifying issues, these metrics are insufficient to create a complete diagnosis, especially in light of the new API. To further assist users in diagnosing issues related to the API (be that misuse or bugs in the implementation) and the garbage collector in general, I propose the addition of three new metrics to the [runtime/metrics package](https://pkg.go.dev/runtime/metrics): * `/gc/throttles:events`: a monotonically increasing count of leaky bucket overflows. * Direct indicator of the application entering a death spiral with the soft memory limit enabled. * `/gc/cycles-by-utilization:percent`: histogram of GC cycles by GC CPU utilization. * Replaces the very misleading runtime.MemStats.GCCPUFraction * `/gc/scavenge/cycles-by-utilization:percent`: histogram of scavenger utilization. * Since the scavenging rate can now change, identifying possible issues there will be critical. ## Prior art ### Java Nearly every Java garbage collector operates with a heap limit by default. As a result, the heap limit is not a special mode of operation for memory limits, but rather the status quo. The limit is typically configured by passing the `-Xmx` flag to the Java runtime executable. Note that this is a heap limit, not a memory limit, and so only counts heap objects. The OpenJDK runtime operates with a default value of ¼ of available memory or 1 GiB, whichever is lesser. Generally speaking, Java runtimes often only return memory to the OS when it decides to shrink the heap space used; more recent implementations (e.g. G1) do so more rarely, except when [the application is idle](https://openjdk.java.net/jeps/346). Some JVMs are "container aware" and read the memory limits of their containers to stay under the limit. This behavior is closer to what is proposed in this document, but I do not believe the memory limit is directly configurable, like the one proposed here. ### SetMaxHeap For nearly 4 years, the Go project has been trialing an experimental API in the `runtime/debug` package called `SetMaxHeap`. The API is available as a patch in Gerrit and has been used for some time within Google. The API proposed in this document builds on top of the work done on `SetMaxHeap`. Some notable details about `SetMaxHeap`: * Its limit is defined solely in terms of heap object bytes, like Java. * It does not alter the scavenging policy of the Go runtime at all. * It accepts an extra channel argument that provides GC pressure notifications. * This channel is ignored in most uses I'm aware of. * One exception is where it is used to log GC behavior for telemetry. * It attempts to limit death spirals by placing a minimum on the runway the GC has. * This minimum was set to 10%. Lessons learned from `SetMaxHeap`: * Backpressure notifications are unnecessarily complex for many use-cases. * Figuring out a good heap limit is tricky and leads to conservative limits. * Without a memory return policy, its usefulness for OOM avoidance is limited. ### TCMalloc TCMalloc provides a `SetMemoryLimit` function to set a [soft memory limit](https://github.com/google/tcmalloc/blob/cb5aa92545ded39f75115f3b2cc2ffd66a17d55b/tcmalloc/malloc_extension.h#L306). Because dynamic memory allocation is provided in C and C++ as a library, TCMalloc's `SetMemoryLimit` can only be aware of its own overheads, but notably it does include all sources of fragmentation and metadata in its calculation. Furthermore, it maintains a policy of eagerly returning memory to the platform if an allocation would cause TCMalloc's memory use to exceed the specified limit. ### Go 1 compatibility This change adds an API to the Go project and does not alter existing ones. Therefore, the proposed changes are Go 1 backwards compatible.
sys
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/CONTRIBUTING.md
# Contributing to Go Go is an open source project. It is the work of hundreds of contributors. We appreciate your help! ## Filing issues When [filing an issue](https://golang.org/issue/new), make sure to answer these five questions: 1. What version of Go are you using (`go version`)? 2. What operating system and processor architecture are you using? 3. What did you do? 4. What did you expect to see? 5. What did you see instead? General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker. The gophers there will answer or ask you to file an issue if you've tripped over a bug. ## Contributing code Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) before sending patches. Unless otherwise noted, the Go source files are distributed under the BSD-style license found in the LICENSE file.
sys
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/PATENTS
Additional IP Rights Grant (Patents) "This implementation" means the copyrightable works distributed by Google as part of the Go project. Google hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, transfer and otherwise run, modify and propagate the contents of this implementation of Go, where such license applies only to those patent claims, both currently owned or controlled by Google and acquired in the future, licensable by Google that are necessarily infringed by this implementation of Go. This grant does not include claims that would be infringed only as a consequence of further modification of this implementation. If you or your agent or exclusive licensee institute or order or agree to the institution of patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that this implementation of Go or any code incorporated within this implementation of Go constitutes direct or contributory patent infringement, or inducement of patent infringement, then any patent rights granted to you under this License for this implementation of Go shall terminate as of the date such litigation is filed.
sys
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/go.mod
module golang.org/x/sys go 1.18
sys
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/README.md
# sys [![Go Reference](https://pkg.go.dev/badge/golang.org/x/sys.svg)](https://pkg.go.dev/golang.org/x/sys) This repository holds supplemental Go packages for low-level interactions with the operating system. ## Download/Install The easiest way to install is to run `go get -u golang.org/x/sys`. You can also manually git clone the repository to `$GOPATH/src/golang.org/x/sys`. ## Report Issues / Send Patches This repository uses Gerrit for code changes. To learn how to submit changes to this repository, see https://golang.org/doc/contribute.html. The main issue tracker for the sys repository is located at https://github.com/golang/go/issues. Prefix your issue with "x/sys:" in the subject line, so it is easy to find.
sys
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/LICENSE
Copyright 2009 The Go Authors. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Google LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
sys
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/codereview.cfg
issuerepo: golang/go
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_riscv64.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build riscv64 package cpu const cacheLineSize = 64 func initOptions() {}
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/endian_big.go
// Copyright 2023 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build armbe || arm64be || m68k || mips || mips64 || mips64p32 || ppc || ppc64 || s390 || s390x || shbe || sparc || sparc64 package cpu // IsBigEndian records whether the GOARCH's byte order is big endian. const IsBigEndian = true
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_linux_arm64.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu import ( "strings" "syscall" ) // HWCAP/HWCAP2 bits. These are exposed by Linux. const ( hwcap_FP = 1 << 0 hwcap_ASIMD = 1 << 1 hwcap_EVTSTRM = 1 << 2 hwcap_AES = 1 << 3 hwcap_PMULL = 1 << 4 hwcap_SHA1 = 1 << 5 hwcap_SHA2 = 1 << 6 hwcap_CRC32 = 1 << 7 hwcap_ATOMICS = 1 << 8 hwcap_FPHP = 1 << 9 hwcap_ASIMDHP = 1 << 10 hwcap_CPUID = 1 << 11 hwcap_ASIMDRDM = 1 << 12 hwcap_JSCVT = 1 << 13 hwcap_FCMA = 1 << 14 hwcap_LRCPC = 1 << 15 hwcap_DCPOP = 1 << 16 hwcap_SHA3 = 1 << 17 hwcap_SM3 = 1 << 18 hwcap_SM4 = 1 << 19 hwcap_ASIMDDP = 1 << 20 hwcap_SHA512 = 1 << 21 hwcap_SVE = 1 << 22 hwcap_ASIMDFHM = 1 << 23 hwcap_DIT = 1 << 24 hwcap2_SVE2 = 1 << 1 hwcap2_I8MM = 1 << 13 ) // linuxKernelCanEmulateCPUID reports whether we're running // on Linux 4.11+. Ideally we'd like to ask the question about // whether the current kernel contains // https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=77c97b4ee21290f5f083173d957843b615abbff2 // but the version number will have to do. func linuxKernelCanEmulateCPUID() bool { var un syscall.Utsname syscall.Uname(&un) var sb strings.Builder for _, b := range un.Release[:] { if b == 0 { break } sb.WriteByte(byte(b)) } major, minor, _, ok := parseRelease(sb.String()) return ok && (major > 4 || major == 4 && minor >= 11) } func doinit() { if err := readHWCAP(); err != nil { // We failed to read /proc/self/auxv. This can happen if the binary has // been given extra capabilities(7) with /bin/setcap. // // When this happens, we have two options. If the Linux kernel is new // enough (4.11+), we can read the arm64 registers directly which'll // trap into the kernel and then return back to userspace. // // But on older kernels, such as Linux 4.4.180 as used on many Synology // devices, calling readARM64Registers (specifically getisar0) will // cause a SIGILL and we'll die. So for older kernels, parse /proc/cpuinfo // instead. // // See golang/go#57336. if linuxKernelCanEmulateCPUID() { readARM64Registers() } else { readLinuxProcCPUInfo() } return } // HWCAP feature bits ARM64.HasFP = isSet(hwCap, hwcap_FP) ARM64.HasASIMD = isSet(hwCap, hwcap_ASIMD) ARM64.HasEVTSTRM = isSet(hwCap, hwcap_EVTSTRM) ARM64.HasAES = isSet(hwCap, hwcap_AES) ARM64.HasPMULL = isSet(hwCap, hwcap_PMULL) ARM64.HasSHA1 = isSet(hwCap, hwcap_SHA1) ARM64.HasSHA2 = isSet(hwCap, hwcap_SHA2) ARM64.HasCRC32 = isSet(hwCap, hwcap_CRC32) ARM64.HasATOMICS = isSet(hwCap, hwcap_ATOMICS) ARM64.HasFPHP = isSet(hwCap, hwcap_FPHP) ARM64.HasASIMDHP = isSet(hwCap, hwcap_ASIMDHP) ARM64.HasCPUID = isSet(hwCap, hwcap_CPUID) ARM64.HasASIMDRDM = isSet(hwCap, hwcap_ASIMDRDM) ARM64.HasJSCVT = isSet(hwCap, hwcap_JSCVT) ARM64.HasFCMA = isSet(hwCap, hwcap_FCMA) ARM64.HasLRCPC = isSet(hwCap, hwcap_LRCPC) ARM64.HasDCPOP = isSet(hwCap, hwcap_DCPOP) ARM64.HasSHA3 = isSet(hwCap, hwcap_SHA3) ARM64.HasSM3 = isSet(hwCap, hwcap_SM3) ARM64.HasSM4 = isSet(hwCap, hwcap_SM4) ARM64.HasASIMDDP = isSet(hwCap, hwcap_ASIMDDP) ARM64.HasSHA512 = isSet(hwCap, hwcap_SHA512) ARM64.HasSVE = isSet(hwCap, hwcap_SVE) ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM) ARM64.HasDIT = isSet(hwCap, hwcap_DIT) // HWCAP2 feature bits ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2) ARM64.HasI8MM = isSet(hwCap2, hwcap2_I8MM) } func isSet(hwc uint, value uint) bool { return hwc&value != 0 }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_ppc64x.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build ppc64 || ppc64le package cpu const cacheLineSize = 128 func initOptions() { options = []option{ {Name: "darn", Feature: &PPC64.HasDARN}, {Name: "scv", Feature: &PPC64.HasSCV}, } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package cpu implements processor feature detection for // various CPU architectures. package cpu import ( "os" "strings" ) // Initialized reports whether the CPU features were initialized. // // For some GOOS/GOARCH combinations initialization of the CPU features depends // on reading an operating specific file, e.g. /proc/self/auxv on linux/arm // Initialized will report false if reading the file fails. var Initialized bool // CacheLinePad is used to pad structs to avoid false sharing. type CacheLinePad struct{ _ [cacheLineSize]byte } // X86 contains the supported CPU features of the // current X86/AMD64 platform. If the current platform // is not X86/AMD64 then all feature flags are false. // // X86 is padded to avoid false sharing. Further the HasAVX // and HasAVX2 are only set if the OS supports XMM and YMM // registers in addition to the CPUID feature bit being set. var X86 struct { _ CacheLinePad HasAES bool // AES hardware implementation (AES NI) HasADX bool // Multi-precision add-carry instruction extensions HasAVX bool // Advanced vector extension HasAVX2 bool // Advanced vector extension 2 HasAVX512 bool // Advanced vector extension 512 HasAVX512F bool // Advanced vector extension 512 Foundation Instructions HasAVX512CD bool // Advanced vector extension 512 Conflict Detection Instructions HasAVX512ER bool // Advanced vector extension 512 Exponential and Reciprocal Instructions HasAVX512PF bool // Advanced vector extension 512 Prefetch Instructions HasAVX512VL bool // Advanced vector extension 512 Vector Length Extensions HasAVX512BW bool // Advanced vector extension 512 Byte and Word Instructions HasAVX512DQ bool // Advanced vector extension 512 Doubleword and Quadword Instructions HasAVX512IFMA bool // Advanced vector extension 512 Integer Fused Multiply Add HasAVX512VBMI bool // Advanced vector extension 512 Vector Byte Manipulation Instructions HasAVX5124VNNIW bool // Advanced vector extension 512 Vector Neural Network Instructions Word variable precision HasAVX5124FMAPS bool // Advanced vector extension 512 Fused Multiply Accumulation Packed Single precision HasAVX512VPOPCNTDQ bool // Advanced vector extension 512 Double and quad word population count instructions HasAVX512VPCLMULQDQ bool // Advanced vector extension 512 Vector carry-less multiply operations HasAVX512VNNI bool // Advanced vector extension 512 Vector Neural Network Instructions HasAVX512GFNI bool // Advanced vector extension 512 Galois field New Instructions HasAVX512VAES bool // Advanced vector extension 512 Vector AES instructions HasAVX512VBMI2 bool // Advanced vector extension 512 Vector Byte Manipulation Instructions 2 HasAVX512BITALG bool // Advanced vector extension 512 Bit Algorithms HasAVX512BF16 bool // Advanced vector extension 512 BFloat16 Instructions HasAMXTile bool // Advanced Matrix Extension Tile instructions HasAMXInt8 bool // Advanced Matrix Extension Int8 instructions HasAMXBF16 bool // Advanced Matrix Extension BFloat16 instructions HasBMI1 bool // Bit manipulation instruction set 1 HasBMI2 bool // Bit manipulation instruction set 2 HasCX16 bool // Compare and exchange 16 Bytes HasERMS bool // Enhanced REP for MOVSB and STOSB HasFMA bool // Fused-multiply-add instructions HasOSXSAVE bool // OS supports XSAVE/XRESTOR for saving/restoring XMM registers. HasPCLMULQDQ bool // PCLMULQDQ instruction - most often used for AES-GCM HasPOPCNT bool // Hamming weight instruction POPCNT. HasRDRAND bool // RDRAND instruction (on-chip random number generator) HasRDSEED bool // RDSEED instruction (on-chip random number generator) HasSSE2 bool // Streaming SIMD extension 2 (always available on amd64) HasSSE3 bool // Streaming SIMD extension 3 HasSSSE3 bool // Supplemental streaming SIMD extension 3 HasSSE41 bool // Streaming SIMD extension 4 and 4.1 HasSSE42 bool // Streaming SIMD extension 4 and 4.2 _ CacheLinePad } // ARM64 contains the supported CPU features of the // current ARMv8(aarch64) platform. If the current platform // is not arm64 then all feature flags are false. var ARM64 struct { _ CacheLinePad HasFP bool // Floating-point instruction set (always available) HasASIMD bool // Advanced SIMD (always available) HasEVTSTRM bool // Event stream support HasAES bool // AES hardware implementation HasPMULL bool // Polynomial multiplication instruction set HasSHA1 bool // SHA1 hardware implementation HasSHA2 bool // SHA2 hardware implementation HasCRC32 bool // CRC32 hardware implementation HasATOMICS bool // Atomic memory operation instruction set HasFPHP bool // Half precision floating-point instruction set HasASIMDHP bool // Advanced SIMD half precision instruction set HasCPUID bool // CPUID identification scheme registers HasASIMDRDM bool // Rounding double multiply add/subtract instruction set HasJSCVT bool // Javascript conversion from floating-point to integer HasFCMA bool // Floating-point multiplication and addition of complex numbers HasLRCPC bool // Release Consistent processor consistent support HasDCPOP bool // Persistent memory support HasSHA3 bool // SHA3 hardware implementation HasSM3 bool // SM3 hardware implementation HasSM4 bool // SM4 hardware implementation HasASIMDDP bool // Advanced SIMD double precision instruction set HasSHA512 bool // SHA512 hardware implementation HasSVE bool // Scalable Vector Extensions HasSVE2 bool // Scalable Vector Extensions 2 HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32 HasDIT bool // Data Independent Timing support HasI8MM bool // Advanced SIMD Int8 matrix multiplication instructions _ CacheLinePad } // ARM contains the supported CPU features of the current ARM (32-bit) platform. // All feature flags are false if: // 1. the current platform is not arm, or // 2. the current operating system is not Linux. var ARM struct { _ CacheLinePad HasSWP bool // SWP instruction support HasHALF bool // Half-word load and store support HasTHUMB bool // ARM Thumb instruction set Has26BIT bool // Address space limited to 26-bits HasFASTMUL bool // 32-bit operand, 64-bit result multiplication support HasFPA bool // Floating point arithmetic support HasVFP bool // Vector floating point support HasEDSP bool // DSP Extensions support HasJAVA bool // Java instruction set HasIWMMXT bool // Intel Wireless MMX technology support HasCRUNCH bool // MaverickCrunch context switching and handling HasTHUMBEE bool // Thumb EE instruction set HasNEON bool // NEON instruction set HasVFPv3 bool // Vector floating point version 3 support HasVFPv3D16 bool // Vector floating point version 3 D8-D15 HasTLS bool // Thread local storage support HasVFPv4 bool // Vector floating point version 4 support HasIDIVA bool // Integer divide instruction support in ARM mode HasIDIVT bool // Integer divide instruction support in Thumb mode HasVFPD32 bool // Vector floating point version 3 D15-D31 HasLPAE bool // Large Physical Address Extensions HasEVTSTRM bool // Event stream support HasAES bool // AES hardware implementation HasPMULL bool // Polynomial multiplication instruction set HasSHA1 bool // SHA1 hardware implementation HasSHA2 bool // SHA2 hardware implementation HasCRC32 bool // CRC32 hardware implementation _ CacheLinePad } // MIPS64X contains the supported CPU features of the current mips64/mips64le // platforms. If the current platform is not mips64/mips64le or the current // operating system is not Linux then all feature flags are false. var MIPS64X struct { _ CacheLinePad HasMSA bool // MIPS SIMD architecture _ CacheLinePad } // PPC64 contains the supported CPU features of the current ppc64/ppc64le platforms. // If the current platform is not ppc64/ppc64le then all feature flags are false. // // For ppc64/ppc64le, it is safe to check only for ISA level starting on ISA v3.00, // since there are no optional categories. There are some exceptions that also // require kernel support to work (DARN, SCV), so there are feature bits for // those as well. The struct is padded to avoid false sharing. var PPC64 struct { _ CacheLinePad HasDARN bool // Hardware random number generator (requires kernel enablement) HasSCV bool // Syscall vectored (requires kernel enablement) IsPOWER8 bool // ISA v2.07 (POWER8) IsPOWER9 bool // ISA v3.00 (POWER9), implies IsPOWER8 _ CacheLinePad } // S390X contains the supported CPU features of the current IBM Z // (s390x) platform. If the current platform is not IBM Z then all // feature flags are false. // // S390X is padded to avoid false sharing. Further HasVX is only set // if the OS supports vector registers in addition to the STFLE // feature bit being set. var S390X struct { _ CacheLinePad HasZARCH bool // z/Architecture mode is active [mandatory] HasSTFLE bool // store facility list extended HasLDISP bool // long (20-bit) displacements HasEIMM bool // 32-bit immediates HasDFP bool // decimal floating point HasETF3EH bool // ETF-3 enhanced HasMSA bool // message security assist (CPACF) HasAES bool // KM-AES{128,192,256} functions HasAESCBC bool // KMC-AES{128,192,256} functions HasAESCTR bool // KMCTR-AES{128,192,256} functions HasAESGCM bool // KMA-GCM-AES{128,192,256} functions HasGHASH bool // KIMD-GHASH function HasSHA1 bool // K{I,L}MD-SHA-1 functions HasSHA256 bool // K{I,L}MD-SHA-256 functions HasSHA512 bool // K{I,L}MD-SHA-512 functions HasSHA3 bool // K{I,L}MD-SHA3-{224,256,384,512} and K{I,L}MD-SHAKE-{128,256} functions HasVX bool // vector facility HasVXE bool // vector-enhancements facility 1 _ CacheLinePad } func init() { archInit() initOptions() processOptions() } // options contains the cpu debug options that can be used in GODEBUG. // Options are arch dependent and are added by the arch specific initOptions functions. // Features that are mandatory for the specific GOARCH should have the Required field set // (e.g. SSE2 on amd64). var options []option // Option names should be lower case. e.g. avx instead of AVX. type option struct { Name string Feature *bool Specified bool // whether feature value was specified in GODEBUG Enable bool // whether feature should be enabled Required bool // whether feature is mandatory and can not be disabled } func processOptions() { env := os.Getenv("GODEBUG") field: for env != "" { field := "" i := strings.IndexByte(env, ',') if i < 0 { field, env = env, "" } else { field, env = env[:i], env[i+1:] } if len(field) < 4 || field[:4] != "cpu." { continue } i = strings.IndexByte(field, '=') if i < 0 { print("GODEBUG sys/cpu: no value specified for \"", field, "\"\n") continue } key, value := field[4:i], field[i+1:] // e.g. "SSE2", "on" var enable bool switch value { case "on": enable = true case "off": enable = false default: print("GODEBUG sys/cpu: value \"", value, "\" not supported for cpu option \"", key, "\"\n") continue field } if key == "all" { for i := range options { options[i].Specified = true options[i].Enable = enable || options[i].Required } continue field } for i := range options { if options[i].Name == key { options[i].Specified = true options[i].Enable = enable continue field } } print("GODEBUG sys/cpu: unknown cpu feature \"", key, "\"\n") } for _, o := range options { if !o.Specified { continue } if o.Enable && !*o.Feature { print("GODEBUG sys/cpu: can not enable \"", o.Name, "\", missing CPU support\n") continue } if !o.Enable && o.Required { print("GODEBUG sys/cpu: can not disable \"", o.Name, "\", required CPU feature\n") continue } *o.Feature = o.Enable } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_gc_arm64.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build gc package cpu func getisar0() uint64 func getisar1() uint64 func getpfr0() uint64 func getzfr0() uint64
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_other_riscv64.go
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build !linux && riscv64 package cpu func archInit() { Initialized = true }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/endian_test.go
// Copyright 2023 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu_test import ( "testing" "unsafe" "golang.org/x/sys/cpu" ) func TestIsBigEndian(t *testing.T) { b := uint16(0xff00) want := *(*byte)(unsafe.Pointer(&b)) == 0xff if cpu.IsBigEndian != want { t.Errorf("IsBigEndian = %t, want %t", cpu.IsBigEndian, want) } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/syscall_aix_gccgo.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Recreate a getsystemcfg syscall handler instead of // using the one provided by x/sys/unix to avoid having // the dependency between them. (See golang.org/issue/32102) // Moreover, this file will be used during the building of // gccgo's libgo and thus must not used a CGo method. //go:build aix && gccgo package cpu import ( "syscall" ) //extern getsystemcfg func gccgoGetsystemcfg(label uint32) (r uint64) func callgetsystemcfg(label int) (r1 uintptr, e1 syscall.Errno) { r1 = uintptr(gccgoGetsystemcfg(uint32(label))) e1 = syscall.GetErrno() return }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/asm_aix_ppc64.s
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build gc #include "textflag.h" // // System calls for ppc64, AIX are implemented in runtime/syscall_aix.go // TEXT ·syscall6(SB),NOSPLIT,$0-88 JMP syscall·syscall6(SB) TEXT ·rawSyscall6(SB),NOSPLIT,$0-88 JMP syscall·rawSyscall6(SB)
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_zos_s390x.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu func initS390Xbase() { // get the facilities list facilities := stfle() // mandatory S390X.HasZARCH = facilities.Has(zarch) S390X.HasSTFLE = facilities.Has(stflef) S390X.HasLDISP = facilities.Has(ldisp) S390X.HasEIMM = facilities.Has(eimm) // optional S390X.HasETF3EH = facilities.Has(etf3eh) S390X.HasDFP = facilities.Has(dfp) S390X.HasMSA = facilities.Has(msa) S390X.HasVX = facilities.Has(vx) if S390X.HasVX { S390X.HasVXE = facilities.Has(vxe) } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_arm64.s
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build gc #include "textflag.h" // func getisar0() uint64 TEXT ·getisar0(SB),NOSPLIT,$0-8 // get Instruction Set Attributes 0 into x0 // mrs x0, ID_AA64ISAR0_EL1 = d5380600 WORD $0xd5380600 MOVD R0, ret+0(FP) RET // func getisar1() uint64 TEXT ·getisar1(SB),NOSPLIT,$0-8 // get Instruction Set Attributes 1 into x0 // mrs x0, ID_AA64ISAR1_EL1 = d5380620 WORD $0xd5380620 MOVD R0, ret+0(FP) RET // func getpfr0() uint64 TEXT ·getpfr0(SB),NOSPLIT,$0-8 // get Processor Feature Register 0 into x0 // mrs x0, ID_AA64PFR0_EL1 = d5380400 WORD $0xd5380400 MOVD R0, ret+0(FP) RET // func getzfr0() uint64 TEXT ·getzfr0(SB),NOSPLIT,$0-8 // get SVE Feature Register 0 into x0 // mrs x0, ID_AA64ZFR0_EL1 = d5380480 WORD $0xd5380480 MOVD R0, ret+0(FP) RET
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_netbsd_arm64.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu import ( "syscall" "unsafe" ) // Minimal copy of functionality from x/sys/unix so the cpu package can call // sysctl without depending on x/sys/unix. const ( _CTL_QUERY = -2 _SYSCTL_VERS_1 = 0x1000000 ) var _zero uintptr func sysctl(mib []int32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { var _p0 unsafe.Pointer if len(mib) > 0 { _p0 = unsafe.Pointer(&mib[0]) } else { _p0 = unsafe.Pointer(&_zero) } _, _, errno := syscall.Syscall6( syscall.SYS___SYSCTL, uintptr(_p0), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if errno != 0 { return errno } return nil } type sysctlNode struct { Flags uint32 Num int32 Name [32]int8 Ver uint32 __rsvd uint32 Un [16]byte _sysctl_size [8]byte _sysctl_func [8]byte _sysctl_parent [8]byte _sysctl_desc [8]byte } func sysctlNodes(mib []int32) ([]sysctlNode, error) { var olen uintptr // Get a list of all sysctl nodes below the given MIB by performing // a sysctl for the given MIB with CTL_QUERY appended. mib = append(mib, _CTL_QUERY) qnode := sysctlNode{Flags: _SYSCTL_VERS_1} qp := (*byte)(unsafe.Pointer(&qnode)) sz := unsafe.Sizeof(qnode) if err := sysctl(mib, nil, &olen, qp, sz); err != nil { return nil, err } // Now that we know the size, get the actual nodes. nodes := make([]sysctlNode, olen/sz) np := (*byte)(unsafe.Pointer(&nodes[0])) if err := sysctl(mib, np, &olen, qp, sz); err != nil { return nil, err } return nodes, nil } func nametomib(name string) ([]int32, error) { // Split name into components. var parts []string last := 0 for i := 0; i < len(name); i++ { if name[i] == '.' { parts = append(parts, name[last:i]) last = i + 1 } } parts = append(parts, name[last:]) mib := []int32{} // Discover the nodes and construct the MIB OID. for partno, part := range parts { nodes, err := sysctlNodes(mib) if err != nil { return nil, err } for _, node := range nodes { n := make([]byte, 0) for i := range node.Name { if node.Name[i] != 0 { n = append(n, byte(node.Name[i])) } } if string(n) == part { mib = append(mib, int32(node.Num)) break } } if len(mib) != partno+1 { return nil, err } } return mib, nil } // aarch64SysctlCPUID is struct aarch64_sysctl_cpu_id from NetBSD's <aarch64/armreg.h> type aarch64SysctlCPUID struct { midr uint64 /* Main ID Register */ revidr uint64 /* Revision ID Register */ mpidr uint64 /* Multiprocessor Affinity Register */ aa64dfr0 uint64 /* A64 Debug Feature Register 0 */ aa64dfr1 uint64 /* A64 Debug Feature Register 1 */ aa64isar0 uint64 /* A64 Instruction Set Attribute Register 0 */ aa64isar1 uint64 /* A64 Instruction Set Attribute Register 1 */ aa64mmfr0 uint64 /* A64 Memory Model Feature Register 0 */ aa64mmfr1 uint64 /* A64 Memory Model Feature Register 1 */ aa64mmfr2 uint64 /* A64 Memory Model Feature Register 2 */ aa64pfr0 uint64 /* A64 Processor Feature Register 0 */ aa64pfr1 uint64 /* A64 Processor Feature Register 1 */ aa64zfr0 uint64 /* A64 SVE Feature ID Register 0 */ mvfr0 uint32 /* Media and VFP Feature Register 0 */ mvfr1 uint32 /* Media and VFP Feature Register 1 */ mvfr2 uint32 /* Media and VFP Feature Register 2 */ pad uint32 clidr uint64 /* Cache Level ID Register */ ctr uint64 /* Cache Type Register */ } func sysctlCPUID(name string) (*aarch64SysctlCPUID, error) { mib, err := nametomib(name) if err != nil { return nil, err } out := aarch64SysctlCPUID{} n := unsafe.Sizeof(out) _, _, errno := syscall.Syscall6( syscall.SYS___SYSCTL, uintptr(unsafe.Pointer(&mib[0])), uintptr(len(mib)), uintptr(unsafe.Pointer(&out)), uintptr(unsafe.Pointer(&n)), uintptr(0), uintptr(0)) if errno != 0 { return nil, errno } return &out, nil } func doinit() { cpuid, err := sysctlCPUID("machdep.cpu0.cpu_id") if err != nil { setMinimalFeatures() return } parseARM64SystemRegisters(cpuid.aa64isar0, cpuid.aa64isar1, cpuid.aa64pfr0) Initialized = true }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_gc_s390x.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build gc package cpu // haveAsmFunctions reports whether the other functions in this file can // be safely called. func haveAsmFunctions() bool { return true } // The following feature detection functions are defined in cpu_s390x.s. // They are likely to be expensive to call so the results should be cached. func stfle() facilityList func kmQuery() queryResult func kmcQuery() queryResult func kmctrQuery() queryResult func kmaQuery() queryResult func kimdQuery() queryResult func klmdQuery() queryResult
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_gccgo_arm64.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build gccgo package cpu func getisar0() uint64 { return 0 } func getisar1() uint64 { return 0 } func getpfr0() uint64 { return 0 }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_gc_x86.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gc package cpu // cpuid is implemented in cpu_x86.s for gc compiler // and in cpu_gccgo.c for gccgo. func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) // xgetbv with ecx = 0 is implemented in cpu_x86.s for gc compiler // and in cpu_gccgo.c for gccgo. func xgetbv() (eax, edx uint32)
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_mips64x.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build mips64 || mips64le package cpu const cacheLineSize = 32 func initOptions() { options = []option{ {Name: "msa", Feature: &MIPS64X.HasMSA}, } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_other_ppc64x.go
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build !aix && !linux && (ppc64 || ppc64le) package cpu func archInit() { PPC64.IsPOWER8 = true Initialized = true }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/parse.go
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu import "strconv" // parseRelease parses a dot-separated version number. It follows the semver // syntax, but allows the minor and patch versions to be elided. // // This is a copy of the Go runtime's parseRelease from // https://golang.org/cl/209597. func parseRelease(rel string) (major, minor, patch int, ok bool) { // Strip anything after a dash or plus. for i := 0; i < len(rel); i++ { if rel[i] == '-' || rel[i] == '+' { rel = rel[:i] break } } next := func() (int, bool) { for i := 0; i < len(rel); i++ { if rel[i] == '.' { ver, err := strconv.Atoi(rel[:i]) rel = rel[i+1:] return ver, err == nil } } ver, err := strconv.Atoi(rel) rel = "" return ver, err == nil } if major, ok = next(); !ok || rel == "" { return } if minor, ok = next(); !ok || rel == "" { return } patch, ok = next() return }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_test.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu_test import ( "runtime" "testing" "golang.org/x/sys/cpu" ) func TestAMD64minimalFeatures(t *testing.T) { if runtime.GOARCH == "amd64" { if !cpu.Initialized { t.Fatal("Initialized expected true, got false") } if !cpu.X86.HasSSE2 { t.Fatal("HasSSE2 expected true, got false") } } } func TestAVX2hasAVX(t *testing.T) { if runtime.GOARCH == "amd64" { if cpu.X86.HasAVX2 && !cpu.X86.HasAVX { t.Fatal("HasAVX expected true, got false") } } } func TestAVX512HasAVX2AndAVX(t *testing.T) { if runtime.GOARCH == "amd64" { if cpu.X86.HasAVX512 && !cpu.X86.HasAVX { t.Fatal("HasAVX expected true, got false") } if cpu.X86.HasAVX512 && !cpu.X86.HasAVX2 { t.Fatal("HasAVX2 expected true, got false") } } } func TestARM64minimalFeatures(t *testing.T) { if runtime.GOARCH != "arm64" || runtime.GOOS == "ios" { return } if !cpu.ARM64.HasASIMD { t.Fatal("HasASIMD expected true, got false") } if !cpu.ARM64.HasFP { t.Fatal("HasFP expected true, got false") } } func TestMIPS64Initialized(t *testing.T) { if runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" { if !cpu.Initialized { t.Fatal("Initialized expected true, got false") } } } // On ppc64x, the ISA bit for POWER8 should always be set on POWER8 and beyond. func TestPPC64minimalFeatures(t *testing.T) { // Do not run this with gccgo on ppc64, as it doesn't have POWER8 as a minimum // requirement. if runtime.Compiler == "gccgo" && runtime.GOARCH == "ppc64" { t.Skip("gccgo does not require POWER8 on ppc64; skipping") } if runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" { if !cpu.PPC64.IsPOWER8 { t.Fatal("IsPOWER8 expected true, got false") } } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_linux.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build !386 && !amd64 && !amd64p32 && !arm64 package cpu func archInit() { if err := readHWCAP(); err != nil { return } doinit() Initialized = true }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_linux_s390x.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu const ( // bit mask values from /usr/include/bits/hwcap.h hwcap_ZARCH = 2 hwcap_STFLE = 4 hwcap_MSA = 8 hwcap_LDISP = 16 hwcap_EIMM = 32 hwcap_DFP = 64 hwcap_ETF3EH = 256 hwcap_VX = 2048 hwcap_VXE = 8192 ) func initS390Xbase() { // test HWCAP bit vector has := func(featureMask uint) bool { return hwCap&featureMask == featureMask } // mandatory S390X.HasZARCH = has(hwcap_ZARCH) // optional S390X.HasSTFLE = has(hwcap_STFLE) S390X.HasLDISP = has(hwcap_LDISP) S390X.HasEIMM = has(hwcap_EIMM) S390X.HasETF3EH = has(hwcap_ETF3EH) S390X.HasDFP = has(hwcap_DFP) S390X.HasMSA = has(hwcap_MSA) S390X.HasVX = has(hwcap_VX) if S390X.HasVX { S390X.HasVXE = has(hwcap_VXE) } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/runtime_auxv.go
// Copyright 2023 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu // getAuxvFn is non-nil on Go 1.21+ (via runtime_auxv_go121.go init) // on platforms that use auxv. var getAuxvFn func() []uintptr func getAuxv() []uintptr { if getAuxvFn == nil { return nil } return getAuxvFn() }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_other_mips64x.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build !linux && (mips64 || mips64le) package cpu func archInit() { Initialized = true }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_s390x.s
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build gc #include "textflag.h" // func stfle() facilityList TEXT ·stfle(SB), NOSPLIT|NOFRAME, $0-32 MOVD $ret+0(FP), R1 MOVD $3, R0 // last doubleword index to store XC $32, (R1), (R1) // clear 4 doublewords (32 bytes) WORD $0xb2b01000 // store facility list extended (STFLE) RET // func kmQuery() queryResult TEXT ·kmQuery(SB), NOSPLIT|NOFRAME, $0-16 MOVD $0, R0 // set function code to 0 (KM-Query) MOVD $ret+0(FP), R1 // address of 16-byte return value WORD $0xB92E0024 // cipher message (KM) RET // func kmcQuery() queryResult TEXT ·kmcQuery(SB), NOSPLIT|NOFRAME, $0-16 MOVD $0, R0 // set function code to 0 (KMC-Query) MOVD $ret+0(FP), R1 // address of 16-byte return value WORD $0xB92F0024 // cipher message with chaining (KMC) RET // func kmctrQuery() queryResult TEXT ·kmctrQuery(SB), NOSPLIT|NOFRAME, $0-16 MOVD $0, R0 // set function code to 0 (KMCTR-Query) MOVD $ret+0(FP), R1 // address of 16-byte return value WORD $0xB92D4024 // cipher message with counter (KMCTR) RET // func kmaQuery() queryResult TEXT ·kmaQuery(SB), NOSPLIT|NOFRAME, $0-16 MOVD $0, R0 // set function code to 0 (KMA-Query) MOVD $ret+0(FP), R1 // address of 16-byte return value WORD $0xb9296024 // cipher message with authentication (KMA) RET // func kimdQuery() queryResult TEXT ·kimdQuery(SB), NOSPLIT|NOFRAME, $0-16 MOVD $0, R0 // set function code to 0 (KIMD-Query) MOVD $ret+0(FP), R1 // address of 16-byte return value WORD $0xB93E0024 // compute intermediate message digest (KIMD) RET // func klmdQuery() queryResult TEXT ·klmdQuery(SB), NOSPLIT|NOFRAME, $0-16 MOVD $0, R0 // set function code to 0 (KLMD-Query) MOVD $ret+0(FP), R1 // address of 16-byte return value WORD $0xB93F0024 // compute last message digest (KLMD) RET
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_zos.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu func archInit() { doinit() Initialized = true }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/endian_little.go
// Copyright 2023 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build 386 || amd64 || amd64p32 || alpha || arm || arm64 || loong64 || mipsle || mips64le || mips64p32le || nios2 || ppc64le || riscv || riscv64 || sh || wasm package cpu // IsBigEndian records whether the GOARCH's byte order is big endian. const IsBigEndian = false
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_wasm.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build wasm package cpu // We're compiling the cpu package for an unknown (software-abstracted) CPU. // Make CacheLinePad an empty struct and hope that the usual struct alignment // rules are good enough. const cacheLineSize = 0 func initOptions() {} func archInit() {}
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_linux_ppc64x.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build linux && (ppc64 || ppc64le) package cpu // HWCAP/HWCAP2 bits. These are exposed by the kernel. const ( // ISA Level _PPC_FEATURE2_ARCH_2_07 = 0x80000000 _PPC_FEATURE2_ARCH_3_00 = 0x00800000 // CPU features _PPC_FEATURE2_DARN = 0x00200000 _PPC_FEATURE2_SCV = 0x00100000 ) func doinit() { // HWCAP2 feature bits PPC64.IsPOWER8 = isSet(hwCap2, _PPC_FEATURE2_ARCH_2_07) PPC64.IsPOWER9 = isSet(hwCap2, _PPC_FEATURE2_ARCH_3_00) PPC64.HasDARN = isSet(hwCap2, _PPC_FEATURE2_DARN) PPC64.HasSCV = isSet(hwCap2, _PPC_FEATURE2_SCV) } func isSet(hwc uint, value uint) bool { return hwc&value != 0 }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/syscall_aix_ppc64_gc.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Minimal copy of x/sys/unix so the cpu package can make a // system call on AIX without depending on x/sys/unix. // (See golang.org/issue/32102) //go:build aix && ppc64 && gc package cpu import ( "syscall" "unsafe" ) //go:cgo_import_dynamic libc_getsystemcfg getsystemcfg "libc.a/shr_64.o" //go:linkname libc_getsystemcfg libc_getsystemcfg type syscallFunc uintptr var libc_getsystemcfg syscallFunc type errno = syscall.Errno // Implemented in runtime/syscall_aix.go. func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err errno) func callgetsystemcfg(label int) (r1 uintptr, e1 errno) { r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_getsystemcfg)), 1, uintptr(label), 0, 0, 0, 0, 0) return }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/runtime_auxv_go121.go
// Copyright 2023 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build go1.21 package cpu import ( _ "unsafe" // for linkname ) //go:linkname runtime_getAuxv runtime.getAuxv func runtime_getAuxv() []uintptr func init() { getAuxvFn = runtime_getAuxv }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/parse_test.go
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu import "testing" type parseReleaseTest struct { in string major, minor, patch int } var parseReleaseTests = []parseReleaseTest{ {"", -1, -1, -1}, {"x", -1, -1, -1}, {"5", 5, 0, 0}, {"5.12", 5, 12, 0}, {"5.12-x", 5, 12, 0}, {"5.12.1", 5, 12, 1}, {"5.12.1-x", 5, 12, 1}, {"5.12.1.0", 5, 12, 1}, {"5.20496382327982653440", -1, -1, -1}, } func TestParseRelease(t *testing.T) { for _, test := range parseReleaseTests { major, minor, patch, ok := parseRelease(test.in) if !ok { major, minor, patch = -1, -1, -1 } if test.major != major || test.minor != minor || test.patch != patch { t.Errorf("parseRelease(%q) = (%v, %v, %v) want (%v, %v, %v)", test.in, major, minor, patch, test.major, test.minor, test.patch) } } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_x86.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build 386 || amd64 || amd64p32 package cpu import "runtime" const cacheLineSize = 64 func initOptions() { options = []option{ {Name: "adx", Feature: &X86.HasADX}, {Name: "aes", Feature: &X86.HasAES}, {Name: "avx", Feature: &X86.HasAVX}, {Name: "avx2", Feature: &X86.HasAVX2}, {Name: "avx512", Feature: &X86.HasAVX512}, {Name: "avx512f", Feature: &X86.HasAVX512F}, {Name: "avx512cd", Feature: &X86.HasAVX512CD}, {Name: "avx512er", Feature: &X86.HasAVX512ER}, {Name: "avx512pf", Feature: &X86.HasAVX512PF}, {Name: "avx512vl", Feature: &X86.HasAVX512VL}, {Name: "avx512bw", Feature: &X86.HasAVX512BW}, {Name: "avx512dq", Feature: &X86.HasAVX512DQ}, {Name: "avx512ifma", Feature: &X86.HasAVX512IFMA}, {Name: "avx512vbmi", Feature: &X86.HasAVX512VBMI}, {Name: "avx512vnniw", Feature: &X86.HasAVX5124VNNIW}, {Name: "avx5124fmaps", Feature: &X86.HasAVX5124FMAPS}, {Name: "avx512vpopcntdq", Feature: &X86.HasAVX512VPOPCNTDQ}, {Name: "avx512vpclmulqdq", Feature: &X86.HasAVX512VPCLMULQDQ}, {Name: "avx512vnni", Feature: &X86.HasAVX512VNNI}, {Name: "avx512gfni", Feature: &X86.HasAVX512GFNI}, {Name: "avx512vaes", Feature: &X86.HasAVX512VAES}, {Name: "avx512vbmi2", Feature: &X86.HasAVX512VBMI2}, {Name: "avx512bitalg", Feature: &X86.HasAVX512BITALG}, {Name: "avx512bf16", Feature: &X86.HasAVX512BF16}, {Name: "amxtile", Feature: &X86.HasAMXTile}, {Name: "amxint8", Feature: &X86.HasAMXInt8}, {Name: "amxbf16", Feature: &X86.HasAMXBF16}, {Name: "bmi1", Feature: &X86.HasBMI1}, {Name: "bmi2", Feature: &X86.HasBMI2}, {Name: "cx16", Feature: &X86.HasCX16}, {Name: "erms", Feature: &X86.HasERMS}, {Name: "fma", Feature: &X86.HasFMA}, {Name: "osxsave", Feature: &X86.HasOSXSAVE}, {Name: "pclmulqdq", Feature: &X86.HasPCLMULQDQ}, {Name: "popcnt", Feature: &X86.HasPOPCNT}, {Name: "rdrand", Feature: &X86.HasRDRAND}, {Name: "rdseed", Feature: &X86.HasRDSEED}, {Name: "sse3", Feature: &X86.HasSSE3}, {Name: "sse41", Feature: &X86.HasSSE41}, {Name: "sse42", Feature: &X86.HasSSE42}, {Name: "ssse3", Feature: &X86.HasSSSE3}, // These capabilities should always be enabled on amd64: {Name: "sse2", Feature: &X86.HasSSE2, Required: runtime.GOARCH == "amd64"}, } } func archInit() { Initialized = true maxID, _, _, _ := cpuid(0, 0) if maxID < 1 { return } _, _, ecx1, edx1 := cpuid(1, 0) X86.HasSSE2 = isSet(26, edx1) X86.HasSSE3 = isSet(0, ecx1) X86.HasPCLMULQDQ = isSet(1, ecx1) X86.HasSSSE3 = isSet(9, ecx1) X86.HasFMA = isSet(12, ecx1) X86.HasCX16 = isSet(13, ecx1) X86.HasSSE41 = isSet(19, ecx1) X86.HasSSE42 = isSet(20, ecx1) X86.HasPOPCNT = isSet(23, ecx1) X86.HasAES = isSet(25, ecx1) X86.HasOSXSAVE = isSet(27, ecx1) X86.HasRDRAND = isSet(30, ecx1) var osSupportsAVX, osSupportsAVX512 bool // For XGETBV, OSXSAVE bit is required and sufficient. if X86.HasOSXSAVE { eax, _ := xgetbv() // Check if XMM and YMM registers have OS support. osSupportsAVX = isSet(1, eax) && isSet(2, eax) if runtime.GOOS == "darwin" { // Darwin doesn't save/restore AVX-512 mask registers correctly across signal handlers. // Since users can't rely on mask register contents, let's not advertise AVX-512 support. // See issue 49233. osSupportsAVX512 = false } else { // Check if OPMASK and ZMM registers have OS support. osSupportsAVX512 = osSupportsAVX && isSet(5, eax) && isSet(6, eax) && isSet(7, eax) } } X86.HasAVX = isSet(28, ecx1) && osSupportsAVX if maxID < 7 { return } _, ebx7, ecx7, edx7 := cpuid(7, 0) X86.HasBMI1 = isSet(3, ebx7) X86.HasAVX2 = isSet(5, ebx7) && osSupportsAVX X86.HasBMI2 = isSet(8, ebx7) X86.HasERMS = isSet(9, ebx7) X86.HasRDSEED = isSet(18, ebx7) X86.HasADX = isSet(19, ebx7) X86.HasAVX512 = isSet(16, ebx7) && osSupportsAVX512 // Because avx-512 foundation is the core required extension if X86.HasAVX512 { X86.HasAVX512F = true X86.HasAVX512CD = isSet(28, ebx7) X86.HasAVX512ER = isSet(27, ebx7) X86.HasAVX512PF = isSet(26, ebx7) X86.HasAVX512VL = isSet(31, ebx7) X86.HasAVX512BW = isSet(30, ebx7) X86.HasAVX512DQ = isSet(17, ebx7) X86.HasAVX512IFMA = isSet(21, ebx7) X86.HasAVX512VBMI = isSet(1, ecx7) X86.HasAVX5124VNNIW = isSet(2, edx7) X86.HasAVX5124FMAPS = isSet(3, edx7) X86.HasAVX512VPOPCNTDQ = isSet(14, ecx7) X86.HasAVX512VPCLMULQDQ = isSet(10, ecx7) X86.HasAVX512VNNI = isSet(11, ecx7) X86.HasAVX512GFNI = isSet(8, ecx7) X86.HasAVX512VAES = isSet(9, ecx7) X86.HasAVX512VBMI2 = isSet(6, ecx7) X86.HasAVX512BITALG = isSet(12, ecx7) eax71, _, _, _ := cpuid(7, 1) X86.HasAVX512BF16 = isSet(5, eax71) } X86.HasAMXTile = isSet(24, edx7) X86.HasAMXInt8 = isSet(25, edx7) X86.HasAMXBF16 = isSet(22, edx7) } func isSet(bitpos uint, value uint32) bool { return value&(1<<bitpos) != 0 }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_other_arm64.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build !linux && !netbsd && !openbsd && arm64 package cpu func doinit() {}
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_openbsd_arm64.go
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu import ( "syscall" "unsafe" ) // Minimal copy of functionality from x/sys/unix so the cpu package can call // sysctl without depending on x/sys/unix. const ( // From OpenBSD's sys/sysctl.h. _CTL_MACHDEP = 7 // From OpenBSD's machine/cpu.h. _CPU_ID_AA64ISAR0 = 2 _CPU_ID_AA64ISAR1 = 3 ) // Implemented in the runtime package (runtime/sys_openbsd3.go) func syscall_syscall6(fn, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) //go:linkname syscall_syscall6 syscall.syscall6 func sysctl(mib []uint32, old *byte, oldlen *uintptr, new *byte, newlen uintptr) (err error) { _, _, errno := syscall_syscall6(libc_sysctl_trampoline_addr, uintptr(unsafe.Pointer(&mib[0])), uintptr(len(mib)), uintptr(unsafe.Pointer(old)), uintptr(unsafe.Pointer(oldlen)), uintptr(unsafe.Pointer(new)), uintptr(newlen)) if errno != 0 { return errno } return nil } var libc_sysctl_trampoline_addr uintptr //go:cgo_import_dynamic libc_sysctl sysctl "libc.so" func sysctlUint64(mib []uint32) (uint64, bool) { var out uint64 nout := unsafe.Sizeof(out) if err := sysctl(mib, (*byte)(unsafe.Pointer(&out)), &nout, nil, 0); err != nil { return 0, false } return out, true } func doinit() { setMinimalFeatures() // Get ID_AA64ISAR0 and ID_AA64ISAR1 from sysctl. isar0, ok := sysctlUint64([]uint32{_CTL_MACHDEP, _CPU_ID_AA64ISAR0}) if !ok { return } isar1, ok := sysctlUint64([]uint32{_CTL_MACHDEP, _CPU_ID_AA64ISAR1}) if !ok { return } parseARM64SystemRegisters(isar0, isar1, 0) Initialized = true }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_x86.s
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gc #include "textflag.h" // func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) TEXT ·cpuid(SB), NOSPLIT, $0-24 MOVL eaxArg+0(FP), AX MOVL ecxArg+4(FP), CX CPUID MOVL AX, eax+8(FP) MOVL BX, ebx+12(FP) MOVL CX, ecx+16(FP) MOVL DX, edx+20(FP) RET // func xgetbv() (eax, edx uint32) TEXT ·xgetbv(SB),NOSPLIT,$0-8 MOVL $0, CX XGETBV MOVL AX, eax+0(FP) MOVL DX, edx+4(FP) RET
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_linux_mips64x.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build linux && (mips64 || mips64le) package cpu // HWCAP bits. These are exposed by the Linux kernel 5.4. const ( // CPU features hwcap_MIPS_MSA = 1 << 1 ) func doinit() { // HWCAP feature bits MIPS64X.HasMSA = isSet(hwCap, hwcap_MIPS_MSA) } func isSet(hwc uint, value uint) bool { return hwc&value != 0 }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/hwcap_linux.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu import ( "os" ) const ( _AT_HWCAP = 16 _AT_HWCAP2 = 26 procAuxv = "/proc/self/auxv" uintSize = int(32 << (^uint(0) >> 63)) ) // For those platforms don't have a 'cpuid' equivalent we use HWCAP/HWCAP2 // These are initialized in cpu_$GOARCH.go // and should not be changed after they are initialized. var hwCap uint var hwCap2 uint func readHWCAP() error { // For Go 1.21+, get auxv from the Go runtime. if a := getAuxv(); len(a) > 0 { for len(a) >= 2 { tag, val := a[0], uint(a[1]) a = a[2:] switch tag { case _AT_HWCAP: hwCap = val case _AT_HWCAP2: hwCap2 = val } } return nil } buf, err := os.ReadFile(procAuxv) if err != nil { // e.g. on android /proc/self/auxv is not accessible, so silently // ignore the error and leave Initialized = false. On some // architectures (e.g. arm64) doinit() implements a fallback // readout and will set Initialized = true again. return err } bo := hostByteOrder() for len(buf) >= 2*(uintSize/8) { var tag, val uint switch uintSize { case 32: tag = uint(bo.Uint32(buf[0:])) val = uint(bo.Uint32(buf[4:])) buf = buf[8:] case 64: tag = uint(bo.Uint64(buf[0:])) val = uint(bo.Uint64(buf[8:])) buf = buf[16:] } switch tag { case _AT_HWCAP: hwCap = val case _AT_HWCAP2: hwCap2 = val } } return nil }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/byteorder.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu import ( "runtime" ) // byteOrder is a subset of encoding/binary.ByteOrder. type byteOrder interface { Uint32([]byte) uint32 Uint64([]byte) uint64 } type littleEndian struct{} type bigEndian struct{} func (littleEndian) Uint32(b []byte) uint32 { _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24 } func (littleEndian) Uint64(b []byte) uint64 { _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 | uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56 } func (bigEndian) Uint32(b []byte) uint32 { _ = b[3] // bounds check hint to compiler; see golang.org/issue/14808 return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24 } func (bigEndian) Uint64(b []byte) uint64 { _ = b[7] // bounds check hint to compiler; see golang.org/issue/14808 return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 | uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56 } // hostByteOrder returns littleEndian on little-endian machines and // bigEndian on big-endian machines. func hostByteOrder() byteOrder { switch runtime.GOARCH { case "386", "amd64", "amd64p32", "alpha", "arm", "arm64", "loong64", "mipsle", "mips64le", "mips64p32le", "nios2", "ppc64le", "riscv", "riscv64", "sh": return littleEndian{} case "armbe", "arm64be", "m68k", "mips", "mips64", "mips64p32", "ppc", "ppc64", "s390", "s390x", "shbe", "sparc", "sparc64": return bigEndian{} } panic("unknown architecture") }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_gccgo_s390x.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build gccgo package cpu // haveAsmFunctions reports whether the other functions in this file can // be safely called. func haveAsmFunctions() bool { return false } // TODO(mundaym): the following feature detection functions are currently // stubs. See https://golang.org/cl/162887 for how to fix this. // They are likely to be expensive to call so the results should be cached. func stfle() facilityList { panic("not implemented for gccgo") } func kmQuery() queryResult { panic("not implemented for gccgo") } func kmcQuery() queryResult { panic("not implemented for gccgo") } func kmctrQuery() queryResult { panic("not implemented for gccgo") } func kmaQuery() queryResult { panic("not implemented for gccgo") } func kimdQuery() queryResult { panic("not implemented for gccgo") } func klmdQuery() queryResult { panic("not implemented for gccgo") }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/proc_cpuinfo_linux.go
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build linux && arm64 package cpu import ( "errors" "io" "os" "strings" ) func readLinuxProcCPUInfo() error { f, err := os.Open("/proc/cpuinfo") if err != nil { return err } defer f.Close() var buf [1 << 10]byte // enough for first CPU n, err := io.ReadFull(f, buf[:]) if err != nil && err != io.ErrUnexpectedEOF { return err } in := string(buf[:n]) const features = "\nFeatures : " i := strings.Index(in, features) if i == -1 { return errors.New("no CPU features found") } in = in[i+len(features):] if i := strings.Index(in, "\n"); i != -1 { in = in[:i] } m := map[string]*bool{} initOptions() // need it early here; it's harmless to call twice for _, o := range options { m[o.Name] = o.Feature } // The EVTSTRM field has alias "evstrm" in Go, but Linux calls it "evtstrm". m["evtstrm"] = &ARM64.HasEVTSTRM for _, f := range strings.Fields(in) { if p, ok := m[f]; ok { *p = true } } return nil }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_linux_arm.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu func doinit() { ARM.HasSWP = isSet(hwCap, hwcap_SWP) ARM.HasHALF = isSet(hwCap, hwcap_HALF) ARM.HasTHUMB = isSet(hwCap, hwcap_THUMB) ARM.Has26BIT = isSet(hwCap, hwcap_26BIT) ARM.HasFASTMUL = isSet(hwCap, hwcap_FAST_MULT) ARM.HasFPA = isSet(hwCap, hwcap_FPA) ARM.HasVFP = isSet(hwCap, hwcap_VFP) ARM.HasEDSP = isSet(hwCap, hwcap_EDSP) ARM.HasJAVA = isSet(hwCap, hwcap_JAVA) ARM.HasIWMMXT = isSet(hwCap, hwcap_IWMMXT) ARM.HasCRUNCH = isSet(hwCap, hwcap_CRUNCH) ARM.HasTHUMBEE = isSet(hwCap, hwcap_THUMBEE) ARM.HasNEON = isSet(hwCap, hwcap_NEON) ARM.HasVFPv3 = isSet(hwCap, hwcap_VFPv3) ARM.HasVFPv3D16 = isSet(hwCap, hwcap_VFPv3D16) ARM.HasTLS = isSet(hwCap, hwcap_TLS) ARM.HasVFPv4 = isSet(hwCap, hwcap_VFPv4) ARM.HasIDIVA = isSet(hwCap, hwcap_IDIVA) ARM.HasIDIVT = isSet(hwCap, hwcap_IDIVT) ARM.HasVFPD32 = isSet(hwCap, hwcap_VFPD32) ARM.HasLPAE = isSet(hwCap, hwcap_LPAE) ARM.HasEVTSTRM = isSet(hwCap, hwcap_EVTSTRM) ARM.HasAES = isSet(hwCap2, hwcap2_AES) ARM.HasPMULL = isSet(hwCap2, hwcap2_PMULL) ARM.HasSHA1 = isSet(hwCap2, hwcap2_SHA1) ARM.HasSHA2 = isSet(hwCap2, hwcap2_SHA2) ARM.HasCRC32 = isSet(hwCap2, hwcap2_CRC32) } func isSet(hwc uint, value uint) bool { return hwc&value != 0 }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_gccgo_x86.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gccgo package cpu //extern gccgoGetCpuidCount func gccgoGetCpuidCount(eaxArg, ecxArg uint32, eax, ebx, ecx, edx *uint32) func cpuid(eaxArg, ecxArg uint32) (eax, ebx, ecx, edx uint32) { var a, b, c, d uint32 gccgoGetCpuidCount(eaxArg, ecxArg, &a, &b, &c, &d) return a, b, c, d } //extern gccgoXgetbv func gccgoXgetbv(eax, edx *uint32) func xgetbv() (eax, edx uint32) { var a, d uint32 gccgoXgetbv(&a, &d) return a, d } // gccgo doesn't build on Darwin, per: // https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/gcc.rb#L76 func darwinSupportsAVX512() bool { return false }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_s390x_test.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu_test import ( "runtime" "testing" "unsafe" "golang.org/x/sys/cpu" ) var s390xTests = []struct { name string feature bool facility uint mandatory bool }{ {"ZARCH", cpu.S390X.HasZARCH, 1, true}, {"STFLE", cpu.S390X.HasSTFLE, 7, true}, {"LDISP", cpu.S390X.HasLDISP, 18, true}, {"EIMM", cpu.S390X.HasEIMM, 21, true}, {"DFP", cpu.S390X.HasDFP, 42, false}, {"MSA", cpu.S390X.HasMSA, 17, false}, {"VX", cpu.S390X.HasVX, 129, false}, {"VXE", cpu.S390X.HasVXE, 135, false}, } // bitIsSet reports whether the bit at index is set. The bit index // is in big endian order, so bit index 0 is the leftmost bit. func bitIsSet(bits [4]uint64, i uint) bool { return bits[i/64]&((1<<63)>>(i%64)) != 0 } // facilityList contains the contents of location 200 on zos. // Bits are numbered in big endian order so the // leftmost bit (the MSB) is at index 0. type facilityList struct { bits [4]uint64 } func TestS390XVectorFacilityFeatures(t *testing.T) { // vector-enhancements require vector facility to be enabled if cpu.S390X.HasVXE && !cpu.S390X.HasVX { t.Error("HasVX expected true, got false (VXE is true)") } } func TestS390XMandatoryFeatures(t *testing.T) { for _, tc := range s390xTests { if tc.mandatory && !tc.feature { t.Errorf("Feature %s is mandatory but is not present", tc.name) } } } func TestS390XFeatures(t *testing.T) { if runtime.GOOS != "zos" { return } // Read available facilities from address 200. facilitiesAddress := uintptr(200) var facilities facilityList for i := 0; i < 4; i++ { facilities.bits[i] = *(*uint64)(unsafe.Pointer(facilitiesAddress + uintptr(8*i))) } for _, tc := range s390xTests { if want := bitIsSet(facilities.bits, tc.facility); want != tc.feature { t.Errorf("Feature %s expected %v, got %v", tc.name, want, tc.feature) } } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_arm.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu const cacheLineSize = 32 // HWCAP/HWCAP2 bits. // These are specific to Linux. const ( hwcap_SWP = 1 << 0 hwcap_HALF = 1 << 1 hwcap_THUMB = 1 << 2 hwcap_26BIT = 1 << 3 hwcap_FAST_MULT = 1 << 4 hwcap_FPA = 1 << 5 hwcap_VFP = 1 << 6 hwcap_EDSP = 1 << 7 hwcap_JAVA = 1 << 8 hwcap_IWMMXT = 1 << 9 hwcap_CRUNCH = 1 << 10 hwcap_THUMBEE = 1 << 11 hwcap_NEON = 1 << 12 hwcap_VFPv3 = 1 << 13 hwcap_VFPv3D16 = 1 << 14 hwcap_TLS = 1 << 15 hwcap_VFPv4 = 1 << 16 hwcap_IDIVA = 1 << 17 hwcap_IDIVT = 1 << 18 hwcap_VFPD32 = 1 << 19 hwcap_LPAE = 1 << 20 hwcap_EVTSTRM = 1 << 21 hwcap2_AES = 1 << 0 hwcap2_PMULL = 1 << 1 hwcap2_SHA1 = 1 << 2 hwcap2_SHA2 = 1 << 3 hwcap2_CRC32 = 1 << 4 ) func initOptions() { options = []option{ {Name: "pmull", Feature: &ARM.HasPMULL}, {Name: "sha1", Feature: &ARM.HasSHA1}, {Name: "sha2", Feature: &ARM.HasSHA2}, {Name: "swp", Feature: &ARM.HasSWP}, {Name: "thumb", Feature: &ARM.HasTHUMB}, {Name: "thumbee", Feature: &ARM.HasTHUMBEE}, {Name: "tls", Feature: &ARM.HasTLS}, {Name: "vfp", Feature: &ARM.HasVFP}, {Name: "vfpd32", Feature: &ARM.HasVFPD32}, {Name: "vfpv3", Feature: &ARM.HasVFPv3}, {Name: "vfpv3d16", Feature: &ARM.HasVFPv3D16}, {Name: "vfpv4", Feature: &ARM.HasVFPv4}, {Name: "half", Feature: &ARM.HasHALF}, {Name: "26bit", Feature: &ARM.Has26BIT}, {Name: "fastmul", Feature: &ARM.HasFASTMUL}, {Name: "fpa", Feature: &ARM.HasFPA}, {Name: "edsp", Feature: &ARM.HasEDSP}, {Name: "java", Feature: &ARM.HasJAVA}, {Name: "iwmmxt", Feature: &ARM.HasIWMMXT}, {Name: "crunch", Feature: &ARM.HasCRUNCH}, {Name: "neon", Feature: &ARM.HasNEON}, {Name: "idivt", Feature: &ARM.HasIDIVT}, {Name: "idiva", Feature: &ARM.HasIDIVA}, {Name: "lpae", Feature: &ARM.HasLPAE}, {Name: "evtstrm", Feature: &ARM.HasEVTSTRM}, {Name: "aes", Feature: &ARM.HasAES}, {Name: "crc32", Feature: &ARM.HasCRC32}, } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_arm64.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu import "runtime" // cacheLineSize is used to prevent false sharing of cache lines. // We choose 128 because Apple Silicon, a.k.a. M1, has 128-byte cache line size. // It doesn't cost much and is much more future-proof. const cacheLineSize = 128 func initOptions() { options = []option{ {Name: "fp", Feature: &ARM64.HasFP}, {Name: "asimd", Feature: &ARM64.HasASIMD}, {Name: "evstrm", Feature: &ARM64.HasEVTSTRM}, {Name: "aes", Feature: &ARM64.HasAES}, {Name: "fphp", Feature: &ARM64.HasFPHP}, {Name: "jscvt", Feature: &ARM64.HasJSCVT}, {Name: "lrcpc", Feature: &ARM64.HasLRCPC}, {Name: "pmull", Feature: &ARM64.HasPMULL}, {Name: "sha1", Feature: &ARM64.HasSHA1}, {Name: "sha2", Feature: &ARM64.HasSHA2}, {Name: "sha3", Feature: &ARM64.HasSHA3}, {Name: "sha512", Feature: &ARM64.HasSHA512}, {Name: "sm3", Feature: &ARM64.HasSM3}, {Name: "sm4", Feature: &ARM64.HasSM4}, {Name: "sve", Feature: &ARM64.HasSVE}, {Name: "sve2", Feature: &ARM64.HasSVE2}, {Name: "crc32", Feature: &ARM64.HasCRC32}, {Name: "atomics", Feature: &ARM64.HasATOMICS}, {Name: "asimdhp", Feature: &ARM64.HasASIMDHP}, {Name: "cpuid", Feature: &ARM64.HasCPUID}, {Name: "asimrdm", Feature: &ARM64.HasASIMDRDM}, {Name: "fcma", Feature: &ARM64.HasFCMA}, {Name: "dcpop", Feature: &ARM64.HasDCPOP}, {Name: "asimddp", Feature: &ARM64.HasASIMDDP}, {Name: "asimdfhm", Feature: &ARM64.HasASIMDFHM}, {Name: "dit", Feature: &ARM64.HasDIT}, {Name: "i8mm", Feature: &ARM64.HasI8MM}, } } func archInit() { switch runtime.GOOS { case "freebsd": readARM64Registers() case "linux", "netbsd", "openbsd": doinit() default: // Many platforms don't seem to allow reading these registers. setMinimalFeatures() } } // setMinimalFeatures fakes the minimal ARM64 features expected by // TestARM64minimalFeatures. func setMinimalFeatures() { ARM64.HasASIMD = true ARM64.HasFP = true } func readARM64Registers() { Initialized = true parseARM64SystemRegisters(getisar0(), getisar1(), getpfr0()) } func parseARM64SystemRegisters(isar0, isar1, pfr0 uint64) { // ID_AA64ISAR0_EL1 switch extractBits(isar0, 4, 7) { case 1: ARM64.HasAES = true case 2: ARM64.HasAES = true ARM64.HasPMULL = true } switch extractBits(isar0, 8, 11) { case 1: ARM64.HasSHA1 = true } switch extractBits(isar0, 12, 15) { case 1: ARM64.HasSHA2 = true case 2: ARM64.HasSHA2 = true ARM64.HasSHA512 = true } switch extractBits(isar0, 16, 19) { case 1: ARM64.HasCRC32 = true } switch extractBits(isar0, 20, 23) { case 2: ARM64.HasATOMICS = true } switch extractBits(isar0, 28, 31) { case 1: ARM64.HasASIMDRDM = true } switch extractBits(isar0, 32, 35) { case 1: ARM64.HasSHA3 = true } switch extractBits(isar0, 36, 39) { case 1: ARM64.HasSM3 = true } switch extractBits(isar0, 40, 43) { case 1: ARM64.HasSM4 = true } switch extractBits(isar0, 44, 47) { case 1: ARM64.HasASIMDDP = true } // ID_AA64ISAR1_EL1 switch extractBits(isar1, 0, 3) { case 1: ARM64.HasDCPOP = true } switch extractBits(isar1, 12, 15) { case 1: ARM64.HasJSCVT = true } switch extractBits(isar1, 16, 19) { case 1: ARM64.HasFCMA = true } switch extractBits(isar1, 20, 23) { case 1: ARM64.HasLRCPC = true } switch extractBits(isar1, 52, 55) { case 1: ARM64.HasI8MM = true } // ID_AA64PFR0_EL1 switch extractBits(pfr0, 16, 19) { case 0: ARM64.HasFP = true case 1: ARM64.HasFP = true ARM64.HasFPHP = true } switch extractBits(pfr0, 20, 23) { case 0: ARM64.HasASIMD = true case 1: ARM64.HasASIMD = true ARM64.HasASIMDHP = true } switch extractBits(pfr0, 32, 35) { case 1: ARM64.HasSVE = true parseARM64SVERegister(getzfr0()) } switch extractBits(pfr0, 48, 51) { case 1: ARM64.HasDIT = true } } func parseARM64SVERegister(zfr0 uint64) { switch extractBits(zfr0, 0, 3) { case 1: ARM64.HasSVE2 = true } } func extractBits(data uint64, start, end uint) uint { return (uint)(data>>start) & ((1 << (end - start + 1)) - 1) }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_linux_noinit.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build linux && !arm && !arm64 && !mips64 && !mips64le && !ppc64 && !ppc64le && !s390x package cpu func doinit() {}
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_mipsx.go
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build mips || mipsle package cpu const cacheLineSize = 32 func initOptions() {}
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_aix.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build aix package cpu const ( // getsystemcfg constants _SC_IMPL = 2 _IMPL_POWER8 = 0x10000 _IMPL_POWER9 = 0x20000 ) func archInit() { impl := getsystemcfg(_SC_IMPL) if impl&_IMPL_POWER8 != 0 { PPC64.IsPOWER8 = true } if impl&_IMPL_POWER9 != 0 { PPC64.IsPOWER8 = true PPC64.IsPOWER9 = true } Initialized = true } func getsystemcfg(label int) (n uint64) { r0, _ := callgetsystemcfg(label) n = uint64(r0) return }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_other_arm.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build !linux && arm package cpu func archInit() {}
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_loong64.go
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build loong64 package cpu const cacheLineSize = 64 func initOptions() { }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_s390x.go
// Copyright 2020 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package cpu const cacheLineSize = 256 func initOptions() { options = []option{ {Name: "zarch", Feature: &S390X.HasZARCH, Required: true}, {Name: "stfle", Feature: &S390X.HasSTFLE, Required: true}, {Name: "ldisp", Feature: &S390X.HasLDISP, Required: true}, {Name: "eimm", Feature: &S390X.HasEIMM, Required: true}, {Name: "dfp", Feature: &S390X.HasDFP}, {Name: "etf3eh", Feature: &S390X.HasETF3EH}, {Name: "msa", Feature: &S390X.HasMSA}, {Name: "aes", Feature: &S390X.HasAES}, {Name: "aescbc", Feature: &S390X.HasAESCBC}, {Name: "aesctr", Feature: &S390X.HasAESCTR}, {Name: "aesgcm", Feature: &S390X.HasAESGCM}, {Name: "ghash", Feature: &S390X.HasGHASH}, {Name: "sha1", Feature: &S390X.HasSHA1}, {Name: "sha256", Feature: &S390X.HasSHA256}, {Name: "sha3", Feature: &S390X.HasSHA3}, {Name: "sha512", Feature: &S390X.HasSHA512}, {Name: "vx", Feature: &S390X.HasVX}, {Name: "vxe", Feature: &S390X.HasVXE}, } } // bitIsSet reports whether the bit at index is set. The bit index // is in big endian order, so bit index 0 is the leftmost bit. func bitIsSet(bits []uint64, index uint) bool { return bits[index/64]&((1<<63)>>(index%64)) != 0 } // facility is a bit index for the named facility. type facility uint8 const ( // mandatory facilities zarch facility = 1 // z architecture mode is active stflef facility = 7 // store-facility-list-extended ldisp facility = 18 // long-displacement eimm facility = 21 // extended-immediate // miscellaneous facilities dfp facility = 42 // decimal-floating-point etf3eh facility = 30 // extended-translation 3 enhancement // cryptography facilities msa facility = 17 // message-security-assist msa3 facility = 76 // message-security-assist extension 3 msa4 facility = 77 // message-security-assist extension 4 msa5 facility = 57 // message-security-assist extension 5 msa8 facility = 146 // message-security-assist extension 8 msa9 facility = 155 // message-security-assist extension 9 // vector facilities vx facility = 129 // vector facility vxe facility = 135 // vector-enhancements 1 vxe2 facility = 148 // vector-enhancements 2 ) // facilityList contains the result of an STFLE call. // Bits are numbered in big endian order so the // leftmost bit (the MSB) is at index 0. type facilityList struct { bits [4]uint64 } // Has reports whether the given facilities are present. func (s *facilityList) Has(fs ...facility) bool { if len(fs) == 0 { panic("no facility bits provided") } for _, f := range fs { if !bitIsSet(s.bits[:], uint(f)) { return false } } return true } // function is the code for the named cryptographic function. type function uint8 const ( // KM{,A,C,CTR} function codes aes128 function = 18 // AES-128 aes192 function = 19 // AES-192 aes256 function = 20 // AES-256 // K{I,L}MD function codes sha1 function = 1 // SHA-1 sha256 function = 2 // SHA-256 sha512 function = 3 // SHA-512 sha3_224 function = 32 // SHA3-224 sha3_256 function = 33 // SHA3-256 sha3_384 function = 34 // SHA3-384 sha3_512 function = 35 // SHA3-512 shake128 function = 36 // SHAKE-128 shake256 function = 37 // SHAKE-256 // KLMD function codes ghash function = 65 // GHASH ) // queryResult contains the result of a Query function // call. Bits are numbered in big endian order so the // leftmost bit (the MSB) is at index 0. type queryResult struct { bits [2]uint64 } // Has reports whether the given functions are present. func (q *queryResult) Has(fns ...function) bool { if len(fns) == 0 { panic("no function codes provided") } for _, f := range fns { if !bitIsSet(q.bits[:], uint(f)) { return false } } return true } func doinit() { initS390Xbase() // We need implementations of stfle, km and so on // to detect cryptographic features. if !haveAsmFunctions() { return } // optional cryptographic functions if S390X.HasMSA { aes := []function{aes128, aes192, aes256} // cipher message km, kmc := kmQuery(), kmcQuery() S390X.HasAES = km.Has(aes...) S390X.HasAESCBC = kmc.Has(aes...) if S390X.HasSTFLE { facilities := stfle() if facilities.Has(msa4) { kmctr := kmctrQuery() S390X.HasAESCTR = kmctr.Has(aes...) } if facilities.Has(msa8) { kma := kmaQuery() S390X.HasAESGCM = kma.Has(aes...) } } // compute message digest kimd := kimdQuery() // intermediate (no padding) klmd := klmdQuery() // last (padding) S390X.HasSHA1 = kimd.Has(sha1) && klmd.Has(sha1) S390X.HasSHA256 = kimd.Has(sha256) && klmd.Has(sha256) S390X.HasSHA512 = kimd.Has(sha512) && klmd.Has(sha512) S390X.HasGHASH = kimd.Has(ghash) // KLMD-GHASH does not exist sha3 := []function{ sha3_224, sha3_256, sha3_384, sha3_512, shake128, shake256, } S390X.HasSHA3 = kimd.Has(sha3...) && klmd.Has(sha3...) } }
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_openbsd_arm64.s
// Copyright 2022 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. #include "textflag.h" TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sysctl(SB) GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB)
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/cpu_gccgo_x86.c
// Copyright 2018 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build (386 || amd64 || amd64p32) && gccgo #include <cpuid.h> #include <stdint.h> #include <x86intrin.h> // Need to wrap __get_cpuid_count because it's declared as static. int gccgoGetCpuidCount(uint32_t leaf, uint32_t subleaf, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx) { return __get_cpuid_count(leaf, subleaf, eax, ebx, ecx, edx); } #pragma GCC diagnostic ignored "-Wunknown-pragmas" #pragma GCC push_options #pragma GCC target("xsave") #pragma clang attribute push (__attribute__((target("xsave"))), apply_to=function) // xgetbv reads the contents of an XCR (Extended Control Register) // specified in the ECX register into registers EDX:EAX. // Currently, the only supported value for XCR is 0. void gccgoXgetbv(uint32_t *eax, uint32_t *edx) { uint64_t v = _xgetbv(0); *eax = v & 0xffffffff; *edx = v >> 32; } #pragma clang attribute pop #pragma GCC pop_options
cpu
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/cpu/runtime_auxv_go121_test.go
// Copyright 2023 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build go1.21 package cpu import ( "runtime" "testing" ) func TestAuxvFromRuntime(t *testing.T) { got := getAuxv() t.Logf("got: %v", got) // notably: we didn't panic if runtime.GOOS == "linux" && len(got) == 0 { t.Errorf("expected auxv on linux; got zero entries") } }
unix
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/unix/syscall_netbsd_amd64.go
// Copyright 2009 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build amd64 && netbsd package unix func setTimespec(sec, nsec int64) Timespec { return Timespec{Sec: sec, Nsec: nsec} } func setTimeval(sec, usec int64) Timeval { return Timeval{Sec: sec, Usec: int32(usec)} } func SetKevent(k *Kevent_t, fd, mode, flags int) { k.Ident = uint64(fd) k.Filter = uint32(mode) k.Flags = uint32(flags) } func (iov *Iovec) SetLen(length int) { iov.Len = uint64(length) } func (msghdr *Msghdr) SetControllen(length int) { msghdr.Controllen = uint32(length) } func (msghdr *Msghdr) SetIovlen(length int) { msghdr.Iovlen = int32(length) } func (cmsg *Cmsghdr) SetLen(length int) { cmsg.Len = uint32(length) }
unix
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/unix/gccgo_linux_amd64.go
// Copyright 2015 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build gccgo && linux && amd64 package unix import "syscall" //extern gettimeofday func realGettimeofday(*Timeval, *byte) int32 func gettimeofday(tv *Timeval) (err syscall.Errno) { r := realGettimeofday(tv, nil) if r < 0 { return syscall.GetErrno() } return 0 }
unix
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/unix/mksyscall_aix_ppc64.go
// Copyright 2019 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. //go:build ignore /* This program reads a file containing function prototypes (like syscall_aix.go) and generates system call bodies. The prototypes are marked by lines beginning with "//sys" and read like func declarations if //sys is replaced by func, but: * The parameter lists must give a name for each argument. This includes return parameters. * The parameter lists must give a type for each argument: the (x, y, z int) shorthand is not allowed. * If the return parameter is an error number, it must be named err. * If go func name needs to be different than its libc name, * or the function is not in libc, name could be specified * at the end, after "=" sign, like //sys getsockopt(s int, level int, name int, val uintptr, vallen *_Socklen) (err error) = libsocket.getsockopt This program will generate three files and handle both gc and gccgo implementation: - zsyscall_aix_ppc64.go: the common part of each implementation (error handler, pointer creation) - zsyscall_aix_ppc64_gc.go: gc part with //go_cgo_import_dynamic and a call to syscall6 - zsyscall_aix_ppc64_gccgo.go: gccgo part with C function and conversion to C type. The generated code looks like this zsyscall_aix_ppc64.go func asyscall(...) (n int, err error) { // Pointer Creation r1, e1 := callasyscall(...) // Type Conversion // Error Handler return } zsyscall_aix_ppc64_gc.go //go:cgo_import_dynamic libc_asyscall asyscall "libc.a/shr_64.o" //go:linkname libc_asyscall libc_asyscall var asyscall syscallFunc func callasyscall(...) (r1 uintptr, e1 Errno) { r1, _, e1 = syscall6(uintptr(unsafe.Pointer(&libc_asyscall)), "nb_args", ... ) return } zsyscall_aix_ppc64_ggcgo.go // int asyscall(...) import "C" func callasyscall(...) (r1 uintptr, e1 Errno) { r1 = uintptr(C.asyscall(...)) e1 = syscall.GetErrno() return } */ package main import ( "bufio" "flag" "fmt" "os" "regexp" "strings" ) var ( b32 = flag.Bool("b32", false, "32bit big-endian") l32 = flag.Bool("l32", false, "32bit little-endian") aix = flag.Bool("aix", false, "aix") tags = flag.String("tags", "", "build tags") ) // cmdLine returns this programs's commandline arguments func cmdLine() string { return "go run mksyscall_aix_ppc64.go " + strings.Join(os.Args[1:], " ") } // goBuildTags returns build tags in the go:build format. func goBuildTags() string { return strings.ReplaceAll(*tags, ",", " && ") } // Param is function parameter type Param struct { Name string Type string } // usage prints the program usage func usage() { fmt.Fprintf(os.Stderr, "usage: go run mksyscall_aix_ppc64.go [-b32 | -l32] [-tags x,y] [file ...]\n") os.Exit(1) } // parseParamList parses parameter list and returns a slice of parameters func parseParamList(list string) []string { list = strings.TrimSpace(list) if list == "" { return []string{} } return regexp.MustCompile(`\s*,\s*`).Split(list, -1) } // parseParam splits a parameter into name and type func parseParam(p string) Param { ps := regexp.MustCompile(`^(\S*) (\S*)$`).FindStringSubmatch(p) if ps == nil { fmt.Fprintf(os.Stderr, "malformed parameter: %s\n", p) os.Exit(1) } return Param{ps[1], ps[2]} } func main() { flag.Usage = usage flag.Parse() if len(flag.Args()) <= 0 { fmt.Fprintf(os.Stderr, "no files to parse provided\n") usage() } endianness := "" if *b32 { endianness = "big-endian" } else if *l32 { endianness = "little-endian" } pack := "" // GCCGO textgccgo := "" cExtern := "/*\n#include <stdint.h>\n" // GC textgc := "" dynimports := "" linknames := "" var vars []string // COMMON textcommon := "" for _, path := range flag.Args() { file, err := os.Open(path) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } s := bufio.NewScanner(file) for s.Scan() { t := s.Text() if p := regexp.MustCompile(`^package (\S+)$`).FindStringSubmatch(t); p != nil && pack == "" { pack = p[1] } nonblock := regexp.MustCompile(`^\/\/sysnb\t`).FindStringSubmatch(t) if regexp.MustCompile(`^\/\/sys\t`).FindStringSubmatch(t) == nil && nonblock == nil { continue } // Line must be of the form // func Open(path string, mode int, perm int) (fd int, err error) // Split into name, in params, out params. f := regexp.MustCompile(`^\/\/sys(nb)?\t(\w+)\(([^()]*)\)\s*(?:\(([^()]+)\))?\s*(?:=\s*(?:(\w*)\.)?(\w*))?$`).FindStringSubmatch(t) if f == nil { fmt.Fprintf(os.Stderr, "%s:%s\nmalformed //sys declaration\n", path, t) os.Exit(1) } funct, inps, outps, modname, sysname := f[2], f[3], f[4], f[5], f[6] // Split argument lists on comma. in := parseParamList(inps) out := parseParamList(outps) inps = strings.Join(in, ", ") outps = strings.Join(out, ", ") if sysname == "" { sysname = funct } onlyCommon := false if funct == "FcntlInt" || funct == "FcntlFlock" || funct == "ioctlPtr" { // This function call another syscall which is already implemented. // Therefore, the gc and gccgo part must not be generated. onlyCommon = true } // Try in vain to keep people from editing this file. // The theory is that they jump into the middle of the file // without reading the header. textcommon += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n" if !onlyCommon { textgccgo += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n" textgc += "// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT\n\n" } // Check if value return, err return available errvar := "" rettype := "" for _, param := range out { p := parseParam(param) if p.Type == "error" { errvar = p.Name } else { rettype = p.Type } } sysname = regexp.MustCompile(`([a-z])([A-Z])`).ReplaceAllString(sysname, `${1}_$2`) sysname = strings.ToLower(sysname) // All libc functions are lowercase. // GCCGO Prototype return type cRettype := "" if rettype == "unsafe.Pointer" { cRettype = "uintptr_t" } else if rettype == "uintptr" { cRettype = "uintptr_t" } else if regexp.MustCompile(`^_`).FindStringSubmatch(rettype) != nil { cRettype = "uintptr_t" } else if rettype == "int" { cRettype = "int" } else if rettype == "int32" { cRettype = "int" } else if rettype == "int64" { cRettype = "long long" } else if rettype == "uint32" { cRettype = "unsigned int" } else if rettype == "uint64" { cRettype = "unsigned long long" } else { cRettype = "int" } if sysname == "exit" { cRettype = "void" } // GCCGO Prototype arguments type var cIn []string for i, param := range in { p := parseParam(param) if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil { cIn = append(cIn, "uintptr_t") } else if p.Type == "string" { cIn = append(cIn, "uintptr_t") } else if regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type) != nil { cIn = append(cIn, "uintptr_t", "size_t") } else if p.Type == "unsafe.Pointer" { cIn = append(cIn, "uintptr_t") } else if p.Type == "uintptr" { cIn = append(cIn, "uintptr_t") } else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil { cIn = append(cIn, "uintptr_t") } else if p.Type == "int" { if (i == 0 || i == 2) && funct == "fcntl" { // These fcntl arguments needs to be uintptr to be able to call FcntlInt and FcntlFlock cIn = append(cIn, "uintptr_t") } else { cIn = append(cIn, "int") } } else if p.Type == "int32" { cIn = append(cIn, "int") } else if p.Type == "int64" { cIn = append(cIn, "long long") } else if p.Type == "uint32" { cIn = append(cIn, "unsigned int") } else if p.Type == "uint64" { cIn = append(cIn, "unsigned long long") } else { cIn = append(cIn, "int") } } if !onlyCommon { // GCCGO Prototype Generation // Imports of system calls from libc if sysname == "select" { // select is a keyword of Go. Its name is // changed to c_select. cExtern += "#define c_select select\n" } cExtern += fmt.Sprintf("%s %s", cRettype, sysname) cIn := strings.Join(cIn, ", ") cExtern += fmt.Sprintf("(%s);\n", cIn) } // GC Library name if modname == "" { modname = "libc.a/shr_64.o" } else { fmt.Fprintf(os.Stderr, "%s: only syscall using libc are available\n", funct) os.Exit(1) } sysvarname := fmt.Sprintf("libc_%s", sysname) if !onlyCommon { // GC Runtime import of function to allow cross-platform builds. dynimports += fmt.Sprintf("//go:cgo_import_dynamic %s %s \"%s\"\n", sysvarname, sysname, modname) // GC Link symbol to proc address variable. linknames += fmt.Sprintf("//go:linkname %s %s\n", sysvarname, sysvarname) // GC Library proc address variable. vars = append(vars, sysvarname) } strconvfunc := "BytePtrFromString" strconvtype := "*byte" // Go function header. if outps != "" { outps = fmt.Sprintf(" (%s)", outps) } if textcommon != "" { textcommon += "\n" } textcommon += fmt.Sprintf("func %s(%s)%s {\n", funct, strings.Join(in, ", "), outps) // Prepare arguments tocall. var argscommon []string // Arguments in the common part var argscall []string // Arguments for call prototype var argsgc []string // Arguments for gc call (with syscall6) var argsgccgo []string // Arguments for gccgo call (with C.name_of_syscall) n := 0 argN := 0 for _, param := range in { p := parseParam(param) if regexp.MustCompile(`^\*`).FindStringSubmatch(p.Type) != nil { argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(%s))", p.Name)) argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name)) argsgc = append(argsgc, p.Name) argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) } else if p.Type == "string" && errvar != "" { textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype) textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name) textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar) argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n)) argscall = append(argscall, fmt.Sprintf("_p%d uintptr ", n)) argsgc = append(argsgc, fmt.Sprintf("_p%d", n)) argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n)) n++ } else if p.Type == "string" { fmt.Fprintf(os.Stderr, path+":"+funct+" uses string arguments, but has no error return\n") textcommon += fmt.Sprintf("\tvar _p%d %s\n", n, strconvtype) textcommon += fmt.Sprintf("\t_p%d, %s = %s(%s)\n", n, errvar, strconvfunc, p.Name) textcommon += fmt.Sprintf("\tif %s != nil {\n\t\treturn\n\t}\n", errvar) argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n)) argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n)) argsgc = append(argsgc, fmt.Sprintf("_p%d", n)) argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n)) n++ } else if m := regexp.MustCompile(`^\[\](.*)`).FindStringSubmatch(p.Type); m != nil { // Convert slice into pointer, length. // Have to be careful not to take address of &a[0] if len == 0: // pass nil in that case. textcommon += fmt.Sprintf("\tvar _p%d *%s\n", n, m[1]) textcommon += fmt.Sprintf("\tif len(%s) > 0 {\n\t\t_p%d = &%s[0]\n\t}\n", p.Name, n, p.Name) argscommon = append(argscommon, fmt.Sprintf("uintptr(unsafe.Pointer(_p%d))", n), fmt.Sprintf("len(%s)", p.Name)) argscall = append(argscall, fmt.Sprintf("_p%d uintptr", n), fmt.Sprintf("_lenp%d int", n)) argsgc = append(argsgc, fmt.Sprintf("_p%d", n), fmt.Sprintf("uintptr(_lenp%d)", n)) argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(_p%d)", n), fmt.Sprintf("C.size_t(_lenp%d)", n)) n++ } else if p.Type == "int64" && endianness != "" { fmt.Fprintf(os.Stderr, path+":"+funct+" uses int64 with 32 bits mode. Case not yet implemented\n") } else if p.Type == "bool" { fmt.Fprintf(os.Stderr, path+":"+funct+" uses bool. Case not yet implemented\n") } else if regexp.MustCompile(`^_`).FindStringSubmatch(p.Type) != nil || p.Type == "unsafe.Pointer" { argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name)) argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name)) argsgc = append(argsgc, p.Name) argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) } else if p.Type == "int" { if (argN == 0 || argN == 2) && ((funct == "fcntl") || (funct == "FcntlInt") || (funct == "FcntlFlock")) { // These fcntl arguments need to be uintptr to be able to call FcntlInt and FcntlFlock argscommon = append(argscommon, fmt.Sprintf("uintptr(%s)", p.Name)) argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name)) argsgc = append(argsgc, p.Name) argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) } else { argscommon = append(argscommon, p.Name) argscall = append(argscall, fmt.Sprintf("%s int", p.Name)) argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name)) } } else if p.Type == "int32" { argscommon = append(argscommon, p.Name) argscall = append(argscall, fmt.Sprintf("%s int32", p.Name)) argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name)) } else if p.Type == "int64" { argscommon = append(argscommon, p.Name) argscall = append(argscall, fmt.Sprintf("%s int64", p.Name)) argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) argsgccgo = append(argsgccgo, fmt.Sprintf("C.longlong(%s)", p.Name)) } else if p.Type == "uint32" { argscommon = append(argscommon, p.Name) argscall = append(argscall, fmt.Sprintf("%s uint32", p.Name)) argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) argsgccgo = append(argsgccgo, fmt.Sprintf("C.uint(%s)", p.Name)) } else if p.Type == "uint64" { argscommon = append(argscommon, p.Name) argscall = append(argscall, fmt.Sprintf("%s uint64", p.Name)) argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) argsgccgo = append(argsgccgo, fmt.Sprintf("C.ulonglong(%s)", p.Name)) } else if p.Type == "uintptr" { argscommon = append(argscommon, p.Name) argscall = append(argscall, fmt.Sprintf("%s uintptr", p.Name)) argsgc = append(argsgc, p.Name) argsgccgo = append(argsgccgo, fmt.Sprintf("C.uintptr_t(%s)", p.Name)) } else { argscommon = append(argscommon, fmt.Sprintf("int(%s)", p.Name)) argscall = append(argscall, fmt.Sprintf("%s int", p.Name)) argsgc = append(argsgc, fmt.Sprintf("uintptr(%s)", p.Name)) argsgccgo = append(argsgccgo, fmt.Sprintf("C.int(%s)", p.Name)) } argN++ } nargs := len(argsgc) // COMMON function generation argscommonlist := strings.Join(argscommon, ", ") callcommon := fmt.Sprintf("call%s(%s)", sysname, argscommonlist) ret := []string{"_", "_"} body := "" doErrno := false for i := 0; i < len(out); i++ { p := parseParam(out[i]) reg := "" if p.Name == "err" { reg = "e1" ret[1] = reg doErrno = true } else { reg = "r0" ret[0] = reg } if p.Type == "bool" { reg = fmt.Sprintf("%s != 0", reg) } if reg != "e1" { body += fmt.Sprintf("\t%s = %s(%s)\n", p.Name, p.Type, reg) } } if ret[0] == "_" && ret[1] == "_" { textcommon += fmt.Sprintf("\t%s\n", callcommon) } else { textcommon += fmt.Sprintf("\t%s, %s := %s\n", ret[0], ret[1], callcommon) } textcommon += body if doErrno { textcommon += "\tif e1 != 0 {\n" textcommon += "\t\terr = errnoErr(e1)\n" textcommon += "\t}\n" } textcommon += "\treturn\n" textcommon += "}\n" if onlyCommon { continue } // CALL Prototype callProto := fmt.Sprintf("func call%s(%s) (r1 uintptr, e1 Errno) {\n", sysname, strings.Join(argscall, ", ")) // GC function generation asm := "syscall6" if nonblock != nil { asm = "rawSyscall6" } if len(argsgc) <= 6 { for len(argsgc) < 6 { argsgc = append(argsgc, "0") } } else { fmt.Fprintf(os.Stderr, "%s: too many arguments to system call", funct) os.Exit(1) } argsgclist := strings.Join(argsgc, ", ") callgc := fmt.Sprintf("%s(uintptr(unsafe.Pointer(&%s)), %d, %s)", asm, sysvarname, nargs, argsgclist) textgc += callProto textgc += fmt.Sprintf("\tr1, _, e1 = %s\n", callgc) textgc += "\treturn\n}\n" // GCCGO function generation argsgccgolist := strings.Join(argsgccgo, ", ") var callgccgo string if sysname == "select" { // select is a keyword of Go. Its name is // changed to c_select. callgccgo = fmt.Sprintf("C.c_%s(%s)", sysname, argsgccgolist) } else { callgccgo = fmt.Sprintf("C.%s(%s)", sysname, argsgccgolist) } textgccgo += callProto textgccgo += fmt.Sprintf("\tr1 = uintptr(%s)\n", callgccgo) textgccgo += "\te1 = syscall.GetErrno()\n" textgccgo += "\treturn\n}\n" } if err := s.Err(); err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } file.Close() } imp := "" if pack != "unix" { imp = "import \"golang.org/x/sys/unix\"\n" } // Print zsyscall_aix_ppc64.go err := os.WriteFile("zsyscall_aix_ppc64.go", []byte(fmt.Sprintf(srcTemplate1, cmdLine(), goBuildTags(), pack, imp, textcommon)), 0644) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } // Print zsyscall_aix_ppc64_gc.go vardecls := "\t" + strings.Join(vars, ",\n\t") vardecls += " syscallFunc" err = os.WriteFile("zsyscall_aix_ppc64_gc.go", []byte(fmt.Sprintf(srcTemplate2, cmdLine(), goBuildTags(), pack, imp, dynimports, linknames, vardecls, textgc)), 0644) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } // Print zsyscall_aix_ppc64_gccgo.go err = os.WriteFile("zsyscall_aix_ppc64_gccgo.go", []byte(fmt.Sprintf(srcTemplate3, cmdLine(), goBuildTags(), pack, cExtern, imp, textgccgo)), 0644) if err != nil { fmt.Fprintf(os.Stderr, err.Error()) os.Exit(1) } } const srcTemplate1 = `// %s // Code generated by the command above; see README.md. DO NOT EDIT. //go:build %s package %s import ( "unsafe" ) %s %s ` const srcTemplate2 = `// %s // Code generated by the command above; see README.md. DO NOT EDIT. //go:build %s && gc package %s import ( "unsafe" ) %s %s %s type syscallFunc uintptr var ( %s ) // Implemented in runtime/syscall_aix.go. func rawSyscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) func syscall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err Errno) %s ` const srcTemplate3 = `// %s // Code generated by the command above; see README.md. DO NOT EDIT. //go:build %s && gccgo package %s %s */ import "C" import ( "syscall" ) %s %s `
unix
/home/linuxreitt/Michinereitt/Tuning/Workshop_Scripts/hf-codegen/data/golang_public_repos/sys/unix/zsyscall_linux_386.go
// go run mksyscall.go -l32 -tags linux,386 syscall_linux.go syscall_linux_386.go syscall_linux_alarm.go // Code generated by the command above; see README.md. DO NOT EDIT. //go:build linux && 386 package unix import ( "syscall" "unsafe" ) var _ syscall.Errno // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func fanotifyMark(fd int, flags uint, mask uint64, dirFd int, pathname *byte) (err error) { _, _, e1 := Syscall6(SYS_FANOTIFY_MARK, uintptr(fd), uintptr(flags), uintptr(mask), uintptr(mask>>32), uintptr(dirFd), uintptr(unsafe.Pointer(pathname))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fallocate(fd int, mode uint32, off int64, len int64) (err error) { _, _, e1 := Syscall6(SYS_FALLOCATE, uintptr(fd), uintptr(mode), uintptr(off), uintptr(off>>32), uintptr(len), uintptr(len>>32)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Tee(rfd int, wfd int, len int, flags int) (n int64, err error) { r0, r1, e1 := Syscall6(SYS_TEE, uintptr(rfd), uintptr(wfd), uintptr(len), uintptr(flags), 0, 0) n = int64(int64(r1)<<32 | int64(r0)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func EpollWait(epfd int, events []EpollEvent, msec int) (n int, err error) { var _p0 unsafe.Pointer if len(events) > 0 { _p0 = unsafe.Pointer(&events[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_EPOLL_WAIT, uintptr(epfd), uintptr(_p0), uintptr(len(events)), uintptr(msec), 0, 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fadvise(fd int, offset int64, length int64, advice int) (err error) { _, _, e1 := Syscall6(SYS_FADVISE64_64, uintptr(fd), uintptr(offset), uintptr(offset>>32), uintptr(length), uintptr(length>>32), uintptr(advice)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fchown(fd int, uid int, gid int) (err error) { _, _, e1 := Syscall(SYS_FCHOWN32, uintptr(fd), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstat(fd int, stat *Stat_t) (err error) { _, _, e1 := Syscall(SYS_FSTAT64, uintptr(fd), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Fstatat(dirfd int, path string, stat *Stat_t, flags int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall6(SYS_FSTATAT64, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), uintptr(flags), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ftruncate(fd int, length int64) (err error) { _, _, e1 := Syscall(SYS_FTRUNCATE64, uintptr(fd), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getegid() (egid int) { r0, _ := RawSyscallNoError(SYS_GETEGID32, 0, 0, 0) egid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Geteuid() (euid int) { r0, _ := RawSyscallNoError(SYS_GETEUID32, 0, 0, 0) euid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getgid() (gid int) { r0, _ := RawSyscallNoError(SYS_GETGID32, 0, 0, 0) gid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Getuid() (uid int) { r0, _ := RawSyscallNoError(SYS_GETUID32, 0, 0, 0) uid = int(r0) return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ioperm(from int, num int, on int) (err error) { _, _, e1 := Syscall(SYS_IOPERM, uintptr(from), uintptr(num), uintptr(on)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Iopl(level int) (err error) { _, _, e1 := Syscall(SYS_IOPL, uintptr(level), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lchown(path string, uid int, gid int) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LCHOWN32, uintptr(unsafe.Pointer(_p0)), uintptr(uid), uintptr(gid)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Lstat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_LSTAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pread(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PREAD64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func pwrite(fd int, p []byte, offset int64) (n int, err error) { var _p0 unsafe.Pointer if len(p) > 0 { _p0 = unsafe.Pointer(&p[0]) } else { _p0 = unsafe.Pointer(&_zero) } r0, _, e1 := Syscall6(SYS_PWRITE64, uintptr(fd), uintptr(_p0), uintptr(len(p)), uintptr(offset), uintptr(offset>>32), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Renameat(olddirfd int, oldpath string, newdirfd int, newpath string) (err error) { var _p0 *byte _p0, err = BytePtrFromString(oldpath) if err != nil { return } var _p1 *byte _p1, err = BytePtrFromString(newpath) if err != nil { return } _, _, e1 := Syscall6(SYS_RENAMEAT, uintptr(olddirfd), uintptr(unsafe.Pointer(_p0)), uintptr(newdirfd), uintptr(unsafe.Pointer(_p1)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func sendfile(outfd int, infd int, offset *int64, count int) (written int, err error) { r0, _, e1 := Syscall6(SYS_SENDFILE64, uintptr(outfd), uintptr(infd), uintptr(unsafe.Pointer(offset)), uintptr(count), 0, 0) written = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setfsgid(gid int) (prev int, err error) { r0, _, e1 := Syscall(SYS_SETFSGID32, uintptr(gid), 0, 0) prev = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setfsuid(uid int) (prev int, err error) { r0, _, e1 := Syscall(SYS_SETFSUID32, uintptr(uid), 0, 0) prev = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Splice(rfd int, roff *int64, wfd int, woff *int64, len int, flags int) (n int, err error) { r0, _, e1 := Syscall6(SYS_SPLICE, uintptr(rfd), uintptr(unsafe.Pointer(roff)), uintptr(wfd), uintptr(unsafe.Pointer(woff)), uintptr(len), uintptr(flags)) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Stat(path string, stat *Stat_t) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_STAT64, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(stat)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func SyncFileRange(fd int, off int64, n int64, flags int) (err error) { _, _, e1 := Syscall6(SYS_SYNC_FILE_RANGE, uintptr(fd), uintptr(off), uintptr(off>>32), uintptr(n), uintptr(n>>32), uintptr(flags)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Truncate(path string, length int64) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_TRUNCATE64, uintptr(unsafe.Pointer(_p0)), uintptr(length), uintptr(length>>32)) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Ustat(dev int, ubuf *Ustat_t) (err error) { _, _, e1 := Syscall(SYS_USTAT, uintptr(dev), uintptr(unsafe.Pointer(ubuf)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getgroups(n int, list *_Gid_t) (nn int, err error) { r0, _, e1 := RawSyscall(SYS_GETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0) nn = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func setgroups(n int, list *_Gid_t) (err error) { _, _, e1 := RawSyscall(SYS_SETGROUPS32, uintptr(n), uintptr(unsafe.Pointer(list)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Select(nfd int, r *FdSet, w *FdSet, e *FdSet, timeout *Timeval) (n int, err error) { r0, _, e1 := Syscall6(SYS__NEWSELECT, uintptr(nfd), uintptr(unsafe.Pointer(r)), uintptr(unsafe.Pointer(w)), uintptr(unsafe.Pointer(e)), uintptr(unsafe.Pointer(timeout)), 0) n = int(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func mmap2(addr uintptr, length uintptr, prot int, flags int, fd int, pageOffset uintptr) (xaddr uintptr, err error) { r0, _, e1 := Syscall6(SYS_MMAP2, uintptr(addr), uintptr(length), uintptr(prot), uintptr(flags), uintptr(fd), uintptr(pageOffset)) xaddr = uintptr(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Pause() (err error) { _, _, e1 := Syscall(SYS_PAUSE, 0, 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func getrlimit(resource int, rlim *rlimit32) (err error) { _, _, e1 := RawSyscall(SYS_GETRLIMIT, uintptr(resource), uintptr(unsafe.Pointer(rlim)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func futimesat(dirfd int, path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_FUTIMESAT, uintptr(dirfd), uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times))) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Gettimeofday(tv *Timeval) (err error) { _, _, e1 := RawSyscall(SYS_GETTIMEOFDAY, uintptr(unsafe.Pointer(tv)), 0, 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Time(t *Time_t) (tt Time_t, err error) { r0, _, e1 := RawSyscall(SYS_TIME, uintptr(unsafe.Pointer(t)), 0, 0) tt = Time_t(r0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Utime(path string, buf *Utimbuf) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIME, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(buf)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func utimes(path string, times *[2]Timeval) (err error) { var _p0 *byte _p0, err = BytePtrFromString(path) if err != nil { return } _, _, e1 := Syscall(SYS_UTIMES, uintptr(unsafe.Pointer(_p0)), uintptr(unsafe.Pointer(times)), 0) if e1 != 0 { err = errnoErr(e1) } return } // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT func Alarm(seconds uint) (remaining uint, err error) { r0, _, e1 := Syscall(SYS_ALARM, uintptr(seconds), 0, 0) remaining = uint(r0) if e1 != 0 { err = errnoErr(e1) } return }