1 /* src/vm/jit/intrp/disass.c - disassembler wrapper for interpreter
3 Copyright (C) 1996-2005, 2006, 2008
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License as
10 published by the Free Software Foundation; either version 2, or (at
11 your option) any later version.
13 This program is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
32 #include "vm/jit/intrp/intrp.h"
35 /* function disassinstr ********************************************************
37 outputs a disassembler listing of one machine code instruction on 'stdout'
38 c: instructions machine code
40 *******************************************************************************/
42 u1 *intrp_disassinstr(u1 *code)
49 r = (u1 *) vm_disassemble_inst((Inst *) code, vm_prim);
56 /* function disassemble ********************************************************
58 outputs a disassembler listing of some machine code on 'stdout'
59 code: pointer to first instruction
60 len: code size (number of instructions * 4)
62 *******************************************************************************/
64 void intrp_disassemble(u1 *start, u1 *end)
68 printf(" --- disassembler listing ---\n");
71 vm_disassemble((Inst *) start, (Inst *) end, vm_prim);
76 void printarg_ui (u4 ui )
78 fprintf(vm_out, "%ud", ui);
81 void printarg_v (Cell v )
83 fprintf(vm_out, "%lld", (long long)v);
86 void printarg_Cell (Cell x )
88 fprintf(vm_out, "%lld", (long long)x);
92 void printarg_b (s4 b )
94 fprintf(vm_out, "%d", b);
97 void printarg_s (s4 s )
99 fprintf(vm_out, "%d", s);
102 void printarg_i (s4 i )
104 fprintf(vm_out, "%d", i);
107 void printarg_l (s8 l )
109 fprintf(vm_out, "%lld", (long long)l);
112 void printarg_f (float f )
114 fprintf(vm_out, "%f", (double)f);
117 void printarg_d (double d )
119 fprintf(vm_out, "%f", d);
122 void printarg_aRef (java_objectheader *aRef )
124 fprintf(vm_out, "obj: %p", (void *)aRef);
127 void printarg_aArray (java_arrayheader * aArray )
129 fprintf(vm_out, "array %p", (void *)aArray);
132 void printarg_aaTarget(Inst ** aaTarget)
135 methodinfo *m=((methodinfo **)aaTarget)[3];
138 fprintf(vm_out, "NULL");
141 void printarg_aClass (classinfo * aClass )
144 utf_fprint_printable_ascii_classname(vm_out, aClass->name);
146 fprintf(vm_out, "NULL");
149 void printarg_acr (constant_classref *acr )
151 fprintf(vm_out, "cr: %p", (void *)acr);
154 void printarg_addr (u1 * addr )
156 fprintf(vm_out, "%p", (void *)addr);
159 void printarg_af (functionptr af )
161 fprintf(vm_out, "f: %p", (void *)af);
164 void printarg_afi (fieldinfo * afi )
167 utf_fprint_printable_ascii_classname(vm_out, afi->clazz->name);
168 fprintf(vm_out, ".");
169 utf_fprint_printable_ascii(vm_out, afi->name);
170 utf_fprint_printable_ascii(vm_out, afi->descriptor);
172 fprintf(vm_out, "fi=NULL");
175 void printarg_am (methodinfo * am )
178 utf_fprint_printable_ascii_classname(vm_out, am->clazz->name);
179 fprintf(vm_out, ".");
180 utf_fprint_printable_ascii(vm_out, am->name);
181 utf_fprint_printable_ascii(vm_out, am->descriptor);
183 fprintf(vm_out, "m=NULL");
186 void printarg_acell (Cell * acell )
188 fprintf(vm_out, "%p", (void *)acell);
191 void printarg_ainst (Inst * ainst )
193 fprintf(vm_out, "%p", (void *)ainst);
196 void printarg_auf (unresolved_field * auf )
199 utf_fprint_printable_ascii(vm_out, auf->fieldref->name);
200 fprintf(vm_out, " (type ");
201 utf_fprint_printable_ascii(vm_out, auf->fieldref->descriptor);
202 fprintf(vm_out, ")");
204 fprintf(vm_out, "NULL");
207 void printarg_aum (unresolved_method *aum )
210 utf_fprint_printable_ascii_classname(vm_out, METHODREF_CLASSNAME(aum->methodref));
211 fprintf(vm_out, ".");
212 utf_fprint_printable_ascii(vm_out, aum->methodref->name);
213 utf_fprint_printable_ascii(vm_out, aum->methodref->descriptor);
215 fprintf(vm_out, "NULL");
218 void printarg_avftbl (vftbl_t * avftbl )
221 fprintf(vm_out, "vftbl: ");
222 utf_fprint_printable_ascii_classname(vm_out, avftbl->class->name);
224 fprintf(vm_out, "NULL");
229 * These are local overrides for various environment variables in Emacs.
230 * Please do not remove this and leave it at the end of the file, where
231 * Emacs will automagically detect them.
232 * ---------------------------------------------------------------------
235 * indent-tabs-mode: t
239 * vim:noexpandtab:sw=4:ts=4: