made is_Unknown() inline
[libfirm] / ir / ana2 / typalise.c
1 /* -*- c -*- */
2
3 /*
4  * Project:     libFIRM
5  * File name:   ir/ana2/pto.c
6  * Purpose:     Pto
7  * Author:      Florian
8  * Modified by:
9  * Created:     Mon 18 Oct 2004
10  * CVS-ID:      $Id$
11  * Copyright:   (c) 1999-2004 Universität Karlsruhe
12  * Licence:     This file is protected by GPL -  GNU GENERAL PUBLIC LICENSE.
13  */
14
15
16 # ifdef HAVE_CONFIG_H
17 #  include "config.h"
18 # endif
19
20 # include "typalise.h"
21
22 # ifndef TRUE
23 #  define TRUE 1
24 #  define FALSE 0
25 # endif /* not defined TRUE */
26
27 # include <assert.h>
28
29 #ifdef HAVE_STRING_H
30 # include <string.h>
31 #endif
32
33 # include "irnode_t.h"
34 # include "irgwalk.h"
35 # include "xmalloc.h"
36 # include "gnu_ext.h"
37
38
39 /*
40   Local Globals
41 */
42
43 static long ta_id = 0;
44
45 /*
46   Local Protos
47 */
48 static typalise_t *typalise_proj (ir_node*);
49
50 /* DEBUGGING only */
51 static void cough_and_die (ir_node *node)
52 {
53   ir_graph *graph = get_irn_irg (node);
54
55   fprintf (stdout, "%s: %s[%li]\n",
56            __FUNCTION__,
57            get_op_name (get_irn_op (node)),
58            get_irn_node_nr (node));
59   dump_ir_block_graph (graph, "-typealise");
60   assert (0);
61 }
62
63 /*
64   Exception b/d
65 */
66 static type *java_lang_Throwable_tp = NULL;
67
68 static type *get_java_lang_Throwable ()
69 {
70   assert (NULL != java_lang_Throwable_tp);
71
72   return (java_lang_Throwable_tp);
73 }
74
75 static void find_java_lang_Throwable (type *tp, void *_unused)
76 {
77   const char *name = get_type_name (tp);
78
79   if (0 == strcmp (name, "java/lang/Throwable")) {
80     assert (NULL == java_lang_Throwable_tp);
81
82     java_lang_Throwable_tp = tp;
83   }
84 }
85
86
87 /*
88   Ctors, Dtors for typalise_t-s
89 */
90 static typalise_t *ta_exact (type *tp)
91 {
92   typalise_t *ta = xmalloc (sizeof (typalise_t));
93   ta->kind = type_exact;
94   ta->res.type = tp;
95   ta->id = ta_id ++;
96
97   assert (is_Class_type (tp));
98
99   return (ta);
100 }
101
102 static typalise_t *ta_types (lset_t *set)
103 {
104   typalise_t *ta = xmalloc (sizeof (typalise_t));
105   ta->kind = type_types;
106   ta->res.types = set;
107   ta->id = ta_id ++;
108
109   return (ta);
110 }
111
112 static typalise_t *ta_type (type *tp)
113 {
114   typalise_t *ta = xmalloc (sizeof (typalise_t));
115   ta->kind = type_type;
116   ta->res.type = tp;
117   ta->id = ta_id ++;
118
119   assert (is_Class_type (tp));
120
121   return (ta);
122 }
123
124 static void ta_delete (typalise_t *ta)
125 {
126   if (type_types == ta->kind) {
127     lset_destroy (ta->res.types);
128     ta->res.types = NULL;
129   } else {
130     ta->res.type = NULL;
131   }
132
133   ta->kind = type_invalid;
134
135   free (ta);
136 }
137
138 /*
139   Helpers for inheritance, overwriting and stuff
140 */
141 /**
142    Find out whether otype is a subtype of stype.
143    Return non-zero iff otype is a subtype of stype.
144 */
145 static int is_subtype (type *otype, type *stype)
146 {
147   int n_sub = get_class_n_subtypes (stype);
148   int is_sub = FALSE;
149   int i;
150
151   if (otype == stype) {
152     return (TRUE);
153   }
154
155   for (i = 0; (!is_sub) && (i < n_sub); i ++) {
156     type *sub = get_class_subtype (stype, i);
157
158     is_sub |= is_subtype (otype, sub);
159   }
160
161
162   return (is_sub);
163 }
164
165
166 /**
167     Compute the closure of all subtypes of otype (including otype
168     itself)
169 */
170 static void _collect_subtypes (type *otype, lset_t *set)
171 {
172   int i, n_sub;
173
174   lset_insert (set, otype);
175
176   n_sub = get_class_n_subtypes (otype);
177   for (i = 0; i < n_sub; i ++) {
178     type *sub = get_class_subtype (otype, i);
179
180     _collect_subtypes (sub, set);
181   }
182 }
183
184 static lset_t *subtype_closure (type *otype)
185 {
186   lset_t *set = lset_create ();
187
188   _collect_subtypes (otype, set);
189
190   return (set);
191 }
192
193 /**
194    Helper method for get_owner_types
195 */
196 static void _collect_owner_types (entity *method, ir_graph *graph, lset_t *tps)
197 {
198   int i, n_over;
199
200   /* search DOWNwards in clazz hierarchy */
201
202   if ((peculiarity_description == get_entity_peculiarity (method)) ||
203       (peculiarity_inherited   == get_entity_peculiarity (method))) {
204     lset_insert (tps, get_entity_owner (method));
205   } else if (peculiarity_existent == get_entity_peculiarity (method)) {
206     ir_graph *ex_graph = get_entity_irg (method);
207
208     if ((NULL == ex_graph) || (ex_graph == graph)) {
209       /* wtf? they define the same graph again? well, whatever: */
210       lset_insert (tps, get_entity_owner (method));
211     } else {
212       /* aha: they define a new graph. can't have that, so bail out */
213       return;
214     }
215   }
216
217   n_over = get_entity_n_overwrittenby (method);
218   for (i = 0; i < n_over; i ++) {
219     entity *ometh = get_entity_overwrittenby (method, i);
220
221     _collect_owner_types (ometh, graph, tps);
222   }
223 }
224
225
226 /**
227    Collect all classes that use the given implementation of a method.
228 */
229 static lset_t *get_owner_types (ir_graph *graph)
230 {
231   lset_t *tps = lset_create ();
232   entity *meth = get_irg_entity (graph);
233
234   _collect_owner_types (meth, graph, tps);
235
236   return (tps);
237 }
238
239 /**
240    Return a list containing all types of 'set' which are a subtype of 'type'.
241 */
242 static lset_t *filter_for_type (lset_t *set, type *stype)
243 {
244   type *curs = (type*) lset_first (set);
245   lset_t *lset = lset_create ();
246
247   while (NULL != curs) {
248     if (is_subtype (curs, stype)) {
249       lset_insert (lset, curs);
250     }
251
252     curs = lset_next (set);
253   }
254
255   return (lset);
256 }
257
258 /*
259  Handle typalise_t-s
260 */
261 /**
262     Join 'one' and 'two'; both args are deallocated, result is freshly
263     allocated.
264 */
265 static typalise_t *ta_join (typalise_t *one, typalise_t *two)
266 {
267   typalise_t *res = NULL;
268
269   /* now, one==NULL or two==NULL cannot happen legitimately (if we hit a NULL pointer constant)
270   if (NULL == one) {
271     return (two);
272   }
273
274   if (NULL == two) {
275     return (one);
276   }
277   */
278   switch (one->kind) {
279   case (type_invalid): { /* shut up, gcc */ }
280   case (type_exact): {
281     switch (two->kind) {
282     case (type_invalid): { /* shut up, gcc */ }
283     case (type_exact): {
284       if (one->res.type == two->res.type) {
285         res = one;
286       } else {
287         lset_t *set = lset_create ();
288         lset_insert (set, one->res.type);
289         lset_insert (set, two->res.type);
290         res = ta_types (set);
291
292         ta_delete (one);
293       }
294
295       ta_delete (two);
296     } break;
297     case (type_types): {
298       lset_insert (two->res.types, one->res.type);
299       ta_delete (one);
300
301       res = two;
302     } break;
303     case (type_type): {
304       if (is_subtype (one->res.type, two->res.type)) {
305         ta_delete (one);
306         res = two;
307       } else {
308         lset_t *closure = subtype_closure (two->res.type);
309         lset_insert (closure, one->res.type);
310
311         ta_delete (two);
312
313         res = one;
314       }
315     } break;
316     }
317   } break;
318   case (type_types): {
319     switch (two->kind) {
320     case (type_invalid): { /* shut up, gcc */ }
321     case (type_exact): {
322       res = ta_join (two, one);
323     } break;
324     case (type_types): {
325       lset_insert_all (one->res.types, two->res.types);
326       ta_delete (two);
327
328       res = one;
329     } break;
330     case (type_type): {
331       lset_t *closure = subtype_closure (two->res.type);
332       lset_append (one->res.types, closure);
333
334       ta_delete (two);
335
336       res = one;
337     } break;
338     }
339   } break;
340   case (type_type): {
341     switch (two->kind) {
342     case (type_invalid): { /* shut up, gcc */ }
343     case (type_exact): {
344       res = ta_join (two, one);
345     } break;
346     case (type_types): {
347       res = ta_join (two, one);
348     } break;
349     case (type_type): {
350       type *one_type = one->res.type;
351       type *two_type = two->res.type;
352
353       if (is_subtype (one_type, two_type)) {
354         ta_delete (one);
355         res = two;
356       } else if (is_subtype (two_type, one_type)) {
357         ta_delete (two);
358         res = one;
359       } else {
360         lset_t *one_closure = subtype_closure (one->res.type);
361         lset_t *two_closure = subtype_closure (two->res.type);
362
363         lset_append (one_closure, two_closure);
364
365         ta_delete (two);
366         ta_delete (one);
367
368         res = ta_types (one_closure);
369       }
370     } break;
371     }
372   } break;
373   }
374
375   assert (res && "no result");
376
377   return (res);
378 }
379
380
381 # ifdef SHUT_UP_GCC
382 static const char *ta_name (typalise_t *ta)
383 {
384 # define BUF_SIZE 1024
385   static char buf [BUF_SIZE];
386
387   int len = sprintf (buf, "[%d] ", ta->id);
388
389   switch (ta->kind) {
390   case (type_invalid): { /* shut up, gcc */ }
391   case (type_exact): {
392     len += sprintf (buf+len, "only ");
393     strncat (buf, get_type_name (ta->res.type), BUF_SIZE);
394   } break;
395   case (type_types): {
396     len += sprintf (buf+len, "one_of ");
397
398     type *iter = lset_first (ta->res.types);
399
400     int size = BUF_SIZE - len - 1;
401     while ((NULL != iter) && (0 < size)) {
402       char *dest = strncat (buf, get_type_name (iter), size);
403       size = (dest - buf);
404
405       iter = lset_next (ta->res.types);
406     }
407   } break;
408   case (type_type): {
409     len += sprintf (buf+len, "poly ");
410     strncat (buf, get_type_name (ta->res.type), BUF_SIZE);
411   } break;
412   }
413
414   return (buf);
415   /* # undef BUF_SIZE */
416 }
417 # endif /* SHUT_UP_GCC */
418
419 /**
420    Find out whether the given clazz uses the given implementation of a
421    method.  Presumably, this is because clazz inherits the graph as
422    the implementation for a method.
423 */
424 static int uses_graph (type *clazz, entity *meth, ir_graph *graph)
425 {
426   type *g_clazz = get_entity_owner (meth);
427   int i, n_over, use = FALSE;
428
429   if (g_clazz == clazz) {
430     return (TRUE);
431   }
432
433   if (peculiarity_existent == get_entity_peculiarity (meth)) {
434     ir_graph *g_graph = get_entity_irg (meth);
435
436     if (g_graph != graph) {
437       return (FALSE);
438     }
439   }
440
441   /* else inherited or description */
442   n_over = get_entity_n_overwrittenby (meth); /* DOWN-wards */
443   for (i = 0; (i < n_over) && (!use); i ++) {
444     entity *over = get_entity_overwrittenby (meth, i);
445
446     use |= uses_graph (clazz, over, graph);
447   }
448
449   return (use);
450 }
451
452 /**
453    Check whether the given typalise_t includes the given type.
454 */
455 static int ta_supports (typalise_t *ta, ir_graph *graph)
456 {
457   switch (ta->kind) {
458   case (type_invalid): { /* shut up, gcc */ }
459   case (type_exact): {
460     int res = FALSE;
461     lset_t *tps = get_owner_types (graph);
462
463     if (lset_contains (tps, ta->res.type)) {
464       res = TRUE;
465     }
466
467     lset_destroy (tps);
468
469     return (res);
470   }
471   case (type_type): {
472     entity *meth = get_irg_entity (graph);
473     type *tp = get_entity_owner (meth);
474     int res = is_subtype (tp, ta->res.type);
475
476     if (res) {
477       return (TRUE);
478     } else {
479       res = uses_graph (ta->res.type, meth, graph);
480     }
481
482     return (res);
483   }
484   case (type_types): {
485     type *tp = get_entity_owner (get_irg_entity (graph));
486
487     return (lset_contains (ta->res.types, tp));
488   }
489   }
490
491   assert (0 && "invalid ta");
492   return FALSE;
493 }
494
495
496 /* =========== WHAT ELSE ? =========== */
497
498 /*
499   Helpers to typalise (ir_node*)
500 */
501 /**
502    Find an approximation to the given load node's value's types
503 */
504 static typalise_t *typalise_call (ir_node *call)
505 {
506   entity *ent = NULL;
507   type *tp = NULL;
508   typalise_t *res = NULL;
509   ir_node *call_ptr = get_Call_ptr (call);
510
511   if (iro_Sel == get_irn_opcode (call_ptr)) {
512     ent = get_Sel_entity (call_ptr);
513   } else if (iro_SymConst == get_irn_opcode (call_ptr)) {
514     if (get_SymConst_kind (call_ptr) == symconst_addr_ent) {
515       ent = get_SymConst_entity (call_ptr);
516     } else if (get_SymConst_kind (call_ptr) == symconst_addr_name) {
517       ident *id = get_SymConst_name (call_ptr);
518       const char *name = get_id_str (id);
519       if (0 == strcmp (name, "iro_Catch")) {
520         res = ta_type (java_lang_Throwable_tp);
521
522         return (res);
523       }
524
525       fprintf (stdout, "%s: cannot handle Call[%li] (symconst_addr_name=\"%s\")\n",
526                __FUNCTION__, get_irn_node_nr (call),
527                get_op_name (get_irn_op (call_ptr)),
528                name);
529       cough_and_die (call_ptr);
530     } else if (get_SymConst_kind (call_ptr) == symconst_type_tag) {
531       fprintf (stdout, "%s: cannot handle Call[%li] (symconst_type_tag)\n",
532                __FUNCTION__, get_irn_node_nr (call),
533                get_op_name (get_irn_op (call_ptr)));
534       cough_and_die (call_ptr);
535     } else {
536       fprintf (stdout, "%s: cannot handle Call[%li] (%i)\n",
537                __FUNCTION__, get_irn_node_nr (call),
538                get_SymConst_kind (call_ptr));
539       cough_and_die (call_ptr);
540     }
541   }
542
543   tp = get_entity_type (ent);
544   assert (is_Method_type (tp));
545
546   tp = get_method_res_type (tp, 0);
547
548   while (is_Pointer_type (tp)) {
549     tp = get_pointer_points_to_type (tp);
550   }
551
552   res = ta_type (tp);
553
554   return (res);
555 }
556
557
558 /**
559    Find an approximation to the given load node's value's types
560 */
561 static typalise_t *typalise_load (ir_node *load)
562 {
563   entity *ent = NULL;
564   type *tp = NULL;
565   typalise_t *res = NULL;
566   ir_node *load_ptr = get_Load_ptr (load);
567
568   if (iro_Sel == get_irn_opcode (load_ptr)) {
569     ent = get_Sel_entity (load_ptr);
570   } else if (iro_SymConst == get_irn_opcode (load_ptr)) {
571     if (get_SymConst_kind (load_ptr) == symconst_addr_ent) {
572       ent = get_SymConst_entity (load_ptr);
573     } else if (get_SymConst_kind (load_ptr) == symconst_type_tag) {
574       tp = get_SymConst_type (load_ptr);
575     } else {
576       fprintf (stdout, "%s: cannot handle load (%s)\n",
577                __FUNCTION__, get_op_name (get_irn_op (load_ptr)));
578
579       cough_and_die (load_ptr);
580     }
581   } else {
582     fprintf (stdout, "%s: cannot handle load (%s)\n",
583              __FUNCTION__, get_op_name (get_irn_op (load_ptr)));
584       cough_and_die (load_ptr);
585   }
586
587   tp = get_entity_type (ent);
588
589   while (is_Pointer_type (tp)) {
590     tp = get_pointer_points_to_type (tp);
591   }
592
593   res = ta_type (tp);
594
595   return (res);
596 }
597
598
599 /**
600     Find an approximation to the given proj node's value's types
601 */
602 static typalise_t *typalise_proj (ir_node *proj)
603 {
604   typalise_t *res = NULL;
605   ir_node *proj_in = get_Proj_pred (proj);
606
607   if (iro_Proj  == get_irn_opcode (proj_in)) {
608     /* fprintf (stdout, "\tProj (Proj)\n"); */
609
610     proj_in = get_Proj_pred (proj_in);
611     if (iro_Start == get_irn_opcode (proj_in)) {
612       /* aha, proj arg */
613       ir_graph *graph = get_irn_irg (proj);
614       entity   *meth  = get_irg_entity (graph);
615
616       long n = get_Proj_proj (proj);
617       type *tp = get_method_param_type (get_entity_type (meth), n);
618       if (is_Pointer_type (tp)) {
619         tp = get_pointer_points_to_type (tp);
620       }
621
622       res = ta_type (tp);
623
624     } else if (iro_Call == get_irn_opcode (proj_in)) {
625       /* call result ... 'whatever' */
626       res = typalise_call (proj_in);
627     } else {
628       fprintf (stdout, "\n Proj (Proj (%s)) not handled\n",
629                get_op_name (get_irn_op (proj_in)));
630       cough_and_die (proj_in);
631     }
632   } else {
633     opcode op = get_irn_opcode (proj_in);
634     if ((iro_Load != op) && (iro_Alloc != op) && (iro_Call != op)) {
635       fprintf (stdout, "\n Proj (%s) not handled\n",
636                get_op_name (get_irn_op (proj_in)));
637       cough_and_die (proj_in);
638     }
639     res = typalise (proj_in);      /* everything else */
640     /* Proj (Load), Proj (New), Proj (Call) */
641   }
642
643   return (res);
644 }
645
646
647
648 /*
649   Public Interface
650 */
651 /**
652    Given a set of graphs and a typalise_t,  return the method (s) in
653    the set that are supported by the typalise_t.  Also, deallocates
654    the given set.
655 */
656 lset_t *filter_for_ta (lset_t *set, typalise_t *ta)
657 {
658   lset_t *res = lset_create ();
659   ir_graph *curs = (ir_graph*) lset_first (set);
660
661   while (NULL != curs) {
662     if (ta_supports (ta, curs)) {
663       lset_insert (res, curs);
664     }
665
666     curs = lset_next (set);
667   }
668
669   lset_destroy (set);
670
671   return (res);
672 }
673
674 /**
675    For the given ptr, do a quick check about what (class) types may be
676    brought along on it.
677 */
678 typalise_t *typalise (ir_node *node)
679 {
680   opcode op = get_irn_opcode (node);
681   typalise_t *res = NULL;
682
683   switch (op) {
684   case (iro_Cast): {
685     /* casts always succeed */
686     typalise_t *ta = NULL;
687     type *tp = get_Cast_type (node);
688
689     if (is_Pointer_type (tp)) {
690       tp = get_pointer_points_to_type (tp);
691     }
692     assert (is_Class_type (tp));
693
694     ta = typalise (get_Cast_op (node));
695
696     if (NULL == ta) {           /* no type found */
697       ta = ta_type (tp);
698     } else if (type_exact == ta->kind) { /* one type found */
699       /* nothing (maybe check cast? */
700     } else if (type_type == ta->kind) { /* some types found */
701       if (is_subtype (tp, ta->res.type)) {
702         ta->res.type = tp;     /* assume cast is correct */
703       } else {
704         /* should assert (is_subtype (ta->res.type, tp)) */
705       }
706     } else if (type_types == ta->kind) {
707       lset_t *ftp = filter_for_type (ta->res.types, tp);
708       lset_destroy (ta->res.types);
709       ta->res.types = ftp;
710     }
711
712     res = ta;
713   } break;
714
715   case (iro_Proj): {
716     res = typalise_proj (node);
717   } break;
718
719   case (iro_Load): {
720     res = typalise_load (node);
721   } break;
722
723   case (iro_Sel): {
724     /* FILTER */
725     /* it's call (sel (ptr)) or load (sel (ptr)) */
726     entity *ent = get_Sel_entity (node);
727     type *tp = get_entity_type (ent);
728
729     if (is_Method_type (tp)) {
730       /* obsoleted by typalise_call */
731       assert (0);
732       tp = get_entity_type (ent);
733       tp = get_method_res_type (tp, 0);
734
735       if (is_Pointer_type (tp)) {
736         tp = get_pointer_points_to_type (tp);
737       }
738
739       res = ta_type (tp);
740     } else if (is_Class_type (tp)) {
741       tp = get_entity_type (ent);
742
743       if (is_Pointer_type (tp)) {
744         tp = get_pointer_points_to_type (tp);
745       }
746
747       res = ta_type (tp);
748     } else if (is_Pointer_type (tp)) {
749       tp = get_pointer_points_to_type (tp);
750       res = ta_type (tp);
751     } else {
752       assert (0 && "select not handled");
753     }
754   } break;
755
756   case (iro_Phi): {
757     int n_ins = get_irn_arity (node);
758     int i;
759     ir_node *phi_in = NULL;
760     typalise_t *ta = NULL;
761
762     for (i = 0; i < n_ins; i ++) {
763       phi_in = get_irn_n (node, i);
764       typalise_t *ta_in = typalise (phi_in);
765
766       if (NULL != ta_in) {
767         ta = (NULL == ta) ? ta_in : ta_join (ta, ta_in);
768       }
769     }
770
771     res = ta;
772   } break;
773
774   case (iro_Alloc): {
775     type *type = get_Alloc_type (node);
776     res = ta_exact (type);
777   } break;
778
779   case (iro_Call): {
780     /* presumably call (sel (proj (call))) */
781     ir_node *ptr = get_Call_ptr (node);
782     entity *meth = NULL;
783     if (iro_Sel == get_irn_opcode (ptr)) {
784       meth = get_Sel_entity (ptr);
785     } else if (iro_SymConst == get_irn_opcode (ptr)) {
786       if (get_SymConst_kind (ptr) == symconst_addr_ent) {
787         meth = get_SymConst_entity (ptr);
788       } else {
789         meth = NULL;            /* WTF? */
790       }
791     }
792
793     if (NULL != meth) {
794       type *tp = get_method_res_type ((type*) meth, 0);
795       res = ta_type (tp);
796     } else {
797       /* could be anything */
798       /* fprintf (stdout, "meth= (null)"); */
799       res = NULL;
800     }
801
802     /* fprintf (stdout, "]\n"); */
803
804   } break;
805
806   case (iro_SymConst): {
807     if (get_SymConst_kind (node) == symconst_type_tag) {
808       type *tp = get_SymConst_type (node);
809
810       res = ta_type (tp);
811     } else if (get_SymConst_kind (node) == symconst_addr_ent) {
812       entity *ent = get_SymConst_entity (node);
813       type *tp = get_entity_owner (ent);
814
815       while (is_Pointer_type (tp)) {
816         tp = get_pointer_points_to_type (tp);
817       }
818
819       assert (is_Class_type (tp));
820
821       res = ta_type (tp);       /* can't use ta_exact */
822     } else if (get_SymConst_kind (node) == symconst_addr_name) {
823       /* oh, this is not a real call but a placeholder (exception stuff) */
824       fprintf (stdout, "%s (%s:%i): can't handle pseudo-call %s\n",
825                __FUNCTION__, __FILE__, __LINE__,
826                get_op_name (get_irn_op (node)));
827
828       res = NULL;
829     } else {
830       fprintf (stdout, "%s (%s:%i): can't handle SymConst %s\n",
831                __FUNCTION__, __FILE__, __LINE__,
832                get_op_name (get_irn_op (node)));
833
834       res = NULL;
835     }
836   } break;
837   case (iro_Const): {
838     /* presumably a NULL constant */
839     /* this also means we cannot handle calls against a NULL pointer. */
840     res = NULL;
841   } break;
842
843     /* template:
844        case (iro_Cast): {}
845        break;
846     */
847
848   default: {
849     fprintf (stdout, "what's with %s?\n", get_op_name (get_irn_op (node)));
850     cough_and_die (node);
851   } break;
852   }
853
854   return (res);
855 }
856
857 /*
858   Initialise the Typalise module
859 */
860 void typalise_init ()
861 {
862   if (NULL == java_lang_Throwable_tp) {
863     class_walk_super2sub (find_java_lang_Throwable, NULL, NULL);
864
865     /* make sure we have found it */
866     get_java_lang_Throwable ();
867   }
868 }
869
870
871
872 \f
873 /*
874   $Log$
875   Revision 1.9  2005/03/22 13:56:09  liekweg
876   "small" fix for exception b/d
877
878   Revision 1.8  2005/01/14 14:13:24  liekweg
879   fix gnu extension
880
881   Revision 1.7  2005/01/10 17:26:34  liekweg
882   fixup printfs, don't put environments on the stack
883
884   Revision 1.6  2005/01/05 14:25:54  beck
885   renames all is_x*_type() functions to is_X*_type() to prevent name clash with EDG fronten
886
887   Revision 1.5  2004/12/22 14:43:14  beck
888   made allocations C-like
889
890   Revision 1.4  2004/12/21 15:50:18  beck
891   removed C99 constructs
892
893   Revision 1.3  2004/12/02 16:17:51  beck
894   fixed config.h include
895
896   Revision 1.2  2004/10/22 09:53:10  liekweg
897   Correctly handle proj_args
898
899   Revision 1.1  2004/10/21 11:09:37  liekweg
900   Moved memwalk stuf into irmemwalk
901   Moved lset stuff into lset
902   Moved typalise stuff into typalise
903
904
905  */