P_Socket IPv4Bind
Primitive: Bind the AsynchronousSocketChannel referenced by the specified handle to an IPv4 address and port. The bytes of the address are specified in network byte order, i.e., big-endian.
Author
Todd L Smith
Functions
Record that some number of nanoseconds were just expended checking the type of the value returned by this primitive.
Record that some number of nanoseconds were just expended running this primitive.
Attempt this primitive with the given Interpreter. The interpreter's argument list must be set up prior to this call. If the primitive fails, it should set the primitive failure code by calling Interpreter.primitiveFailure and returning its result from the primitive. Otherwise it should set the interpreter's primitive result by calling Interpreter.primitiveSuccess and then return its result from the primitive. For unusual primitives that replace the current continuation, Result.CONTINUATION_CHANGED is more appropriate, and the latestResult need not be set. For primitives that need to cause a context switch, Result.FIBER_SUSPENDED should be returned.
Attempt to generate a simplified, faster invocation of the given constant function, with the given argument restrictions. The arguments will be on the stack, the last-pushed one at stackp. If this code generation attempt is successful, code will be generated to invoke the given function, and if it completes without reification, to check the return result if it's not already guaranteed correct. Note that the call and the return type check can't be in separate instructions, since there's nowhere to store the unchecked return value to compare it against the expected type. We can't just clobber the expected type (that was pushed at the start of the call), since that would
Return a function type that restricts actual primitive blocks defined using that primitive. The actual block's argument types must be at least as specific as this function type's argument types, and the actual block's return type must be at least as general as this function type's return type. That's equivalent to the condition that the actual block's type is a subtype of this function type.
To simplify styling during bootstrapping, a method defined by the pragma mechanism can have its primitive declare a styler primitive to plug in as that method definition's styler.
Answer whether a raw function using this primitive can/should have nybblecode instructions.
Answer the fallibility of the primitive for a call site with the given argument types.
Write a JVM invocation of this primitive. This sets up the interpreter, calls Interpreter.beforeAttemptPrimitive, calls Primitive.attempt, calls Interpreter.afterAttemptPrimitive, and records statistics as needed. It also deals with primitive failures, suspensions, and reifications.
Test whether the specified Flag is set for this primitive.
Answer the type of the result that will be produced by a call site with the given argument types. Don't include semantic restrictions defined in the Avail code, but if convenient answer something stronger than the return type in the primitive's basic function type.
The primitive couldn't be folded out, and the primitive failed to produce specialized L2 instructions for itself. If the primitive is still known to be infallible (and does not affect the continuation stack) at this site, generate an L2_RUN_INFALLIBLE_PRIMITIVE for it and answer true, ensuring control flow will go to the appropriate CallSiteHelper exit point, and leave the translator NOT at a currentReachable() point.
The primitive couldn't be folded out, so see if alternative instructions can be generated for its invocation. If so, answer true, ensure control flow will go to the appropriate CallSiteHelper exit point, and leave the translator NOT at a currentReachable() point. If the alternative instructions could not be generated for this primitive, answer false, and generate nothing.
Generate suitable primitive failure code on the given L1InstructionWriter. Some primitives may have special requirements, but most (fallible) primitives follow the same pattern.
Properties
The number of arguments the primitive expects. The value -1 is used by the special primitive P_PushConstant to indicate it may have any number of arguments. However, note that that primitive cannot be used explicitly in Avail code.
A type to constrain the A_Type.writeType of the variable declaration within the primitive declaration of a block. The actual variable's inner type must be this or a supertype.
The Statistic for abandoning the stack due to a primitive attempt answering Result.CONTINUATION_CHANGED.
The Statistic for reification prior to invoking a primitive that does not have Flag.CanInline set.