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
33 $Id: disass.c 4357 2006-01-22 23:33:38Z twisti $
44 #include "vm/jit/intrp/intrp.h"
47 /* function disassinstr ********************************************************
49 outputs a disassembler listing of one machine code instruction on 'stdout'
50 c: instructions machine code
52 *******************************************************************************/
54 u1 *intrp_disassinstr(u1 *code)
56 return (u1 *) vm_disassemble_inst((Inst *) code, vm_prim);
60 /* function disassemble ********************************************************
62 outputs a disassembler listing of some machine code on 'stdout'
63 code: pointer to first instruction
64 len: code size (number of instructions * 4)
66 *******************************************************************************/
68 void intrp_disassemble(u1 *start, u1 *end)
70 printf(" --- disassembler listing ---\n");
71 vm_disassemble((Inst *) start, (Inst *) end, vm_prim);
75 void printarg_ui (u4 ui )
77 fprintf(vm_out, "%ud", ui);
80 void printarg_v (Cell v )
82 fprintf(vm_out, "%lld", (long long)v);
85 void printarg_Cell (Cell x )
87 fprintf(vm_out, "%lld", (long long)x);
91 void printarg_b (s4 b )
93 fprintf(vm_out, "%d", b);
96 void printarg_s (s4 s )
98 fprintf(vm_out, "%d", s);
101 void printarg_i (s4 i )
103 fprintf(vm_out, "%d", i);
106 void printarg_l (s8 l )
108 fprintf(vm_out, "%lld", (long long)l);
111 void printarg_f (float f )
113 fprintf(vm_out, "%f", (double)f);
116 void printarg_d (double d )
118 fprintf(vm_out, "%f", d);
121 void printarg_aRef (java_objectheader *aRef )
123 fprintf(vm_out, "obj: %p", (void *)aRef);
126 void printarg_aArray (java_arrayheader * aArray )
128 fprintf(vm_out, "array %p", (void *)aArray);
131 void printarg_aaTarget(Inst ** aaTarget)
134 methodinfo *m=((methodinfo **)aaTarget)[3];
137 fprintf(vm_out, "NULL");
140 void printarg_aClass (classinfo * aClass )
143 utf_fprint_classname(vm_out, aClass->name);
145 fprintf(vm_out, "NULL");
148 void printarg_acr (constant_classref *acr )
150 fprintf(vm_out, "cr: %p", (void *)acr);
153 void printarg_addr (u1 * addr )
155 fprintf(vm_out, "%p", (void *)addr);
158 void printarg_af (functionptr af )
160 fprintf(vm_out, "f: %p", (void *)af);
163 void printarg_am (methodinfo * am )
166 utf_fprint_classname(vm_out, am->class->name);
167 fprintf(vm_out, ".");
168 utf_fprint(vm_out, am->name);
169 utf_fprint(vm_out, am->descriptor);
171 fprintf(vm_out, "m=NULL");
174 void printarg_acell (Cell * acell )
176 fprintf(vm_out, "%p", (void *)acell);
179 void printarg_ainst (Inst * ainst )
181 fprintf(vm_out, "%p", (void *)ainst);
184 void printarg_auf (unresolved_field * auf )
187 utf_fprint(vm_out, auf->fieldref->name);
188 fprintf(vm_out, " (type ");
189 utf_fprint(vm_out, auf->fieldref->descriptor);
190 fprintf(vm_out, ")");
192 fprintf(vm_out, "NULL");
195 void printarg_aum (unresolved_method *aum )
198 utf_fprint_classname(vm_out, aum->methodref->classref->name);
199 fprintf(vm_out, ".");
200 utf_fprint(vm_out, aum->methodref->name);
201 utf_fprint(vm_out, aum->methodref->descriptor);
203 fprintf(vm_out, "NULL");
206 void printarg_avftbl (vftbl_t * avftbl )
209 fprintf(vm_out, "vftbl: ");
210 utf_fprint_classname(vm_out, avftbl->class->name);
212 fprintf(vm_out, "NULL");
217 * These are local overrides for various environment variables in Emacs.
218 * Please do not remove this and leave it at the end of the file, where
219 * Emacs will automagically detect them.
220 * ---------------------------------------------------------------------
223 * indent-tabs-mode: t