cinap_lenrekadd hg and python4bb9e2215 years agoHistory
4570 lines · 109.1 KB · C
RawDownload
	fprintf(stderr, "used: %d, depth: %d, offset: %d %s%s\n",		b->b_iused, b->b_startdepth, b->b_offset, seen, b_return);	if (b->b_instr) {		int i;		for (i = 0; i < b->b_iused; i++) {			fprintf(stderr, "  [%02d] ", i);			dump_instr(b->b_instr + i);		}	}}#endif static PyCodeObject *assemble(struct compiler *c, int addNone){	basicblock *b, *entryblock;	struct assembler a;	int i, j, nblocks;	PyCodeObject *co = NULL; 	/* Make sure every block that falls off the end returns None.	   XXX NEXT_BLOCK() isn't quite right, because if the last	   block ends with a jump or return b_next shouldn't set.	 */	if (!c->u->u_curblock->b_return) {		NEXT_BLOCK(c);		if (addNone)			ADDOP_O(c, LOAD_CONST, Py_None, consts);		ADDOP(c, RETURN_VALUE);	} 	nblocks = 0;	entryblock = NULL;	for (b = c->u->u_blocks; b != NULL; b = b->b_list) {		nblocks++;		entryblock = b; 	} 	/* Set firstlineno if it wasn't explicitly set. */	if (!c->u->u_firstlineno) {		if (entryblock && entryblock->b_instr)			c->u->u_firstlineno = entryblock->b_instr->i_lineno;		else			c->u->u_firstlineno = 1;	}	if (!assemble_init(&a, nblocks, c->u->u_firstlineno))		goto error;	dfs(c, entryblock, &a); 	/* Can't modify the bytecode after computing jump offsets. */	assemble_jump_offsets(&a, c); 	/* Emit code in reverse postorder from dfs. */	for (i = a.a_nblocks - 1; i >= 0; i--) {		b = a.a_postorder[i];		for (j = 0; j < b->b_iused; j++)			if (!assemble_emit(&a, &b->b_instr[j]))				goto error;	} 	if (_PyString_Resize(&a.a_lnotab, a.a_lnotab_off) < 0)		goto error;	if (_PyString_Resize(&a.a_bytecode, a.a_offset) < 0)		goto error; 	co = makecode(c, &a); error:	assemble_free(&a);	return co;}

Lines 4501–4570 of 4570. Previous lines