Author: zoltan
Date: 2005-03-15 15:02:19 -0500 (Tue, 15 Mar 2005)
New Revision: 41852

Added:
   
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/selfassert.cs
   branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/selfdeny.cs
   
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/selfpermit.cs
Modified:
   branches/vargaz/mini-xp-local-regalloc/mono/mono/arch/ChangeLog
   branches/vargaz/mini-xp-local-regalloc/mono/mono/arch/amd64/amd64-codegen.h
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/ChangeLog
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-amd64.md
   branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/declsec.c
   branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/Makefile
   branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/README
   
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/ChangeLog
   
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/Makefile
   
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/icall1.cs
   
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/icall2.cs
Log:
Merge from HEAD.


Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/arch/ChangeLog
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/arch/ChangeLog     
2005-03-15 20:01:54 UTC (rev 41851)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/arch/ChangeLog     
2005-03-15 20:02:19 UTC (rev 41852)
@@ -1,3 +1,14 @@
+2005-03-15  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * amd64/amd64-codegen.h (amd64_emit_rex): Emit a rex when accessing the
+       byte registers.
+       
+       * amd64/amd64-codegen.h (AMD64_BYTE_REGS): Add AMD64_BYTE_REGS macro.
+
+2005-03-14  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * amd64/amd64-codegen.h: Add missing AMD64_XMM7.
+
 2005-03-13  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * amd64/amd64-codegen.h: Remove some unneccesary REXes.

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/arch/amd64/amd64-codegen.h
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/arch/amd64/amd64-codegen.h 
2005-03-15 20:01:54 UTC (rev 41851)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/arch/amd64/amd64-codegen.h 
2005-03-15 20:02:19 UTC (rev 41852)
@@ -45,6 +45,7 @@
        AMD64_XMM4 = 4,
        AMD64_XMM5 = 5,
        AMD64_XMM6 = 6,
+       AMD64_XMM7 = 7,
        AMD64_XMM8 = 8,
        AMD64_XMM9 = 9,
        AMD64_XMM10 = 10,
@@ -81,7 +82,7 @@
                        (((reg_modrm) > 7) ? AMD64_REX_R : 0) | \
                        (((reg_index) > 7) ? AMD64_REX_X : 0) | \
                        (((reg_rm_base_opcode) > 7) ? AMD64_REX_B : 0); \
-               if (_amd64_rex_bits != 0) *(inst)++ = 
AMD64_REX(_amd64_rex_bits); \
+               if ((_amd64_rex_bits != 0) || ((width == 1))) *(inst)++ = 
AMD64_REX(_amd64_rex_bits); \
        } while (0)
 
 typedef union {
@@ -91,69 +92,10 @@
 
 #include "../x86/x86-codegen.h"
 
+/* In 64 bit mode, all registers have a low byte subregister */
 #undef X86_IS_BYTE_REG
 #define X86_IS_BYTE_REG(reg) 1
 
-/* Need to fill this info in for amd64. */
-
-#if 0
-/*
-// bitvector mask for callee-saved registers
-*/
-#define X86_ESI_MASK (1<<X86_ESI)
-#define X86_EDI_MASK (1<<X86_EDI)
-#define X86_EBX_MASK (1<<X86_EBX)
-#define X86_EBP_MASK (1<<X86_EBP)
-
-#define X86_CALLEE_REGS ((1<<X86_EAX) | (1<<X86_ECX) | (1<<X86_EDX))
-#define X86_CALLER_REGS ((1<<X86_EBX) | (1<<X86_EBP) | (1<<X86_ESI) | 
(1<<X86_EDI))
-#define X86_BYTE_REGS   ((1<<X86_EAX) | (1<<X86_ECX) | (1<<X86_EDX) | 
(1<<X86_EBX))
-
-#define X86_IS_SCRATCH(reg) (X86_CALLER_REGS & (1 << (reg))) /* X86_EAX, 
X86_ECX, or X86_EDX */
-#define X86_IS_CALLEE(reg)  (X86_CALLEE_REGS & (1 << (reg)))   /* X86_ESI, 
X86_EDI, X86_EBX, or X86_EBP */
-
-#define X86_IS_BYTE_REG(reg) ((reg) < 4)
-
-/*
-// Frame structure:
-//
-//      +--------------------------------+
-//      | in_arg[0]       = var[0]          |
-//      | in_arg[1]          = var[1]       |
-//      |            . . .                              |
-//      | in_arg[n_arg-1] = var[n_arg-1] |
-//      +--------------------------------+
-//      |       return IP                |
-//      +--------------------------------+
-//      |       saved EBP                | <-- frame pointer (EBP)
-//      +--------------------------------+
-//      |            ...                 |  n_extra
-//      +--------------------------------+
-//      |          var[n_arg]               |
-//      |          var[n_arg+1]             |  local variables area
-//      |          . . .                 |
-//      |          var[n_var-1]             | 
-//      +--------------------------------+
-//      |                                           |
-//      |                                           |  
-//      |              spill area               | area for spilling mimic stack
-//      |                                           |
-//      +--------------------------------|
-//      |          ebx                   |
-//      |          ebp [ESP_Frame only]  |
-//      |             esi                   |  0..3 callee-saved regs
-//      |          edi                   | <-- stack pointer (ESP)
-//      +--------------------------------+
-//      |      stk0                         |
-//      |      stk1                         |  operand stack area/
-//      |      . . .                        |  out args
-//      |      stkn-1                       |
-//      +--------------------------------|
-//
-//
-*/
-#endif
-
 #define amd64_modrm_mod(modrm) ((modrm) >> 6)
 #define amd64_modrm_reg(modrm) (((modrm) >> 3) & 0x7)
 #define amd64_modrm_rm(modrm) ((modrm) & 0x7)
@@ -721,7 +663,7 @@
 #define amd64_branch32_size(inst,cond,imm,is_signed,size) do { amd64_emit_rex 
((inst),(size),0,0,0); x86_branch32((inst),(cond),(imm),(is_signed)); } while 
(0)
 #define amd64_branch_size(inst,cond,target,is_signed,size) do { amd64_emit_rex 
((inst),(size),0,0,0); x86_branch((inst),(cond),(target),(is_signed)); } while 
(0)
 #define amd64_branch_disp_size(inst,cond,disp,is_signed,size) do { 
amd64_emit_rex ((inst),(size),0,0,0); 
x86_branch_disp((inst),(cond),(disp),(is_signed)); } while (0)
-#define amd64_set_reg_size(inst,cond,reg,is_signed,size) do { amd64_emit_rex 
((inst),0,0,0,(reg)); x86_set_reg((inst),(cond),((reg)&0x7),(is_signed)); } 
while (0)
+#define amd64_set_reg_size(inst,cond,reg,is_signed,size) do { 
amd64_emit_rex((inst),1,0,0,(reg)); 
x86_set_reg((inst),(cond),((reg)&0x7),(is_signed)); } while (0)
 #define amd64_set_mem_size(inst,cond,mem,is_signed,size) do { amd64_emit_rex 
((inst),(size),0,0,0); x86_set_mem((inst),(cond),(mem),(is_signed)); } while (0)
 #define amd64_set_membase_size(inst,cond,basereg,disp,is_signed,size) do { 
amd64_emit_rex ((inst),(size),0,0,(basereg)); 
x86_set_membase((inst),(cond),((basereg)&0x7),(disp),(is_signed)); } while (0)
 #define amd64_call_imm_size(inst,disp,size) do { amd64_emit_rex 
((inst),(size),0,0,0); x86_call_imm((inst),(disp)); } while (0)

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/ChangeLog
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/ChangeLog     
2005-03-15 20:01:54 UTC (rev 41851)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/ChangeLog     
2005-03-15 20:02:19 UTC (rev 41852)
@@ -1,3 +1,21 @@
+2005-03-15  Zoltan Varga  <[EMAIL PROTECTED]>
+
+       * mini-amd64.c: Rework local register allocator to unify the fp+non fp
+       allocation. Also add handling for more corner cases.
+
+       * mini.c linear-scan.c: Promote local variables which are local to
+       a basic block to virtual registers.
+       
+       * mini-amd64.c (mono_arch_setup_jit_tls_data): Enable 
+       thread_tls_offset calculation.
+
+2005-03-14  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * declsec.c: Reworked linkdemand checks for icall. The previous code
+       was using the declaration code (untrusted) and didn't work as expected
+       with the CLR 2.0. We're now more compatible with 2.0 than 1.x for this
+       specific case.
+
 2005-03-13  Zoltan Varga  <[EMAIL PROTECTED]>
 
        * iltests.il: Add new localloc test.

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-amd64.md
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-amd64.md  
2005-03-15 20:01:54 UTC (rev 41851)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/cpu-amd64.md  
2005-03-15 20:02:19 UTC (rev 41852)
@@ -16,8 +16,9 @@
 #      b  base register (used in address references)
 #      f  floating point register
 #      a  EAX register
