dotgnu-pnet-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc.c engine/jitc_ptr.c


From: Klaus Treichel
Subject: [dotgnu-pnet-commits] pnet ./ChangeLog engine/jitc.c engine/jitc_ptr.c
Date: Fri, 06 Jan 2006 11:01:30 +0000

CVSROOT:        /cvsroot/dotgnu-pnet
Module name:    pnet
Branch:         
Changes by:     Klaus Treichel <address@hidden> 06/01/06 11:01:30

Modified files:
        .              : ChangeLog 
        engine         : jitc.c jitc_ptr.c 

Log message:
        Clean up the code a bit and fix a bug in stelem where a conversion to 
the
        array type was missing.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/ChangeLog.diff?tr1=1.3268&tr2=1.3269&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc.c.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://cvs.savannah.gnu.org/viewcvs/dotgnu-pnet/pnet/engine/jitc_ptr.c.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: pnet/ChangeLog
diff -u pnet/ChangeLog:1.3268 pnet/ChangeLog:1.3269
--- pnet/ChangeLog:1.3268       Thu Jan  5 20:15:06 2006
+++ pnet/ChangeLog      Fri Jan  6 11:01:30 2006
@@ -1,3 +1,8 @@
+2006-01-06  Klaus Treichel  <address@hidden>
+
+       * engine/jitc.c, engine/jitc_ptr.c: Clean up the code a bit and fix a 
bug
+       in stelem where a conversion to the array type was missing.
+
 2006-01-04  Klaus Treichel  <address@hidden>
 
        * engine/jitc.c, engine/jitc.h, engine/jitc_branch.c, 
engine/jitc_conv.c,
Index: pnet/engine/jitc.c
diff -u pnet/engine/jitc.c:1.9 pnet/engine/jitc.c:1.10
--- pnet/engine/jitc.c:1.9      Thu Jan  5 19:40:07 2006
+++ pnet/engine/jitc.c  Fri Jan  6 11:01:30 2006
@@ -697,6 +697,40 @@
 }
 
 /*
+ * Get the evaluation stack type for the given ILJitType.
+ */
+static ILJitType _ILJitTypeToStackType(ILJitType type)
+{
+       ILJitType  stackType = jit_type_promote_int(type);;
+
+       if(type == stackType)
+       {
+               if((type == _IL_JIT_TYPE_SINGLE) || (type == 
_IL_JIT_TYPE_DOUBLE))
+               {
+                       stackType = _IL_JIT_TYPE_NFLOAT;
+               }
+       }
+       return stackType;
+}
+
+/*
+ * Convert the given ILJitValue to the type needed on the evaluation stack.
+ * When no conversion is needed the value is returned as it is.
+ */
+static ILJitValue _ILJitValueConvertToStackType(ILJitFunction func,
+                                                                               
                ILJitValue value)
+{
+       ILJitType type = jit_value_get_type(value);
+       ILJitType stackType = _ILJitTypeToStackType(type);
+
+       if(type != stackType)
+       {
+               value = jit_insn_convert(func, value, stackType, 0);
+       }
+       return value;
+}
+
+/*
  * Generate the stub for calling an internal function.
  */
 static int _ILJitCompileInternal(jit_function_t func, ILMethod *method, void 
*nativeFunction)
Index: pnet/engine/jitc_ptr.c
diff -u pnet/engine/jitc_ptr.c:1.3 pnet/engine/jitc_ptr.c:1.4
--- pnet/engine/jitc_ptr.c:1.3  Thu Jan  5 19:40:07 2006
+++ pnet/engine/jitc_ptr.c      Fri Jan  6 11:01:30 2006
@@ -82,31 +82,15 @@
        ILJitValue length;
        ILJitValue value;
        ILJitValue arrayBase;
-       ILJitType  stackType = jit_type_promote_int(type);;
 
        ValidateAddress(coder, array);
        length = GetArrayLength(coder, array);
        ValidateArrayIndex(coder, length, index);
        arrayBase = GetArrayBase(coder, array);
-       if(type == stackType)
-       {
-               if((type == _IL_JIT_TYPE_SINGLE) || (type == 
_IL_JIT_TYPE_DOUBLE))
-               {
-                       stackType = _IL_JIT_TYPE_NFLOAT;
-               }
-       }
        value = jit_insn_load_elem(coder->jitFunction, arrayBase, index,
                                                           type);
-       if(type != stackType)
-       {
-               coder->jitStack[coder->stackTop - 2] =
-                       jit_insn_convert(coder->jitFunction, value,
-                                                        stackType, 0);
-       }
-       else
-       {
-               coder->jitStack[coder->stackTop - 2] = value;
-       }
+       coder->jitStack[coder->stackTop - 2] = 
+               _ILJitValueConvertToStackType(coder->jitFunction, value);
        JITC_ADJUST(coder, -1);
 }
 
@@ -120,12 +104,18 @@
        ILJitValue value = coder->jitStack[coder->stackTop - 1];
        ILJitValue length;
        ILJitValue arrayBase;
+       ILJitType valueType = jit_value_get_type(value);
 
        ValidateAddress(coder, array);
        length = GetArrayLength(coder, array);
        ValidateArrayIndex(coder, length, index);
        arrayBase = GetArrayBase(coder, array);
 
+       /* Convert the value to the array type when needed. */
+       if(valueType != type)
+       {
+               value = jit_insn_convert(coder->jitFunction, value, type, 0);
+       }
        jit_insn_store_elem(coder->jitFunction, arrayBase, index, value);
        JITC_ADJUST(coder, -3);
 }
@@ -137,27 +127,11 @@
 {
        ILJitValue ptr = coder->jitStack[coder->stackTop - 1];
        ILJitValue value;
-       ILJitType  stackType = jit_type_promote_int(type);;
 
        ValidateAddress(coder, ptr);
-       if(type == stackType)
-       {
-               if((type == _IL_JIT_TYPE_SINGLE) || (type == 
_IL_JIT_TYPE_DOUBLE))
-               {
-                       stackType = _IL_JIT_TYPE_NFLOAT;
-               }
-       }
        value = jit_insn_load_relative(coder->jitFunction, ptr, (jit_nint)0, 
type);
-       if(type != stackType)
-       {
-               coder->jitStack[coder->stackTop - 1] =
-                       jit_insn_convert(coder->jitFunction, value,
-                                                        stackType, 0);
-       }
-       else
-       {
-               coder->jitStack[coder->stackTop - 1] = value;
-       }
+       coder->jitStack[coder->stackTop - 1] = 
+               _ILJitValueConvertToStackType(coder->jitFunction, value);
 }
 
 /*




reply via email to

[Prev in Thread] Current Thread [Next in Thread]