* src/vm/jit/alpha/codegen.c (codegen): Use lock_monitor_enter/exit
[cacao.git] / src / vm / descriptor.c
index 419a1a552d29dbe82774fb715849c07c72ed627d..8b30632895f360a6dd76e96d4f72bf1095c5ad73 100644 (file)
@@ -1,9 +1,9 @@
 /* src/vm/descriptor.c - checking and parsing of field / method descriptors
 
-   Copyright (C) 1996-2005 R. Grafl, A. Krall, C. Kruegel, C. Oates,
-   R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner,
-   C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger,
-   Institut f. Computersprachen - TU Wien
+   Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel,
+   C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring,
+   E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich,
+   J. Wenninger, Institut f. Computersprachen - TU Wien
 
    This file is part of CACAO.
 
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA.
 
-   Contact: cacao@complang.tuwien.ac.at
+   Contact: cacao@cacaojvm.org
 
    Authors: Edwin Steiner
 
    Changes: Christian Thalinger
             Christian Ullrich
 
-   $Id: descriptor.c 3826 2005-12-01 18:52:50Z edwin $
+   $Id: descriptor.c 4879 2006-05-05 17:34:49Z edwin $
 
 */
 
 
+#include "config.h"
+
 #include <assert.h>
 
-#include "types.h"
+#include "vm/types.h"
+
 #include "md-abi.h"
 
 #include "mm/memory.h"
 #include "vm/descriptor.h"
 #include "vm/exceptions.h"
+#include "vm/options.h"
 #include "vm/resolve.h"
 #include "vm/stringlocal.h"
 
@@ -453,7 +457,7 @@ descriptor_pool_add_class(descriptor_pool *pool, utf *name)
 
 #ifdef DESCRIPTOR_VERBOSE
        fprintf(stderr,"descriptor_pool_add_class(%p,",(void*)pool);
-       utf_fprint(stderr,name);fprintf(stderr,")\n");
+       utf_fprint_printable_ascii(stderr,name);fprintf(stderr,")\n");
 #endif
 
        /* find a place in the hashtable */
@@ -518,7 +522,7 @@ descriptor_pool_add(descriptor_pool *pool, utf *desc, int *paramslots)
        
 #ifdef DESCRIPTOR_VERBOSE
        fprintf(stderr,"descriptor_pool_add(%p,",(void*)pool);
-       utf_fprint(stderr,desc);fprintf(stderr,")\n");
+       utf_fprint_printable_ascii(stderr,desc);fprintf(stderr,")\n");
 #endif
 
        assert(pool);
@@ -865,7 +869,7 @@ descriptor_pool_parse_method_descriptor(descriptor_pool *pool, utf *desc,
 #ifdef DESCRIPTOR_VERBOSE
        fprintf(stderr,"descriptor_pool_parse_method_descriptor(%p,%d,%p,",
                        (void*)pool,(int)mflags,(void*)thisclass);
-       utf_fprint(stderr,desc); fprintf(stderr,")\n");
+       utf_fprint_printable_ascii(stderr,desc); fprintf(stderr,")\n");
 #endif
 
        assert(pool);
@@ -969,13 +973,21 @@ descriptor_pool_parse_method_descriptor(descriptor_pool *pool, utf *desc,
                }
 
                /* fill the paramdesc */
-               /* md_param_alloc has to be called if md->paramcount == 0, too, so it */
-               /* can make the reservation for the Linkage Area, Return Register...  */
-               md_param_alloc(md);
-       }
-       else {
-               /* params will be allocated later by descriptor_params_from_paramtypes */
-               /* if necessary                                                        */
+               /* md_param_alloc has to be called if md->paramcount == 0,
+                  too, so it can make the reservation for the Linkage Area,
+                  Return Register... */
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+               if (!opt_intrp)
+# endif
+                       md_param_alloc(md);
+#endif
+
+       } else {
+               /* params will be allocated later by
+                  descriptor_params_from_paramtypes if necessary */
+
                md->params = NULL;
        }
 
@@ -1049,16 +1061,22 @@ bool descriptor_params_from_paramtypes(methoddesc *md, s4 mflags)
                /* allocate memory for params */
 
                md->params = MNEW(paramdesc, md->paramcount);
-       }
-       else {
+
+       else {
                md->params = METHODDESC_NOPARAMS;
        }
 
        /* fill the paramdesc */
-       /* md_param_alloc has to be called if md->paramcount == 0, too, so     */
-       /* it can make the reservation for the Linkage Area, Return Register.. */
-
-       md_param_alloc(md);
+       /* md_param_alloc has to be called if md->paramcount == 0, too, so
+          it can make the reservation for the Linkage Area, Return
+          Register.. */
+
+#if defined(ENABLE_JIT)
+# if defined(ENABLE_INTRP)
+       if (!opt_intrp)
+# endif
+               md_param_alloc(md);
+#endif
 
        return true;
 }
@@ -1157,7 +1175,7 @@ descriptor_debug_print_typedesc(FILE *file,typedesc *d)
        
        if (d->type == TYPE_ADDRESS) {
                if (d->classref)
-                       utf_fprint(file,d->classref->name);
+                       utf_fprint_printable_ascii(file,d->classref->name);
                else
                        fprintf(file,"<class=NULL>");
        }
@@ -1260,7 +1278,7 @@ descriptor_pool_debug_dump(descriptor_pool *pool,FILE *file)
        u4 size;
        
        fprintf(file,"======[descriptor_pool for ");
-       utf_fprint(file,pool->referer->name);
+       utf_fprint_printable_ascii(file,pool->referer->name);
        fprintf(file,"]======\n");
 
        fprintf(file,"fieldcount:     %d\n",pool->fieldcount);
@@ -1276,7 +1294,7 @@ descriptor_pool_debug_dump(descriptor_pool *pool,FILE *file)
                classref_hash_entry *c = (classref_hash_entry *) pool->classrefhash.ptr[slot];
                while (c) {
                        fprintf(file,"    %4d: ",c->index);
-                       utf_fprint(file,c->name);
+                       utf_fprint_printable_ascii(file,c->name);
                        fprintf(file,"\n");
                        c = c->hashlink;
                }
@@ -1287,7 +1305,7 @@ descriptor_pool_debug_dump(descriptor_pool *pool,FILE *file)
                descriptor_hash_entry *c = (descriptor_hash_entry *) pool->descriptorhash.ptr[slot];
                while (c) {
                        fprintf(file,"    %p: ",c->parseddesc.any);
-                       utf_fprint(file,c->desc);
+                       utf_fprint_printable_ascii(file,c->desc);
                        fprintf(file,"\n");
                        c = c->hashlink;
                }