*** empty log message ***
[cacao.git] / src / vm / jit / codegen.inc
index 96f6eff690339daa1aa80eb10a09e7a74974bcdf..cd7729faec4f93c9f90f02e2ee4ea14d62b8dccf 100644 (file)
@@ -47,7 +47,7 @@
    memory. All functions writing values into the data area return the offset
    relative the begin of the code area (start of procedure).   
 
-   $Id: codegen.inc 1759 2004-12-14 13:16:11Z twisti $
+   $Id: codegen.inc 2220 2005-04-05 15:49:13Z christian $
 
 */
 
@@ -314,6 +314,7 @@ static s4 dseg_adds8(codegendata *cd, s8 value)
 #endif
 
 
+#if !defined(__XDSPCORE__)
 static s4 dseg_addfloat_increase(codegendata *cd, float value)
 {
        dseg_increase(cd);
@@ -364,6 +365,7 @@ static s4 dseg_adddouble(codegendata *cd, double value)
 
        return -(cd->dseglen);
 }
+#endif /* !defined(__XDSPCORE__) */
 
 
 static void dseg_addtarget(codegendata *cd, basicblock *target)
@@ -872,38 +874,14 @@ static int reg_of_var(registerdata *rd, stackptr v, int tempregnum)
                break;
 
        case ARGVAR:
-               v->regoff = v->varnum;
-               if (IS_FLT_DBL_TYPE(v->type)) {
-                       if (v->varnum < FLT_ARG_CNT) {
-                               v->regoff = rd->argfltregs[v->varnum];
-                               return(rd->argfltregs[v->varnum]);
-                       }
-
-#if defined(__POWERPC__)
-                       v->regoff += 6;
-#else
-                       v->regoff -= FLT_ARG_CNT;
-#endif
-
-               } else {
-#if defined(__POWERPC__)
-                       if (v->varnum < INT_ARG_CNT - (IS_2_WORD_TYPE(v->type) != 0)) {
-#else
-                       if (v->varnum < INT_ARG_CNT) {
-#endif
-                               v->regoff = rd->argintregs[v->varnum];
-                               return (rd->argintregs[v->varnum]);
-                       }
-
-#if defined(__POWERPC__)
-                       v->regoff += 6;
-#else
-                       v->regoff -= INT_ARG_CNT;
-#endif
-               }
+               if (!(v->flags & INMEMORY))
+                       return(v->regoff);
                break;
        }
-
+#ifdef STATISTICS
+       if (opt_stat)
+               count_spills_read++;
+#endif
        v->flags |= INMEMORY;
        return tempregnum;
 }
@@ -1017,13 +995,20 @@ static void codegen_resolve_native(methodinfo *m,void **insertionPoint,void *jmp
        void *lib;
        void *sym;
 
+#if defined(USE_THREADS)
   builtin_monitorenter((java_objectheader*) m);
+#endif
+
 #if defined(__X86_64__)
   if ((*((s4*)jmpPatchTarget))==((s4)jmpTarget)) {
 #else
   if ((*jmpPatchTarget)==jmpTarget) {
 #endif
+
+#if defined(USE_THREADS)
     builtin_monitorexit((java_objectheader*) m);
+#endif
+
     return;
   }
   /*log_text("trying to resolve a native method");
@@ -1076,6 +1061,7 @@ static void codegen_resolve_native(methodinfo *m,void **insertionPoint,void *jmp
         /*log_text("resolved");*/
       } else { 
          /* we failed to find the native function within the execution image (app + loaded libraries) -> will cause an exit*/
+                dolog("\nnative function not found: %s",overloadedNative);
          MFREE(overloadedNative,char,overloadedNativeLen);
          log_text("It was not possible to find the native function implementation. Not even in overloading case");
       }
@@ -1088,7 +1074,11 @@ static void codegen_resolve_native(methodinfo *m,void **insertionPoint,void *jmp
 #else
       (*jmpPatchTarget)=jmpTarget;
 #endif
+
+#if defined(USE_THREADS)
       builtin_monitorexit((java_objectheader *) m );
+#endif
+
       return;
     }
 
@@ -1103,7 +1093,10 @@ static void codegen_resolve_native(methodinfo *m,void **insertionPoint,void *jmp
     info=(char*)MNEW(char,slen);
     sprintf(info,"%s.%s%s",m->class->name->text,m->name->text,m->descriptor->text);
     
+#if defined(USE_THREADS)
     builtin_monitorexit((java_objectheader *) m );
+#endif
+
     throw_cacao_exception_exit(string_java_lang_LinkageError,
                                                        info);
   }