Source/Packages

Runtime.NativeSocketEndpoint

packages/execution/src/Runtime/NativeSocketEndpoint.alpha

351 lines15 declarations16.0 KiBSHA-256 1e45c8e4599a

def · lines 110–212

nativeSocketReadConnectStatus

Full file
Writability includes refusal. Read the full int SO_ERROR, negate its errno, and only then report success. Reuse the no-longer-live pollfd stack bytes.
110def nativeSocketReadConnectStatus =
111  (lambda unrestricted tail : (family X86NativeAssembly) .
112    (nativePhysicalNativeEmit
113      (nativePhysicalNativeMoveImmediate32
114        (constructor X86NativeRegister64 X86NativeRAX)
115        (nativeSocketImmediate 0))
116      (nativePhysicalNativeEmit
117        (constructor
118          X86NativeInstruction
119          X86NativeStoreMemory32
120          (constructor X86NativeRegister64 X86NativeRSP)
121          (nativeSocketDisplacement nativeSocketPollSlot)
122          (constructor X86NativeRegister64 X86NativeRAX))
123        (nativePhysicalNativeEmit
124          (nativePhysicalNativeMoveImmediate32
125            (constructor X86NativeRegister64 X86NativeRAX)
126            (nativeSocketImmediate nativeSocketPollFdBytes))
127          (nativePhysicalNativeEmit
128            (constructor
129              X86NativeInstruction
130              X86NativeStoreMemory32
131              (constructor X86NativeRegister64 X86NativeRSP)
132              (nativeSocketDisplacement nativeSocketPollEventsSlot)
133              (constructor X86NativeRegister64 X86NativeRAX))
134            (nativePhysicalNativeEmit
135              (nativePhysicalNativeMove
136                (constructor X86NativeRegister64 X86NativeRBX)
137                (constructor X86NativeRegister64 X86NativeRDI))
138              (nativePhysicalNativeEmit
139                (nativePhysicalNativeMoveImmediate32
140                  (constructor X86NativeRegister64 X86NativeRSI)
141                  (nativeSocketImmediate 1))
142                (nativePhysicalNativeEmit
143                  (nativePhysicalNativeMoveImmediate32
144                    (constructor X86NativeRegister64 X86NativeRDX)
145                    (nativeSocketImmediate 4))
146                  (nativePhysicalNativeEmit
147                    (nativePhysicalNativeMove
148                      (constructor X86NativeRegister64 X86NativeRSP)
149                      (constructor X86NativeRegister64 X86NativeR10))
150                    (nativePhysicalNativeEmit
151                      (nativePhysicalNativeAddImmediate
152                        (constructor X86NativeRegister64 X86NativeR10)
153                        (nativeSocketImmediate nativeSocketPollSlot))
154                      (nativePhysicalNativeEmit
155                        (nativePhysicalNativeMove
156                          (constructor X86NativeRegister64 X86NativeRSP)
157                          (constructor X86NativeRegister64 X86NativeR8))
158                        (nativePhysicalNativeEmit
159                          (nativePhysicalNativeAddImmediate
160                            (constructor X86NativeRegister64 X86NativeR8)
161                            (nativeSocketImmediate nativeSocketPollEventsSlot))
162                          (nativePhysicalNativeEmit
163                            (nativePhysicalNativeMoveImmediate32
164                              (constructor X86NativeRegister64 X86NativeRAX)
165                              (nativeSocketImmediate 55))
166                            (nativePhysicalNativeEmit
167                              nativePhysicalNativeSystemCallInstruction
168                              (nativePhysicalNativeEmit
169                                (nativePhysicalNativeCompareImmediate
170                                  (constructor X86NativeRegister64 X86NativeRAX)
171                                  (nativeSocketImmediate (naturalSaturatingSubtract 4294967296 4)))
172                                (nativePhysicalNativeJumpCondition
173                                  (constructor X86NativeCondition X86NativeConditionZero)
174                                  b"socket-loop"
175                                  (nativePhysicalNativeEmit
176                                    (nativePhysicalNativeTest
177                                      (constructor X86NativeRegister64 X86NativeRAX)
178                                      (constructor X86NativeRegister64 X86NativeRAX))
179                                    (nativePhysicalNativeJumpCondition
180                                      (constructor X86NativeCondition X86NativeConditionSign)
181                                      b"socket-return"
182                                      (nativePhysicalNativeEmit
183                                        (constructor
184                                        X86NativeInstruction
185                                        X86NativeLoadMemory32ZeroExtend64
186                                        (constructor X86NativeRegister64 X86NativeR13)
187                                        (constructor X86NativeRegister64 X86NativeRSP)
188                                        (nativeSocketDisplacement nativeSocketPollEventsSlot))
189                                        (nativePhysicalNativeEmit
190                                        (nativePhysicalNativeCompareImmediate
191                                        (constructor X86NativeRegister64 X86NativeR13)
192                                        (nativeSocketImmediate nativeSocketPollFdBytes))
193                                        (nativePhysicalNativeJumpCondition
194                                        (constructor X86NativeCondition X86NativeConditionNotZero)
195                                        b"socket-invalid"
196                                        (nativePhysicalNativeEmit
197                                        (constructor
198                                        X86NativeInstruction
199                                        X86NativeLoadMemory32ZeroExtend64
200                                        (constructor X86NativeRegister64 X86NativeR13)
201                                        (constructor X86NativeRegister64 X86NativeRSP)
202                                        (nativeSocketDisplacement nativeSocketPollSlot))
203                                        (nativePhysicalNativeEmit
204                                        (constructor
205                                        X86NativeInstruction
206                                        X86NativeClear32
207                                        (constructor X86NativeRegister64 X86NativeRAX))
208                                        (nativePhysicalNativeEmit
209                                        (nativePhysicalNativeSubtract
210                                        (constructor X86NativeRegister64 X86NativeR13)
211                                        (constructor X86NativeRegister64 X86NativeRAX))
212                                        (nativePhysicalNativeJump b"socket-return" tail)))))))))))))))))))))))))

The compiler supplied declaration spans and resolved links from this source snapshot. This page does not assert that this file belongs to a checked closure.