-#       d  EDX register
+#   d  EDX register
 #      l  long reg (forced eax:edx)
+#   c  register which can be used as a byte register (RAX..RDX)
 #
 # len:number         describe the maximun length in bytes of the instruction
 #                   number is a positive integer.  If the length is not 
specified
@@ -204,11 +205,11 @@
 prefix1:
 prefixref:
 arglist:
-ceq: dest:i len:8
-cgt: dest:i len:8
-cgt.un: dest:i len:8
-clt: dest:i len:8
-clt.un: dest:i len:8
+ceq: dest:c len:8
+cgt: dest:c len:8
+cgt.un: dest:c len:8
+clt: dest:c len:8
+clt.un: dest:c len:8
 ldftn:
 ldvirtftn:
 ldarg:
@@ -262,9 +263,9 @@
 fcall: dest:f len:64 clob:c
 fcall_reg: dest:f src1:i len:64 clob:c
 fcall_membase: dest:f src1:b len:64 clob:c
-lcall: dest:i len:64 clob:c
-lcall_reg: dest:i src1:i len:64 clob:c
-lcall_membase: dest:i src1:b len:64 clob:c
+lcall: dest:a len:64 clob:c
+lcall_reg: dest:a src1:i len:64 clob:c
+lcall_membase: dest:a src1:b len:64 clob:c
 vcall: len:64 clob:c
 vcall_reg: src1:i len:64 clob:c
 vcall_membase: src1:b len:64 clob:c
@@ -283,7 +284,7 @@
 store_membase_reg: dest:b src1:i len:9
 storei8_membase_reg: dest:b src1:i len:9
 storei1_membase_imm: dest:b len:11
-storei1_membase_reg: dest:b src1:i len:9
+storei1_membase_reg: dest:b src1:c len:9
 storei2_membase_imm: dest:b len:13
 storei2_membase_reg: dest:b src1:i len:9
 storei4_membase_imm: dest:b len:13
@@ -292,8 +293,8 @@
 storer4_membase_reg: dest:b src1:f len:14
 storer8_membase_reg: dest:b src1:f len:9
 load_membase: dest:i src1:b len:15
-loadi1_membase: dest:i src1:b len:9
-loadu1_membase: dest:i src1:b len:9
+loadi1_membase: dest:c src1:b len:9
+loadu1_membase: dest:c src1:b len:9
 loadi2_membase: dest:i src1:b len:9
 loadu2_membase: dest:i src1:b len:9
 loadi4_membase: dest:i src1:b len:9
@@ -575,11 +576,11 @@
 int_shr_un_imm: dest:i src1:i clob:1 len:64
 int_neg: dest:i src1:i clob:1 len:64
 int_not: dest:i src1:i clob:1 len:64
-int_ceq: dest:i len:64
-int_cgt: dest:i len:64
-int_cgt_un: dest:i len:64
-int_clt: dest:i len:64
-int_clt_un: dest:i len:64
+int_ceq: dest:c len:64
+int_cgt: dest:c len:64
+int_cgt_un: dest:c len:64
+int_clt: dest:c len:64
+int_clt_un: dest:c len:64
 int_beq: len:64
 int_bne_un: len:64
 int_blt: len:64

Modified: branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/declsec.c
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/declsec.c     
2005-03-15 20:01:54 UTC (rev 41851)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/mini/declsec.c     
2005-03-15 20:02:19 UTC (rev 41852)
@@ -138,6 +138,40 @@
  * Ensure that the restrictions for partially trusted code are satisfied.
  *
  * @domain     The current application domain
