1 /* src/vm/jit/intrp/disass.c - disassembler wrapper for interpreter
3 Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
4 C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
5 E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
6 J. Wenninger, Institut f. Computersprachen - TU Wien
8 This file is part of CACAO.
10 This program is free software; you can redistribute it and/or
11 modify it under the terms of the GNU General Public License as
12 published by the Free Software Foundation; either version 2, or (at
13 your option) any later version.
15 This program is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 Contact: cacao@cacaojvm.org
27 Authors: Andreas Krall
30 Changes: Christian Thalinger
43 #include "vm/jit/intrp/intrp.h"
46 /* function disassinstr ********************************************************
48 outputs a disassembler listing of one machine code instruction on 'stdout'
49 c: instructions machine code
51 *******************************************************************************/
53 u1 *intrp_disassinstr(u1 *code)
60 r = (u1 *) vm_disassemble_inst((Inst *) code, vm_prim);
67 /* function disassemble ********************************************************
69 outputs a disassembler listing of some machine code on 'stdout'
70 code: pointer to first instruction
71 len: code size (number of instructions * 4)
73 *******************************************************************************/
75 void intrp_disassemble(u1 *start, u1 *end)
79 printf(" --- disassembler listing ---\n");
82 vm_disassemble((Inst *) start, (Inst *) end, vm_prim);
87 void printarg_ui (u4 ui )
89 fprintf(vm_out, "%ud", ui);
92 void printarg_v (Cell v )
94 fprintf(vm_out, "%lld", (long long)v);
97 void printarg_Cell (Cell x )
99 fprintf(vm_out, "%lld", (long long)x);
103 void printarg_b (s4 b )
105 fprintf(vm_out, "%d", b);
108 void printarg_s (s4 s )
110 fprintf(vm_out, "%d", s);
113 void printarg_i (s4 i )
115 fprintf(vm_out, "%d", i);
118 void printarg_l (s8 l )
120 fprintf(vm_out, "%lld", (long long)l);
123 void printarg_f (float f )
125 fprintf(vm_out, "%f", (double)f);
128 void printarg_d (double d )
130 fprintf(vm_out, "%f", d);
133 void printarg_aRef (java_objectheader *aRef )
135 fprintf(vm_out, "obj: %p", (void *)aRef);
138 void printarg_aArray (java_arrayheader * aArray )
140 fprintf(vm_out, "array %p", (void *)aArray);
143 void printarg_aaTarget(Inst ** aaTarget)
146 methodinfo *m=((methodinfo **)aaTarget)[3];
149 fprintf(vm_out, "NULL");
152 void printarg_aClass (classinfo * aClass )
155 utf_fprint_printable_ascii_classname(vm_out, aClass->name);
157 fprintf(vm_out, "NULL");
160 void printarg_acr (constant_classref *acr )
162 fprintf(vm_out, "cr: %p", (void *)acr);
165 void printarg_addr (u1 * addr )
167 fprintf(vm_out, "%p", (void *)addr);
170 void printarg_af (functionptr af )
172 fprintf(vm_out, "f: %p", (void *)af);
175 void printarg_afi (fieldinfo * afi )
178 utf_fprint_printable_ascii_classname(vm_out, afi->class->name);
179 fprintf(vm_out, ".");
180 utf_fprint_printable_ascii(vm_out, afi->name);
181 utf_fprint_printable_ascii(vm_out, afi->descriptor);
183 fprintf(vm_out, "fi=NULL");
186 void printarg_am (methodinfo * am )
189 utf_fprint_printable_ascii_classname(vm_out, am->class->name);
190 fprintf(vm_out, ".");
191 utf_fprint_printable_ascii(vm_out, am->name);
192 utf_fprint_printable_ascii(vm_out, am->descriptor);
194 fprintf(vm_out, "m=NULL");
197 void printarg_acell (Cell * acell )
199 fprintf(vm_out, "%p", (void *)acell);
202 void printarg_ainst (Inst * ainst )
204 fprintf(vm_out, "%p", (void *)ainst);
207 void printarg_auf (unresolved_field * auf )
210 utf_fprint_printable_ascii(vm_out, auf->fieldref->name);
211 fprintf(vm_out, " (type ");
212 utf_fprint_printable_ascii(vm_out, auf->fieldref->descriptor);
213 fprintf(vm_out, ")");
215 fprintf(vm_out, "NULL");
218 void printarg_aum (unresolved_method *aum )
221 utf_fprint_printable_ascii_classname(vm_out, METHODREF_CLASSNAME(aum->methodref));
222 fprintf(vm_out, ".");
223 utf_fprint_printable_ascii(vm_out, aum->methodref->name);
224 utf_fprint_printable_ascii(vm_out, aum->methodref->descriptor);
226 fprintf(vm_out, "NULL");
229 void printarg_avftbl (vftbl_t * avftbl )
232 fprintf(vm_out, "vftbl: ");
233 utf_fprint_printable_ascii_classname(vm_out, avftbl->class->name);
235 fprintf(vm_out, "NULL");
240 * These are local overrides for various environment variables in Emacs.
241 * Please do not remove this and leave it at the end of the file, where
242 * Emacs will automagically detect them.
243 * ---------------------------------------------------------------------
246 * indent-tabs-mode: t
250 * vim:noexpandtab:sw=4:ts=4: