Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(274)

Side by Side Diff: src/untrusted/irt/irt_dev.h

Issue 984713003: Add an IRT interface for subzero/compiler to serve_translate_requests. (Closed) Base URL: https://chromium.googlesource.com/native_client/src/native_client.git@master
Patch Set: size_t Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2013 The Native Client Authors. All rights reserved. 2 * Copyright (c) 2013 The Native Client Authors. All rights reserved.
3 * Use of this source code is governed by a BSD-style license that can be 3 * Use of this source code is governed by a BSD-style license that can be
4 * found in the LICENSE file. 4 * found in the LICENSE file.
5 */ 5 */
6 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H_ 6 #ifndef NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H_
7 #define NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H_ 7 #define NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H_
8 8
9 #include <stdarg.h> 9 #include <stdarg.h>
10 #include <stddef.h> 10 #include <stddef.h>
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 * success or a non-zero value on error. 131 * success or a non-zero value on error.
132 */ 132 */
133 #define NACL_IRT_PRIVATE_PNACL_TRANSLATOR_LINK_v0_1 \ 133 #define NACL_IRT_PRIVATE_PNACL_TRANSLATOR_LINK_v0_1 \
134 "nacl-irt-private-pnacl-translator-link-0.1" 134 "nacl-irt-private-pnacl-translator-link-0.1"
135 struct nacl_irt_private_pnacl_translator_link { 135 struct nacl_irt_private_pnacl_translator_link {
136 void (*serve_link_request)(int (*func)(int nexe_fd, 136 void (*serve_link_request)(int (*func)(int nexe_fd,
137 const int *obj_file_fds, 137 const int *obj_file_fds,
138 int obj_file_fd_count)); 138 int obj_file_fd_count));
139 }; 139 };
140 140
141 /*
142 * This is an internal interface, for use by PNaCl's sandboxed compilers for
143 * communicating with the browser. This applies to pnacl-llc and pnacl-sz
144 * though how pnacl-llc and pnacl-sz use the interface can be slightly
145 * different (e.g., pnacl-sz will only use the first the obj_file_fds entry).
146 *
147 * serve_translate_request(funcs) loops waiting for sequences of requests
148 * via IPC, and then calls the appropriate callback to handle the IPC,
149 * on the same thread.
150 *
151 * (*) init_callback is used to initialize the translation process
Mark Seaborn 2015/03/26 20:39:00 Nit: how about putting the per-function comments b
jvoung (off chromium) 2015/03/26 22:30:11 That sounds good. Done.
152 * with configuration info:
153 * |num_threads| is the number of recommended *translate* threads
154 * to use (there may be other worker threads). For pnacl-sz,
155 * num_threads == 0 is for completely sequential translation
156 * (no worker threads).
157 * |obj_file_fds| is an array of FDs for writing an output object file.
158 * Not all fds are valid.
Mark Seaborn 2015/03/26 20:39:00 What does it mean for an FD to be invalid? Does t
jvoung (off chromium) 2015/03/26 22:30:12 Hmm, right... I mixed up the "array length" from t
159 * |obj_file_fd_count| number of valid fds in the beginning of the
Mark Seaborn 2015/03/26 20:39:00 "fds" -> "FDs" for consistency. Same above.
jvoung (off chromium) 2015/03/26 22:30:12 Done.
160 * |obj_file_fds| array (the array may have invalid fds at the end).
161 * |cmd_flags| is \0 delimited set of command-line flags.
Mark Seaborn 2015/03/26 20:39:00 Do you mean "terminated" rather than "delimited"?
jvoung (off chromium) 2015/03/26 22:30:12 I really meant null-delimited. At the time we thou
162 * |cmd_flags_len| is the length of the |cmd_flags| array.
Mark Seaborn 2015/03/26 20:39:00 Isn't this redundant if cmd_flags is null-terminat
jvoung (off chromium) 2015/03/26 22:30:12 Changed this to mean the same as "argc".
163 * (*) data_callback is invoked to stream additional bitcode data
164 * to the translator.
165 * (*) end_callback is invoked to signal the end of the data stream.
166 * This must block until translation is actually complete and
167 * the translator process can be terminated.
168 *
169 * All callbacks return zero on success or a non-zero value on error.
170 * TODO(jvoung): Add error output.
171 */
172 struct irt_pnacl_compile_funcs {
Mark Seaborn 2015/03/26 20:39:00 Use "nacl_irt_" prefix for consistency?
jvoung (off chromium) 2015/03/26 22:30:12 Done.
173 int (*init_callback)(uint32_t num_threads,
174 int *obj_file_fds, size_t obj_file_fd_count,
175 const char *cmd_flags, size_t cmd_flags_len);
176 int (*data_callback)(unsigned char *data, size_t num_bytes);
Mark Seaborn 2015/03/26 20:39:00 Nit: maybe "const void *" instead, to match read/w
jvoung (off chromium) 2015/03/26 22:30:12 Done. The underlying LLVM QueueStreamer doesn't ta
177 int (*end_callback)(void);
178 /* TODO(jvoung): have a separate method for getting internal UMA stats. */
179 };
180
181 #define NACL_IRT_PRIVATE_PNACL_TRANSLATOR_COMPILE_v0_1 \
182 "nacl-irt-private-pnacl-translator-compile-0.1"
183 struct nacl_irt_private_pnacl_translator_compile {
184 void (*serve_translate_request)(
185 const struct irt_pnacl_compile_funcs *funcs);
186 };
187
141 #if defined(__cplusplus) 188 #if defined(__cplusplus)
142 } 189 }
143 #endif 190 #endif
144 191
145 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H */ 192 #endif /* NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_DEV_H */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698