+ * @assembly   The assembly to query
+ * return value: TRUE if the assembly is runnning at FullTrust, FALSE 
otherwise.
+ */
+static gboolean
+mono_declsec_is_assembly_fulltrust (MonoDomain *domain, MonoAssembly *assembly)
+{
+       if (!MONO_SECMAN_FLAG_INIT (assembly->fulltrust)) {
+               MonoReflectionAssembly *refass = (MonoReflectionAssembly*) 
mono_assembly_get_object (domain, assembly);
+               MonoSecurityManager *secman = mono_security_manager_get_methods 
();
+
+               if (secman && refass) {
+                       MonoObject *res;
+                       gpointer args [1];
+                       args [0] = refass;
+
+                       res = mono_runtime_invoke (secman->linkdemandfulltrust, 
NULL, args, NULL);
+                       if (*(MonoBoolean *) mono_object_unbox(res)) {
+                               /* keep this value cached as it will be used 
very often */
+                               MONO_SECMAN_FLAG_SET_VALUE 
(assembly->fulltrust, TRUE);
+                               return TRUE;
+                       }
+               }
+
+               MONO_SECMAN_FLAG_SET_VALUE (assembly->fulltrust, FALSE);
+               return FALSE;
+       }
+
+       return MONO_SECMAN_FLAG_GET_VALUE (assembly->fulltrust);
+}
+
+/*
+ * Ensure that the restrictions for partially trusted code are satisfied.
+ *
+ * @domain     The current application domain
  * @caller     The method calling
  * @callee     The called method
  * return value: TRUE if a security violation is detection, FALSE otherwise.
@@ -186,28 +220,7 @@
                return FALSE;
 
        /* E - the caller's assembly must have full trust permissions */
-       if (!MONO_SECMAN_FLAG_INIT (assembly->fulltrust)) {
-               MonoReflectionAssembly *refass = (MonoReflectionAssembly*) 
mono_assembly_get_object (domain, assembly);
-               if (!secman)
-                       secman = mono_security_manager_get_methods ();
-
-               if (secman && refass) {
-                       MonoObject *res;
-                       gpointer args [1];
-                       args [0] = refass;
-
-                       res = mono_runtime_invoke (secman->linkdemandfulltrust, 
NULL, args, NULL);
-                       if (*(MonoBoolean *) mono_object_unbox(res)) {
-                               /* keep this value cached as it will be used 
very often */
-                               MONO_SECMAN_FLAG_SET_VALUE 
(assembly->fulltrust, TRUE);
-                               return FALSE;
-                       }
-               }
-
-               MONO_SECMAN_FLAG_SET_VALUE (assembly->fulltrust, FALSE);
-       }
-
-       if (MONO_SECMAN_FLAG_GET_VALUE (assembly->fulltrust))
+       if (mono_declsec_is_assembly_fulltrust (domain, assembly))
                return FALSE;
 
        /* g_warning ("FAILURE *** JIT LinkDemand APTC check *** %s.%s calls 
into %s.%s",
@@ -217,49 +230,6 @@
 }
 
 /*
- * Ensure that the restrictions for calling internal calls are satisfied.
- *
- * @caller     The method calling
- * @icall      The internal call method
- * return value: TRUE if a security violation is detection, FALSE otherwise.
- *
- * Executing internal calls (icalls) is a restricted operation. Only 
- * assemblies with an ECMA public key are allowed to call them (unless they
- * are publicly available).
- *
- * This LinkDemand case is special because it can be done without calling 
- * managed code.
- */
-static gboolean
-mono_declsec_linkdemand_ecma (MonoMethod *caller, MonoMethod *icall)
-{
-       MonoAssembly *assembly;
-
-       mono_jit_stats.cas_linkdemand_icall++;
-
-       /* some icall are public (i.e. they CAN be called by any code) */
-       if (((icall->klass->flags & TYPE_ATTRIBUTE_PUBLIC) == 
TYPE_ATTRIBUTE_PUBLIC) &&
-               ((icall->flags & FIELD_ATTRIBUTE_PUBLIC) == 
FIELD_ATTRIBUTE_PUBLIC)) {
-               return FALSE;
-       }
-
-       assembly = mono_image_get_assembly (icall->klass->image);
-       if (!MONO_SECMAN_FLAG_INIT (assembly->ecma)) {
-               guint32 size = 0;
-               const char *pk = mono_image_get_public_key 
(caller->klass->image, &size);
-               MONO_SECMAN_FLAG_SET_VALUE (assembly->ecma, mono_is_ecma_key 
(pk, size));
-       }
-
-       if (MONO_SECMAN_FLAG_GET_VALUE (assembly->ecma))
-               return FALSE;
-
-       /* g_warning ("FAILURE *** JIT LinkDemand for ECMA check *** %s.%s 
calls into %s.%s", 
-               caller->klass->name, caller->name, icall->klass->name, 
icall->name); */
-
-       return TRUE;    /* i.e. throw new SecurityException(); */
-}
-
-/*
  * Ensure that the restrictions for calling native code are satisfied.
  *
  * @domain     The current application domain
@@ -324,7 +294,47 @@
        return TRUE;    /* i.e. throw new SecurityException(); */
 }
 
