Open Network Computing ( ONC ) Remote Procedure Call ( RPC ), commonly known as Sun RPC is a remote procedure call system. ONC was originally developed by Sun Microsystems in the 1980s as part of their Network File System project.
66-614: ONC is based on calling conventions used in Unix and the C programming language . It serializes data using the External Data Representation (XDR), which has also found some use to encode and decode data in files that are to be accessed on more than one platform. ONC then delivers the XDR payload using either UDP or TCP . Access to RPC services on a machine are provided via a port mapper that listens for queries on
132-544: A map [ string ] interface {} (map of string to empty interface). This recursively describes data in the form of a dictionary with string keys and values of any type. Interface values are implemented using pointer to data and a second pointer to run-time type information. Like some other types implemented using pointers in Go, interface values are nil if uninitialized. Since version 1.18, Go supports generic code using parameterized types. Functions and types now have
198-431: A data structure . Dummy arguments are created for arguments which are constants or which do not agree with the type of argument the called procedure expects. Go language Go is a fast statically typed , compiled high-level general purpose programming language . It is known for its simplicity and efficiency . It was designed at Google in 2009 by Robert Griesemer , Rob Pike , and Ken Thompson . It
264-419: A stack frame on the call stack . There are design choices for how the tasks of preparing for a function call and restoring the environment after the function has completed are divided between the caller and the callee. Some calling convention specifies the way every function should get called. The correct calling convention should be used for every function call, to allow the correct and reliable execution of
330-974: A well-known port (number 111) over UDP and TCP. ONC RPC version 2 was first described in RFC 1050 published in April 1988. In June 1988 it was updated by RFC 1057 . Later it was updated by RFC 1831 , published in August 1995. RFC 5531 , published in May 2009, is the current version. All these documents describe only version 2 and version 1 was not covered by any RFC document. Authentication mechanisms used by ONC RPC are described in RFC 2695, RFC 2203, and RFC 2623. Implementations of ONC RPC exist in most Unix-like systems. Microsoft supplied an implementation for Windows in their (now discontinued) Microsoft Windows Services for UNIX product; in addition,
396-476: A 64-bit variation called O64. For 64-bit, the N64 ABI (not related to Nintendo 64 ) by Silicon Graphics is most commonly used. The most important improvement is that eight registers are now available for argument passing; It also increases the number of floating-point registers to 32. There is also an ILP32 version called N32, which uses 32-bit pointers for smaller code, analogous to the x32 ABI . Both run under
462-413: A defined calling convention with two flavors, with or without floating point. It passes arguments in registers whenever possible. The POWER , PowerPC , and Power ISA architectures have a large number of registers so most functions can pass all arguments in registers for single level calls. Additional arguments are passed on the stack, and space for register-based arguments is also always allocated on
528-402: A function call with a public interface. This calling convention causes a "typical" ARM subroutine to: The 64-bit ARM ( AArch64 ) calling convention allocates the 31 general-purpose registers as: All registers starting with x have a corresponding 32-bit register prefixed with w . Thus, a 32-bit x0 is called w0. Similarly, the 32 floating-point registers are allocated as: RISC-V has
594-458: A function type; thus, func(string, int32) (int, error) is the type of functions that take a string and a 32-bit signed integer, and return a signed integer (of default width) and a value of the built-in interface type error . Any named type has a method set associated with it. The IP address example above can be extended with a method for checking whether its value is a known standard: Due to nominal typing, this method definition adds
660-413: A given program's language may differ from the calling convention of the underlying platform, OS, or of some library being linked to. For example, on 32-bit Windows , operating system calls have the stdcall calling convention, whereas many C programs that run there use the cdecl calling convention. To accommodate these differences in calling convention, compilers often permit keywords that specify
726-472: A limited form of structural typing in the otherwise nominal type system of Go. An object which is of an interface type is also of another type, much like C++ objects being simultaneously of a base and derived class. Go interfaces were designed after protocols from the Smalltalk programming language. Multiple sources use the term duck typing when describing Go interfaces. Although the term duck typing
SECTION 10
#1732798666383792-410: A method to ipv4addr , but not on uint32 . While methods have special definition and call syntax, there is no distinct method type. Go provides two features that replace class inheritance . The first is embedding , which can be viewed as an automated form of composition . The second are its interfaces , which provides runtime polymorphism . Interfaces are a class of types and provide
858-470: A number of third-party implementation of ONC RPC for Windows exist, including versions for C / C++ , Java , and .NET (see external links). In 2009, Sun relicensed the ONC RPC code under the standard 3-clause BSD license and then reconfirmed by Oracle Corporation in 2010 following confusion about the scope of the relicensing. Calling convention In computer science , a calling convention
924-553: A run-time type check. The language constructs to do so are the type assertion , which checks against a single potential type: and the type switch , which checks against multiple types: The empty interface interface {} is an important base case because it can refer to an item of any concrete type. It is similar to the Object class in Java or C# and is satisfied by any type, including built-in types like int . Code using
990-401: A set of types (known as type set) using | (Union) operator, as well as a set of methods. These changes were made to support type constraints in generics code. For a generic function or type, a constraint can be thought of as the type of the type argument: a meta-type. This new ~T syntax will be the first use of ~ as a token in Go. ~T means the set of all types whose underlying type
1056-426: A weakness that might be changed at some point. The Google team built at least one compiler for an experimental Go dialect with generics, but did not release it. In August 2018, the Go principal contributors published draft designs for generic programming and error handling and asked users to submit feedback. However, the error handling proposal was eventually abandoned. In June 2020, a new draft design document
1122-406: Is T . Go uses the iota keyword to create enumerated constants. In Go's package system, each package has a path (e.g., "compress/bzip2" or "golang.org/x/net/html" ) and a name (e.g., bzip2 or html ). References to other packages' definitions must always be prefixed with the other package's name, and only the capitalized names from other packages are accessible: io.Reader
1188-416: Is syntactically similar to C , but also has memory safety , garbage collection , structural typing , and CSP -style concurrency . It is often referred to as Golang because of its former domain name, golang.org , but its proper name is Go. There are two major implementations: A third-party source-to-source compiler , GopherJS, compiles Go to JavaScript for front-end web development . Go
1254-673: Is a statement. In Go, statements are separated by ending a line (hitting the Enter key) or by a semicolon " ; ". Hitting the Enter key adds " ; " to the end of the line implicitly (does not show up in the source code). The left curly bracket { cannot come at the start of a line. Go has a number of built-in types, including numeric ones ( byte , int64 , float32 , etc.), Booleans , and byte strings ( string ). Strings are immutable; built-in operators and keywords (rather than functions) provide concatenation, comparison, and UTF-8 encoding/decoding. Record types can be defined with
1320-405: Is an implementation -level (low-level) scheme for how subroutines or functions receive parameters from their caller and how they return a result. When some code calls a function, design choices have been taken for where and how parameters are passed to that function, and where and how results are returned from that function, with these transfers typically done via certain registers or within
1386-431: Is not precisely defined and therefore not wrong, it usually implies that type conformance is not statically checked. Because conformance to a Go interface is checked statically by the Go compiler (except when performing a type assertion), the Go authors prefer the term structural typing . The definition of an interface type lists required methods by name and type. Any object of type T for which functions exist matching all
SECTION 20
#17327986663831452-487: Is one of language's major selling points. Go is influenced by C (especially the Plan 9 dialect ), but with an emphasis on greater simplicity and safety. It consists of: Go's syntax includes changes from C aimed at keeping code concise and readable. A combined declaration/initialization operator was introduced that allows the programmer to write i := 3 or s := "Hello, world!" , without specifying
1518-475: Is responsible for saving ACC, EXT, X1, and X2. There are two pseudo-operations for calling subroutines, CALL to code non-relocatable subroutines directly linked with the main program, and LIBF to call relocatable library subroutines through a transfer vector . Both pseudo-ops resolve to a Branch and Store IAR ( BSI ) machine instruction that stores the address of the next instruction at its effective address (EA) and branches to EA+1. Arguments follow
1584-401: Is returned in a register. Some conventions use registers for the first few parameters which may improve performance, especially for short and simple leaf-routines very frequently invoked (i.e. routines that do not call other routines). Example call: Typical callee structure: (some or all (except ret) of the instructions below may be optimized away in simple procedures). Some conventions leave
1650-623: Is usually defined on a higher abstraction level and seen as a part of the language rather than as a low-level implementation detail of a particular language's compiler . Calling conventions may differ in: Sometimes multiple calling conventions appear on a single platform; a given platform and language implementation may offer a choice of calling conventions. Reasons for this include performance, adaptation of conventions of other popular languages, and restrictions or conventions imposed by various " computing platforms ". Many architectures only have one widely-used calling convention, often suggested by
1716-622: The BSI —usually these are one-word addresses of arguments—the called routine must know how many arguments to expect so that it can skip over them on return. Alternatively, arguments can be passed in registers. Function routines returned the result in ACC for real arguments, or in a memory location referred to as the Real Number Pseudo-Accumulator (FAC). Arguments and the return address were addressed using an offset to
1782-493: The struct keyword. For each type T and each non-negative integer constant n , there is an array type denoted [ n ] T ; arrays of differing lengths are thus of different types. Dynamic arrays are available as "slices", denoted [] T for some type T . These have a length and a capacity specifying when new memory needs to be allocated to expand the array. Several slices may share their underlying memory. Pointers are available for all types, and
1848-489: The uint32 value x as an IP address. Simply assigning x to a variable of type ipv4addr is a type error. Constant expressions may be either typed or "untyped"; they are given a type when assigned to a typed variable if the value they represent passes a compile-time check. Function types are indicated by the func keyword; they take zero or more parameters and return zero or more values, all of which are typed. The parameter and return values determine
1914-751: The System/390 ABI and the z/Architecture ABI, used in Linux: Additional arguments are passed on the stack. Note: "preserved" reserves to callee saving; same goes for "guaranteed". The most common calling convention for the Motorola 68000 series is: The IBM 1130 was a small 16-bit word-addressable machine. It had only six registers plus condition indicators, and no stack. The registers are Instruction Address Register (IAR) , Accumulator (ACC) , Accumulator Extension (EXT) , and three index registers X1–X3. The calling program
1980-423: The "out" registers (%o0-%o7). The "in" registers are used to pass arguments to the function being called, and any additional arguments need to be pushed onto the stack . However, space is always allocated by the called function to handle a potential register window overflow, local variables, and (on 32-bit SPARC) returning a struct by value. To call a function, one places the arguments for the function to be called in
2046-412: The "out" registers; when the function is called, the "out" registers become the "in" registers and the called function accesses the arguments in its "in" registers. When the called function completes, it places the return value in the first "in" register, which becomes the first "out" register when the called function returns. The System V ABI , which most modern Unix -like systems follow, passes
Sun RPC - Misplaced Pages Continue
2112-491: The 64-bit mode of the CPU. A few attempts have been made to replace O32 with a 32-bit ABI that resembles N32 more. A 1995 conference came up with MIPS EABI, for which the 32-bit version was quite similar. EABI inspired MIPS Technologies to propose a more radical "NUBI" ABI that additionally reuses argument registers for the return value. MIPS EABI is supported by GCC but not LLVM; neither supports NUBI. For all of O32 and N32/N64,
2178-499: The AMD64 System V ABI, is used by Unix-like systems and, with some changes, by OpenVMS . As x86-64 has more general-purpose registers than does 16-bit x86, both conventions pass some arguments in registers. The standard 32-bit ARM calling convention allocates the 16 general-purpose registers as: If the type of value returned is too large to fit in r0 to r3, or whose size cannot be determined statically at compile time, then
2244-555: The API, and not ABI. Sometimes APIs do include keywords to specify the calling convention for functions. Calling conventions do not typically include information on handling lifespan of dynamically-allocated structures and objects. Other supplementary documentation may state where the responsibility for freeing up allocated memory lies. Calling conventions are unlikely to specify the layout of items within structures and objects, such as byte ordering or structure packing. For some languages,
2310-512: The Go project. Go is a humanist sans-serif resembling Lucida Grande , and Go Mono is monospaced . Both fonts adhere to the WGL4 character set and were designed to be legible with a large x-height and distinct letterforms . Both Go and Go Mono adhere to the DIN 1450 standard by having a slashed zero, lowercase l with a tail, and an uppercase I with serifs. In April 2018, the original logo
2376-526: The IAR value stored in the first location of the subroutine. Subroutines in IBM 1130, CDC 6600 and PDP-8 (all three computers were introduced in 1965) store the return address in the first location of a subroutine. Threaded code places all the responsibility for setting up for and cleaning up after a function call on the called code. The calling code does nothing but list the subroutines to be called. This puts all
2442-447: The ability to be generic using type parameters. These type parameters are specified within square brackets, right after the function or type name. The compiler transforms the generic function or type into non-generic by substituting type arguments for the type parameters provided, either explicitly by the user or type inference by the compiler. This transformation process is referred to as type instantiation. Interfaces now can define
2508-471: The architect. For RISCs including SPARC, MIPS, and RISC-V , registers names based on this calling convention are often used. For example, MIPS registers $ 4 through $ 7 have "ABI names" $ a0 through $ a3 , reflecting their use for parameter passing in the standard calling convention. (RISC CPUs have many equivalent general-purpose registers so there's typically no hardware reason for giving them names other than numbers.) The calling convention of
2574-402: The argument addresses are passed via an argument list in memory. A final, hidden, address may be passed pointing to an area to contain the return value. Because of the wide variety of data types supported by PL/I a data descriptor may also be passed to define, for example, the lengths of character or bit strings, the dimension and bounds of arrays ( dope vectors ), or the layout and contents of
2640-404: The caller must allocate space for that value at run time, and pass a pointer to that space in r0. Subroutines must preserve the contents of r4 to r11 and the stack pointer (perhaps by saving them to the stack in the function prologue , then using them as scratch space, then restoring them from the stack in the function epilogue ). In particular, subroutines that call other subroutines must save
2706-460: The calling convention for a given function. The function declarations will include additional platform-specific keywords that indicate the calling convention to be used. When handled correctly, the compiler will generate code to call functions in the appropriate manner. Some languages allow the calling convention for a function to be explicitly specified with that function; other languages will have some calling convention but it will be hidden from
Sun RPC - Misplaced Pages Continue
2772-407: The calling convention includes details of error or exception handling, (e.g. Go , Java ) and for others, it does not (e.g. C++ ). For Remote procedure calls , there is an analogous concept called Marshalling . Calling conventions may be related to a particular programming language's evaluation strategy , but most often are not considered part of it (or vice versa), as the evaluation strategy
2838-457: The effect of creating a combined interface that is satisfied by exactly the types that implement the embedded interface and any methods that the newly defined interface adds. The Go standard library uses interfaces to provide genericity in several places, including the input/output system that is based on the concepts of Reader and Writer . Besides calling methods via interfaces, Go allows converting interface values to other types with
2904-600: The empty interface cannot simply call methods (or built-in operators) on the referred-to object, but it can store the interface {} value, try to convert it to a more useful type via a type assertion or type switch, or inspect it with Go's reflect package. Because interface {} can refer to any value, it is a limited way to escape the restrictions of static typing, like void * in C but with additional run-time type checks. The interface {} type can be used to model structured data of any arbitrary schema in Go, such as JSON or YAML data, by representing it as
2970-525: The first six arguments in "in" registers %i0 through %i5, reserving %i6 for the frame pointer and %i7 for the return address. The IBM System/360 is another architecture without a hardware stack. The examples below illustrate the calling convention used by OS/360 and successors prior to the introduction of 64-bit z/Architecture ; other operating systems for System/360 might have different calling conventions. Calling program: Called program: Standard entry sequence: Standard return sequence: Notes: In
3036-467: The function setup and clean-up code in one place—the prologue and epilogue of the function—rather than in the many places that function is called. This makes threaded code the most compact calling convention. Threaded code passes all arguments on the stack. All return values are returned on the stack. This makes naive implementations slower than calling conventions that keep more values in registers. However, threaded code implementations that cache several of
3102-499: The general-purpose registers; a routine returns to its caller with a branch instruction that uses the link register as the destination address. Leaf routines do not need to save or restore the link register; non-leaf routines must save the return address before making a call to another routine and restore it before it returns, saving it by using the Move From Special Purpose Register instruction to move
3168-415: The language, with special syntax and built-in functions. chan T is a channel that allows sending values of type T between concurrent Go processes . Aside from its support for interfaces , Go's type system is nominal : the type keyword can be used to define a new named type , which is distinct from other named types that have the same layout (in the case of a struct , the same members in
3234-524: The link register to a general-purpose register and, if necessary, then saving it to the stack, and restoring it by, if it was saved to the stack, loading the saved link register value to a general-purpose register, and then using the Move To Special Purpose Register instruction to move the register containing the saved link-register value to the link register. The O32 ABI is the most commonly-used ABI, owing to its status as
3300-411: The original System V ABI for MIPS. It is strictly stack-based, with only four registers $ a0-$ a3 available to pass arguments. This perceived slowness, along with an antique floating-point model with 16 registers only, has encouraged the proliferation of many other calling conventions. The ABI took shape in 1990 and was never updated since 1994. It is only defined for 32-bit MIPS, but GCC has created
3366-415: The parameter space allocated, using plain ret instead of ret imm16 . In that case, the caller could add esp,12 in this example, or otherwise deal with the change to ESP. The 64-bit version of the x86 architecture, known as x86-64 , AMD64, and Intel 64, has two calling sequences in common use. One calling sequence, defined by Microsoft, is used on Windows; the other calling sequence, specified in
SECTION 50
#17327986663833432-594: The pointer-to- T type is denoted * T . Address-taking and indirection use the & and * operators, as in C, or happen implicitly through the method call or attribute access syntax. There is no pointer arithmetic, except via the special unsafe.Pointer type in the standard library. For a pair of types K , V , the type map[ K ] V is the type mapping type- K keys to type- V values, though Go Programming Language specification does not give any performance guarantees or implementation requirements for map types. Hash tables are built into
3498-463: The required methods of interface type I is an object of type I as well. The definition of type T need not (and cannot) identify type I. For example, if Shape , Square and Circle are defined as then both a Square and a Circle are implicitly a Shape and can be assigned to a Shape -typed variable. In formal language, Go's interface system provides structural rather than nominal typing. Interfaces can embed other interfaces with
3564-408: The return address in the link register r14 to the stack before calling those other subroutines. However, such subroutines do not need to return that value to r14—they merely need to load that value into r15, the program counter, to return. The ARM calling convention mandates using a full-descending stack. In addition, the stack pointer must always be 4-byte aligned, and must always be 8-byte aligned at
3630-483: The return address is stored in a $ ra register. This is automatically set with the use of the JAL (jump and link) or JALR (jump and link register) instructions. The stack grows downwards. The SPARC architecture, unlike most RISC architectures, is built on register windows . There are 24 accessible registers in each register window: 8 are the "in" registers (%i0-%i7), 8 are the "local" registers (%l0-%l7), and 8 are
3696-421: The same order). Some conversions between types (e.g., between the various integer types) are pre-defined and adding a new type may define additional conversions, but conversions between named types must always be invoked explicitly. For example, the type keyword can be used to define a type for IPv4 addresses, based on 32-bit unsigned integers as follows: With this type definition, ipv4addr(x) interprets
3762-438: The stack as a convenience to the called function in case multi-level calls are used (recursive or otherwise) and the registers must be saved. This is also of use in variadic functions , such as printf() , where the function's arguments need to be accessed as an array. A single calling convention is used for all procedural languages. Branch-and-link instructions store the return address in a special link register separate from
3828-410: The standard library. All versions up through the current Go 1.23 release have maintained this promise. Go does not follow SemVer ; rather, each major Go release is supported until there are two newer major releases. Unlike most software, Go calls the second number in a version the major, i.e., in 1.x x is the major version. This is because Go plans to never reach 2.0, given that compatibility
3894-494: The top stack values in registers—in particular, the return address—are usually faster than subroutine calling conventions that always push and pop the return address to the stack. The default calling convention for programs written in the PL/I language passes all arguments by reference , although other conventions may optionally be specified. The arguments are handled differently for different compilers and platforms, but typically
3960-679: The types of variables used. This contrasts with C's int i = 3 ; and const char * s = "Hello, world!" ; . Semicolons still terminate statements; but are implicit when the end of a line occurs. Methods may return multiple values, and returning a result , err pair is the conventional way a method indicates an error to its caller in Go. Go adds literal syntaxes for initializing struct parameters by name and for initializing maps and slices . As an alternative to C's three-statement for loop, Go's range expressions allow concise iteration over arrays, slices, strings, maps, and channels. fmt.Println("Hello World!")
4026-400: The users of that language, and therefore will not typically be a consideration for the programmer. The 32-bit version of the x86 architecture is used with many different calling conventions. Due to the small number of architectural registers, and historical focus on simplicity and small code-size, many x86 calling conventions pass arguments on the stack. The return value (or a pointer to it)
SECTION 60
#17327986663834092-523: The whole program using these functions. Calling conventions are usually considered part of the application binary interface (ABI). They may be considered a contract between the caller and the called function. The names or meanings of the parameters and return values are defined in the application programming interface (API, as opposed to ABI), which is a separate though related concept to ABI and calling convention. The names of members within passed structures and objects would also be considered part of
4158-460: Was designed at Google in 2007 to improve programming productivity in an era of multicore , networked machines and large codebases . The designers wanted to address criticisms of other languages in use at Google, but keep their useful characteristics: Its designers were primarily motivated by their shared dislike of C++ . Go was publicly announced in November 2009, and version 1.0
4224-409: Was published that would add the necessary syntax to Go for declaring generic functions and types. A code translation tool, go2go , was provided to allow users to try the new syntax, along with a generics-enabled version of the online Go Playground. Generics were finally added to Go in version 1.18 on March 15, 2022. Go 1 guarantees compatibility for the language specification and major parts of
4290-441: Was redesigned by brand designer Adam Smith. The new logo is a modern, stylized GO slanting right with trailing streamlines. (The Gopher mascot remained the same. ) The lack of support for generic programming in initial versions of Go drew considerable criticism. The designers expressed an openness to generic programming and noted that built-in functions were in fact type-generic, but are treated as special cases; Pike called this
4356-487: Was released in March 2012. Go is widely used in production at Google and in many other organizations and open-source projects. The Gopher mascot was introduced in 2009 for the open source launch of the language. The design, by Renée French , borrowed from a c. 2000 WFMU promotion. In November 2016, the Go and Go Mono fonts were released by type designers Charles Bigelow and Kris Holmes specifically for use by
#382617