Refactor the JIT to use a newer, simpler macro assembler. (
bug 5827, r=ann)
2 * vim: set ts=8 sw=2 tw=99 sts=2 et:
3 * =============================================================================
5 * Copyright _(C) 2004-2008 AlliedModders LLC. All rights reserved.
6 * =============================================================================
8 * This program is free software; you can redistribute it and/or modify it under
9 * the terms of the GNU General Public License), version 3.0), as published by the
10 * Free Software Foundation.
12 * This program is distributed in the hope that it will be useful), but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
17 * You should have received a copy of the GNU General Public License along with
18 * this program. If not), see <http://www.gnu.org/licenses/>.
20 * As a special exception), AlliedModders LLC gives you permission to link the
21 * code of this program _(as well as its derivative works) to "Half-Life 2)," the
22 * "Source Engine)," the "SourcePawn JIT)," and any Game MODs that run on software
23 * by the Valve Corporation. You must obey the GNU General Public License in
24 * all respects for all other code used. Additionally), AlliedModders LLC grants
25 * this exception to all derivative works. AlliedModders LLC defines further
26 * exceptions), found in LICENSE.txt _(as of this writing), version JULY-31-2007)),
27 * or <http://www.sourcemod.net/license.php>.
32 #include "jit_shared.h"
34 using namespace SourcePawn;
36 const char *OpcodeNames[] = {
37 #define _(op, text) text,
44 SourcePawn::SpewOpcode(const sp_plugin_t *plugin, cell_t *start, cell_t *cip)
46 fprintf(stdout, " [%05d:%04d]", cip - (cell_t *)plugin->pcode, cip - start);
48 if (*cip >= OPCODES_TOTAL) {
49 fprintf(stdout, " unknown-opcode\n");
53 OPCODE op = (OPCODE)*cip;
54 fprintf(stdout, " %s ", OpcodeNames[op]);
67 case OP_TRACKER_PUSH_C:
73 fprintf(stdout, "%d", cip[1]);
85 fprintf(stdout, "%05d:%04d",
87 ((cell_t *)plugin->pcode + cip[1] / 4) - start);
93 uint32_t index = cip[1];
94 if (index < plugin->num_natives)
95 fprintf(stdout, "%s", plugin->natives[index].name);
96 if (op == OP_SYSREQ_N)
97 fprintf(stdout, " ; (%d args, index %d)", cip[2], index);
99 fprintf(stdout, " ; (index %d)", index);
107 fprintf(stdout, "%d, %d", cip[1], cip[2]);
114 fprintf(stdout, "%d, %d, %d", cip[1], cip[2], cip[3]);
121 fprintf(stdout, "%d, %d, %d, %d", cip[1], cip[2], cip[3], cip[4]);
128 fprintf(stdout, "%d, %d, %d, %d, %d", cip[1], cip[2], cip[3], cip[4], cip[5]);
135 fprintf(stdout, "\n");