+/*
+ * Ensure that the restrictions for calling internal calls are satisfied.
+ *
+ * @domain     The current application domain
+ * @caller     The method calling
+ * @icall      The internal call method
+ * return value: TRUE if a security violation is detection, FALSE otherwise.
+ *
+ * We can't trust the icall flags/iflags as it comes from the assembly
+ * that we may want to restrict and we do not have the public/restricted
+ * information about icalls in the runtime. Actually it is not so bad 
+ * as the CLR 2.0 doesn't enforce that restriction anymore.
+ * 
+ * So we'll limit the icalls to originate from ECMA signed assemblies 
+ * (as this is required for partial trust scenarios) - or - assemblies that 
+ * have FullTrust.
+ */
+static gboolean
+mono_declsec_linkdemand_icall (MonoDomain *domain, MonoMethod *caller, 
MonoMethod *icall)
+{
+       MonoAssembly *assembly;
 
+       mono_jit_stats.cas_linkdemand_icall++;
+
+       /* check if the _icall_ is defined inside an ECMA signed assembly */
+       assembly = mono_image_get_assembly (icall->klass->image);
+       if (!MONO_SECMAN_FLAG_INIT (assembly->ecma)) {
+               guint32 size = 0;
+               const char *pk = mono_image_get_public_key 
(icall->klass->image, &size);
+               MONO_SECMAN_FLAG_SET_VALUE (assembly->ecma, mono_is_ecma_key 
(pk, size));
+       }
+
+       if (MONO_SECMAN_FLAG_GET_VALUE (assembly->ecma))
+               return FALSE;
+
+       /* else check if the _calling_ assembly is running at FullTrust */
+       assembly = mono_image_get_assembly (caller->klass->image);
+       return !mono_declsec_is_assembly_fulltrust (domain, assembly);
+}
+
+
 /*
  * Before the JIT can link (call) into a method the following security checks
  * must be done:
@@ -349,8 +359,8 @@
        /* first, the special (implied) linkdemand */
 
        if (callee->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) {
-               /* restrict calls into the runtime to ECMA signed assemblies */
-               if (mono_declsec_linkdemand_ecma (caller, callee))
+               /* restrict internal calls into the runtime */
+               if (mono_declsec_linkdemand_icall (domain, caller, callee))
                        violation = MONO_JIT_LINKDEMAND_ECMA;
        } else if (callee->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
                /* CAS can restrict p/invoke calls with the assembly granted 
permissions */

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/Makefile
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/Makefile  
2005-03-15 20:01:54 UTC (rev 41851)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/Makefile  
2005-03-15 20:02:19 UTC (rev 41852)
@@ -3,13 +3,16 @@
 PROFILE = net_1_1
 
 all:   pinvoke1.exe pinvoke2.exe pinvoke3.exe \
-       sucs1.exe sucs2.exe sucs3.exe sucs4.exe 
+       sucs1.exe sucs2.exe sucs3.exe sucs4.exe \
+       selfassert.exe selfdeny.exe selfpermit.exe
 
 aot:   pinvoke1.exe.so pinvoke2.exe.so pinvoke3.exe.so \
-       sucs1.exe.so sucs2.exe.so sucs3.exe.so sucs4.exe.so 
+       sucs1.exe.so sucs2.exe.so sucs3.exe.so sucs4.exe.so \
+       selfassert.exe.so selfdeny.exe.so selfpermit.exe.so
 
 FULLTRUST_TEST_FILES = pinvoke1 pinvoke2 pinvoke3 \
-       sucs1 sucs2 sucs3 sucs4
+       sucs1 sucs2 sucs3 sucs4 \
+       selfassert selfdeny selfpermit
 
 UNHANDLED_TEST_FILES = 
 

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/README
===================================================================
--- branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/README    
2005-03-15 20:01:54 UTC (rev 41851)
+++ branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/README    
2005-03-15 20:02:19 UTC (rev 41852)
@@ -27,3 +27,17 @@
 Notes
 - With Mono runtime the native function getuid is called in libc
 - With MS runtime the native function GetTickCount is called in kernel32.dll
+
+
+** Self
+
+Stack walk starts at the caller frame - i.e. the current frame is ignored. The
+self*.cs tests ensure that the walk starts at the right frame (or at least 
+that it ignore the caller frame).
+
+selfassert.cs  Deny on caller, Assert and Demand on callee. Assert is 
+               ignored, Demand is executed and fail on caller's Deny.
+selfdeny.cs    Deny and Demand on the same frame. Deny is ignored. Demand is
+               executed (stack walk).
+selfpermit.cs  PermitOnly Unmanaged, Demand ControlAppDomain. PermitOnly is
+               ignored and Demand (for ControlAppDomain) succeed.

Copied: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/selfassert.cs 
(from rev 41848, trunk/mono/mono/tests/cas/demand/selfassert.cs)

Copied: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/selfdeny.cs 
(from rev 41848, trunk/mono/mono/tests/cas/demand/selfdeny.cs)

Copied: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/demand/selfpermit.cs 
(from rev 41848, trunk/mono/mono/tests/cas/demand/selfpermit.cs)

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/ChangeLog
===================================================================
--- 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/ChangeLog 
    2005-03-15 20:01:54 UTC (rev 41851)
+++ 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/ChangeLog 
    2005-03-15 20:02:19 UTC (rev 41852)
@@ -1,3 +1,12 @@
+2005-03-14  Sebastien Pouliot  <[EMAIL PROTECTED]>
+
+       * icall1.cs: Fixed test to work on NET_2_0. We're now accepting the
+       2.0 behaviour when dealing with icalls (as we do not keep their
+       pblic status in the runtime).
+       * icall2.cs: Fixed test to work on NET_2_0 as the icall has changed
+       it's return value from bool to void. 
+       * Makefile: Allow to build the tests with either NET_1_1 or NET_2_0.
+
 2005-03-03  Sebastien Pouliot  <[EMAIL PROTECTED]>
 
        * cas4-5.cs: Removed. Replaced by new refcas#.cs tests.

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/Makefile
===================================================================
--- 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/Makefile  
    2005-03-15 20:01:54 UTC (rev 41851)
+++ 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/Makefile  
    2005-03-15 20:02:19 UTC (rev 41852)
@@ -1,7 +1,15 @@
 RUNTIME = mono --debug --security
-CSCOMPILE = mcs --debug
 PROFILE = net_1_1
 
+compiler_defines = -d:NET_1_1
+
+ifeq ($(PROFILE), net_2_0)
+CSCOMPILE = gmcs --debug
+compiler_defines += -d:NET_2_0
+else
+CSCOMPILE = mcs --debug
+endif
+
 all:   icall1.exe icall2.exe icall3.exe icall4.exe icall5.exe icall6.exe \
        aptc1a.exe aptc1b.exe aptc2a.exe aptc2b.exe aptclib.dll \
        pinvoke1.exe pinvoke2.exe pinvoke3.exe pinvoke4.exe \
@@ -75,25 +83,25 @@
        sn -k aptc.snk
 
 %a.exe: %.cs
-       $(CSCOMPILE) $^ /out:$@
+       $(CSCOMPILE) $^ /out:$@ $(compiler_defines)
 
 %b.exe: %.cs
-       $(CSCOMPILE) $^ /out:$@ /keyfile:ecma.pub /delaysign+
+       $(CSCOMPILE) $^ /out:$@ /keyfile:ecma.pub /delaysign+ 
$(compiler_defines)
 
 aptc1b.exe: aptc1.cs aptc.snk
-       $(CSCOMPILE) aptc1.cs /out:$@ /keyfile:aptc.snk
+       $(CSCOMPILE) aptc1.cs /out:$@ /keyfile:aptc.snk $(compiler_defines)
 
 aptc2a.exe: aptc2.cs aptclib.dll
-       $(CSCOMPILE) aptc2.cs /out:$@ /r:aptclib.dll
+       $(CSCOMPILE) aptc2.cs /out:$@ /r:aptclib.dll $(compiler_defines)
 
 aptc2b.exe: aptc2.cs aptclib.dll
-       $(CSCOMPILE) aptc2.cs /out:$@ /keyfile:aptc.snk /r:aptclib.dll
+       $(CSCOMPILE) aptc2.cs /out:$@ /keyfile:aptc.snk /r:aptclib.dll 
$(compiler_defines)
 
 aptclib.dll: aptclib.cs aptc.snk
-       $(CSCOMPILE) aptclib.cs /out:$@ /target:library /keyfile:aptc.snk
+       $(CSCOMPILE) aptclib.cs /out:$@ /target:library /keyfile:aptc.snk 
$(compiler_defines)
 
 %.exe: %.cs
-       $(CSCOMPILE) $^ /out:$@
+       $(CSCOMPILE) $^ /out:$@ $(compiler_defines)
 
 %.exe.so: %.exe
        $(RUNTIME) --aot $^

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/icall1.cs
===================================================================
--- 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/icall1.cs 
    2005-03-15 20:01:54 UTC (rev 41851)
+++ 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/icall1.cs 
    2005-03-15 20:02:19 UTC (rev 41852)
@@ -8,7 +8,7 @@
        public class Environment {
 
                [MethodImplAttribute (MethodImplOptions.InternalCall)]
-               internal extern static string internalGetGacPath ();
+               public extern static string internalGetGacPath ();
        }
 
        // private internal call for MS runtime
@@ -20,7 +20,11 @@
                }
 
                [MethodImpl (MethodImplOptions.InternalCall)]
