assemble.c 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603
  1. #include <stdbool.h>
  2. #include "Python.h"
  3. #include "pycore_code.h" // write_location_entry_start()
  4. #include "pycore_compile.h"
  5. #include "pycore_opcode.h" // _PyOpcode_Caches[] and opcode category macros
  6. #include "pycore_pymem.h" // _PyMem_IsPtrFreed()
  7. #define DEFAULT_CODE_SIZE 128
  8. #define DEFAULT_LNOTAB_SIZE 16
  9. #define DEFAULT_CNOTAB_SIZE 32
  10. #undef SUCCESS
  11. #undef ERROR
  12. #define SUCCESS 0
  13. #define ERROR -1
  14. #define RETURN_IF_ERROR(X) \
  15. if ((X) == -1) { \
  16. return ERROR; \
  17. }
  18. typedef _PyCompilerSrcLocation location;
  19. typedef _PyCompile_Instruction instruction;
  20. typedef _PyCompile_InstructionSequence instr_sequence;
  21. static inline bool
  22. same_location(location a, location b)
  23. {
  24. return a.lineno == b.lineno &&
  25. a.end_lineno == b.end_lineno &&
  26. a.col_offset == b.col_offset &&
  27. a.end_col_offset == b.end_col_offset;
  28. }
  29. struct assembler {
  30. PyObject *a_bytecode; /* bytes containing bytecode */
  31. int a_offset; /* offset into bytecode */
  32. PyObject *a_except_table; /* bytes containing exception table */
  33. int a_except_table_off; /* offset into exception table */
  34. /* Location Info */
  35. int a_lineno; /* lineno of last emitted instruction */
  36. PyObject* a_linetable; /* bytes containing location info */
  37. int a_location_off; /* offset of last written location info frame */
  38. };
  39. static int
  40. assemble_init(struct assembler *a, int firstlineno)
  41. {
  42. memset(a, 0, sizeof(struct assembler));
  43. a->a_lineno = firstlineno;
  44. a->a_linetable = NULL;
  45. a->a_location_off = 0;
  46. a->a_except_table = NULL;
  47. a->a_bytecode = PyBytes_FromStringAndSize(NULL, DEFAULT_CODE_SIZE);
  48. if (a->a_bytecode == NULL) {
  49. goto error;
  50. }
  51. a->a_linetable = PyBytes_FromStringAndSize(NULL, DEFAULT_CNOTAB_SIZE);
  52. if (a->a_linetable == NULL) {
  53. goto error;
  54. }
  55. a->a_except_table = PyBytes_FromStringAndSize(NULL, DEFAULT_LNOTAB_SIZE);
  56. if (a->a_except_table == NULL) {
  57. goto error;
  58. }
  59. return SUCCESS;
  60. error:
  61. Py_XDECREF(a->a_bytecode);
  62. Py_XDECREF(a->a_linetable);
  63. Py_XDECREF(a->a_except_table);
  64. return ERROR;
  65. }
  66. static void
  67. assemble_free(struct assembler *a)
  68. {
  69. Py_XDECREF(a->a_bytecode);
  70. Py_XDECREF(a->a_linetable);
  71. Py_XDECREF(a->a_except_table);
  72. }
  73. static inline void
  74. write_except_byte(struct assembler *a, int byte) {
  75. unsigned char *p = (unsigned char *) PyBytes_AS_STRING(a->a_except_table);
  76. p[a->a_except_table_off++] = byte;
  77. }
  78. #define CONTINUATION_BIT 64
  79. static void
  80. assemble_emit_exception_table_item(struct assembler *a, int value, int msb)
  81. {
  82. assert ((msb | 128) == 128);
  83. assert(value >= 0 && value < (1 << 30));
  84. if (value >= 1 << 24) {
  85. write_except_byte(a, (value >> 24) | CONTINUATION_BIT | msb);
  86. msb = 0;
  87. }
  88. if (value >= 1 << 18) {
  89. write_except_byte(a, ((value >> 18)&0x3f) | CONTINUATION_BIT | msb);
  90. msb = 0;
  91. }
  92. if (value >= 1 << 12) {
  93. write_except_byte(a, ((value >> 12)&0x3f) | CONTINUATION_BIT | msb);
  94. msb = 0;
  95. }
  96. if (value >= 1 << 6) {
  97. write_except_byte(a, ((value >> 6)&0x3f) | CONTINUATION_BIT | msb);
  98. msb = 0;
  99. }
  100. write_except_byte(a, (value&0x3f) | msb);
  101. }
  102. /* See Objects/exception_handling_notes.txt for details of layout */
  103. #define MAX_SIZE_OF_ENTRY 20
  104. static int
  105. assemble_emit_exception_table_entry(struct assembler *a, int start, int end,
  106. _PyCompile_ExceptHandlerInfo *handler)
  107. {
  108. Py_ssize_t len = PyBytes_GET_SIZE(a->a_except_table);
  109. if (a->a_except_table_off + MAX_SIZE_OF_ENTRY >= len) {
  110. RETURN_IF_ERROR(_PyBytes_Resize(&a->a_except_table, len * 2));
  111. }
  112. int size = end-start;
  113. assert(end > start);
  114. int target = handler->h_offset;
  115. int depth = handler->h_startdepth - 1;
  116. if (handler->h_preserve_lasti > 0) {
  117. depth -= 1;
  118. }
  119. assert(depth >= 0);
  120. int depth_lasti = (depth<<1) | handler->h_preserve_lasti;
  121. assemble_emit_exception_table_item(a, start, (1<<7));
  122. assemble_emit_exception_table_item(a, size, 0);
  123. assemble_emit_exception_table_item(a, target, 0);
  124. assemble_emit_exception_table_item(a, depth_lasti, 0);
  125. return SUCCESS;
  126. }
  127. static int
  128. assemble_exception_table(struct assembler *a, instr_sequence *instrs)
  129. {
  130. int ioffset = 0;
  131. _PyCompile_ExceptHandlerInfo handler;
  132. handler.h_offset = -1;
  133. handler.h_preserve_lasti = -1;
  134. int start = -1;
  135. for (int i = 0; i < instrs->s_used; i++) {
  136. instruction *instr = &instrs->s_instrs[i];
  137. if (instr->i_except_handler_info.h_offset != handler.h_offset) {
  138. if (handler.h_offset >= 0) {
  139. RETURN_IF_ERROR(
  140. assemble_emit_exception_table_entry(a, start, ioffset, &handler));
  141. }
  142. start = ioffset;
  143. handler = instr->i_except_handler_info;
  144. }
  145. ioffset += _PyCompile_InstrSize(instr->i_opcode, instr->i_oparg);
  146. }
  147. if (handler.h_offset >= 0) {
  148. RETURN_IF_ERROR(assemble_emit_exception_table_entry(a, start, ioffset, &handler));
  149. }
  150. return SUCCESS;
  151. }
  152. /* Code location emitting code. See locations.md for a description of the format. */
  153. #define MSB 0x80
  154. static void
  155. write_location_byte(struct assembler* a, int val)
  156. {
  157. PyBytes_AS_STRING(a->a_linetable)[a->a_location_off] = val&255;
  158. a->a_location_off++;
  159. }
  160. static uint8_t *
  161. location_pointer(struct assembler* a)
  162. {
  163. return (uint8_t *)PyBytes_AS_STRING(a->a_linetable) +
  164. a->a_location_off;
  165. }
  166. static void
  167. write_location_first_byte(struct assembler* a, int code, int length)
  168. {
  169. a->a_location_off += write_location_entry_start(
  170. location_pointer(a), code, length);
  171. }
  172. static void
  173. write_location_varint(struct assembler* a, unsigned int val)
  174. {
  175. uint8_t *ptr = location_pointer(a);
  176. a->a_location_off += write_varint(ptr, val);
  177. }
  178. static void
  179. write_location_signed_varint(struct assembler* a, int val)
  180. {
  181. uint8_t *ptr = location_pointer(a);
  182. a->a_location_off += write_signed_varint(ptr, val);
  183. }
  184. static void
  185. write_location_info_short_form(struct assembler* a, int length, int column, int end_column)
  186. {
  187. assert(length > 0 && length <= 8);
  188. int column_low_bits = column & 7;
  189. int column_group = column >> 3;
  190. assert(column < 80);
  191. assert(end_column >= column);
  192. assert(end_column - column < 16);
  193. write_location_first_byte(a, PY_CODE_LOCATION_INFO_SHORT0 + column_group, length);
  194. write_location_byte(a, (column_low_bits << 4) | (end_column - column));
  195. }
  196. static void
  197. write_location_info_oneline_form(struct assembler* a, int length, int line_delta, int column, int end_column)
  198. {
  199. assert(length > 0 && length <= 8);
  200. assert(line_delta >= 0 && line_delta < 3);
  201. assert(column < 128);
  202. assert(end_column < 128);
  203. write_location_first_byte(a, PY_CODE_LOCATION_INFO_ONE_LINE0 + line_delta, length);
  204. write_location_byte(a, column);
  205. write_location_byte(a, end_column);
  206. }
  207. static void
  208. write_location_info_long_form(struct assembler* a, location loc, int length)
  209. {
  210. assert(length > 0 && length <= 8);
  211. write_location_first_byte(a, PY_CODE_LOCATION_INFO_LONG, length);
  212. write_location_signed_varint(a, loc.lineno - a->a_lineno);
  213. assert(loc.end_lineno >= loc.lineno);
  214. write_location_varint(a, loc.end_lineno - loc.lineno);
  215. write_location_varint(a, loc.col_offset + 1);
  216. write_location_varint(a, loc.end_col_offset + 1);
  217. }
  218. static void
  219. write_location_info_none(struct assembler* a, int length)
  220. {
  221. write_location_first_byte(a, PY_CODE_LOCATION_INFO_NONE, length);
  222. }
  223. static void
  224. write_location_info_no_column(struct assembler* a, int length, int line_delta)
  225. {
  226. write_location_first_byte(a, PY_CODE_LOCATION_INFO_NO_COLUMNS, length);
  227. write_location_signed_varint(a, line_delta);
  228. }
  229. #define THEORETICAL_MAX_ENTRY_SIZE 25 /* 1 + 6 + 6 + 6 + 6 */
  230. static int
  231. write_location_info_entry(struct assembler* a, location loc, int isize)
  232. {
  233. Py_ssize_t len = PyBytes_GET_SIZE(a->a_linetable);
  234. if (a->a_location_off + THEORETICAL_MAX_ENTRY_SIZE >= len) {
  235. assert(len > THEORETICAL_MAX_ENTRY_SIZE);
  236. RETURN_IF_ERROR(_PyBytes_Resize(&a->a_linetable, len*2));
  237. }
  238. if (loc.lineno < 0) {
  239. write_location_info_none(a, isize);
  240. return SUCCESS;
  241. }
  242. int line_delta = loc.lineno - a->a_lineno;
  243. int column = loc.col_offset;
  244. int end_column = loc.end_col_offset;
  245. assert(column >= -1);
  246. assert(end_column >= -1);
  247. if (column < 0 || end_column < 0) {
  248. if (loc.end_lineno == loc.lineno || loc.end_lineno == -1) {
  249. write_location_info_no_column(a, isize, line_delta);
  250. a->a_lineno = loc.lineno;
  251. return SUCCESS;
  252. }
  253. }
  254. else if (loc.end_lineno == loc.lineno) {
  255. if (line_delta == 0 && column < 80 && end_column - column < 16 && end_column >= column) {
  256. write_location_info_short_form(a, isize, column, end_column);
  257. return SUCCESS;
  258. }
  259. if (line_delta >= 0 && line_delta < 3 && column < 128 && end_column < 128) {
  260. write_location_info_oneline_form(a, isize, line_delta, column, end_column);
  261. a->a_lineno = loc.lineno;
  262. return SUCCESS;
  263. }
  264. }
  265. write_location_info_long_form(a, loc, isize);
  266. a->a_lineno = loc.lineno;
  267. return SUCCESS;
  268. }
  269. static int
  270. assemble_emit_location(struct assembler* a, location loc, int isize)
  271. {
  272. if (isize == 0) {
  273. return SUCCESS;
  274. }
  275. while (isize > 8) {
  276. RETURN_IF_ERROR(write_location_info_entry(a, loc, 8));
  277. isize -= 8;
  278. }
  279. return write_location_info_entry(a, loc, isize);
  280. }
  281. static int
  282. assemble_location_info(struct assembler *a, instr_sequence *instrs,
  283. int firstlineno)
  284. {
  285. a->a_lineno = firstlineno;
  286. location loc = NO_LOCATION;
  287. int size = 0;
  288. for (int i = 0; i < instrs->s_used; i++) {
  289. instruction *instr = &instrs->s_instrs[i];
  290. if (!same_location(loc, instr->i_loc)) {
  291. RETURN_IF_ERROR(assemble_emit_location(a, loc, size));
  292. loc = instr->i_loc;
  293. size = 0;
  294. }
  295. size += _PyCompile_InstrSize(instr->i_opcode, instr->i_oparg);
  296. }
  297. RETURN_IF_ERROR(assemble_emit_location(a, loc, size));
  298. return SUCCESS;
  299. }
  300. static void
  301. write_instr(_Py_CODEUNIT *codestr, instruction *instr, int ilen)
  302. {
  303. int opcode = instr->i_opcode;
  304. assert(!IS_PSEUDO_OPCODE(opcode));
  305. int oparg = instr->i_oparg;
  306. assert(HAS_ARG(opcode) || oparg == 0);
  307. int caches = _PyOpcode_Caches[opcode];
  308. switch (ilen - caches) {
  309. case 4:
  310. codestr->op.code = EXTENDED_ARG;
  311. codestr->op.arg = (oparg >> 24) & 0xFF;
  312. codestr++;
  313. /* fall through */
  314. case 3:
  315. codestr->op.code = EXTENDED_ARG;
  316. codestr->op.arg = (oparg >> 16) & 0xFF;
  317. codestr++;
  318. /* fall through */
  319. case 2:
  320. codestr->op.code = EXTENDED_ARG;
  321. codestr->op.arg = (oparg >> 8) & 0xFF;
  322. codestr++;
  323. /* fall through */
  324. case 1:
  325. codestr->op.code = opcode;
  326. codestr->op.arg = oparg & 0xFF;
  327. codestr++;
  328. break;
  329. default:
  330. Py_UNREACHABLE();
  331. }
  332. while (caches--) {
  333. codestr->op.code = CACHE;
  334. codestr->op.arg = 0;
  335. codestr++;
  336. }
  337. }
  338. /* assemble_emit_instr()
  339. Extend the bytecode with a new instruction.
  340. Update lnotab if necessary.
  341. */
  342. static int
  343. assemble_emit_instr(struct assembler *a, instruction *instr)
  344. {
  345. Py_ssize_t len = PyBytes_GET_SIZE(a->a_bytecode);
  346. _Py_CODEUNIT *code;
  347. int size = _PyCompile_InstrSize(instr->i_opcode, instr->i_oparg);
  348. if (a->a_offset + size >= len / (int)sizeof(_Py_CODEUNIT)) {
  349. if (len > PY_SSIZE_T_MAX / 2) {
  350. return ERROR;
  351. }
  352. RETURN_IF_ERROR(_PyBytes_Resize(&a->a_bytecode, len * 2));
  353. }
  354. code = (_Py_CODEUNIT *)PyBytes_AS_STRING(a->a_bytecode) + a->a_offset;
  355. a->a_offset += size;
  356. write_instr(code, instr, size);
  357. return SUCCESS;
  358. }
  359. static int
  360. assemble_emit(struct assembler *a, instr_sequence *instrs,
  361. int first_lineno, PyObject *const_cache)
  362. {
  363. RETURN_IF_ERROR(assemble_init(a, first_lineno));
  364. for (int i = 0; i < instrs->s_used; i++) {
  365. instruction *instr = &instrs->s_instrs[i];
  366. RETURN_IF_ERROR(assemble_emit_instr(a, instr));
  367. }
  368. RETURN_IF_ERROR(assemble_location_info(a, instrs, a->a_lineno));
  369. RETURN_IF_ERROR(assemble_exception_table(a, instrs));
  370. RETURN_IF_ERROR(_PyBytes_Resize(&a->a_except_table, a->a_except_table_off));
  371. RETURN_IF_ERROR(_PyCompile_ConstCacheMergeOne(const_cache, &a->a_except_table));
  372. RETURN_IF_ERROR(_PyBytes_Resize(&a->a_linetable, a->a_location_off));
  373. RETURN_IF_ERROR(_PyCompile_ConstCacheMergeOne(const_cache, &a->a_linetable));
  374. RETURN_IF_ERROR(_PyBytes_Resize(&a->a_bytecode, a->a_offset * sizeof(_Py_CODEUNIT)));
  375. RETURN_IF_ERROR(_PyCompile_ConstCacheMergeOne(const_cache, &a->a_bytecode));
  376. return SUCCESS;
  377. }
  378. static PyObject *
  379. dict_keys_inorder(PyObject *dict, Py_ssize_t offset)
  380. {
  381. PyObject *tuple, *k, *v;
  382. Py_ssize_t i, pos = 0, size = PyDict_GET_SIZE(dict);
  383. tuple = PyTuple_New(size);
  384. if (tuple == NULL)
  385. return NULL;
  386. while (PyDict_Next(dict, &pos, &k, &v)) {
  387. i = PyLong_AS_LONG(v);
  388. assert((i - offset) < size);
  389. assert((i - offset) >= 0);
  390. PyTuple_SET_ITEM(tuple, i - offset, Py_NewRef(k));
  391. }
  392. return tuple;
  393. }
  394. // This is in codeobject.c.
  395. extern void _Py_set_localsplus_info(int, PyObject *, unsigned char,
  396. PyObject *, PyObject *);
  397. static void
  398. compute_localsplus_info(_PyCompile_CodeUnitMetadata *umd, int nlocalsplus,
  399. PyObject *names, PyObject *kinds)
  400. {
  401. PyObject *k, *v;
  402. Py_ssize_t pos = 0;
  403. while (PyDict_Next(umd->u_varnames, &pos, &k, &v)) {
  404. int offset = (int)PyLong_AS_LONG(v);
  405. assert(offset >= 0);
  406. assert(offset < nlocalsplus);
  407. // For now we do not distinguish arg kinds.
  408. _PyLocals_Kind kind = CO_FAST_LOCAL;
  409. if (PyDict_Contains(umd->u_fasthidden, k)) {
  410. kind |= CO_FAST_HIDDEN;
  411. }
  412. if (PyDict_GetItem(umd->u_cellvars, k) != NULL) {
  413. kind |= CO_FAST_CELL;
  414. }
  415. _Py_set_localsplus_info(offset, k, kind, names, kinds);
  416. }
  417. int nlocals = (int)PyDict_GET_SIZE(umd->u_varnames);
  418. // This counter mirrors the fix done in fix_cell_offsets().
  419. int numdropped = 0;
  420. pos = 0;
  421. while (PyDict_Next(umd->u_cellvars, &pos, &k, &v)) {
  422. if (PyDict_GetItem(umd->u_varnames, k) != NULL) {
  423. // Skip cells that are already covered by locals.
  424. numdropped += 1;
  425. continue;
  426. }
  427. int offset = (int)PyLong_AS_LONG(v);
  428. assert(offset >= 0);
  429. offset += nlocals - numdropped;
  430. assert(offset < nlocalsplus);
  431. _Py_set_localsplus_info(offset, k, CO_FAST_CELL, names, kinds);
  432. }
  433. pos = 0;
  434. while (PyDict_Next(umd->u_freevars, &pos, &k, &v)) {
  435. int offset = (int)PyLong_AS_LONG(v);
  436. assert(offset >= 0);
  437. offset += nlocals - numdropped;
  438. assert(offset < nlocalsplus);
  439. _Py_set_localsplus_info(offset, k, CO_FAST_FREE, names, kinds);
  440. }
  441. }
  442. static PyCodeObject *
  443. makecode(_PyCompile_CodeUnitMetadata *umd, struct assembler *a, PyObject *const_cache,
  444. PyObject *constslist, int maxdepth, int nlocalsplus, int code_flags,
  445. PyObject *filename)
  446. {
  447. PyCodeObject *co = NULL;
  448. PyObject *names = NULL;
  449. PyObject *consts = NULL;
  450. PyObject *localsplusnames = NULL;
  451. PyObject *localspluskinds = NULL;
  452. names = dict_keys_inorder(umd->u_names, 0);
  453. if (!names) {
  454. goto error;
  455. }
  456. if (_PyCompile_ConstCacheMergeOne(const_cache, &names) < 0) {
  457. goto error;
  458. }
  459. consts = PyList_AsTuple(constslist); /* PyCode_New requires a tuple */
  460. if (consts == NULL) {
  461. goto error;
  462. }
  463. if (_PyCompile_ConstCacheMergeOne(const_cache, &consts) < 0) {
  464. goto error;
  465. }
  466. assert(umd->u_posonlyargcount < INT_MAX);
  467. assert(umd->u_argcount < INT_MAX);
  468. assert(umd->u_kwonlyargcount < INT_MAX);
  469. int posonlyargcount = (int)umd->u_posonlyargcount;
  470. int posorkwargcount = (int)umd->u_argcount;
  471. assert(INT_MAX - posonlyargcount - posorkwargcount > 0);
  472. int kwonlyargcount = (int)umd->u_kwonlyargcount;
  473. localsplusnames = PyTuple_New(nlocalsplus);
  474. if (localsplusnames == NULL) {
  475. goto error;
  476. }
  477. localspluskinds = PyBytes_FromStringAndSize(NULL, nlocalsplus);
  478. if (localspluskinds == NULL) {
  479. goto error;
  480. }
  481. compute_localsplus_info(umd, nlocalsplus, localsplusnames, localspluskinds);
  482. struct _PyCodeConstructor con = {
  483. .filename = filename,
  484. .name = umd->u_name,
  485. .qualname = umd->u_qualname ? umd->u_qualname : umd->u_name,
  486. .flags = code_flags,
  487. .code = a->a_bytecode,
  488. .firstlineno = umd->u_firstlineno,
  489. .linetable = a->a_linetable,
  490. .consts = consts,
  491. .names = names,
  492. .localsplusnames = localsplusnames,
  493. .localspluskinds = localspluskinds,
  494. .argcount = posonlyargcount + posorkwargcount,
  495. .posonlyargcount = posonlyargcount,
  496. .kwonlyargcount = kwonlyargcount,
  497. .stacksize = maxdepth,
  498. .exceptiontable = a->a_except_table,
  499. };
  500. if (_PyCode_Validate(&con) < 0) {
  501. goto error;
  502. }
  503. if (_PyCompile_ConstCacheMergeOne(const_cache, &localsplusnames) < 0) {
  504. goto error;
  505. }
  506. con.localsplusnames = localsplusnames;
  507. co = _PyCode_New(&con);
  508. if (co == NULL) {
  509. goto error;
  510. }
  511. error:
  512. Py_XDECREF(names);
  513. Py_XDECREF(consts);
  514. Py_XDECREF(localsplusnames);
  515. Py_XDECREF(localspluskinds);
  516. return co;
  517. }
  518. PyCodeObject *
  519. _PyAssemble_MakeCodeObject(_PyCompile_CodeUnitMetadata *umd, PyObject *const_cache,
  520. PyObject *consts, int maxdepth, instr_sequence *instrs,
  521. int nlocalsplus, int code_flags, PyObject *filename)
  522. {
  523. PyCodeObject *co = NULL;
  524. struct assembler a;
  525. int res = assemble_emit(&a, instrs, umd->u_firstlineno, const_cache);
  526. if (res == SUCCESS) {
  527. co = makecode(umd, &a, const_cache, consts, maxdepth, nlocalsplus,
  528. code_flags, filename);
  529. }
  530. assemble_free(&a);
  531. return co;
  532. }