-               internal extern bool CompleteGuid ();
+#if NET_2_0
+               public extern void CompleteGuid ();
+#else
+               public extern bool CompleteGuid ();
+#endif
        }
 }
 
@@ -41,14 +45,28 @@
                                result = Environment.internalGetGacPath ();
                        } else {
                                System.Guid g = new System.Guid ();
+#if NET_2_0
+                               g.CompleteGuid ();
+                               result = "completed";
+#else
                                result = g.CompleteGuid ().ToString ();
+#endif
                        }
-                       Console.WriteLine ("*1* Unexcepted internal call: {0}", 
result);
-                       return 1;
+#if NET_2_0
+                       Console.WriteLine ("*0* Excepted internal call: {0}", 
result);
+#else
+                       Console.WriteLine ("*0* Unexcepted (1.x) but accepted 
(like 2.x) internal call: {0}", result);
+#endif
+                       return 0;
                }
                catch (SecurityException se) {
-                       Console.WriteLine ("*0* Expected 
SecurityException\n{0}", se);
+#if NET_2_0
+                       Console.WriteLine ("*1* Unexpected 
SecurityException\n{0}", se);
+                       return 1;
+#else
+                       Console.WriteLine ("*0* Expected (1.x) 
SecurityException\n{0}", se);
                        return 0;
+#endif
                }
                catch (Exception e) {
                        Console.WriteLine ("*2* Unexpected exception\n{0}", e);

Modified: 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/icall2.cs
===================================================================
--- 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/icall2.cs 
    2005-03-15 20:01:54 UTC (rev 41851)
+++ 
branches/vargaz/mini-xp-local-regalloc/mono/mono/tests/cas/linkdemand/icall2.cs 
    2005-03-15 20:02:19 UTC (rev 41852)
@@ -21,6 +21,8 @@
                        icall = "internalGetGacPath";
                        mi = typeof (System.Environment).GetMethod (icall, 
BindingFlags.Static | BindingFlags.NonPublic);
                } else {
+                       // private internal call for MS runtime
+                       // 
http://msdn.microsoft.com/msdnmag/issues/04/11/NETMatters/
                        icall = "CompleteGuid";
                        mi = typeof (System.Guid).GetMethod (icall, 
BindingFlags.Instance | BindingFlags.NonPublic);
                }
@@ -36,7 +38,12 @@
                                result = (string) mi.Invoke (null, null);
                        } else {
                                System.Guid g = new System.Guid ();
+#if NET_2_0
+                               mi.Invoke (g, null);
+                               result = "completed";
+#else
                                result = ((bool) mi.Invoke (g, null)).ToString 
();
+#endif
                        }
                        Console.WriteLine ("*0* [Reflected]{0}: {1}", icall, 
result);
                        return 0;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to