From: Vlad Brezae Date: Tue, 3 Jan 2017 19:12:46 +0000 (+0200) Subject: Merge pull request #4152 from BrzVlad/misc-gc-altstack X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=commitdiff_plain;h=379436fcf5258ac83c27c0dc469eb6cfc80e0b7b;hp=46717b4a552efbe619176828e6d92415275f2e05;p=mono.git Merge pull request #4152 from BrzVlad/misc-gc-altstack [sgen] Reenable gc-altstack test --- diff --git a/configure.ac b/configure.ac index f198f127a4e..150e08245a0 100644 --- a/configure.ac +++ b/configure.ac @@ -432,6 +432,10 @@ AC_HEADER_STDC AC_LIBTOOL_WIN32_DLL # This causes monodis to not link correctly #AC_DISABLE_FAST_INSTALL + +#lookup makedev() header +AC_HEADER_MAJOR + AM_PROG_LIBTOOL # Use dolt (http://dolt.freedesktop.org/) instead of libtool for building. DOLT @@ -789,15 +793,16 @@ AC_MSG_RESULT($csc_compiler) # Set the build profiles and options before things which use them # -AC_ARG_WITH(profile4_x, [ --with-profile4_x=yes,no If you want to install the 4.x FX (defaults to yes)], [], [with_profile4_x=default]) -AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to build the MonoDroid assemblies (defaults to no)], [], [with_monodroid=default]) -AC_ARG_WITH(monotouch, [ --with-monotouch=yes,no If you want to build the Xamarin.iOS assemblies (defaults to no)], [], [with_monotouch=default]) -AC_ARG_WITH(monotouch_watch, [ --with-monotouch_watch=yes,no If you want to build the Xamarin.WatchOS assemblies (defaults to no)],[], [with_monotouch_watch=default]) -AC_ARG_WITH(monotouch_tv, [ --with-monotouch_tv=yes,no If you want to build the Xamarin.TVOS assemblies (defaults to no)], [], [with_monotouch_tv=default]) -AC_ARG_WITH(bitcode, [ --with-bitcode=yes,no If bitcode is enabled (defaults to no)], [], [with_bitcode=default]) -AC_ARG_WITH(xammac, [ --with-xammac=yes,no If you want to build the Xamarin.Mac assemblies (defaults to no)], [], [with_xammac=default]) -AC_ARG_WITH(aot_hybrid, [ --with-aot_hybrid=yes,no If you want to build the aot_hybrid assemblies (defaults to no)], [], [with_aot_hybrid=default]) -AC_ARG_WITH(aot_only, [ --with-aot_only=yes,no If you want to build the aot_only assemblies (defaults to no)], [], [with_aot_only=default]) +AC_ARG_WITH(profile4_x, [ --with-profile4_x=yes,no If you want to install the 4.x FX (defaults to yes)], [], [with_profile4_x=default]) +AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to build the MonoDroid assemblies (defaults to no)], [], [with_monodroid=default]) +AC_ARG_WITH(monotouch, [ --with-monotouch=yes,no If you want to build the Xamarin.iOS assemblies (defaults to no)], [], [with_monotouch=default]) +AC_ARG_WITH(monotouch_watch, [ --with-monotouch_watch=yes,no If you want to build the Xamarin.WatchOS assemblies (defaults to no)], [], [with_monotouch_watch=default]) +AC_ARG_WITH(monotouch_tv, [ --with-monotouch_tv=yes,no If you want to build the Xamarin.TVOS assemblies (defaults to no)], [], [with_monotouch_tv=default]) +AC_ARG_WITH(bitcode, [ --with-bitcode=yes,no If bitcode is enabled (defaults to no)], [], [with_bitcode=default]) +AC_ARG_WITH(xammac, [ --with-xammac=yes,no If you want to build the Xamarin.Mac assemblies (defaults to no)], [], [with_xammac=default]) +AC_ARG_WITH(testing_aot_hybrid, [ --with-testing_aot_hybrid=yes,no If you want to build the testing_aot_hybrid assemblies (defaults to no)], [], [with_testing_aot_hybrid=default]) +AC_ARG_WITH(testing_aot_full, [ --with-testing_aot_full=yes,no If you want to build the testing_aot_full assemblies (defaults to no)], [], [with_testing_aot_full=default]) +AC_ARG_WITH(winaot, [ --with-winaot=yes,no If you want to build the Windows friendly AOT assemblies (defaults to no)], [], [with_winaot=default]) AC_ARG_WITH(runtime_preset, [ --with-runtime_preset=net_4_x,all,aot,hybridaot,fullaot,bitcode Which default profile to build (defaults to net_4_x)], [], [with_runtime_preset=net_4_x]) @@ -813,8 +818,9 @@ with_monotouch_default=no with_monotouch_watch_default=no with_monotouch_tv_default=no with_xammac_default=no -with_aot_hybrid_default=no -with_aot_only_default=no +with_testing_aot_hybrid_default=no +with_testing_aot_full_default=no +with_winaot_default=no with_bitcode_default=no with_cooperative_gc_default=no @@ -832,10 +838,11 @@ elif test x$with_runtime_preset = xall; then with_monotouch_watch_default=yes with_monotouch_tv_default=yes with_xammac_default=yes + with_winaot_default=yes elif test x$with_runtime_preset = xfullaot; then DISABLE_MCS_DOCS_default=yes - with_aot_only_default=yes - TEST_PROFILE=aot_only + with_testing_aot_full_default=yes + TEST_PROFILE=testing_aot_full mono_feature_disable_com='yes' mono_feature_disable_remoting='yes' @@ -847,10 +854,10 @@ elif test x$with_runtime_preset = xfullaot; then AOT_RUN_FLAGS="--full-aot" elif test x$with_runtime_preset = xbitcode; then DISABLE_MCS_DOCS_default=yes - with_aot_only_default=yes + with_testing_aot_full_default=yes with_bitcode_default=yes with_cooperative_gc_default=yes - TEST_PROFILE=aot_only + TEST_PROFILE=testing_aot_full enable_llvm_default=yes mono_feature_disable_com='yes' @@ -863,8 +870,8 @@ elif test x$with_runtime_preset = xbitcode; then AOT_RUN_FLAGS="--llvmonly" elif test x$with_runtime_preset = xhybridaot; then DISABLE_MCS_DOCS_default=yes - with_aot_hybrid_default=yes - TEST_PROFILE=aot_hybrid + with_testing_aot_hybrid_default=yes + TEST_PROFILE=testing_aot_hybrid mono_feature_disable_com='yes' mono_feature_disable_remoting='yes' @@ -913,12 +920,16 @@ fi if test "x$with_xammac" = "xdefault"; then with_xammac=$with_xammac_default fi -if test "x$with_aot_hybrid" = "xdefault"; then - with_aot_hybrid=$with_aot_hybrid_default +if test "x$with_testing_aot_hybrid" = "xdefault"; then + with_testing_aot_hybrid=$with_testing_aot_hybrid_default fi -if test "x$with_aot_only" = "xdefault"; then - with_aot_only=$with_aot_only_default +if test "x$with_testing_aot_full" = "xdefault"; then + with_testing_aot_full=$with_testing_aot_full_default fi +if test "x$with_winaot" = "xdefault"; then + with_winaot=$with_winaot_default +fi + AM_CONDITIONAL(INSTALL_4_x, [test "x$with_profile4_x" = "xyes"]) AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"]) @@ -927,11 +938,12 @@ AM_CONDITIONAL(INSTALL_MONOTOUCH_WATCH, [test "x$with_monotouch_watch" != "xno"] AM_CONDITIONAL(INSTALL_MONOTOUCH_TV, [test "x$with_monotouch_tv" != "xno"]) AM_CONDITIONAL(BITCODE, test "x$with_bitcode" = "xyes") AM_CONDITIONAL(INSTALL_XAMMAC, [test "x$with_xammac" != "xno"]) -AM_CONDITIONAL(INSTALL_AOT_HYBRID, [test "x$with_aot_hybrid" != "xno"]) -AM_CONDITIONAL(INSTALL_AOT_ONLY, [test "x$with_aot_only" != "xno"]) +AM_CONDITIONAL(INSTALL_TESTING_AOT_HYBRID, [test "x$with_testing_aot_hybrid" != "xno"]) +AM_CONDITIONAL(INSTALL_TESTING_AOT_FULL, [test "x$with_testing_aot_full" != "xno"]) +AM_CONDITIONAL(INSTALL_WINAOT, [test "x$with_winaot" != "xno"]) -AC_SUBST(INSTALL_AOT_HYBRID) -AC_SUBST(INSTALL_AOT_ONLY) +AC_SUBST(INSTALL_TESTING_AOT_HYBRID) +AC_SUBST(INSTALL_TESTING_AOT_FULL) default_profile=net_4_x if test -z "$INSTALL_MONODROID_TRUE"; then : @@ -943,11 +955,11 @@ fi if test -z "$INSTALL_XAMMAC_TRUE"; then : default_profile=xammac fi -if test -z "$INSTALL_AOT_HYBRID_TRUE"; then : - default_profile=aot_hybrid +if test -z "$INSTALL_TESTING_AOT_HYBRID_TRUE"; then : + default_profile=testing_aot_hybrid fi -if test -z "$INSTALL_AOT_ONLY_TRUE"; then : - default_profile=aot_only +if test -z "$INSTALL_TESTING_AOT_FULL_TRUE"; then : + default_profile=testing_aot_full fi if test -z "$INSTALL_4_x_TRUE"; then : default_profile=net_4_x @@ -3052,6 +3064,7 @@ case "$host" in AOT_SUPPORTED="yes" BTLS_SUPPORTED=yes BTLS_PLATFORM=x86_64 + boehm_supported=false ;; openbsd*|freebsd*|kfreebsd-gnu*) ;; @@ -4085,13 +4098,20 @@ AC_SUBST(mono_build_root) mono_runtime=mono/mini/mono AC_SUBST(mono_runtime) -CSC=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.1.3.2/tools/csc.exe +CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.2.0.0/tools/csc.exe + +if test $csc_compiler = mcs; then + CSC=$mcs_topdir/class/lib/build/mcs.exe +else + CSC=$CSC_LOCATION +fi mono_cfg_root=$mono_build_root/runtime if test x$host_win32 = xyes; then if test "x$cross_compiling" = "xno"; then mono_cfg_dir=`cygpath -w -a $mono_cfg_root`\\etc CSC="'"`cygpath -w -a $CSC`"'" + CSC_LOCATION="'"`cygpath -w -a $CSC_LOCATION`"'" else mono_cfg_dir=`echo $mono_cfg_root | tr '/' '\\'`\\etc fi @@ -4434,7 +4454,7 @@ fi echo "BCL_OPTIMIZE = 1" >> $srcdir/$mcsdir/build/config.make fi - echo "CSC_LOCATION = $CSC" >> $srcdir/$mcsdir/build/config.make + echo "CSC_LOCATION = $CSC_LOCATION" >> $srcdir/$mcsdir/build/config.make if test $csc_compiler = mcs; then echo "MCS_MODE = 1" >> $srcdir/$mcsdir/build/config.make @@ -4489,8 +4509,8 @@ echo " Xamarin.WatchOS: $with_monotouch_watch Xamarin.TVOS: $with_monotouch_tv Xamarin.Mac: $with_xammac - AOT preferred: $with_aot_hybrid - AOT only: $with_aot_only + Windows AOT: $with_winaot + Test profiles: AOT Full ($with_testing_aot_full), AOT Hybrid ($with_testing_aot_hybrid) JNI support: $jdk_headers_found libgdiplus: $libgdiplus_msg zlib: $zlib_msg diff --git a/external/android-libunwind/README b/external/android-libunwind/README deleted file mode 100644 index b226141e567..00000000000 --- a/external/android-libunwind/README +++ /dev/null @@ -1,9 +0,0 @@ -This is a copy of a few libunwind headers from https://android.googlesource.com/platform/external/libunwind - -We can't make the repo a git submodule because it contains a folder called 'aux' which -is reserved on Windows and would break on checkout there. - -These files are unmodified from the originals and should preferably stay that -way to avoid merge hell. - -Commit: 338c9755cfe3d009c3dfff7d108e2c3ddaa6f3bb (android-6.0.1_r24) \ No newline at end of file diff --git a/external/android-libunwind/include/libunwind-aarch64.h b/external/android-libunwind/include/libunwind-aarch64.h deleted file mode 100644 index 700ed172229..00000000000 --- a/external/android-libunwind/include/libunwind-aarch64.h +++ /dev/null @@ -1,219 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2001-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - Copyright (C) 2013 Linaro Limited - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include -#include -#include - -#define UNW_TARGET aarch64 -#define UNW_TARGET_AARCH64 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* This needs to be big enough to accommodate "struct cursor", while - leaving some slack for future expansion. Changing this value will - require recompiling all users of this library. Stack allocation is - relatively cheap and unwind-state copying is relatively rare, so we - want to err on making it rather too big than too small. */ - -#define UNW_TDEP_CURSOR_LEN 4096 - -typedef uint64_t unw_word_t; -typedef int64_t unw_sword_t; - -typedef long double unw_tdep_fpreg_t; - -typedef struct - { - /* no aarch64-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -typedef enum - { - /* 64-bit general registers. */ - UNW_AARCH64_X0, - UNW_AARCH64_X1, - UNW_AARCH64_X2, - UNW_AARCH64_X3, - UNW_AARCH64_X4, - UNW_AARCH64_X5, - UNW_AARCH64_X6, - UNW_AARCH64_X7, - UNW_AARCH64_X8, - - /* Temporary registers. */ - UNW_AARCH64_X9, - UNW_AARCH64_X10, - UNW_AARCH64_X11, - UNW_AARCH64_X12, - UNW_AARCH64_X13, - UNW_AARCH64_X14, - UNW_AARCH64_X15, - - /* Intra-procedure-call temporary registers. */ - UNW_AARCH64_X16, - UNW_AARCH64_X17, - - /* Callee-saved registers. */ - UNW_AARCH64_X18, - UNW_AARCH64_X19, - UNW_AARCH64_X20, - UNW_AARCH64_X21, - UNW_AARCH64_X22, - UNW_AARCH64_X23, - UNW_AARCH64_X24, - UNW_AARCH64_X25, - UNW_AARCH64_X26, - UNW_AARCH64_X27, - UNW_AARCH64_X28, - - /* 64-bit frame pointer. */ - UNW_AARCH64_X29, - - /* 64-bit link register. */ - UNW_AARCH64_X30, - - /* 64-bit stack pointer. */ - UNW_AARCH64_SP = 31, - UNW_AARCH64_PC, - UNW_AARCH64_PSTATE, - - /* 128-bit FP/Advanced SIMD registers. */ - UNW_AARCH64_V0 = 64, - UNW_AARCH64_V1, - UNW_AARCH64_V2, - UNW_AARCH64_V3, - UNW_AARCH64_V4, - UNW_AARCH64_V5, - UNW_AARCH64_V6, - UNW_AARCH64_V7, - UNW_AARCH64_V8, - UNW_AARCH64_V9, - UNW_AARCH64_V10, - UNW_AARCH64_V11, - UNW_AARCH64_V12, - UNW_AARCH64_V13, - UNW_AARCH64_V14, - UNW_AARCH64_V15, - UNW_AARCH64_V16, - UNW_AARCH64_V17, - UNW_AARCH64_V18, - UNW_AARCH64_V19, - UNW_AARCH64_V20, - UNW_AARCH64_V21, - UNW_AARCH64_V22, - UNW_AARCH64_V23, - UNW_AARCH64_V24, - UNW_AARCH64_V25, - UNW_AARCH64_V26, - UNW_AARCH64_V27, - UNW_AARCH64_V28, - UNW_AARCH64_V29, - UNW_AARCH64_V30, - UNW_AARCH64_V31, - - UNW_AARCH64_FPSR, - UNW_AARCH64_FPCR, - - /* For AArch64, the CFA is the value of SP (x31) at the call site of the - previous frame. */ - UNW_AARCH64_CFA = UNW_AARCH64_SP, - - UNW_TDEP_LAST_REG = UNW_AARCH64_FPCR, - - UNW_TDEP_IP = UNW_AARCH64_X30, - UNW_TDEP_SP = UNW_AARCH64_SP, - UNW_TDEP_EH = UNW_AARCH64_X0, - - } -aarch64_regnum_t; - -/* Use R0 through R3 to pass exception handling information. */ -#define UNW_TDEP_NUM_EH_REGS 4 - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_save_loc_t; - - -/* On AArch64, we can directly use ucontext_t as the unwind context. */ -typedef ucontext_t unw_tdep_context_t; - -#include "libunwind-common.h" -#include "libunwind-dynamic.h" - -/* ANDROID support update. */ -/* There is no getcontext in Android. */ -#define unw_tdep_getcontext(uc) (({ \ - unw_tdep_context_t *unw_ctx = (uc); \ - register uint64_t *unw_base asm ("x0") = (uint64_t*) unw_ctx->uc_mcontext.regs; \ - __asm__ __volatile__ ( \ - "stp x0, x1, [%[base], #0]\n" \ - "stp x2, x3, [%[base], #16]\n" \ - "stp x4, x5, [%[base], #32]\n" \ - "stp x6, x7, [%[base], #48]\n" \ - "stp x8, x9, [%[base], #64]\n" \ - "stp x10, x11, [%[base], #80]\n" \ - "stp x12, x13, [%[base], #96]\n" \ - "stp x14, x13, [%[base], #112]\n" \ - "stp x16, x17, [%[base], #128]\n" \ - "stp x18, x19, [%[base], #144]\n" \ - "stp x20, x21, [%[base], #160]\n" \ - "stp x22, x23, [%[base], #176]\n" \ - "stp x24, x25, [%[base], #192]\n" \ - "stp x26, x27, [%[base], #208]\n" \ - "stp x28, x29, [%[base], #224]\n" \ - "str x30, [%[base], #240]\n" \ - "mov x1, sp\n" \ - "stp x1, x30, [%[base], #248]\n" \ - : [base] "+r" (unw_base) : : "x1", "memory"); \ - }), 0) -/* End of ANDROID update. */ -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) - -extern int unw_tdep_is_fpreg (int); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-arm.h b/external/android-libunwind/include/libunwind-arm.h deleted file mode 100644 index 495948e70c6..00000000000 --- a/external/android-libunwind/include/libunwind-arm.h +++ /dev/null @@ -1,308 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2008 CodeSourcery - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include -#include - -#define UNW_TARGET arm -#define UNW_TARGET_ARM 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* This needs to be big enough to accommodate "struct cursor", while - leaving some slack for future expansion. Changing this value will - require recompiling all users of this library. Stack allocation is - relatively cheap and unwind-state copying is relatively rare, so we - want to err on making it rather too big than too small. */ - -/* FIXME for ARM. Too big? What do other things use for similar tasks? */ -#define UNW_TDEP_CURSOR_LEN 4096 - -typedef uint32_t unw_word_t; -typedef int32_t unw_sword_t; - -typedef long double unw_tdep_fpreg_t; - -typedef enum - { - UNW_ARM_R0, - UNW_ARM_R1, - UNW_ARM_R2, - UNW_ARM_R3, - UNW_ARM_R4, - UNW_ARM_R5, - UNW_ARM_R6, - UNW_ARM_R7, - UNW_ARM_R8, - UNW_ARM_R9, - UNW_ARM_R10, - UNW_ARM_R11, - UNW_ARM_R12, - UNW_ARM_R13, - UNW_ARM_R14, - UNW_ARM_R15, - - /* VFPv2 s0-s31 (obsolescent numberings). */ - UNW_ARM_S0 = 64, - UNW_ARM_S1, - UNW_ARM_S2, - UNW_ARM_S3, - UNW_ARM_S4, - UNW_ARM_S5, - UNW_ARM_S6, - UNW_ARM_S7, - UNW_ARM_S8, - UNW_ARM_S9, - UNW_ARM_S10, - UNW_ARM_S11, - UNW_ARM_S12, - UNW_ARM_S13, - UNW_ARM_S14, - UNW_ARM_S15, - UNW_ARM_S16, - UNW_ARM_S17, - UNW_ARM_S18, - UNW_ARM_S19, - UNW_ARM_S20, - UNW_ARM_S21, - UNW_ARM_S22, - UNW_ARM_S23, - UNW_ARM_S24, - UNW_ARM_S25, - UNW_ARM_S26, - UNW_ARM_S27, - UNW_ARM_S28, - UNW_ARM_S29, - UNW_ARM_S30, - UNW_ARM_S31, - - /* FPA register numberings. */ - UNW_ARM_F0 = 96, - UNW_ARM_F1, - UNW_ARM_F2, - UNW_ARM_F3, - UNW_ARM_F4, - UNW_ARM_F5, - UNW_ARM_F6, - UNW_ARM_F7, - - /* iWMMXt GR register numberings. */ - UNW_ARM_wCGR0 = 104, - UNW_ARM_wCGR1, - UNW_ARM_wCGR2, - UNW_ARM_wCGR3, - UNW_ARM_wCGR4, - UNW_ARM_wCGR5, - UNW_ARM_wCGR6, - UNW_ARM_wCGR7, - - /* iWMMXt register numberings. */ - UNW_ARM_wR0 = 112, - UNW_ARM_wR1, - UNW_ARM_wR2, - UNW_ARM_wR3, - UNW_ARM_wR4, - UNW_ARM_wR5, - UNW_ARM_wR6, - UNW_ARM_wR7, - UNW_ARM_wR8, - UNW_ARM_wR9, - UNW_ARM_wR10, - UNW_ARM_wR11, - UNW_ARM_wR12, - UNW_ARM_wR13, - UNW_ARM_wR14, - UNW_ARM_wR15, - - /* Two-byte encodings from here on. */ - - /* SPSR. */ - UNW_ARM_SPSR = 128, - UNW_ARM_SPSR_FIQ, - UNW_ARM_SPSR_IRQ, - UNW_ARM_SPSR_ABT, - UNW_ARM_SPSR_UND, - UNW_ARM_SPSR_SVC, - - /* User mode registers. */ - UNW_ARM_R8_USR = 144, - UNW_ARM_R9_USR, - UNW_ARM_R10_USR, - UNW_ARM_R11_USR, - UNW_ARM_R12_USR, - UNW_ARM_R13_USR, - UNW_ARM_R14_USR, - - /* FIQ registers. */ - UNW_ARM_R8_FIQ = 151, - UNW_ARM_R9_FIQ, - UNW_ARM_R10_FIQ, - UNW_ARM_R11_FIQ, - UNW_ARM_R12_FIQ, - UNW_ARM_R13_FIQ, - UNW_ARM_R14_FIQ, - - /* IRQ registers. */ - UNW_ARM_R13_IRQ = 158, - UNW_ARM_R14_IRQ, - - /* ABT registers. */ - UNW_ARM_R13_ABT = 160, - UNW_ARM_R14_ABT, - - /* UND registers. */ - UNW_ARM_R13_UND = 162, - UNW_ARM_R14_UND, - - /* SVC registers. */ - UNW_ARM_R13_SVC = 164, - UNW_ARM_R14_SVC, - - /* iWMMXt control registers. */ - UNW_ARM_wC0 = 192, - UNW_ARM_wC1, - UNW_ARM_wC2, - UNW_ARM_wC3, - UNW_ARM_wC4, - UNW_ARM_wC5, - UNW_ARM_wC6, - UNW_ARM_wC7, - - /* VFPv3/Neon 64-bit registers. */ - UNW_ARM_D0 = 256, - UNW_ARM_D1, - UNW_ARM_D2, - UNW_ARM_D3, - UNW_ARM_D4, - UNW_ARM_D5, - UNW_ARM_D6, - UNW_ARM_D7, - UNW_ARM_D8, - UNW_ARM_D9, - UNW_ARM_D10, - UNW_ARM_D11, - UNW_ARM_D12, - UNW_ARM_D13, - UNW_ARM_D14, - UNW_ARM_D15, - UNW_ARM_D16, - UNW_ARM_D17, - UNW_ARM_D18, - UNW_ARM_D19, - UNW_ARM_D20, - UNW_ARM_D21, - UNW_ARM_D22, - UNW_ARM_D23, - UNW_ARM_D24, - UNW_ARM_D25, - UNW_ARM_D26, - UNW_ARM_D27, - UNW_ARM_D28, - UNW_ARM_D29, - UNW_ARM_D30, - UNW_ARM_D31, - - /* For ARM, the CFA is the value of SP (r13) at the call site in the - previous frame. */ - UNW_ARM_CFA, - - UNW_TDEP_LAST_REG = UNW_ARM_D31, - - UNW_TDEP_IP = UNW_ARM_R14, /* A little white lie. */ - UNW_TDEP_SP = UNW_ARM_R13, - UNW_TDEP_EH = UNW_ARM_R0 /* FIXME. */ - } -arm_regnum_t; - -#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for ARM. */ - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_save_loc_t; - -/* On ARM, we define our own unw_tdep_context instead of using ucontext_t. - This allows us to support systems that don't support getcontext and - therefore do not define ucontext_t. */ -typedef struct unw_tdep_context - { - unsigned long regs[16]; - } -unw_tdep_context_t; - -/* There is no getcontext() on ARM. Use a stub version which only saves GP - registers. FIXME: Not ideal, may not be sufficient for all libunwind - use cases. Stores pc+8, which is only approximately correct, really. */ -#ifndef __thumb__ -#define unw_tdep_getcontext(uc) (({ \ - unw_tdep_context_t *unw_ctx = (uc); \ - register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ - __asm__ __volatile__ ( \ - "stmia %[base], {r0-r15}" \ - : : [base] "r" (unw_base) : "memory"); \ - }), 0) -#else /* __thumb__ */ -#define unw_tdep_getcontext(uc) (({ \ - unw_tdep_context_t *unw_ctx = (uc); \ - register unsigned long *unw_base asm ("r0") = unw_ctx->regs; \ - __asm__ __volatile__ ( \ - ".align 2\nbx pc\nnop\n.code 32\n" \ - "stmia %[base], {r0-r15}\n" \ - "orr %[base], pc, #1\nbx %[base]" \ - : [base] "+r" (unw_base) : : "memory", "cc"); \ - }), 0) -#endif - -#include "libunwind-dynamic.h" - -typedef struct - { - /* no arm-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -#include "libunwind-common.h" - -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) -extern int unw_tdep_is_fpreg (int); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-common.h b/external/android-libunwind/include/libunwind-common.h deleted file mode 100644 index f4cbc88afbd..00000000000 --- a/external/android-libunwind/include/libunwind-common.h +++ /dev/null @@ -1,308 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2001-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -/* ANDROID support update. */ -#include -/* End of ANDROID update. */ - -#define UNW_VERSION_MAJOR 1 -#define UNW_VERSION_MINOR 1 -#define UNW_VERSION_EXTRA - -#define UNW_VERSION_CODE(maj,min) (((maj) << 16) | (min)) -#define UNW_VERSION UNW_VERSION_CODE(UNW_VERSION_MAJOR, UNW_VERSION_MINOR) - -#define UNW_PASTE2(x,y) x##y -#define UNW_PASTE(x,y) UNW_PASTE2(x,y) -#define UNW_OBJ(fn) UNW_PASTE(UNW_PREFIX, fn) -#define UNW_ARCH_OBJ(fn) UNW_PASTE(UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_), fn) - -#ifdef UNW_LOCAL_ONLY -# ifdef UNW_ADDITIONAL_PREFIX -# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UUL,UNW_TARGET),_) -# else -# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UL,UNW_TARGET),_) -# endif -#else /* !UNW_LOCAL_ONLY */ -# ifdef UNW_ADDITIONAL_PREFIX -# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_UU,UNW_TARGET),_) -# else -# define UNW_PREFIX UNW_PASTE(UNW_PASTE(_U,UNW_TARGET),_) -# endif -#endif /* !UNW_LOCAL_ONLY */ - -/* Error codes. The unwind routines return the *negated* values of - these error codes on error and a non-negative value on success. */ -typedef enum - { - UNW_ESUCCESS = 0, /* no error */ - UNW_EUNSPEC, /* unspecified (general) error */ - UNW_ENOMEM, /* out of memory */ - UNW_EBADREG, /* bad register number */ - UNW_EREADONLYREG, /* attempt to write read-only register */ - UNW_ESTOPUNWIND, /* stop unwinding */ - UNW_EINVALIDIP, /* invalid IP */ - UNW_EBADFRAME, /* bad frame */ - UNW_EINVAL, /* unsupported operation or bad value */ - UNW_EBADVERSION, /* unwind info has unsupported version */ - UNW_ENOINFO /* no unwind info found */ - } -unw_error_t; - -/* The following enum defines the indices for a couple of - (pseudo-)registers which have the same meaning across all - platforms. (RO) means read-only. (RW) means read-write. General - registers (aka "integer registers") are expected to start with - index 0. The number of such registers is architecture-dependent. - The remaining indices can be used as an architecture sees fit. The - last valid register index is given by UNW_REG_LAST. */ -typedef enum - { - UNW_REG_IP = UNW_TDEP_IP, /* (rw) instruction pointer (pc) */ - UNW_REG_SP = UNW_TDEP_SP, /* (ro) stack pointer */ - UNW_REG_EH = UNW_TDEP_EH, /* (rw) exception-handling reg base */ - UNW_REG_LAST = UNW_TDEP_LAST_REG - } -unw_frame_regnum_t; - -/* Number of exception-handler argument registers: */ -#define UNW_NUM_EH_REGS UNW_TDEP_NUM_EH_REGS - -typedef enum - { - UNW_CACHE_NONE, /* no caching */ - UNW_CACHE_GLOBAL, /* shared global cache */ - UNW_CACHE_PER_THREAD /* per-thread caching */ - } -unw_caching_policy_t; - -typedef int unw_regnum_t; - -/* The unwind cursor starts at the youngest (most deeply nested) frame - and is used to track the frame state as the unwinder steps from - frame to frame. It is safe to make (shallow) copies of variables - of this type. */ -typedef struct unw_cursor - { - unw_word_t opaque[UNW_TDEP_CURSOR_LEN]; - } -unw_cursor_t; - -/* This type encapsulates the entire (preserved) machine-state. */ -typedef unw_tdep_context_t unw_context_t; - -/* unw_getcontext() fills the unw_context_t pointed to by UC with the - machine state as it exists at the call-site. For implementation - reasons, this needs to be a target-dependent macro. It's easiest - to think of unw_getcontext() as being identical to getcontext(). */ -#define unw_getcontext(uc) unw_tdep_getcontext(uc) - -/* Return 1 if register number R is a floating-point register, zero - otherwise. - This routine is signal-safe. */ -#define unw_is_fpreg(r) unw_tdep_is_fpreg(r) - -typedef unw_tdep_fpreg_t unw_fpreg_t; - -typedef struct unw_addr_space *unw_addr_space_t; - -/* Each target may define it's own set of flags, but bits 0-15 are - reserved for general libunwind-use. */ -#define UNW_PI_FLAG_FIRST_TDEP_BIT 16 -/* The information comes from a .debug_frame section. */ -#define UNW_PI_FLAG_DEBUG_FRAME 32 - -typedef struct unw_proc_info - { - unw_word_t start_ip; /* first IP covered by this procedure */ - unw_word_t end_ip; /* first IP NOT covered by this procedure */ - unw_word_t lsda; /* address of lang.-spec. data area (if any) */ - unw_word_t handler; /* optional personality routine */ - unw_word_t gp; /* global-pointer value for this procedure */ - unw_word_t flags; /* misc. flags */ - - int format; /* unwind-info format (arch-specific) */ - int unwind_info_size; /* size of the information (if applicable) */ - void *unwind_info; /* unwind-info (arch-specific) */ - unw_tdep_proc_info_t extra; /* target-dependent auxiliary proc-info */ - } -unw_proc_info_t; - -/* These are backend callback routines that provide access to the - state of a "remote" process. This can be used, for example, to - unwind another process through the ptrace() interface. */ -typedef struct unw_accessors - { - /* Look up the unwind info associated with instruction-pointer IP. - On success, the routine fills in the PROC_INFO structure. */ - int (*find_proc_info) (unw_addr_space_t, unw_word_t, unw_proc_info_t *, - int, void *); - - /* Release any resources (e.g., memory) that were allocated for - the unwind info returned in by a previous call to - find_proc_info() with NEED_UNWIND_INFO set to 1. */ - void (*put_unwind_info) (unw_addr_space_t, unw_proc_info_t *, void *); - - /* Return the list-head of the dynamically registered unwind - info. */ - int (*get_dyn_info_list_addr) (unw_addr_space_t, unw_word_t *, void *); - - /* Access aligned word at address ADDR. The value is returned - according to the endianness of the host (e.g., if the host is - little-endian and the target is big-endian, access_mem() needs - to byte-swap the value before returning it). */ - int (*access_mem) (unw_addr_space_t, unw_word_t, unw_word_t *, int, - void *); - - /* Access register number REG at address ADDR. */ - int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, int, - void *); - - /* Access register number REG at address ADDR. */ - int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, - unw_fpreg_t *, int, void *); - - int (*resume) (unw_addr_space_t, unw_cursor_t *, void *); - - /* Optional call back to obtain the name of a (static) procedure. - Dynamically generated procedures are handled automatically by - libunwind. This callback is optional and may be set to - NULL. */ - int (*get_proc_name) (unw_addr_space_t, unw_word_t, char *, size_t, - unw_word_t *, void *); - } -unw_accessors_t; - -typedef enum unw_save_loc_type - { - UNW_SLT_NONE, /* register is not saved ("not an l-value") */ - UNW_SLT_MEMORY, /* register has been saved in memory */ - UNW_SLT_REG /* register has been saved in (another) register */ - } -unw_save_loc_type_t; - -typedef struct unw_save_loc - { - unw_save_loc_type_t type; - union - { - unw_word_t addr; /* valid if type==UNW_SLT_MEMORY */ - unw_regnum_t regnum; /* valid if type==UNW_SLT_REG */ - } - u; - unw_tdep_save_loc_t extra; /* target-dependent additional information */ - } -unw_save_loc_t; - -/* ANDROID support update. */ -typedef struct unw_map_cursor - { - void *map_list; - void *cur_map; - } -unw_map_cursor_t; - -typedef struct unw_map - { - unw_word_t start; - unw_word_t end; - unw_word_t offset; - unw_word_t load_base; - char *path; - int flags; - } -unw_map_t; -/* End of ANDROID update. */ - -/* These routines work both for local and remote unwinding. */ - -#define unw_local_access_addr_space_init UNW_OBJ(local_access_addr_space_init) -#define unw_local_addr_space UNW_OBJ(local_addr_space) -#define unw_create_addr_space UNW_OBJ(create_addr_space) -#define unw_destroy_addr_space UNW_OBJ(destroy_addr_space) -#define unw_get_accessors UNW_ARCH_OBJ(get_accessors) -#define unw_init_local UNW_OBJ(init_local) -#define unw_init_remote UNW_OBJ(init_remote) -#define unw_step UNW_OBJ(step) -#define unw_resume UNW_OBJ(resume) -#define unw_get_proc_info UNW_OBJ(get_proc_info) -#define unw_get_proc_info_by_ip UNW_OBJ(get_proc_info_by_ip) -#define unw_get_reg UNW_OBJ(get_reg) -#define unw_set_reg UNW_OBJ(set_reg) -#define unw_get_fpreg UNW_OBJ(get_fpreg) -#define unw_set_fpreg UNW_OBJ(set_fpreg) -#define unw_get_save_loc UNW_OBJ(get_save_loc) -#define unw_is_signal_frame UNW_OBJ(is_signal_frame) -#define unw_handle_signal_frame UNW_OBJ(handle_signal_frame) -#define unw_get_proc_name UNW_OBJ(get_proc_name) -#define unw_get_proc_name_by_ip UNW_OBJ(get_proc_name_by_ip) -#define unw_set_caching_policy UNW_OBJ(set_caching_policy) -#define unw_regname UNW_ARCH_OBJ(regname) -#define unw_flush_cache UNW_ARCH_OBJ(flush_cache) -#define unw_strerror UNW_ARCH_OBJ(strerror) - -extern void unw_local_access_addr_space_init (unw_addr_space_t); -extern unw_addr_space_t unw_create_addr_space (unw_accessors_t *, int); -extern void unw_destroy_addr_space (unw_addr_space_t); -extern unw_accessors_t *unw_get_accessors (unw_addr_space_t); -extern void unw_flush_cache (unw_addr_space_t, unw_word_t, unw_word_t); -extern int unw_set_caching_policy (unw_addr_space_t, unw_caching_policy_t); -extern const char *unw_regname (unw_regnum_t); - -extern int unw_init_local (unw_cursor_t *, unw_context_t *); -extern int unw_init_remote (unw_cursor_t *, unw_addr_space_t, void *); -extern int unw_step (unw_cursor_t *); -extern int unw_resume (unw_cursor_t *); -extern int unw_get_proc_info (unw_cursor_t *, unw_proc_info_t *); -extern int unw_get_proc_info_by_ip (unw_addr_space_t, unw_word_t, - unw_proc_info_t *, void *); -extern int unw_get_reg (unw_cursor_t *, int, unw_word_t *); -extern int unw_set_reg (unw_cursor_t *, int, unw_word_t); -extern int unw_get_fpreg (unw_cursor_t *, int, unw_fpreg_t *); -extern int unw_set_fpreg (unw_cursor_t *, int, unw_fpreg_t); -extern int unw_get_save_loc (unw_cursor_t *, int, unw_save_loc_t *); -extern int unw_is_signal_frame (unw_cursor_t *); -extern int unw_handle_signal_frame (unw_cursor_t *); -extern int unw_get_proc_name (unw_cursor_t *, char *, size_t, unw_word_t *); -extern int unw_get_proc_name_by_ip (unw_addr_space_t, unw_word_t, char *, - size_t, unw_word_t *, void *); -extern const char *unw_strerror (int); -extern int unw_backtrace (void **, int); - -/* ANDROID support update. */ -extern int unw_map_local_cursor_valid (unw_map_cursor_t *); -extern void unw_map_local_cursor_get (unw_map_cursor_t *); -extern int unw_map_local_cursor_get_next (unw_map_cursor_t *, unw_map_t *); -extern int unw_map_local_create (void); -extern void unw_map_local_destroy (void); -extern void unw_map_set (unw_addr_space_t, unw_map_cursor_t *); -extern void unw_map_cursor_reset (unw_map_cursor_t *); -extern void unw_map_cursor_clear (unw_map_cursor_t *); -extern int unw_map_cursor_create (unw_map_cursor_t *, pid_t); -extern void unw_map_cursor_destroy (unw_map_cursor_t *); -extern int unw_map_cursor_get_next (unw_map_cursor_t *, unw_map_t *); -/* End of ANDROID update. */ - -extern unw_addr_space_t unw_local_addr_space; diff --git a/external/android-libunwind/include/libunwind-coredump.h b/external/android-libunwind/include/libunwind-coredump.h deleted file mode 100644 index d2b05e71c2e..00000000000 --- a/external/android-libunwind/include/libunwind-coredump.h +++ /dev/null @@ -1,73 +0,0 @@ -/* libunwind - a platform-independent unwind library - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef libunwind_coredump_h -#define libunwind_coredump_h - -#include - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -/* Helper routines which make it easy to use libunwind on a coredump. - They're available only if UNW_REMOTE_ONLY is _not_ defined and they - aren't really part of the libunwind API. They are implemented in a - archive library called libunwind-coredump.a. */ - -struct UCD_info; - -extern struct UCD_info *_UCD_create(const char *filename); -extern void _UCD_destroy(struct UCD_info *); - -extern int _UCD_get_num_threads(struct UCD_info *); -extern void _UCD_select_thread(struct UCD_info *, int); -extern pid_t _UCD_get_pid(struct UCD_info *); -extern int _UCD_get_cursig(struct UCD_info *); -extern int _UCD_add_backing_file_at_segment(struct UCD_info *, int phdr_no, const char *filename); -extern int _UCD_add_backing_file_at_vaddr(struct UCD_info *, - unsigned long vaddr, - const char *filename); - -extern int _UCD_find_proc_info (unw_addr_space_t, unw_word_t, - unw_proc_info_t *, int, void *); -extern void _UCD_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *); -extern int _UCD_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *, - void *); -extern int _UCD_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int, - void *); -extern int _UCD_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *, - int, void *); -extern int _UCD_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, - int, void *); -extern int _UCD_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t, - unw_word_t *, void *); -extern int _UCD_resume (unw_addr_space_t, unw_cursor_t *, void *); -extern unw_accessors_t _UCD_accessors; - - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* libunwind_coredump_h */ diff --git a/external/android-libunwind/include/libunwind-dynamic.h b/external/android-libunwind/include/libunwind-dynamic.h deleted file mode 100644 index 584f392c567..00000000000 --- a/external/android-libunwind/include/libunwind-dynamic.h +++ /dev/null @@ -1,210 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2002-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -/* This file defines the runtime-support routines for dynamically -generated code. Even though it is implemented as part of libunwind, -it is logically separate from the interface to perform the actual -unwinding. In particular, this interface is always used in the -context of the unwind target, whereas the rest of the unwind API is -used in context of the process that is doing the unwind (which may be -a debugger running on another machine, for example). - -Note that the data-structures declared here server a dual purpose: -when a program registers a dynamically generated procedure, it uses -these structures directly. On the other hand, with remote-unwinding, -the data-structures are read from the remote process's memory and -translated into internalized versions. To facilitate remote-access, -the following rules should be followed in declaring these structures: - - (1) Declare a member as a pointer only if the the information the - member points to needs to be internalized as well (e.g., a - string representing a procedure name should be declared as - "const char *", but the instruction pointer should be declared - as unw_word_t). - - (2) Provide sufficient padding to ensure that no implicit padding - will be needed on any of the supported target architectures. For - the time being, padding data structures with the assumption that - sizeof (unw_word_t) == 8 should be sufficient. (Note: it's not - impossible to internalize structures with internal padding, but - it does make the process a bit harder). - - (3) Don't declare members that contain bitfields or floating-point - values. - - (4) Don't declare members with enumeration types. Declare them as - int32_t instead. */ - -typedef enum - { - UNW_DYN_STOP = 0, /* end-of-unwind-info marker */ - UNW_DYN_SAVE_REG, /* save register to another register */ - UNW_DYN_SPILL_FP_REL, /* frame-pointer-relative register spill */ - UNW_DYN_SPILL_SP_REL, /* stack-pointer-relative register spill */ - UNW_DYN_ADD, /* add constant value to a register */ - UNW_DYN_POP_FRAMES, /* drop one or more stack frames */ - UNW_DYN_LABEL_STATE, /* name the current state */ - UNW_DYN_COPY_STATE, /* set the region's entry-state */ - UNW_DYN_ALIAS /* get unwind info from an alias */ - } -unw_dyn_operation_t; - -typedef enum - { - UNW_INFO_FORMAT_DYNAMIC, /* unw_dyn_proc_info_t */ - UNW_INFO_FORMAT_TABLE, /* unw_dyn_table_t */ - UNW_INFO_FORMAT_REMOTE_TABLE, /* unw_dyn_remote_table_t */ - UNW_INFO_FORMAT_ARM_EXIDX /* ARM specific unwind info */ - } -unw_dyn_info_format_t; - -typedef struct unw_dyn_op - { - int8_t tag; /* what operation? */ - int8_t qp; /* qualifying predicate register */ - int16_t reg; /* what register */ - int32_t when; /* when does it take effect? */ - unw_word_t val; /* auxiliary value */ - } -unw_dyn_op_t; - -typedef struct unw_dyn_region_info - { - struct unw_dyn_region_info *next; /* linked list of regions */ - int32_t insn_count; /* region length (# of instructions) */ - uint32_t op_count; /* length of op-array */ - unw_dyn_op_t op[1]; /* variable-length op-array */ - } -unw_dyn_region_info_t; - -typedef struct unw_dyn_proc_info - { - unw_word_t name_ptr; /* address of human-readable procedure name */ - unw_word_t handler; /* address of personality routine */ - uint32_t flags; - int32_t pad0; - unw_dyn_region_info_t *regions; - } -unw_dyn_proc_info_t; - -typedef struct unw_dyn_table_info - { - unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ - unw_word_t segbase; /* segment base */ - unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ - unw_word_t *table_data; - } -unw_dyn_table_info_t; - -typedef struct unw_dyn_remote_table_info - { - unw_word_t name_ptr; /* addr. of table name (e.g., library name) */ - unw_word_t segbase; /* segment base */ - unw_word_t table_len; /* must be a multiple of sizeof(unw_word_t)! */ - unw_word_t table_data; - } -unw_dyn_remote_table_info_t; - -typedef struct unw_dyn_info - { - /* doubly-linked list of dyn-info structures: */ - struct unw_dyn_info *next; - struct unw_dyn_info *prev; - unw_word_t start_ip; /* first IP covered by this entry */ - unw_word_t end_ip; /* first IP NOT covered by this entry */ - unw_word_t gp; /* global-pointer in effect for this entry */ - int32_t format; /* real type: unw_dyn_info_format_t */ - int32_t pad; - union - { - unw_dyn_proc_info_t pi; - unw_dyn_table_info_t ti; - unw_dyn_remote_table_info_t rti; - } - u; - } -unw_dyn_info_t; - -typedef struct unw_dyn_info_list - { - uint32_t version; - uint32_t generation; - unw_dyn_info_t *first; - } -unw_dyn_info_list_t; - -/* Return the size (in bytes) of an unw_dyn_region_info_t structure that can - hold OP_COUNT ops. */ -#define _U_dyn_region_info_size(op_count) \ - ((char *) (((unw_dyn_region_info_t *) NULL)->op + (op_count)) \ - - (char *) NULL) - -/* Register the unwind info for a single procedure. - This routine is NOT signal-safe. */ -extern void _U_dyn_register (unw_dyn_info_t *); - -/* Cancel the unwind info for a single procedure. - This routine is NOT signal-safe. */ -extern void _U_dyn_cancel (unw_dyn_info_t *); - - -/* Convenience routines. */ - -#define _U_dyn_op(_tag, _qp, _when, _reg, _val) \ - ((unw_dyn_op_t) { (_tag), (_qp), (_reg), (_when), (_val) }) - -#define _U_dyn_op_save_reg(op, qp, when, reg, dst) \ - (*(op) = _U_dyn_op (UNW_DYN_SAVE_REG, (qp), (when), (reg), (dst))) - -#define _U_dyn_op_spill_fp_rel(op, qp, when, reg, offset) \ - (*(op) = _U_dyn_op (UNW_DYN_SPILL_FP_REL, (qp), (when), (reg), \ - (offset))) - -#define _U_dyn_op_spill_sp_rel(op, qp, when, reg, offset) \ - (*(op) = _U_dyn_op (UNW_DYN_SPILL_SP_REL, (qp), (when), (reg), \ - (offset))) - -#define _U_dyn_op_add(op, qp, when, reg, value) \ - (*(op) = _U_dyn_op (UNW_DYN_ADD, (qp), (when), (reg), (value))) - -#define _U_dyn_op_pop_frames(op, qp, when, num_frames) \ - (*(op) = _U_dyn_op (UNW_DYN_POP_FRAMES, (qp), (when), 0, (num_frames))) - -#define _U_dyn_op_label_state(op, label) \ - (*(op) = _U_dyn_op (UNW_DYN_LABEL_STATE, _U_QP_TRUE, -1, 0, (label))) - -#define _U_dyn_op_copy_state(op, label) \ - (*(op) = _U_dyn_op (UNW_DYN_COPY_STATE, _U_QP_TRUE, -1, 0, (label))) - -#define _U_dyn_op_alias(op, qp, when, addr) \ - (*(op) = _U_dyn_op (UNW_DYN_ALIAS, (qp), (when), 0, (addr))) - -#define _U_dyn_op_stop(op) \ - (*(op) = _U_dyn_op (UNW_DYN_STOP, _U_QP_TRUE, -1, 0, 0)) - -/* The target-dependent qualifying predicate which is always TRUE. On - IA-64, that's p0 (0), on non-predicated architectures, the value is - ignored. */ -#define _U_QP_TRUE _U_TDEP_QP_TRUE diff --git a/external/android-libunwind/include/libunwind-hppa.h b/external/android-libunwind/include/libunwind-hppa.h deleted file mode 100644 index b5fba562718..00000000000 --- a/external/android-libunwind/include/libunwind-hppa.h +++ /dev/null @@ -1,131 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2003-2004 Hewlett-Packard Co - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include -#include - -#define UNW_TARGET hppa -#define UNW_TARGET_HPPA 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* This needs to be big enough to accommodate "struct cursor", while - leaving some slack for future expansion. Changing this value will - require recompiling all users of this library. Stack allocation is - relatively cheap and unwind-state copying is relatively rare, so we - want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 511 - -typedef uint32_t unw_word_t; -typedef int32_t unw_sword_t; - -typedef union - { - struct { unw_word_t bits[2]; } raw; - double val; - } -unw_tdep_fpreg_t; - -typedef enum - { - /* Note: general registers are expected to start with index 0. - This convention facilitates architecture-independent - implementation of the C++ exception handling ABI. See - _Unwind_SetGR() and _Unwind_GetGR() for details. */ - UNW_HPPA_GR = 0, - UNW_HPPA_RP = 2, /* return pointer */ - UNW_HPPA_FP = 3, /* frame pointer */ - UNW_HPPA_SP = UNW_HPPA_GR + 30, - - UNW_HPPA_FR = UNW_HPPA_GR + 32, - - UNW_HPPA_IP = UNW_HPPA_FR + 32, /* instruction pointer */ - - /* other "preserved" registers (fpsr etc.)... */ - - /* PA-RISC has 4 exception-argument registers but they're not - contiguous. To deal with this, we define 4 pseudo - exception-handling registers which we then alias to the actual - physical register. */ - - UNW_HPPA_EH0 = UNW_HPPA_IP + 1, /* alias for UNW_HPPA_GR + 20 */ - UNW_HPPA_EH1 = UNW_HPPA_EH0 + 1, /* alias for UNW_HPPA_GR + 21 */ - UNW_HPPA_EH2 = UNW_HPPA_EH1 + 1, /* alias for UNW_HPPA_GR + 22 */ - UNW_HPPA_EH3 = UNW_HPPA_EH2 + 1, /* alias for UNW_HPPA_GR + 31 */ - - /* frame info (read-only) */ - UNW_HPPA_CFA, - - UNW_TDEP_LAST_REG = UNW_HPPA_IP, - - UNW_TDEP_IP = UNW_HPPA_IP, - UNW_TDEP_SP = UNW_HPPA_SP, - UNW_TDEP_EH = UNW_HPPA_EH0 - } -hppa_regnum_t; - -#define UNW_TDEP_NUM_EH_REGS 4 - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_save_loc_t; - -/* On PA-RISC, we can directly use ucontext_t as the unwind context. */ -typedef ucontext_t unw_tdep_context_t; - -#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_HPPA_FR) < 32) - -#include "libunwind-dynamic.h" - -typedef struct - { - /* no PA-RISC-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -#include "libunwind-common.h" - -#define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) -extern int unw_tdep_getcontext (unw_tdep_context_t *); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-ia64.h b/external/android-libunwind/include/libunwind-ia64.h deleted file mode 100644 index 4dcc4f9c34f..00000000000 --- a/external/android-libunwind/include/libunwind-ia64.h +++ /dev/null @@ -1,197 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2001-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#include -#include - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#ifdef ia64 - /* This works around a bug in Intel's ECC v7.0 which defines "ia64" - as "1". */ -# undef ia64 -#endif - -#ifdef __hpux - /* On HP-UX, there is no hope of supporting UNW_LOCAL_ONLY, because - it's impossible to obtain the address of the members in the - sigcontext structure. */ -# undef UNW_LOCAL_ONLY -# define UNW_GENERIC_ONLY -#endif - -#define UNW_TARGET ia64 -#define UNW_TARGET_IA64 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* This needs to be big enough to accommodate "struct cursor", while - leaving some slack for future expansion. Changing this value will - require recompiling all users of this library. Stack allocation is - relatively cheap and unwind-state copying is relatively rare, so we - want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 511 - -/* If this bit is it indicates that the procedure saved all of ar.bsp, - ar.bspstore, and ar.rnat. If, additionally, ar.bsp != saved ar.bsp, - then this procedure has performed a register-backing-store switch. */ -#define UNW_PI_FLAG_IA64_RBS_SWITCH_BIT (UNW_PI_FLAG_FIRST_TDEP_BIT + 0) - -#define UNW_PI_FLAG_IA64_RBS_SWITCH (1 << UNW_PI_FLAG_IA64_RBS_SWITCH_BIT) - -typedef uint64_t unw_word_t; -typedef int64_t unw_sword_t; - -/* On IA-64, we want to access the contents of floating-point - registers as a pair of "words", but to ensure 16-byte alignment, we - make it a union that contains a "long double". This will do the - Right Thing on all known IA-64 platforms, including HP-UX. */ -typedef union - { - struct { unw_word_t bits[2]; } raw; - long double dummy; /* dummy to force 16-byte alignment */ - } -unw_tdep_fpreg_t; - -typedef struct - { - /* no ia64-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -typedef enum - { - /* Note: general registers are excepted to start with index 0. - This convention facilitates architecture-independent - implementation of the C++ exception handling ABI. See - _Unwind_SetGR() and _Unwind_GetGR() for details. */ - UNW_IA64_GR = 0, /* general registers (r0..r127) */ - UNW_IA64_GP = UNW_IA64_GR + 1, - UNW_IA64_TP = UNW_IA64_GR + 13, - - UNW_IA64_NAT = UNW_IA64_GR + 128, /* NaT registers (nat0..nat127) */ - - UNW_IA64_FR = UNW_IA64_NAT + 128, /* fp registers (f0..f127) */ - - UNW_IA64_AR = UNW_IA64_FR + 128, /* application registers (ar0..r127) */ - UNW_IA64_AR_RSC = UNW_IA64_AR + 16, - UNW_IA64_AR_BSP = UNW_IA64_AR + 17, - UNW_IA64_AR_BSPSTORE = UNW_IA64_AR + 18, - UNW_IA64_AR_RNAT = UNW_IA64_AR + 19, - UNW_IA64_AR_CSD = UNW_IA64_AR + 25, - UNW_IA64_AR_26 = UNW_IA64_AR + 26, - UNW_IA64_AR_SSD = UNW_IA64_AR_26, - UNW_IA64_AR_CCV = UNW_IA64_AR + 32, - UNW_IA64_AR_UNAT = UNW_IA64_AR + 36, - UNW_IA64_AR_FPSR = UNW_IA64_AR + 40, - UNW_IA64_AR_PFS = UNW_IA64_AR + 64, - UNW_IA64_AR_LC = UNW_IA64_AR + 65, - UNW_IA64_AR_EC = UNW_IA64_AR + 66, - - UNW_IA64_BR = UNW_IA64_AR + 128, /* branch registers (b0..p7) */ - UNW_IA64_RP = UNW_IA64_BR + 0, /* return pointer (rp) */ - UNW_IA64_PR = UNW_IA64_BR + 8, /* predicate registers (p0..p63) */ - UNW_IA64_CFM, - - /* frame info: */ - UNW_IA64_BSP, - UNW_IA64_IP, - UNW_IA64_SP, - - UNW_TDEP_LAST_REG = UNW_IA64_SP, - - UNW_TDEP_IP = UNW_IA64_IP, - UNW_TDEP_SP = UNW_IA64_SP, - UNW_TDEP_EH = UNW_IA64_GR + 15 - } -ia64_regnum_t; - -#define UNW_TDEP_NUM_EH_REGS 4 /* r15-r18 are exception args */ - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. On IA-64, - we use this to provide the bit number in which a NaT bit gets - saved. */ - uint8_t nat_bitnr; - - /* Padding reserved for future use. */ - uint8_t reserved[7]; - } -unw_tdep_save_loc_t; - -/* On IA-64, we can directly use ucontext_t as the unwind context. */ -typedef ucontext_t unw_tdep_context_t; - -#define unw_tdep_is_fpreg(r) ((unsigned) ((r) - UNW_IA64_FR) < 128) - -#include "libunwind-dynamic.h" -#include "libunwind-common.h" - -#ifdef __hpux - /* In theory, we could use _Uia64_getcontext() on HP-UX as well, but - the benefit of doing so would be marginal given that it can't - support UNW_LOCAL_ONLY. */ -# define unw_tdep_getcontext getcontext -#else -# define unw_tdep_getcontext UNW_ARCH_OBJ (getcontext) - extern int unw_tdep_getcontext (unw_tdep_context_t *); -#endif - -/* This is a helper routine to search an ia64 unwind table. If the - address-space argument AS points to something other than the local - address-space, the memory for the unwind-info will be allocated - with malloc(), and should be free()d during the put_unwind_info() - callback. This routine is signal-safe for the local-address-space - case ONLY. */ -#define unw_search_ia64_unwind_table UNW_OBJ(search_unwind_table) -extern int unw_search_ia64_unwind_table (unw_addr_space_t, unw_word_t, - unw_dyn_info_t *, unw_proc_info_t *, - int, void *); - -/* This is a helper routine which the get_dyn_info_list_addr() - callback can use to locate the special dynamic-info list entry in - an IA-64 unwind table. If the entry exists in the table, the - list-address is returned. In all other cases, 0 is returned. */ -extern unw_word_t _Uia64_find_dyn_list (unw_addr_space_t, unw_dyn_info_t *, - void *); - -/* This is a helper routine to obtain the kernel-unwind info. It is - signal-safe. */ -extern int _Uia64_get_kernel_table (unw_dyn_info_t *); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-mips.h b/external/android-libunwind/include/libunwind-mips.h deleted file mode 100644 index 83e44dead7f..00000000000 --- a/external/android-libunwind/include/libunwind-mips.h +++ /dev/null @@ -1,163 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2008 CodeSourcery - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include -#include - -#ifdef mips -# undef mips -#endif - -#define UNW_TARGET mips -#define UNW_TARGET_MIPS 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* This needs to be big enough to accommodate "struct cursor", while - leaving some slack for future expansion. Changing this value will - require recompiling all users of this library. Stack allocation is - relatively cheap and unwind-state copying is relatively rare, so we - want to err on making it rather too big than too small. */ - -/* FIXME for MIPS. Too big? What do other things use for similar tasks? */ -#define UNW_TDEP_CURSOR_LEN 4096 - -/* The size of a "word" varies on MIPS. This type is used for memory - addresses and register values. To allow a single library to support - multiple ABIs, and to support N32 at all, we must use a 64-bit type - even when addresses are only 32 bits. */ -typedef uint64_t unw_word_t; -typedef int32_t unw_sword_t; - -/* FIXME: MIPS ABIs. */ -typedef long double unw_tdep_fpreg_t; - -typedef enum - { - UNW_MIPS_R0, - UNW_MIPS_R1, - UNW_MIPS_R2, - UNW_MIPS_R3, - UNW_MIPS_R4, - UNW_MIPS_R5, - UNW_MIPS_R6, - UNW_MIPS_R7, - UNW_MIPS_R8, - UNW_MIPS_R9, - UNW_MIPS_R10, - UNW_MIPS_R11, - UNW_MIPS_R12, - UNW_MIPS_R13, - UNW_MIPS_R14, - UNW_MIPS_R15, - UNW_MIPS_R16, - UNW_MIPS_R17, - UNW_MIPS_R18, - UNW_MIPS_R19, - UNW_MIPS_R20, - UNW_MIPS_R21, - UNW_MIPS_R22, - UNW_MIPS_R23, - UNW_MIPS_R24, - UNW_MIPS_R25, - UNW_MIPS_R26, - UNW_MIPS_R27, - UNW_MIPS_R28, - UNW_MIPS_R29, - UNW_MIPS_R30, - UNW_MIPS_R31, - - UNW_MIPS_PC = 34, - - /* FIXME: Other registers! */ - - /* For MIPS, the CFA is the value of SP (r29) at the call site in the - previous frame. */ - UNW_MIPS_CFA, - - UNW_TDEP_LAST_REG = UNW_MIPS_R31, - - UNW_TDEP_IP = UNW_MIPS_R31, - UNW_TDEP_SP = UNW_MIPS_R29, - UNW_TDEP_EH = UNW_MIPS_R0 /* FIXME. */ - } -mips_regnum_t; - -typedef enum - { - UNW_MIPS_ABI_O32, - UNW_MIPS_ABI_N32, - UNW_MIPS_ABI_N64 - } -mips_abi_t; - -#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for MIPS. */ - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_save_loc_t; - -/* On x86, we can directly use ucontext_t as the unwind context. FIXME for - MIPS. */ -typedef ucontext_t unw_tdep_context_t; - -#include "libunwind-dynamic.h" - -typedef struct - { - /* no mips-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -#include "libunwind-common.h" - -/* There is no getcontext() on MIPS. Use a stub version which only saves GP - registers. FIXME: Not ideal, may not be sufficient for all libunwind - use cases. */ -#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) -extern int unw_tdep_getcontext (ucontext_t *uc); - -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) -extern int unw_tdep_is_fpreg (int); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-ppc32.h b/external/android-libunwind/include/libunwind-ppc32.h deleted file mode 100644 index 51852e86571..00000000000 --- a/external/android-libunwind/include/libunwind-ppc32.h +++ /dev/null @@ -1,213 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2006-2007 IBM - Contributed by - Corey Ashford - Jose Flavio Aguilar Paulino - - Copied from libunwind-x86_64.h, modified slightly for building - frysk successfully on ppc64, by Wu Zhou - Will be replaced when libunwind is ready on ppc64 platform. - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include -#include - -#define UNW_TARGET ppc32 -#define UNW_TARGET_PPC32 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* - * This needs to be big enough to accommodate "struct cursor", while - * leaving some slack for future expansion. Changing this value will - * require recompiling all users of this library. Stack allocation is - * relatively cheap and unwind-state copying is relatively rare, so we want - * to err on making it rather too big than too small. - * - * To simplify this whole process, we are at least initially taking the - * tack that UNW_PPC32_* map straight across to the .eh_frame column register - * numbers. These register numbers come from gcc's source in - * gcc/config/rs6000/rs6000.h - * - * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115 - * elements in the loc array, each sized 2 * unw_word_t, plus the rest of - * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's - * round that up to 280. - */ - -#define UNW_TDEP_CURSOR_LEN 280 - -#if __WORDSIZE==32 -typedef uint32_t unw_word_t; -typedef int32_t unw_sword_t; -#else -typedef uint64_t unw_word_t; -typedef int64_t unw_sword_t; -#endif - -typedef long double unw_tdep_fpreg_t; - -typedef enum - { - UNW_PPC32_R0, - UNW_PPC32_R1, /* called STACK_POINTER in gcc */ - UNW_PPC32_R2, - UNW_PPC32_R3, - UNW_PPC32_R4, - UNW_PPC32_R5, - UNW_PPC32_R6, - UNW_PPC32_R7, - UNW_PPC32_R8, - UNW_PPC32_R9, - UNW_PPC32_R10, - UNW_PPC32_R11, /* called STATIC_CHAIN in gcc */ - UNW_PPC32_R12, - UNW_PPC32_R13, - UNW_PPC32_R14, - UNW_PPC32_R15, - UNW_PPC32_R16, - UNW_PPC32_R17, - UNW_PPC32_R18, - UNW_PPC32_R19, - UNW_PPC32_R20, - UNW_PPC32_R21, - UNW_PPC32_R22, - UNW_PPC32_R23, - UNW_PPC32_R24, - UNW_PPC32_R25, - UNW_PPC32_R26, - UNW_PPC32_R27, - UNW_PPC32_R28, - UNW_PPC32_R29, - UNW_PPC32_R30, - UNW_PPC32_R31, /* called HARD_FRAME_POINTER in gcc */ - - /* Count Register */ - UNW_PPC32_CTR = 32, - /* Fixed-Point Status and Control Register */ - UNW_PPC32_XER = 33, - /* Condition Register */ - UNW_PPC32_CCR = 34, - /* Machine State Register */ - //UNW_PPC32_MSR = 35, - /* MQ or SPR0, not part of generic Power, part of MPC601 */ - //UNW_PPC32_MQ = 36, - /* Link Register */ - UNW_PPC32_LR = 36, - /* Floating Pointer Status and Control Register */ - UNW_PPC32_FPSCR = 37, - - UNW_PPC32_F0 = 48, - UNW_PPC32_F1, - UNW_PPC32_F2, - UNW_PPC32_F3, - UNW_PPC32_F4, - UNW_PPC32_F5, - UNW_PPC32_F6, - UNW_PPC32_F7, - UNW_PPC32_F8, - UNW_PPC32_F9, - UNW_PPC32_F10, - UNW_PPC32_F11, - UNW_PPC32_F12, - UNW_PPC32_F13, - UNW_PPC32_F14, - UNW_PPC32_F15, - UNW_PPC32_F16, - UNW_PPC32_F17, - UNW_PPC32_F18, - UNW_PPC32_F19, - UNW_PPC32_F20, - UNW_PPC32_F21, - UNW_PPC32_F22, - UNW_PPC32_F23, - UNW_PPC32_F24, - UNW_PPC32_F25, - UNW_PPC32_F26, - UNW_PPC32_F27, - UNW_PPC32_F28, - UNW_PPC32_F29, - UNW_PPC32_F30, - UNW_PPC32_F31, - - UNW_TDEP_LAST_REG = UNW_PPC32_F31, - - UNW_TDEP_IP = UNW_PPC32_LR, - UNW_TDEP_SP = UNW_PPC32_R1, - UNW_TDEP_EH = UNW_PPC32_R12 - } -ppc32_regnum_t; - -/* - * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for - * passing parameters to exception handlers. - */ - -#define UNW_TDEP_NUM_EH_REGS 4 - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_save_loc_t; - -/* On ppc, we can directly use ucontext_t as the unwind context. */ -typedef ucontext_t unw_tdep_context_t; - -/* XXX this is not ideal: an application should not be prevented from - using the "getcontext" name just because it's using libunwind. We - can't just use __getcontext() either, because that isn't exported - by glibc... */ -#define unw_tdep_getcontext(uc) (getcontext (uc), 0) - -#include "libunwind-dynamic.h" - -typedef struct - { - /* no ppc32-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -#include "libunwind-common.h" - -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) -extern int unw_tdep_is_fpreg (int); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-ppc64.h b/external/android-libunwind/include/libunwind-ppc64.h deleted file mode 100644 index e0dbaaa9e00..00000000000 --- a/external/android-libunwind/include/libunwind-ppc64.h +++ /dev/null @@ -1,270 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2006-2007 IBM - Contributed by - Corey Ashford - Jose Flavio Aguilar Paulino - - Copied from libunwind-x86_64.h, modified slightly for building - frysk successfully on ppc64, by Wu Zhou - Will be replaced when libunwind is ready on ppc64 platform. - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include -#include - -#define UNW_TARGET ppc64 -#define UNW_TARGET_PPC64 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* - * This needs to be big enough to accommodate "struct cursor", while - * leaving some slack for future expansion. Changing this value will - * require recompiling all users of this library. Stack allocation is - * relatively cheap and unwind-state copying is relatively rare, so we want - * to err on making it rather too big than too small. - * - * To simplify this whole process, we are at least initially taking the - * tack that UNW_PPC64_* map straight across to the .eh_frame column register - * numbers. These register numbers come from gcc's source in - * gcc/config/rs6000/rs6000.h - * - * UNW_TDEP_CURSOR_LEN is in terms of unw_word_t size. Since we have 115 - * elements in the loc array, each sized 2 * unw_word_t, plus the rest of - * the cursor struct, this puts us at about 2 * 115 + 40 = 270. Let's - * round that up to 280. - */ - -#define UNW_TDEP_CURSOR_LEN 280 - -#if __WORDSIZE==32 -typedef uint32_t unw_word_t; -typedef int32_t unw_sword_t; -#else -typedef uint64_t unw_word_t; -typedef int64_t unw_sword_t; -#endif - -typedef long double unw_tdep_fpreg_t; - -/* - * Vector register (in PowerPC64 used for AltiVec registers) - */ -typedef struct { - uint64_t halves[2]; -} unw_tdep_vreg_t; - -typedef enum - { - UNW_PPC64_R0, - UNW_PPC64_R1, /* called STACK_POINTER in gcc */ - UNW_PPC64_R2, - UNW_PPC64_R3, - UNW_PPC64_R4, - UNW_PPC64_R5, - UNW_PPC64_R6, - UNW_PPC64_R7, - UNW_PPC64_R8, - UNW_PPC64_R9, - UNW_PPC64_R10, - UNW_PPC64_R11, /* called STATIC_CHAIN in gcc */ - UNW_PPC64_R12, - UNW_PPC64_R13, - UNW_PPC64_R14, - UNW_PPC64_R15, - UNW_PPC64_R16, - UNW_PPC64_R17, - UNW_PPC64_R18, - UNW_PPC64_R19, - UNW_PPC64_R20, - UNW_PPC64_R21, - UNW_PPC64_R22, - UNW_PPC64_R23, - UNW_PPC64_R24, - UNW_PPC64_R25, - UNW_PPC64_R26, - UNW_PPC64_R27, - UNW_PPC64_R28, - UNW_PPC64_R29, - UNW_PPC64_R30, - UNW_PPC64_R31, /* called HARD_FRAME_POINTER in gcc */ - - UNW_PPC64_F0 = 32, - UNW_PPC64_F1, - UNW_PPC64_F2, - UNW_PPC64_F3, - UNW_PPC64_F4, - UNW_PPC64_F5, - UNW_PPC64_F6, - UNW_PPC64_F7, - UNW_PPC64_F8, - UNW_PPC64_F9, - UNW_PPC64_F10, - UNW_PPC64_F11, - UNW_PPC64_F12, - UNW_PPC64_F13, - UNW_PPC64_F14, - UNW_PPC64_F15, - UNW_PPC64_F16, - UNW_PPC64_F17, - UNW_PPC64_F18, - UNW_PPC64_F19, - UNW_PPC64_F20, - UNW_PPC64_F21, - UNW_PPC64_F22, - UNW_PPC64_F23, - UNW_PPC64_F24, - UNW_PPC64_F25, - UNW_PPC64_F26, - UNW_PPC64_F27, - UNW_PPC64_F28, - UNW_PPC64_F29, - UNW_PPC64_F30, - UNW_PPC64_F31, - /* Note that there doesn't appear to be an .eh_frame register column - for the FPSCR register. I don't know why this is. Since .eh_frame - info is what this implementation uses for unwinding, we have no way - to unwind this register, and so we will not expose an FPSCR register - number in the libunwind API. - */ - - UNW_PPC64_LR = 65, - UNW_PPC64_CTR = 66, - UNW_PPC64_ARG_POINTER = 67, - - UNW_PPC64_CR0 = 68, - UNW_PPC64_CR1, - UNW_PPC64_CR2, - UNW_PPC64_CR3, - UNW_PPC64_CR4, - /* CR5 .. CR7 are currently unused */ - UNW_PPC64_CR5, - UNW_PPC64_CR6, - UNW_PPC64_CR7, - - UNW_PPC64_XER = 76, - - UNW_PPC64_V0 = 77, - UNW_PPC64_V1, - UNW_PPC64_V2, - UNW_PPC64_V3, - UNW_PPC64_V4, - UNW_PPC64_V5, - UNW_PPC64_V6, - UNW_PPC64_V7, - UNW_PPC64_V8, - UNW_PPC64_V9, - UNW_PPC64_V10, - UNW_PPC64_V11, - UNW_PPC64_V12, - UNW_PPC64_V13, - UNW_PPC64_V14, - UNW_PPC64_V15, - UNW_PPC64_V16, - UNW_PPC64_V17, - UNW_PPC64_V18, - UNW_PPC64_V19, - UNW_PPC64_V20, - UNW_PPC64_V21, - UNW_PPC64_V22, - UNW_PPC64_V23, - UNW_PPC64_V24, - UNW_PPC64_V25, - UNW_PPC64_V26, - UNW_PPC64_V27, - UNW_PPC64_V28, - UNW_PPC64_V29, - UNW_PPC64_V30, - UNW_PPC64_V31, - - UNW_PPC64_VRSAVE = 109, - UNW_PPC64_VSCR = 110, - UNW_PPC64_SPE_ACC = 111, - UNW_PPC64_SPEFSCR = 112, - - /* frame info (read-only) */ - UNW_PPC64_FRAME_POINTER, - UNW_PPC64_NIP, - - - UNW_TDEP_LAST_REG = UNW_PPC64_NIP, - - UNW_TDEP_IP = UNW_PPC64_NIP, - UNW_TDEP_SP = UNW_PPC64_R1, - UNW_TDEP_EH = UNW_PPC64_R12 - } -ppc64_regnum_t; - -/* - * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for - * passing parameters to exception handlers. - */ - -#define UNW_TDEP_NUM_EH_REGS 4 - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_save_loc_t; - -/* On ppc64, we can directly use ucontext_t as the unwind context. */ -typedef ucontext_t unw_tdep_context_t; - -/* XXX this is not ideal: an application should not be prevented from - using the "getcontext" name just because it's using libunwind. We - can't just use __getcontext() either, because that isn't exported - by glibc... */ -#define unw_tdep_getcontext(uc) (getcontext (uc), 0) - -#include "libunwind-dynamic.h" - -typedef struct - { - /* no ppc64-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -#include "libunwind-common.h" - -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) -extern int unw_tdep_is_fpreg (int); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-ptrace.h b/external/android-libunwind/include/libunwind-ptrace.h deleted file mode 100644 index 7fca205e50c..00000000000 --- a/external/android-libunwind/include/libunwind-ptrace.h +++ /dev/null @@ -1,63 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef libunwind_ptrace_h -#define libunwind_ptrace_h - -#include - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -/* Helper routines which make it easy to use libunwind via ptrace(). - They're available only if UNW_REMOTE_ONLY is _not_ defined and they - aren't really part of the libunwind API. They are implemented in a - archive library called libunwind-ptrace.a. */ - -extern void *_UPT_create (pid_t); -extern void _UPT_destroy (void *); -extern int _UPT_find_proc_info (unw_addr_space_t, unw_word_t, - unw_proc_info_t *, int, void *); -extern void _UPT_put_unwind_info (unw_addr_space_t, unw_proc_info_t *, void *); -extern int _UPT_get_dyn_info_list_addr (unw_addr_space_t, unw_word_t *, - void *); -extern int _UPT_access_mem (unw_addr_space_t, unw_word_t, unw_word_t *, int, - void *); -extern int _UPT_access_reg (unw_addr_space_t, unw_regnum_t, unw_word_t *, - int, void *); -extern int _UPT_access_fpreg (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, - int, void *); -extern int _UPT_get_proc_name (unw_addr_space_t, unw_word_t, char *, size_t, - unw_word_t *, void *); -extern int _UPT_resume (unw_addr_space_t, unw_cursor_t *, void *); -extern unw_accessors_t _UPT_accessors; - - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* libunwind_ptrace_h */ diff --git a/external/android-libunwind/include/libunwind-sh.h b/external/android-libunwind/include/libunwind-sh.h deleted file mode 100644 index 8f36a258db7..00000000000 --- a/external/android-libunwind/include/libunwind-sh.h +++ /dev/null @@ -1,120 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2008 CodeSourcery - Copyright (C) 2012 Tommi Rantala - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include -#include -#include - -#define UNW_TARGET sh -#define UNW_TARGET_SH 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* This needs to be big enough to accommodate "struct cursor", while - leaving some slack for future expansion. Changing this value will - require recompiling all users of this library. Stack allocation is - relatively cheap and unwind-state copying is relatively rare, so we - want to err on making it rather too big than too small. */ - -#define UNW_TDEP_CURSOR_LEN 4096 - -typedef uint32_t unw_word_t; -typedef int32_t unw_sword_t; - -typedef long double unw_tdep_fpreg_t; - -typedef enum - { - UNW_SH_R0, - UNW_SH_R1, - UNW_SH_R2, - UNW_SH_R3, - UNW_SH_R4, - UNW_SH_R5, - UNW_SH_R6, - UNW_SH_R7, - UNW_SH_R8, - UNW_SH_R9, - UNW_SH_R10, - UNW_SH_R11, - UNW_SH_R12, - UNW_SH_R13, - UNW_SH_R14, - UNW_SH_R15, - - UNW_SH_PC, - UNW_SH_PR, - - UNW_TDEP_LAST_REG = UNW_SH_PR, - - UNW_TDEP_IP = UNW_SH_PR, - UNW_TDEP_SP = UNW_SH_R15, - UNW_TDEP_EH = UNW_SH_R0 - } -sh_regnum_t; - -#define UNW_TDEP_NUM_EH_REGS 2 - -typedef ucontext_t unw_tdep_context_t; - -#define unw_tdep_getcontext(uc) (getcontext (uc), 0) - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_save_loc_t; - -#include "libunwind-dynamic.h" - -typedef struct - { - /* no sh-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -#include "libunwind-common.h" - -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) -extern int unw_tdep_is_fpreg (int); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-x86.h b/external/android-libunwind/include/libunwind-x86.h deleted file mode 100644 index e46632d51f0..00000000000 --- a/external/android-libunwind/include/libunwind-x86.h +++ /dev/null @@ -1,193 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2002-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include -#include -#include - -#define UNW_TARGET x86 -#define UNW_TARGET_X86 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* This needs to be big enough to accommodate "struct cursor", while - leaving some slack for future expansion. Changing this value will - require recompiling all users of this library. Stack allocation is - relatively cheap and unwind-state copying is relatively rare, so we - want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 127 - -typedef uint32_t unw_word_t; -typedef int32_t unw_sword_t; - -typedef union { - struct { uint8_t b[4]; } val32; - struct { uint8_t b[10]; } val80; - struct { uint8_t b[16]; } val128; -} unw_tdep_fpreg_t; - -typedef enum - { - /* Note: general registers are expected to start with index 0. - This convention facilitates architecture-independent - implementation of the C++ exception handling ABI. See - _Unwind_SetGR() and _Unwind_GetGR() for details. - - The described register usage convention is based on "System V - Application Binary Interface, Intel386 Architecture Processor - Supplement, Fourth Edition" at - - http://www.linuxbase.org/spec/refspecs/elf/abi386-4.pdf - - It would have been nice to use the same register numbering as - DWARF, but that doesn't work because the libunwind requires - that the exception argument registers be consecutive, which the - wouldn't be with the DWARF numbering. */ - UNW_X86_EAX, /* scratch (exception argument 1) */ - UNW_X86_EDX, /* scratch (exception argument 2) */ - UNW_X86_ECX, /* scratch */ - UNW_X86_EBX, /* preserved */ - UNW_X86_ESI, /* preserved */ - UNW_X86_EDI, /* preserved */ - UNW_X86_EBP, /* (optional) frame-register */ - UNW_X86_ESP, /* (optional) frame-register */ - UNW_X86_EIP, /* frame-register */ - UNW_X86_EFLAGS, /* scratch (except for "direction", which is fixed */ - UNW_X86_TRAPNO, /* scratch */ - - /* MMX/stacked-fp registers */ - UNW_X86_ST0, /* fp return value */ - UNW_X86_ST1, /* scratch */ - UNW_X86_ST2, /* scratch */ - UNW_X86_ST3, /* scratch */ - UNW_X86_ST4, /* scratch */ - UNW_X86_ST5, /* scratch */ - UNW_X86_ST6, /* scratch */ - UNW_X86_ST7, /* scratch */ - - UNW_X86_FCW, /* scratch */ - UNW_X86_FSW, /* scratch */ - UNW_X86_FTW, /* scratch */ - UNW_X86_FOP, /* scratch */ - UNW_X86_FCS, /* scratch */ - UNW_X86_FIP, /* scratch */ - UNW_X86_FEA, /* scratch */ - UNW_X86_FDS, /* scratch */ - - /* SSE registers */ - UNW_X86_XMM0_lo, /* scratch */ - UNW_X86_XMM0_hi, /* scratch */ - UNW_X86_XMM1_lo, /* scratch */ - UNW_X86_XMM1_hi, /* scratch */ - UNW_X86_XMM2_lo, /* scratch */ - UNW_X86_XMM2_hi, /* scratch */ - UNW_X86_XMM3_lo, /* scratch */ - UNW_X86_XMM3_hi, /* scratch */ - UNW_X86_XMM4_lo, /* scratch */ - UNW_X86_XMM4_hi, /* scratch */ - UNW_X86_XMM5_lo, /* scratch */ - UNW_X86_XMM5_hi, /* scratch */ - UNW_X86_XMM6_lo, /* scratch */ - UNW_X86_XMM6_hi, /* scratch */ - UNW_X86_XMM7_lo, /* scratch */ - UNW_X86_XMM7_hi, /* scratch */ - - UNW_X86_MXCSR, /* scratch */ - - /* segment registers */ - UNW_X86_GS, /* special */ - UNW_X86_FS, /* special */ - UNW_X86_ES, /* special */ - UNW_X86_DS, /* special */ - UNW_X86_SS, /* special */ - UNW_X86_CS, /* special */ - UNW_X86_TSS, /* special */ - UNW_X86_LDT, /* special */ - - /* frame info (read-only) */ - UNW_X86_CFA, - - UNW_X86_XMM0, /* scratch */ - UNW_X86_XMM1, /* scratch */ - UNW_X86_XMM2, /* scratch */ - UNW_X86_XMM3, /* scratch */ - UNW_X86_XMM4, /* scratch */ - UNW_X86_XMM5, /* scratch */ - UNW_X86_XMM6, /* scratch */ - UNW_X86_XMM7, /* scratch */ - - UNW_TDEP_LAST_REG = UNW_X86_XMM7, - - UNW_TDEP_IP = UNW_X86_EIP, - UNW_TDEP_SP = UNW_X86_ESP, - UNW_TDEP_EH = UNW_X86_EAX - } -x86_regnum_t; - -#define UNW_TDEP_NUM_EH_REGS 2 /* eax and edx are exception args */ - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_save_loc_t; - -/* On x86, we can directly use ucontext_t as the unwind context. */ -typedef ucontext_t unw_tdep_context_t; - -#include "libunwind-dynamic.h" - -typedef struct - { - /* no x86-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -#include "libunwind-common.h" - -#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) -extern int unw_tdep_getcontext (unw_tdep_context_t *); - -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) -extern int unw_tdep_is_fpreg (int); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind-x86_64.h b/external/android-libunwind/include/libunwind-x86_64.h deleted file mode 100644 index ed8cb11fbdb..00000000000 --- a/external/android-libunwind/include/libunwind-x86_64.h +++ /dev/null @@ -1,145 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2002-2004 Hewlett-Packard Co - Contributed by David Mosberger-Tang - - Modified for x86_64 by Max Asbock - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef LIBUNWIND_H -#define LIBUNWIND_H - -#if defined(__cplusplus) || defined(c_plusplus) -extern "C" { -#endif - -#include -#include -#include - -#define UNW_TARGET x86_64 -#define UNW_TARGET_X86_64 1 - -#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ - -/* This needs to be big enough to accommodate "struct cursor", while - leaving some slack for future expansion. Changing this value will - require recompiling all users of this library. Stack allocation is - relatively cheap and unwind-state copying is relatively rare, so we - want to err on making it rather too big than too small. */ -#define UNW_TDEP_CURSOR_LEN 127 - -typedef uint64_t unw_word_t; -typedef int64_t unw_sword_t; - -typedef long double unw_tdep_fpreg_t; - -typedef enum - { - UNW_X86_64_RAX, - UNW_X86_64_RDX, - UNW_X86_64_RCX, - UNW_X86_64_RBX, - UNW_X86_64_RSI, - UNW_X86_64_RDI, - UNW_X86_64_RBP, - UNW_X86_64_RSP, - UNW_X86_64_R8, - UNW_X86_64_R9, - UNW_X86_64_R10, - UNW_X86_64_R11, - UNW_X86_64_R12, - UNW_X86_64_R13, - UNW_X86_64_R14, - UNW_X86_64_R15, - UNW_X86_64_RIP, -#ifdef CONFIG_MSABI_SUPPORT - UNW_X86_64_XMM0, - UNW_X86_64_XMM1, - UNW_X86_64_XMM2, - UNW_X86_64_XMM3, - UNW_X86_64_XMM4, - UNW_X86_64_XMM5, - UNW_X86_64_XMM6, - UNW_X86_64_XMM7, - UNW_X86_64_XMM8, - UNW_X86_64_XMM9, - UNW_X86_64_XMM10, - UNW_X86_64_XMM11, - UNW_X86_64_XMM12, - UNW_X86_64_XMM13, - UNW_X86_64_XMM14, - UNW_X86_64_XMM15, - UNW_TDEP_LAST_REG = UNW_X86_64_XMM15, -#else - UNW_TDEP_LAST_REG = UNW_X86_64_RIP, -#endif - - /* XXX Add other regs here */ - - /* frame info (read-only) */ - UNW_X86_64_CFA, - - UNW_TDEP_IP = UNW_X86_64_RIP, - UNW_TDEP_SP = UNW_X86_64_RSP, - UNW_TDEP_BP = UNW_X86_64_RBP, - UNW_TDEP_EH = UNW_X86_64_RAX - } -x86_64_regnum_t; - -#define UNW_TDEP_NUM_EH_REGS 2 /* XXX Not sure what this means */ - -typedef struct unw_tdep_save_loc - { - /* Additional target-dependent info on a save location. */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_save_loc_t; - -/* On x86_64, we can directly use ucontext_t as the unwind context. */ -typedef ucontext_t unw_tdep_context_t; - -typedef struct - { - /* no x86-64-specific auxiliary proc-info */ - /* ANDROID support update. */ - char __reserved; - /* End of ANDROID update. */ - } -unw_tdep_proc_info_t; - -#include "libunwind-dynamic.h" -#include "libunwind-common.h" - -#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) -#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) - -extern int unw_tdep_getcontext (unw_tdep_context_t *); -extern int unw_tdep_is_fpreg (int); - -#if defined(__cplusplus) || defined(c_plusplus) -} -#endif - -#endif /* LIBUNWIND_H */ diff --git a/external/android-libunwind/include/libunwind.h b/external/android-libunwind/include/libunwind.h deleted file mode 100644 index 0fafda653b8..00000000000 --- a/external/android-libunwind/include/libunwind.h +++ /dev/null @@ -1,34 +0,0 @@ -/* Provide a real file - not a symlink - as it would cause multiarch conflicts - when multiple different arch releases are installed simultaneously. */ - -#ifndef UNW_REMOTE_ONLY - -#if defined __aarch64__ -#include "libunwind-aarch64.h" -#elif defined __arm__ -# include "libunwind-arm.h" -#elif defined __hppa__ -# include "libunwind-hppa.h" -#elif defined __ia64__ -# include "libunwind-ia64.h" -#elif defined __mips__ -# include "libunwind-mips.h" -#elif defined __powerpc__ && !defined __powerpc64__ -# include "libunwind-ppc32.h" -#elif defined __powerpc64__ -# include "libunwind-ppc64.h" -#elif defined __sh__ -# include "libunwind-sh.h" -#elif defined __i386__ -# include "libunwind-x86.h" -#elif defined __x86_64__ -# include "libunwind-x86_64.h" -#else -# error "Unsupported arch" -#endif - -#else /* UNW_REMOTE_ONLY */ - -# include "libunwind-arm.h" - -#endif /* UNW_REMOTE_ONLY */ diff --git a/external/android-libunwind/include/unwind.h b/external/android-libunwind/include/unwind.h deleted file mode 100644 index f8d43d0d0e1..00000000000 --- a/external/android-libunwind/include/unwind.h +++ /dev/null @@ -1,154 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2003 Hewlett-Packard Co - Contributed by David Mosberger-Tang - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#ifndef _UNWIND_H -#define _UNWIND_H - -/* For uint64_t */ -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* Minimal interface as per C++ ABI draft standard: - - http://www.codesourcery.com/cxx-abi/abi-eh.html */ - -typedef enum - { - _URC_NO_REASON = 0, - _URC_FOREIGN_EXCEPTION_CAUGHT = 1, - _URC_FATAL_PHASE2_ERROR = 2, - _URC_FATAL_PHASE1_ERROR = 3, - _URC_NORMAL_STOP = 4, - _URC_END_OF_STACK = 5, - _URC_HANDLER_FOUND = 6, - _URC_INSTALL_CONTEXT = 7, - _URC_CONTINUE_UNWIND = 8 - } -_Unwind_Reason_Code; - -typedef int _Unwind_Action; - -#define _UA_SEARCH_PHASE 1 -#define _UA_CLEANUP_PHASE 2 -#define _UA_HANDLER_FRAME 4 -#define _UA_FORCE_UNWIND 8 - -struct _Unwind_Context; /* opaque data-structure */ -struct _Unwind_Exception; /* forward-declaration */ - -typedef void (*_Unwind_Exception_Cleanup_Fn) (_Unwind_Reason_Code, - struct _Unwind_Exception *); - -typedef _Unwind_Reason_Code (*_Unwind_Stop_Fn) (int, _Unwind_Action, - uint64_t, - struct _Unwind_Exception *, - struct _Unwind_Context *, - void *); - -/* The C++ ABI requires exception_class, private_1, and private_2 to - be of type uint64 and the entire structure to be - double-word-aligned. Please note that exception_class stays 64-bit - even on 32-bit machines for gcc compatibility. */ -struct _Unwind_Exception - { - uint64_t exception_class; - _Unwind_Exception_Cleanup_Fn exception_cleanup; - unsigned long private_1; - unsigned long private_2; - } __attribute__((__aligned__)); - -extern _Unwind_Reason_Code _Unwind_RaiseException (struct _Unwind_Exception *); -extern _Unwind_Reason_Code _Unwind_ForcedUnwind (struct _Unwind_Exception *, - _Unwind_Stop_Fn, void *); -extern void _Unwind_Resume (struct _Unwind_Exception *); -extern void _Unwind_DeleteException (struct _Unwind_Exception *); -extern unsigned long _Unwind_GetGR (struct _Unwind_Context *, int); -extern void _Unwind_SetGR (struct _Unwind_Context *, int, unsigned long); -extern unsigned long _Unwind_GetIP (struct _Unwind_Context *); -extern unsigned long _Unwind_GetIPInfo (struct _Unwind_Context *, int *); -extern void _Unwind_SetIP (struct _Unwind_Context *, unsigned long); -extern unsigned long _Unwind_GetLanguageSpecificData (struct _Unwind_Context*); -extern unsigned long _Unwind_GetRegionStart (struct _Unwind_Context *); - -#ifdef _GNU_SOURCE - -/* Callback for _Unwind_Backtrace(). The backtrace stops immediately - if the callback returns any value other than _URC_NO_REASON. */ -typedef _Unwind_Reason_Code (*_Unwind_Trace_Fn) (struct _Unwind_Context *, - void *); - -/* See http://gcc.gnu.org/ml/gcc-patches/2001-09/msg00082.html for why - _UA_END_OF_STACK exists. */ -# define _UA_END_OF_STACK 16 - -/* If the unwind was initiated due to a forced unwind, resume that - operation, else re-raise the exception. This is used by - __cxa_rethrow(). */ -extern _Unwind_Reason_Code - _Unwind_Resume_or_Rethrow (struct _Unwind_Exception *); - -/* See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00154.html for why - _Unwind_GetBSP() exists. */ -extern unsigned long _Unwind_GetBSP (struct _Unwind_Context *); - -/* Return the "canonical frame address" for the given context. - This is used by NPTL... */ -extern unsigned long _Unwind_GetCFA (struct _Unwind_Context *); - -/* Return the base-address for data references. */ -extern unsigned long _Unwind_GetDataRelBase (struct _Unwind_Context *); - -/* Return the base-address for text references. */ -extern unsigned long _Unwind_GetTextRelBase (struct _Unwind_Context *); - -/* Call _Unwind_Trace_Fn once for each stack-frame, without doing any - cleanup. The first frame for which the callback is invoked is the - one for the caller of _Unwind_Backtrace(). _Unwind_Backtrace() - returns _URC_END_OF_STACK when the backtrace stopped due to - reaching the end of the call-chain or _URC_FATAL_PHASE1_ERROR if it - stops for any other reason. */ -extern _Unwind_Reason_Code _Unwind_Backtrace (_Unwind_Trace_Fn, void *); - -/* Find the start-address of the procedure containing the specified IP - or NULL if it cannot be found (e.g., because the function has no - unwind info). Note: there is not necessarily a one-to-one - correspondence between source-level functions and procedures: some - functions don't have unwind-info and others are split into multiple - procedures. */ -extern void *_Unwind_FindEnclosingFunction (void *); - -/* See also Linux Standard Base Spec: - http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/libgcc-s.html */ - -#endif /* _GNU_SOURCE */ - -#ifdef __cplusplus -}; -#endif - -#endif /* _UNWIND_H */ diff --git a/external/corefx b/external/corefx index b1aa1d92ca3..9e497a72151 160000 --- a/external/corefx +++ b/external/corefx @@ -1 +1 @@ -Subproject commit b1aa1d92ca33d0cb8ffbac9b6ff73b284db6bbf1 +Subproject commit 9e497a721510a76c233a52dabe3c05fbb2c4ba52 diff --git a/external/roslyn-binaries b/external/roslyn-binaries index a1c06d559d6..606eb251183 160000 --- a/external/roslyn-binaries +++ b/external/roslyn-binaries @@ -1 +1 @@ -Subproject commit a1c06d559d6f2cbbaeae86ea87632d409a82ca94 +Subproject commit 606eb25118347c5c8eeb69d247fcfe4ecb43460c diff --git a/man/mono.1 b/man/mono.1 index 08a93ac9182..bea38842eb3 100644 --- a/man/mono.1 +++ b/man/mono.1 @@ -257,6 +257,9 @@ The default files are /etc/mono/config and ~/.mono/config or the file specified in the MONO_CONFIG environment variable, if set. See the mono-config(5) man page for details on the format of this file. .TP +\fB--aot-path=PATH\fR +List of additional directories to search for AOT images. +.TP \fB--debugger-agent=[options]\fR This instructs the Mono runtime to start a debugging agent inside the Mono runtime and connect it to a diff --git a/mcs/Makefile b/mcs/Makefile index 232a4acfbcb..043acf5563c 100644 --- a/mcs/Makefile +++ b/mcs/Makefile @@ -5,7 +5,7 @@ SUBDIRS := build jay mcs class nunit24 ilasm tools tests errors docs packages # Resgen is corlib specific tool basic_SUBDIRS := build jay class -build_SUBDIRS := build class class/aot-compiler tools +build_SUBDIRS := build class class/aot-compiler tools ilasm monodroid_SUBDIRS := build class monotouch_SUBDIRS := build class monotouch_watch_SUBDIRS := build class @@ -14,13 +14,14 @@ monotouch_runtime_SUBDIRS := build class monotouch_watch_runtime_SUBDIRS := build class monotouch_tv_runtime_SUBDIRS := build class xammac_SUBDIRS := build class -aot_hybrid_SUBDIRS := build class ilasm -aot_only_SUBDIRS := build class ilasm +testing_aot_hybrid_SUBDIRS := build class +testing_aot_full_SUBDIRS := build class binary_reference_assemblies_SUBDIRS := build class net_4_x_SUBDIRS := build class nunit24 ilasm tools tests errors docs mcs class/aot-compiler packages xammac_net_4_5_SUBDIRS := build class xbuild_12_SUBDIRS := build class tools/xbuild xbuild_14_SUBDIRS := build class tools/xbuild +winaot_SUBDIRS := build class include build/rules.make @@ -71,8 +72,9 @@ $(_boot_:%=profile-do--monotouch_watch_runtime--%): profile-do--monotouch_watch $(_boot_:%=profile-do--monotouch_tv_runtime--%): profile-do--monotouch_tv_runtime--%: profile-do--build--% $(_boot_:%=profile-do--xammac--%): profile-do--xammac--%: profile-do--build--% $(_boot_:%=profile-do--xammac_net_4_5--%): profile-do--xammac_net_4_5--%: profile-do--build--% -$(_boot_:%=profile-do--aot_hybrid--%): profile-do--aot_hybrid--%: profile-do--build--% -$(_boot_:%=profile-do--aot_only--%): profile-do--aot_only--%: profile-do--build--% +$(_boot_:%=profile-do--testing_aot_hybrid--%): profile-do--testing_aot_hybrid--%: profile-do--build--% +$(_boot_:%=profile-do--testing_aot_full--%): profile-do--testing_aot_full--%: profile-do--build--% +$(_boot_:%=profile-do--winaot--%): profile-do--winaot--%: profile-do--build--% $(_boot_:%=profile-do--build--%): profile-do--build--%: profile-do--basic--% testcorlib: diff --git a/mcs/build/common/SR.cs b/mcs/build/common/SR.cs index 0685edb53bc..0cfe659dc4b 100644 --- a/mcs/build/common/SR.cs +++ b/mcs/build/common/SR.cs @@ -21,6 +21,30 @@ static partial class SR { return name; } + + internal static string Format(string resourceFormat, params object[] args) + { + if (args != null) { + return string.Format (CultureInfo.InvariantCulture, resourceFormat, args); + } + + return resourceFormat; + } + + internal static string Format(string resourceFormat, object p1) + { + return string.Format (CultureInfo.InvariantCulture, resourceFormat, p1); + } + + internal static string Format(string resourceFormat, object p1, object p2) + { + return string.Format (CultureInfo.InvariantCulture, resourceFormat, p1, p2); + } + + internal static string Format(string resourceFormat, object p1, object p2, object p3) + { + return string.Format (CultureInfo.InvariantCulture, resourceFormat, p1, p2, p3); + } } namespace System.Runtime.CompilerServices diff --git a/mcs/build/common/basic-profile-check.cs b/mcs/build/common/basic-profile-check.cs index 591843dd20e..88f326271ce 100644 --- a/mcs/build/common/basic-profile-check.cs +++ b/mcs/build/common/basic-profile-check.cs @@ -40,7 +40,7 @@ class X { if (!Version.TryParse (field.GetValue (null) as string, out version)) return 4; - if (version < new Version (4, 8)) + if (version < new Version (4, 9)) return 5; return 0; diff --git a/mcs/build/profiles/aot_hybrid.make b/mcs/build/profiles/aot_hybrid.make deleted file mode 100644 index 97ae3b2c348..00000000000 --- a/mcs/build/profiles/aot_hybrid.make +++ /dev/null @@ -1,36 +0,0 @@ -#! -*- makefile -*- - -BOOTSTRAP_PROFILE = build - -BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC) -MCS = $(BOOTSTRAP_MCS) - -# Use system resgen as we don't want local System.Windows.Forms dependency -RESGEN = resgen2 - -profile-check: - @: - -DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll - -PROFILE_MCS_FLAGS = \ - -d:NET_1_1 \ - -d:NET_2_0 \ - -d:NET_2_1 \ - -d:MOBILE,MOBILE_LEGACY \ - -d:MOBILE_DYNAMIC \ - -d:NET_3_5 \ - -d:NET_4_0 \ - -d:NET_4_5 \ - -d:MONO \ - -d:NETSTANDARD \ - -nowarn:1699 \ - -nostdlib \ - $(DEFAULT_REFERENCES) \ - $(PLATFORM_DEBUG_FLAGS) - -FRAMEWORK_VERSION = 2.1 - -NO_INSTALL = yes -MOBILE_DYNAMIC = yes -MOBILE_PROFILE = yes \ No newline at end of file diff --git a/mcs/build/profiles/aot_only.make b/mcs/build/profiles/aot_only.make deleted file mode 100644 index ba50e26cb51..00000000000 --- a/mcs/build/profiles/aot_only.make +++ /dev/null @@ -1,47 +0,0 @@ -#! -*- makefile -*- - -BOOTSTRAP_PROFILE = build - -BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC) -MCS = $(BOOTSTRAP_MCS) - -# Use system resgen as we don't want local System.Windows.Forms dependency -RESGEN = resgen2 - -profile-check: - @: - -DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll - -PROFILE_MCS_FLAGS = \ - -d:NET_1_1 \ - -d:NET_2_0 \ - -d:NET_2_1 \ - -d:NET_3_5 \ - -d:NET_4_0 \ - -d:NET_4_5 \ - -d:MONO \ - -d:NETSTANDARD \ - -d:MOBILE,MOBILE_LEGACY \ - -d:AOT_ONLY_DESKTOP \ - -d:FULL_AOT_RUNTIME \ - -d:DISABLE_REMOTING \ - -d:DISABLE_COM \ - -nowarn:1699 \ - -nostdlib \ - $(DEFAULT_REFERENCES) \ - $(PLATFORM_DEBUG_FLAGS) - -FRAMEWORK_VERSION = 2.1 - -# the tuner takes care of the install -NO_INSTALL = yes -AOT_FRIENDLY_PROFILE = yes -MOBILE_PROFILE = yes -NO_VTS_TEST = yes - -# Note need for trailing comma. If you add, keep it -PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS, - -ALWAYS_AOT = yes - diff --git a/mcs/build/profiles/testing_aot_full.make b/mcs/build/profiles/testing_aot_full.make new file mode 100644 index 00000000000..41c8ac0e144 --- /dev/null +++ b/mcs/build/profiles/testing_aot_full.make @@ -0,0 +1,47 @@ +#! -*- makefile -*- + +BOOTSTRAP_PROFILE = build + +BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC) +MCS = $(BOOTSTRAP_MCS) + +# Use system resgen as we don't want local System.Windows.Forms dependency +RESGEN = resgen2 + +profile-check: + @: + +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll + +PROFILE_MCS_FLAGS = \ + -d:NET_1_1 \ + -d:NET_2_0 \ + -d:NET_2_1 \ + -d:NET_3_5 \ + -d:NET_4_0 \ + -d:NET_4_5 \ + -d:MONO \ + -d:NETSTANDARD \ + -d:MOBILE,MOBILE_LEGACY \ + -d:FULL_AOT_DESKTOP \ + -d:FULL_AOT_RUNTIME \ + -d:DISABLE_REMOTING \ + -d:DISABLE_COM \ + -nowarn:1699 \ + -nostdlib \ + $(DEFAULT_REFERENCES) \ + $(PLATFORM_DEBUG_FLAGS) + +FRAMEWORK_VERSION = 2.1 + +# the tuner takes care of the install +NO_INSTALL = yes +AOT_FRIENDLY_PROFILE = yes +MOBILE_PROFILE = yes +NO_VTS_TEST = yes + +# Note need for trailing comma. If you add, keep it +PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS, + +ALWAYS_AOT = yes + diff --git a/mcs/build/profiles/testing_aot_hybrid.make b/mcs/build/profiles/testing_aot_hybrid.make new file mode 100644 index 00000000000..97ae3b2c348 --- /dev/null +++ b/mcs/build/profiles/testing_aot_hybrid.make @@ -0,0 +1,36 @@ +#! -*- makefile -*- + +BOOTSTRAP_PROFILE = build + +BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC) +MCS = $(BOOTSTRAP_MCS) + +# Use system resgen as we don't want local System.Windows.Forms dependency +RESGEN = resgen2 + +profile-check: + @: + +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll + +PROFILE_MCS_FLAGS = \ + -d:NET_1_1 \ + -d:NET_2_0 \ + -d:NET_2_1 \ + -d:MOBILE,MOBILE_LEGACY \ + -d:MOBILE_DYNAMIC \ + -d:NET_3_5 \ + -d:NET_4_0 \ + -d:NET_4_5 \ + -d:MONO \ + -d:NETSTANDARD \ + -nowarn:1699 \ + -nostdlib \ + $(DEFAULT_REFERENCES) \ + $(PLATFORM_DEBUG_FLAGS) + +FRAMEWORK_VERSION = 2.1 + +NO_INSTALL = yes +MOBILE_DYNAMIC = yes +MOBILE_PROFILE = yes \ No newline at end of file diff --git a/mcs/build/profiles/winaot.make b/mcs/build/profiles/winaot.make new file mode 100644 index 00000000000..edd9f4e2104 --- /dev/null +++ b/mcs/build/profiles/winaot.make @@ -0,0 +1,45 @@ +#! -*- makefile -*- + +BOOTSTRAP_PROFILE = build + +BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_CSC) +MCS = $(BOOTSTRAP_MCS) + +# Use system resgen as we don't want local System.Windows.Forms dependency +RESGEN = resgen2 + +profile-check: + @: + +DEFAULT_REFERENCES = -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll + +PROFILE_MCS_FLAGS = \ + -d:NET_1_1 \ + -d:NET_2_0 \ + -d:NET_2_1 \ + -d:NET_3_5 \ + -d:NET_4_0 \ + -d:NET_4_5 \ + -d:MONO \ + -d:NETSTANDARD \ + -d:MOBILE,MOBILE_LEGACY \ + -d:FULL_AOT_DESKTOP \ + -d:FULL_AOT_RUNTIME \ + -d:DISABLE_REMOTING \ + -d:DISABLE_COM \ + -nowarn:1699 \ + -nostdlib \ + $(DEFAULT_REFERENCES) \ + $(PLATFORM_DEBUG_FLAGS) + +FRAMEWORK_VERSION = 2.1 + +# the tuner takes care of the install +NO_INSTALL = yes +AOT_FRIENDLY_PROFILE = yes +ALWAYS_AOT = yes +MOBILE_PROFILE = yes +NO_VTS_TEST = yes + +# Note need for trailing comma. If you add, keep it +PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,PKITS, diff --git a/mcs/build/rules.make b/mcs/build/rules.make index 3f58bcc3c2c..d2f33ea2dad 100644 --- a/mcs/build/rules.make +++ b/mcs/build/rules.make @@ -33,7 +33,7 @@ USE_MCS_FLAGS = /codepage:$(CODEPAGE) /nologo /noconfig /deterministic $(LOCAL_M USE_MBAS_FLAGS = /codepage:$(CODEPAGE) $(LOCAL_MBAS_FLAGS) $(PLATFORM_MBAS_FLAGS) $(PROFILE_MBAS_FLAGS) $(MBAS_FLAGS) USE_CFLAGS = $(LOCAL_CFLAGS) $(CFLAGS) $(CPPFLAGS) CSCOMPILE = $(Q_MCS) $(MCS) $(USE_MCS_FLAGS) -CSC_RUNTIME_FLAGS = --gc-params=nursery-size=64m +CSC_RUNTIME_FLAGS = --aot-path=$(topdir)/class/lib/$(BUILD_TOOLS_PROFILE) --gc-params=nursery-size=64m BASCOMPILE = $(MBAS) $(USE_MBAS_FLAGS) CCOMPILE = $(CC) $(USE_CFLAGS) BOOT_COMPILE = $(Q_MCS) $(BOOTSTRAP_MCS) $(USE_MCS_FLAGS) @@ -140,7 +140,7 @@ endif # For this to be done safely, we really need two passes. This # ensures that all of the .dlls are compiled before trying to # aot them. Because we want this to be the -# default target for some profiles(aot_only) we have a +# default target for some profiles(testing_aot_full) we have a # two-level build system. The do-all-aot target is what # gets invoked at the top-level when someone tries to build with aot. # It will invoke the do-all target, and will set TOP_LEVEL_DO for this diff --git a/mcs/class/Accessibility/makefile.build b/mcs/class/Accessibility/makefile.build deleted file mode 100755 index 2744aa3b5ce..00000000000 --- a/mcs/class/Accessibility/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/Facades/Makefile b/mcs/class/Facades/Makefile index 4ef52f56dca..d16c77cfa06 100644 --- a/mcs/class/Facades/Makefile +++ b/mcs/class/Facades/Makefile @@ -39,7 +39,8 @@ doc-update-recursive: System System.Core System.ComponentModel.DataAnnotations System.Numerics System.Runtime.Serialization System.XML \ System.ComponentModel.Composition System.ServiceModel System.Xml.Linq System.Data System.IO.Compression.FileSystem \ -System.ServiceProcess System.Security System.Net.Http.WebRequest System.Net.Http System.ServiceProcess: +System.ServiceProcess System.Security System.Net.Http.WebRequest System.Net.Http System.ServiceProcess System.IO.Compression \ +System.Web.Services: all-local-aot: diff --git a/mcs/class/Facades/Microsoft.Win32.Primitives/AssemblyInfo.cs b/mcs/class/Facades/Microsoft.Win32.Primitives/AssemblyInfo.cs index adf2110e12a..1f71caa9cab 100644 --- a/mcs/class/Facades/Microsoft.Win32.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/Microsoft.Win32.Primitives/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/Microsoft.Win32.Primitives/Microsoft.Win32.Primitives-net_4_x.csproj b/mcs/class/Facades/Microsoft.Win32.Primitives/Microsoft.Win32.Primitives-net_4_x.csproj deleted file mode 100644 index 2630fb56947..00000000000 --- a/mcs/class/Facades/Microsoft.Win32.Primitives/Microsoft.Win32.Primitives-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A904ACC7-C277-4A80-89D3-9A768CB9BB27} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - Microsoft.Win32.Primitives - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/AssemblyInfo.cs b/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/AssemblyInfo.cs index 3c218109d8b..10409b00438 100644 --- a/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/AssemblyInfo.cs +++ b/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Microsoft.Win32.Registry.AccessControl-net_4_x.csproj b/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Microsoft.Win32.Registry.AccessControl-net_4_x.csproj deleted file mode 100644 index 44dfeed5540..00000000000 --- a/mcs/class/Facades/Microsoft.Win32.Registry.AccessControl/Microsoft.Win32.Registry.AccessControl-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {E96824DA-02F6-499E-8C4F-F0C185F34914} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - Microsoft.Win32.Registry.AccessControl - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/Microsoft.Win32.Registry/AssemblyInfo.cs b/mcs/class/Facades/Microsoft.Win32.Registry/AssemblyInfo.cs index a07a2f1289f..4b723eac1ab 100644 --- a/mcs/class/Facades/Microsoft.Win32.Registry/AssemblyInfo.cs +++ b/mcs/class/Facades/Microsoft.Win32.Registry/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/Microsoft.Win32.Registry/Microsoft.Win32.Registry-net_4_x.csproj b/mcs/class/Facades/Microsoft.Win32.Registry/Microsoft.Win32.Registry-net_4_x.csproj deleted file mode 100644 index 1f68dad0f5a..00000000000 --- a/mcs/class/Facades/Microsoft.Win32.Registry/Microsoft.Win32.Registry-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {7836B6F1-CF82-403F-A827-DF59AC191482} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - Microsoft.Win32.Registry - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.AppContext/AssemblyInfo.cs b/mcs/class/Facades/System.AppContext/AssemblyInfo.cs index 7ad734c7719..a092c11971b 100644 --- a/mcs/class/Facades/System.AppContext/AssemblyInfo.cs +++ b/mcs/class/Facades/System.AppContext/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.AppContext/System.AppContext-net_4_x.csproj b/mcs/class/Facades/System.AppContext/System.AppContext-net_4_x.csproj deleted file mode 100644 index 8d93541b697..00000000000 --- a/mcs/class/Facades/System.AppContext/System.AppContext-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {8CBEEB50-B386-4B1E-96F2-E0398B3E67DF} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.AppContext - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Collections.Concurrent/AssemblyInfo.cs b/mcs/class/Facades/System.Collections.Concurrent/AssemblyInfo.cs index 2a5a8022ba0..98a5064a7b5 100644 --- a/mcs/class/Facades/System.Collections.Concurrent/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Collections.Concurrent/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Collections.Concurrent/System.Collections.Concurrent-net_4_x.csproj b/mcs/class/Facades/System.Collections.Concurrent/System.Collections.Concurrent-net_4_x.csproj deleted file mode 100644 index 95a9815549a..00000000000 --- a/mcs/class/Facades/System.Collections.Concurrent/System.Collections.Concurrent-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F5B70D1F-90DB-4FD1-B039-7569A4E501AE} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Collections.Concurrent - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Collections.NonGeneric/AssemblyInfo.cs b/mcs/class/Facades/System.Collections.NonGeneric/AssemblyInfo.cs index b9393811380..dc7beb6e665 100644 --- a/mcs/class/Facades/System.Collections.NonGeneric/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Collections.NonGeneric/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Collections.NonGeneric/System.Collections.NonGeneric-net_4_x.csproj b/mcs/class/Facades/System.Collections.NonGeneric/System.Collections.NonGeneric-net_4_x.csproj deleted file mode 100644 index b90d2ba25a6..00000000000 --- a/mcs/class/Facades/System.Collections.NonGeneric/System.Collections.NonGeneric-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {2413142C-E37A-420B-A9C0-82972AE1A263} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Collections.NonGeneric - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Collections.Specialized/AssemblyInfo.cs b/mcs/class/Facades/System.Collections.Specialized/AssemblyInfo.cs index 5b4595a55ba..cb52be7e4b7 100644 --- a/mcs/class/Facades/System.Collections.Specialized/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Collections.Specialized/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Collections.Specialized/System.Collections.Specialized-net_4_x.csproj b/mcs/class/Facades/System.Collections.Specialized/System.Collections.Specialized-net_4_x.csproj deleted file mode 100644 index 077873b535f..00000000000 --- a/mcs/class/Facades/System.Collections.Specialized/System.Collections.Specialized-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {EE7013C7-887F-464A-A4A1-F75B016C9A3C} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Collections.Specialized - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Collections/AssemblyInfo.cs b/mcs/class/Facades/System.Collections/AssemblyInfo.cs index 38bd3393424..03768bea6a5 100644 --- a/mcs/class/Facades/System.Collections/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Collections/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Collections/System.Collections-net_4_x.csproj b/mcs/class/Facades/System.Collections/System.Collections-net_4_x.csproj deleted file mode 100644 index 3e595bb8e9c..00000000000 --- a/mcs/class/Facades/System.Collections/System.Collections-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {3EFD0DB4-F21E-48FB-93E7-B77066503BB0} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Collections - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ComponentModel.Annotations/AssemblyInfo.cs b/mcs/class/Facades/System.ComponentModel.Annotations/AssemblyInfo.cs index 1f20ad3ac9a..932bd697e19 100644 --- a/mcs/class/Facades/System.ComponentModel.Annotations/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ComponentModel.Annotations/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ComponentModel.Annotations/System.ComponentModel.Annotations-net_4_x.csproj b/mcs/class/Facades/System.ComponentModel.Annotations/System.ComponentModel.Annotations-net_4_x.csproj deleted file mode 100644 index 35c6072e1c8..00000000000 --- a/mcs/class/Facades/System.ComponentModel.Annotations/System.ComponentModel.Annotations-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C4208967-8212-4AC2-93FF-60F28647B753} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ComponentModel.Annotations - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {8F86C287-38A5-49F8-BE6D-1E0E3D74AF39} - System.ComponentModel.DataAnnotations-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ComponentModel.EventBasedAsync/AssemblyInfo.cs b/mcs/class/Facades/System.ComponentModel.EventBasedAsync/AssemblyInfo.cs index d5419500e36..33cc599901f 100644 --- a/mcs/class/Facades/System.ComponentModel.EventBasedAsync/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ComponentModel.EventBasedAsync/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ComponentModel.EventBasedAsync/System.ComponentModel.EventBasedAsync-net_4_x.csproj b/mcs/class/Facades/System.ComponentModel.EventBasedAsync/System.ComponentModel.EventBasedAsync-net_4_x.csproj deleted file mode 100644 index b499bae7b4f..00000000000 --- a/mcs/class/Facades/System.ComponentModel.EventBasedAsync/System.ComponentModel.EventBasedAsync-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F203E8F5-5FDB-4FB5-815B-3BDD36F77B32} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ComponentModel.EventBasedAsync - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ComponentModel.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.ComponentModel.Primitives/AssemblyInfo.cs index 97155bed0a7..52e1e932960 100644 --- a/mcs/class/Facades/System.ComponentModel.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ComponentModel.Primitives/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ComponentModel.Primitives/System.ComponentModel.Primitives-net_4_x.csproj b/mcs/class/Facades/System.ComponentModel.Primitives/System.ComponentModel.Primitives-net_4_x.csproj deleted file mode 100644 index c06fa790173..00000000000 --- a/mcs/class/Facades/System.ComponentModel.Primitives/System.ComponentModel.Primitives-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {9D6B894B-F8F7-4ABF-86C5-5A22243A69DF} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ComponentModel.Primitives - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ComponentModel.TypeConverter/AssemblyInfo.cs b/mcs/class/Facades/System.ComponentModel.TypeConverter/AssemblyInfo.cs index 9a9c86d1663..12d0da57abd 100644 --- a/mcs/class/Facades/System.ComponentModel.TypeConverter/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ComponentModel.TypeConverter/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ComponentModel.TypeConverter/System.ComponentModel.TypeConverter-net_4_x.csproj b/mcs/class/Facades/System.ComponentModel.TypeConverter/System.ComponentModel.TypeConverter-net_4_x.csproj deleted file mode 100644 index 07dc6d0be3f..00000000000 --- a/mcs/class/Facades/System.ComponentModel.TypeConverter/System.ComponentModel.TypeConverter-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {E67A7117-9707-4CB4-8863-D000270049A5} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ComponentModel.TypeConverter - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ComponentModel/AssemblyInfo.cs b/mcs/class/Facades/System.ComponentModel/AssemblyInfo.cs index dafb55c25c9..3cc2efbc623 100644 --- a/mcs/class/Facades/System.ComponentModel/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ComponentModel/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ComponentModel/System.ComponentModel-net_4_x.csproj b/mcs/class/Facades/System.ComponentModel/System.ComponentModel-net_4_x.csproj deleted file mode 100644 index 8c4fb657532..00000000000 --- a/mcs/class/Facades/System.ComponentModel/System.ComponentModel-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {7F65588D-E140-4B92-9785-5D2BB851A186} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ComponentModel - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Console/AssemblyInfo.cs b/mcs/class/Facades/System.Console/AssemblyInfo.cs index c868f9a3434..3c52215a0be 100644 --- a/mcs/class/Facades/System.Console/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Console/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Console/System.Console-net_4_x.csproj b/mcs/class/Facades/System.Console/System.Console-net_4_x.csproj deleted file mode 100644 index 3a501705762..00000000000 --- a/mcs/class/Facades/System.Console/System.Console-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C0C599C7-BF72-4706-ABD4-3F0CF7A12441} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Console - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Data.Common/AssemblyInfo.cs b/mcs/class/Facades/System.Data.Common/AssemblyInfo.cs index 73821cb1d9d..452d0c245ff 100644 --- a/mcs/class/Facades/System.Data.Common/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Data.Common/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Data.Common/System.Data.Common-net_4_x.csproj b/mcs/class/Facades/System.Data.Common/System.Data.Common-net_4_x.csproj deleted file mode 100644 index b72694a381a..00000000000 --- a/mcs/class/Facades/System.Data.Common/System.Data.Common-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {398444D5-6C7D-41C8-8C7A-78A4F08D24CF} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Data.Common - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {EC439BB8-FFED-4A32-A05D-2FA3A70CAD64} - System.Data-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Data.SqlClient/AssemblyInfo.cs b/mcs/class/Facades/System.Data.SqlClient/AssemblyInfo.cs index cb229b702ad..b9f48ff1266 100644 --- a/mcs/class/Facades/System.Data.SqlClient/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Data.SqlClient/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Data.SqlClient/System.Data.SqlClient-net_4_x.csproj b/mcs/class/Facades/System.Data.SqlClient/System.Data.SqlClient-net_4_x.csproj deleted file mode 100644 index 949dbb96a8a..00000000000 --- a/mcs/class/Facades/System.Data.SqlClient/System.Data.SqlClient-net_4_x.csproj +++ /dev/null @@ -1,104 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C176C0C1-FF12-4194-968A-C30BDB4BB85B} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Data.SqlClient - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {EC439BB8-FFED-4A32-A05D-2FA3A70CAD64} - System.Data-net_4_x - - - {87FD2F0F-5222-4AE6-BD63-2D4975E11E5B} - System.Xml-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.Contracts/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.Contracts/AssemblyInfo.cs index 7e6dd250b65..6ca83887fcf 100644 --- a/mcs/class/Facades/System.Diagnostics.Contracts/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.Contracts/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.Contracts/System.Diagnostics.Contracts-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.Contracts/System.Diagnostics.Contracts-net_4_x.csproj deleted file mode 100644 index e76dfa683ff..00000000000 --- a/mcs/class/Facades/System.Diagnostics.Contracts/System.Diagnostics.Contracts-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {CEC9E493-B899-4F32-9C00-6A9362EF333E} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.Contracts - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.Debug/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.Debug/AssemblyInfo.cs index 242e20e8954..774ef2a98fc 100644 --- a/mcs/class/Facades/System.Diagnostics.Debug/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.Debug/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.Debug/System.Diagnostics.Debug-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.Debug/System.Diagnostics.Debug-net_4_x.csproj deleted file mode 100644 index 42f098b852d..00000000000 --- a/mcs/class/Facades/System.Diagnostics.Debug/System.Diagnostics.Debug-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A6EF8D0A-59A7-4FA0-A0C5-E65E58B42107} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.Debug - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.FileVersionInfo/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.FileVersionInfo/AssemblyInfo.cs index 1bd261deaab..5712ceccba2 100644 --- a/mcs/class/Facades/System.Diagnostics.FileVersionInfo/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.FileVersionInfo/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.FileVersionInfo/System.Diagnostics.FileVersionInfo-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.FileVersionInfo/System.Diagnostics.FileVersionInfo-net_4_x.csproj deleted file mode 100644 index 4e8cb81bb32..00000000000 --- a/mcs/class/Facades/System.Diagnostics.FileVersionInfo/System.Diagnostics.FileVersionInfo-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {EE80031D-25ED-4805-95C2-BD985242F42D} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.FileVersionInfo - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.Process/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.Process/AssemblyInfo.cs index 8d5f7dae743..bd6d4fcfbc1 100644 --- a/mcs/class/Facades/System.Diagnostics.Process/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.Process/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.Process/System.Diagnostics.Process-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.Process/System.Diagnostics.Process-net_4_x.csproj deleted file mode 100644 index ba33e7219c9..00000000000 --- a/mcs/class/Facades/System.Diagnostics.Process/System.Diagnostics.Process-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {1E66E92F-26A7-481A-882D-2FAFF0F99DFE} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.Process - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.StackTrace/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.StackTrace/AssemblyInfo.cs index 392d6f846a0..fa5b9f81d52 100644 --- a/mcs/class/Facades/System.Diagnostics.StackTrace/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.StackTrace/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.StackTrace/System.Diagnostics.StackTrace-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.StackTrace/System.Diagnostics.StackTrace-net_4_x.csproj deleted file mode 100644 index 7376455e971..00000000000 --- a/mcs/class/Facades/System.Diagnostics.StackTrace/System.Diagnostics.StackTrace-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {8EF31B7E-36D8-4397-B6C4-3C819698FBF1} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.StackTrace - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/AssemblyInfo.cs index f99ca87531e..64f94693e83 100644 --- a/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/System.Diagnostics.TextWriterTraceListener-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/System.Diagnostics.TextWriterTraceListener-net_4_x.csproj deleted file mode 100644 index f82f041d9e7..00000000000 --- a/mcs/class/Facades/System.Diagnostics.TextWriterTraceListener/System.Diagnostics.TextWriterTraceListener-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {083A05CA-46F9-4387-8A1A-18613416994A} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.TextWriterTraceListener - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.Tools/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.Tools/AssemblyInfo.cs index 2376da70e9f..945f12e82f7 100644 --- a/mcs/class/Facades/System.Diagnostics.Tools/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.Tools/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.Tools/System.Diagnostics.Tools-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.Tools/System.Diagnostics.Tools-net_4_x.csproj deleted file mode 100644 index ac309533053..00000000000 --- a/mcs/class/Facades/System.Diagnostics.Tools/System.Diagnostics.Tools-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {2927B0ED-6DD3-49FA-9253-E4392BF85420} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.Tools - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.TraceEvent/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.TraceEvent/AssemblyInfo.cs index 3190b1f5986..82cfa9e2068 100644 --- a/mcs/class/Facades/System.Diagnostics.TraceEvent/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.TraceEvent/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.TraceEvent/System.Diagnostics.TraceEvent-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.TraceEvent/System.Diagnostics.TraceEvent-net_4_x.csproj deleted file mode 100644 index afae7e011c3..00000000000 --- a/mcs/class/Facades/System.Diagnostics.TraceEvent/System.Diagnostics.TraceEvent-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C3169BCC-D230-4018-9EA0-87B6D7C6392B} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.TraceEvent - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.TraceSource/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.TraceSource/AssemblyInfo.cs index 9420a46a73b..9e16ae3a0b8 100644 --- a/mcs/class/Facades/System.Diagnostics.TraceSource/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.TraceSource/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.TraceSource/System.Diagnostics.TraceSource-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.TraceSource/System.Diagnostics.TraceSource-net_4_x.csproj deleted file mode 100644 index f93d405cc5c..00000000000 --- a/mcs/class/Facades/System.Diagnostics.TraceSource/System.Diagnostics.TraceSource-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F54C3FD6-173D-48D3-82F8-6EF8AE95D7ED} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.TraceSource - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Diagnostics.Tracing/AssemblyInfo.cs b/mcs/class/Facades/System.Diagnostics.Tracing/AssemblyInfo.cs index 2165fc82ea9..a6d882dd4ff 100644 --- a/mcs/class/Facades/System.Diagnostics.Tracing/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Diagnostics.Tracing/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Diagnostics.Tracing/System.Diagnostics.Tracing-net_4_x.csproj b/mcs/class/Facades/System.Diagnostics.Tracing/System.Diagnostics.Tracing-net_4_x.csproj deleted file mode 100644 index b25e1de7721..00000000000 --- a/mcs/class/Facades/System.Diagnostics.Tracing/System.Diagnostics.Tracing-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {33D0A27B-2E67-4C32-BAEA-EC230C369B40} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Diagnostics.Tracing - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Drawing.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.Drawing.Primitives/AssemblyInfo.cs index 440b1643f33..1b522cf3f11 100644 --- a/mcs/class/Facades/System.Drawing.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Drawing.Primitives/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Dynamic.Runtime/AssemblyInfo.cs b/mcs/class/Facades/System.Dynamic.Runtime/AssemblyInfo.cs index 80d903f9250..13760231ae3 100644 --- a/mcs/class/Facades/System.Dynamic.Runtime/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Dynamic.Runtime/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Dynamic.Runtime/System.Dynamic.Runtime-net_4_x.csproj b/mcs/class/Facades/System.Dynamic.Runtime/System.Dynamic.Runtime-net_4_x.csproj deleted file mode 100644 index 3f46c3dc3e4..00000000000 --- a/mcs/class/Facades/System.Dynamic.Runtime/System.Dynamic.Runtime-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {418689E8-51EA-4FA6-90C5-6846D29E3062} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Dynamic.Runtime - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Globalization.Calendars/AssemblyInfo.cs b/mcs/class/Facades/System.Globalization.Calendars/AssemblyInfo.cs index 8fa6ecaeb21..85f641fbc25 100644 --- a/mcs/class/Facades/System.Globalization.Calendars/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Globalization.Calendars/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Globalization.Calendars/System.Globalization.Calendars-net_4_x.csproj b/mcs/class/Facades/System.Globalization.Calendars/System.Globalization.Calendars-net_4_x.csproj deleted file mode 100644 index e34b395e8d0..00000000000 --- a/mcs/class/Facades/System.Globalization.Calendars/System.Globalization.Calendars-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {51EC76AD-57BD-429F-87CB-6A4FADCA4894} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Globalization.Calendars - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Globalization.Extensions/AssemblyInfo.cs b/mcs/class/Facades/System.Globalization.Extensions/AssemblyInfo.cs index 2564d4dbefa..ab67b29b11b 100644 --- a/mcs/class/Facades/System.Globalization.Extensions/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Globalization.Extensions/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Globalization.Extensions/System.Globalization.Extensions-net_4_x.csproj b/mcs/class/Facades/System.Globalization.Extensions/System.Globalization.Extensions-net_4_x.csproj deleted file mode 100644 index 7065015b3c8..00000000000 --- a/mcs/class/Facades/System.Globalization.Extensions/System.Globalization.Extensions-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {88125961-F07C-4F11-9895-ECF9FEC7D594} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Globalization.Extensions - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Globalization/AssemblyInfo.cs b/mcs/class/Facades/System.Globalization/AssemblyInfo.cs index 87fe7738310..961dbdbdcec 100644 --- a/mcs/class/Facades/System.Globalization/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Globalization/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Globalization/System.Globalization-net_4_x.csproj b/mcs/class/Facades/System.Globalization/System.Globalization-net_4_x.csproj deleted file mode 100644 index 2dd1f9fce84..00000000000 --- a/mcs/class/Facades/System.Globalization/System.Globalization-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {66237F5D-4D39-40D6-910D-25EF86D6DBAA} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Globalization - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.Compression.ZipFile/AssemblyInfo.cs b/mcs/class/Facades/System.IO.Compression.ZipFile/AssemblyInfo.cs index d47dccdccaf..ae297ca9999 100644 --- a/mcs/class/Facades/System.IO.Compression.ZipFile/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.Compression.ZipFile/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.Compression.ZipFile/System.IO.Compression.ZipFile-net_4_x.csproj b/mcs/class/Facades/System.IO.Compression.ZipFile/System.IO.Compression.ZipFile-net_4_x.csproj deleted file mode 100644 index fe768fcd644..00000000000 --- a/mcs/class/Facades/System.IO.Compression.ZipFile/System.IO.Compression.ZipFile-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {274AEB31-DD0D-4E3C-85D7-5FE1FDA84F80} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.Compression.ZipFile - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {9E61FF2E-493E-4CA0-BBDA-2EF96A4CB058} - System.IO.Compression.FileSystem-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.FileSystem.AccessControl/AssemblyInfo.cs b/mcs/class/Facades/System.IO.FileSystem.AccessControl/AssemblyInfo.cs index 87c50f578ad..056e067985e 100644 --- a/mcs/class/Facades/System.IO.FileSystem.AccessControl/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.FileSystem.AccessControl/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl-net_4_x.csproj b/mcs/class/Facades/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl-net_4_x.csproj deleted file mode 100644 index b19ff5493b7..00000000000 --- a/mcs/class/Facades/System.IO.FileSystem.AccessControl/System.IO.FileSystem.AccessControl-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {45771E24-F17F-4E6C-B4BF-9C8B9E0C2F5F} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.FileSystem.AccessControl - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.FileSystem.DriveInfo/AssemblyInfo.cs b/mcs/class/Facades/System.IO.FileSystem.DriveInfo/AssemblyInfo.cs index eb9dacd386f..124cbdd41b6 100644 --- a/mcs/class/Facades/System.IO.FileSystem.DriveInfo/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.FileSystem.DriveInfo/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.FileSystem.DriveInfo/System.IO.FileSystem.DriveInfo-net_4_x.csproj b/mcs/class/Facades/System.IO.FileSystem.DriveInfo/System.IO.FileSystem.DriveInfo-net_4_x.csproj deleted file mode 100644 index a22683db86b..00000000000 --- a/mcs/class/Facades/System.IO.FileSystem.DriveInfo/System.IO.FileSystem.DriveInfo-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A47EFB9A-50A0-494E-BED3-980A874F3689} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.FileSystem.DriveInfo - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.FileSystem.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.IO.FileSystem.Primitives/AssemblyInfo.cs index 9c1bdc1d980..90b1c6e136d 100644 --- a/mcs/class/Facades/System.IO.FileSystem.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.FileSystem.Primitives/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.FileSystem.Primitives/System.IO.FileSystem.Primitives-net_4_x.csproj b/mcs/class/Facades/System.IO.FileSystem.Primitives/System.IO.FileSystem.Primitives-net_4_x.csproj deleted file mode 100644 index 7779846c244..00000000000 --- a/mcs/class/Facades/System.IO.FileSystem.Primitives/System.IO.FileSystem.Primitives-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {7F454C3A-D682-4F27-AE61-363FFA293AB8} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.FileSystem.Primitives - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.FileSystem.Watcher/AssemblyInfo.cs b/mcs/class/Facades/System.IO.FileSystem.Watcher/AssemblyInfo.cs index 1710705c69f..5ad34d12895 100644 --- a/mcs/class/Facades/System.IO.FileSystem.Watcher/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.FileSystem.Watcher/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.FileSystem.Watcher/System.IO.FileSystem.Watcher-net_4_x.csproj b/mcs/class/Facades/System.IO.FileSystem.Watcher/System.IO.FileSystem.Watcher-net_4_x.csproj deleted file mode 100644 index 74e4540241b..00000000000 --- a/mcs/class/Facades/System.IO.FileSystem.Watcher/System.IO.FileSystem.Watcher-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {0EBA505C-125C-4A83-B5B9-E01D1C453F90} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.FileSystem.Watcher - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.FileSystem/AssemblyInfo.cs b/mcs/class/Facades/System.IO.FileSystem/AssemblyInfo.cs index 8c13ddd645f..0fe6a83bd68 100644 --- a/mcs/class/Facades/System.IO.FileSystem/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.FileSystem/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.FileSystem/System.IO.FileSystem-net_4_x.csproj b/mcs/class/Facades/System.IO.FileSystem/System.IO.FileSystem-net_4_x.csproj deleted file mode 100644 index ee656811446..00000000000 --- a/mcs/class/Facades/System.IO.FileSystem/System.IO.FileSystem-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F75DDF37-902B-4FDC-98D3-47993A11D755} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.FileSystem - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.IsolatedStorage/AssemblyInfo.cs b/mcs/class/Facades/System.IO.IsolatedStorage/AssemblyInfo.cs index 2ad6e6ec379..391e632344d 100644 --- a/mcs/class/Facades/System.IO.IsolatedStorage/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.IsolatedStorage/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.IsolatedStorage/System.IO.IsolatedStorage-net_4_x.csproj b/mcs/class/Facades/System.IO.IsolatedStorage/System.IO.IsolatedStorage-net_4_x.csproj deleted file mode 100644 index 39bc78ef5ae..00000000000 --- a/mcs/class/Facades/System.IO.IsolatedStorage/System.IO.IsolatedStorage-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {D2884794-EC16-4749-90D1-B78256EA585D} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.IsolatedStorage - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.MemoryMappedFiles/AssemblyInfo.cs b/mcs/class/Facades/System.IO.MemoryMappedFiles/AssemblyInfo.cs index 5fdcbc2b5ee..9af226336d0 100644 --- a/mcs/class/Facades/System.IO.MemoryMappedFiles/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.MemoryMappedFiles/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.MemoryMappedFiles/System.IO.MemoryMappedFiles-net_4_x.csproj b/mcs/class/Facades/System.IO.MemoryMappedFiles/System.IO.MemoryMappedFiles-net_4_x.csproj deleted file mode 100644 index b4b750f7d2c..00000000000 --- a/mcs/class/Facades/System.IO.MemoryMappedFiles/System.IO.MemoryMappedFiles-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F5860D09-FB2B-45FB-A40A-C91837BDFEF9} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.MemoryMappedFiles - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.Packaging/AssemblyInfo.cs b/mcs/class/Facades/System.IO.Packaging/AssemblyInfo.cs index b9f9f742734..a98189c190f 100644 --- a/mcs/class/Facades/System.IO.Packaging/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.Packaging/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.Pipes/AssemblyInfo.cs b/mcs/class/Facades/System.IO.Pipes/AssemblyInfo.cs index 0bbce8e5570..d258ac1d231 100644 --- a/mcs/class/Facades/System.IO.Pipes/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.Pipes/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.Pipes/System.IO.Pipes-net_4_x.csproj b/mcs/class/Facades/System.IO.Pipes/System.IO.Pipes-net_4_x.csproj deleted file mode 100644 index 5490775688e..00000000000 --- a/mcs/class/Facades/System.IO.Pipes/System.IO.Pipes-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A2174186-0D8E-4072-814F-9F912DF748F4} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.Pipes - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO.UnmanagedMemoryStream/AssemblyInfo.cs b/mcs/class/Facades/System.IO.UnmanagedMemoryStream/AssemblyInfo.cs index 50b6c7a5913..da6e1ff710a 100644 --- a/mcs/class/Facades/System.IO.UnmanagedMemoryStream/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO.UnmanagedMemoryStream/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO.UnmanagedMemoryStream/System.IO.UnmanagedMemoryStream-net_4_x.csproj b/mcs/class/Facades/System.IO.UnmanagedMemoryStream/System.IO.UnmanagedMemoryStream-net_4_x.csproj deleted file mode 100644 index 332d95bbdbd..00000000000 --- a/mcs/class/Facades/System.IO.UnmanagedMemoryStream/System.IO.UnmanagedMemoryStream-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C4259E97-D61C-4A38-8228-204068097BD8} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO.UnmanagedMemoryStream - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.IO/AssemblyInfo.cs b/mcs/class/Facades/System.IO/AssemblyInfo.cs index 2e74bfb0e5f..0b30d7e92a1 100644 --- a/mcs/class/Facades/System.IO/AssemblyInfo.cs +++ b/mcs/class/Facades/System.IO/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.IO/System.IO-net_4_x.csproj b/mcs/class/Facades/System.IO/System.IO-net_4_x.csproj deleted file mode 100644 index 328669d46a5..00000000000 --- a/mcs/class/Facades/System.IO/System.IO-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {60855135-F9FE-4B50-9468-F40363D61ABD} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.IO - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Linq.Expressions/AssemblyInfo.cs b/mcs/class/Facades/System.Linq.Expressions/AssemblyInfo.cs index 169db85b2a0..85fae00a87c 100644 --- a/mcs/class/Facades/System.Linq.Expressions/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Linq.Expressions/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Linq.Expressions/System.Linq.Expressions-net_4_x.csproj b/mcs/class/Facades/System.Linq.Expressions/System.Linq.Expressions-net_4_x.csproj deleted file mode 100644 index d1c3fafbea2..00000000000 --- a/mcs/class/Facades/System.Linq.Expressions/System.Linq.Expressions-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {66D22ECC-9C45-4526-BCC2-509A89A9D116} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Linq.Expressions - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Linq.Parallel/AssemblyInfo.cs b/mcs/class/Facades/System.Linq.Parallel/AssemblyInfo.cs index a00afa3d829..a56fc30a0c7 100644 --- a/mcs/class/Facades/System.Linq.Parallel/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Linq.Parallel/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Linq.Parallel/System.Linq.Parallel-net_4_x.csproj b/mcs/class/Facades/System.Linq.Parallel/System.Linq.Parallel-net_4_x.csproj deleted file mode 100644 index 574fe2589f3..00000000000 --- a/mcs/class/Facades/System.Linq.Parallel/System.Linq.Parallel-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {15667AA0-CDB9-45E1-B90B-716D7B01797C} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Linq.Parallel - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Linq.Queryable/AssemblyInfo.cs b/mcs/class/Facades/System.Linq.Queryable/AssemblyInfo.cs index 4a2870cb82d..67a34c8d408 100644 --- a/mcs/class/Facades/System.Linq.Queryable/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Linq.Queryable/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Linq.Queryable/System.Linq.Queryable-net_4_x.csproj b/mcs/class/Facades/System.Linq.Queryable/System.Linq.Queryable-net_4_x.csproj deleted file mode 100644 index 23896991efd..00000000000 --- a/mcs/class/Facades/System.Linq.Queryable/System.Linq.Queryable-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {B9FAF584-DE80-41D1-AB01-A6191BAEB42F} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Linq.Queryable - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Linq/AssemblyInfo.cs b/mcs/class/Facades/System.Linq/AssemblyInfo.cs index 65cb98ce56c..485ed0f5e8e 100644 --- a/mcs/class/Facades/System.Linq/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Linq/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Linq/System.Linq-net_4_x.csproj b/mcs/class/Facades/System.Linq/System.Linq-net_4_x.csproj deleted file mode 100644 index b384b88bc8c..00000000000 --- a/mcs/class/Facades/System.Linq/System.Linq-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {CA268E6F-4B22-406B-94FC-751A27B971F3} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Linq - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.AuthenticationManager/AssemblyInfo.cs b/mcs/class/Facades/System.Net.AuthenticationManager/AssemblyInfo.cs index 62287f3a999..41a9f26f33a 100644 --- a/mcs/class/Facades/System.Net.AuthenticationManager/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.AuthenticationManager/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.AuthenticationManager/System.Net.AuthenticationManager-net_4_x.csproj b/mcs/class/Facades/System.Net.AuthenticationManager/System.Net.AuthenticationManager-net_4_x.csproj deleted file mode 100644 index 385a054f27a..00000000000 --- a/mcs/class/Facades/System.Net.AuthenticationManager/System.Net.AuthenticationManager-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {2361432C-3A88-4BF8-B018-F2DB72EA9FBD} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.AuthenticationManager - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.Cache/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Cache/AssemblyInfo.cs index e619e2599dc..9a5fc8b92e2 100644 --- a/mcs/class/Facades/System.Net.Cache/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.Cache/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.Cache/System.Net.Cache-net_4_x.csproj b/mcs/class/Facades/System.Net.Cache/System.Net.Cache-net_4_x.csproj deleted file mode 100644 index 40eb73fd21d..00000000000 --- a/mcs/class/Facades/System.Net.Cache/System.Net.Cache-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {DDF8D090-7030-43D4-9400-D4C46C628A6B} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.Cache - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.HttpListener/AssemblyInfo.cs b/mcs/class/Facades/System.Net.HttpListener/AssemblyInfo.cs index 6949ef4aed2..46fa1bbcaae 100644 --- a/mcs/class/Facades/System.Net.HttpListener/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.HttpListener/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.HttpListener/System.Net.HttpListener-net_4_x.csproj b/mcs/class/Facades/System.Net.HttpListener/System.Net.HttpListener-net_4_x.csproj deleted file mode 100644 index 41703d0b100..00000000000 --- a/mcs/class/Facades/System.Net.HttpListener/System.Net.HttpListener-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A975094D-17EA-4FA4-9195-24D1FFDCFD67} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.HttpListener - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.Mail/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Mail/AssemblyInfo.cs index de825175670..bd358be7696 100644 --- a/mcs/class/Facades/System.Net.Mail/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.Mail/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.Mail/System.Net.Mail-net_4_x.csproj b/mcs/class/Facades/System.Net.Mail/System.Net.Mail-net_4_x.csproj deleted file mode 100644 index cff5e1dd539..00000000000 --- a/mcs/class/Facades/System.Net.Mail/System.Net.Mail-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F86C04C2-A21E-4901-8D2F-02FF76C0E938} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.Mail - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.NameResolution/AssemblyInfo.cs b/mcs/class/Facades/System.Net.NameResolution/AssemblyInfo.cs index 54751ca692d..edbeb6c3354 100644 --- a/mcs/class/Facades/System.Net.NameResolution/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.NameResolution/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.NameResolution/System.Net.NameResolution-net_4_x.csproj b/mcs/class/Facades/System.Net.NameResolution/System.Net.NameResolution-net_4_x.csproj deleted file mode 100644 index 7bcdb44002a..00000000000 --- a/mcs/class/Facades/System.Net.NameResolution/System.Net.NameResolution-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {CA24BFDB-D8AC-4672-9A08-0804150F90FC} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.NameResolution - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.NetworkInformation/AssemblyInfo.cs b/mcs/class/Facades/System.Net.NetworkInformation/AssemblyInfo.cs index ac560532e14..bf9bd187378 100644 --- a/mcs/class/Facades/System.Net.NetworkInformation/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.NetworkInformation/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.NetworkInformation/System.Net.NetworkInformation-net_4_x.csproj b/mcs/class/Facades/System.Net.NetworkInformation/System.Net.NetworkInformation-net_4_x.csproj deleted file mode 100644 index 6b1a634a65c..00000000000 --- a/mcs/class/Facades/System.Net.NetworkInformation/System.Net.NetworkInformation-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {50E028ED-FB17-4C85-AD0F-0D72ED6C0B2B} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.NetworkInformation - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.Ping/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Ping/AssemblyInfo.cs index 98c665431db..00d2b6bddb2 100644 --- a/mcs/class/Facades/System.Net.Ping/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.Ping/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Primitives/AssemblyInfo.cs index 00d82d3d16c..e1b1d5cef2e 100644 --- a/mcs/class/Facades/System.Net.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.Primitives/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.Primitives/System.Net.Primitives-net_4_x.csproj b/mcs/class/Facades/System.Net.Primitives/System.Net.Primitives-net_4_x.csproj deleted file mode 100644 index 09412ddbd8e..00000000000 --- a/mcs/class/Facades/System.Net.Primitives/System.Net.Primitives-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {ED2E1AA1-4502-4D57-837F-B84F6D2DB507} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.Primitives - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.Requests/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Requests/AssemblyInfo.cs index 4162f8a98fb..ea456ea32e1 100644 --- a/mcs/class/Facades/System.Net.Requests/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.Requests/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.Requests/System.Net.Requests-net_4_x.csproj b/mcs/class/Facades/System.Net.Requests/System.Net.Requests-net_4_x.csproj deleted file mode 100644 index 01ea7035f8e..00000000000 --- a/mcs/class/Facades/System.Net.Requests/System.Net.Requests-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {0B9F1A9C-4AF1-4C78-B449-943FC2537E1D} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.Requests - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.Security/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Security/AssemblyInfo.cs index 7b4a0bc23b6..03de95ac3dc 100644 --- a/mcs/class/Facades/System.Net.Security/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.Security/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.Security/System.Net.Security-net_4_x.csproj b/mcs/class/Facades/System.Net.Security/System.Net.Security-net_4_x.csproj deleted file mode 100644 index 07f3b9f6893..00000000000 --- a/mcs/class/Facades/System.Net.Security/System.Net.Security-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {61C6A402-B5A0-42D6-BD13-3151F86C0E17} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.Security - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.ServicePoint/AssemblyInfo.cs b/mcs/class/Facades/System.Net.ServicePoint/AssemblyInfo.cs index cceb70b41b9..5d9f4a0d7c8 100644 --- a/mcs/class/Facades/System.Net.ServicePoint/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.ServicePoint/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.ServicePoint/System.Net.ServicePoint-net_4_x.csproj b/mcs/class/Facades/System.Net.ServicePoint/System.Net.ServicePoint-net_4_x.csproj deleted file mode 100644 index 1feec7c2589..00000000000 --- a/mcs/class/Facades/System.Net.ServicePoint/System.Net.ServicePoint-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {22C96ACE-D774-4957-878B-9B3009DD93F7} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.ServicePoint - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.Sockets/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Sockets/AssemblyInfo.cs index 6032c3d4dc7..b81cf3cf99a 100644 --- a/mcs/class/Facades/System.Net.Sockets/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.Sockets/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.Sockets/System.Net.Sockets-net_4_x.csproj b/mcs/class/Facades/System.Net.Sockets/System.Net.Sockets-net_4_x.csproj deleted file mode 100644 index 517b9725f79..00000000000 --- a/mcs/class/Facades/System.Net.Sockets/System.Net.Sockets-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {EC70B9EA-9C94-4813-90C8-C0B0A3811233} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.Sockets - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.Utilities/AssemblyInfo.cs b/mcs/class/Facades/System.Net.Utilities/AssemblyInfo.cs index c7d3201cdce..14dfcca6ec0 100644 --- a/mcs/class/Facades/System.Net.Utilities/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.Utilities/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.Utilities/System.Net.Utilities-net_4_x.csproj b/mcs/class/Facades/System.Net.Utilities/System.Net.Utilities-net_4_x.csproj deleted file mode 100644 index 79513976df6..00000000000 --- a/mcs/class/Facades/System.Net.Utilities/System.Net.Utilities-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {71C31FDE-1906-4DEC-BF5D-B2A8FE544CA5} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.Utilities - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.WebHeaderCollection/AssemblyInfo.cs b/mcs/class/Facades/System.Net.WebHeaderCollection/AssemblyInfo.cs index 3202543ce19..5063a95a575 100644 --- a/mcs/class/Facades/System.Net.WebHeaderCollection/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.WebHeaderCollection/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.WebHeaderCollection/System.Net.WebHeaderCollection-net_4_x.csproj b/mcs/class/Facades/System.Net.WebHeaderCollection/System.Net.WebHeaderCollection-net_4_x.csproj deleted file mode 100644 index 93b18b868a3..00000000000 --- a/mcs/class/Facades/System.Net.WebHeaderCollection/System.Net.WebHeaderCollection-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {6A1428FB-1FB9-4617-A2C7-F26375676C6C} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.WebHeaderCollection - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.WebSockets.Client/AssemblyInfo.cs b/mcs/class/Facades/System.Net.WebSockets.Client/AssemblyInfo.cs index 59927089998..8c078e171c9 100644 --- a/mcs/class/Facades/System.Net.WebSockets.Client/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.WebSockets.Client/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.WebSockets.Client/System.Net.WebSockets.Client-net_4_x.csproj b/mcs/class/Facades/System.Net.WebSockets.Client/System.Net.WebSockets.Client-net_4_x.csproj deleted file mode 100644 index dac4937e8e1..00000000000 --- a/mcs/class/Facades/System.Net.WebSockets.Client/System.Net.WebSockets.Client-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {09DEA2D2-CE69-47A8-840A-F4CC73E27E2A} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.WebSockets.Client - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Net.WebSockets/AssemblyInfo.cs b/mcs/class/Facades/System.Net.WebSockets/AssemblyInfo.cs index 3f67e57f48f..587efb0f1ec 100644 --- a/mcs/class/Facades/System.Net.WebSockets/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Net.WebSockets/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Net.WebSockets/System.Net.WebSockets-net_4_x.csproj b/mcs/class/Facades/System.Net.WebSockets/System.Net.WebSockets-net_4_x.csproj deleted file mode 100644 index 86e4262d84b..00000000000 --- a/mcs/class/Facades/System.Net.WebSockets/System.Net.WebSockets-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {976F449E-E59E-49B5-A524-C6889D80E9E5} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Net.WebSockets - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ObjectModel/AssemblyInfo.cs b/mcs/class/Facades/System.ObjectModel/AssemblyInfo.cs index b07ebd18d22..c5029ef246c 100644 --- a/mcs/class/Facades/System.ObjectModel/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ObjectModel/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ObjectModel/System.ObjectModel-net_4_x.csproj b/mcs/class/Facades/System.ObjectModel/System.ObjectModel-net_4_x.csproj deleted file mode 100644 index b650e9344ff..00000000000 --- a/mcs/class/Facades/System.ObjectModel/System.ObjectModel-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {7AF310B3-CC3F-4F19-B172-42339F219894} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ObjectModel - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Reflection.Emit.ILGeneration/AssemblyInfo.cs b/mcs/class/Facades/System.Reflection.Emit.ILGeneration/AssemblyInfo.cs index 8b9f6f86f5e..6637d225c6a 100644 --- a/mcs/class/Facades/System.Reflection.Emit.ILGeneration/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Reflection.Emit.ILGeneration/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Reflection.Emit.ILGeneration/System.Reflection.Emit.ILGeneration-net_4_x.csproj b/mcs/class/Facades/System.Reflection.Emit.ILGeneration/System.Reflection.Emit.ILGeneration-net_4_x.csproj deleted file mode 100644 index b33e9d6c420..00000000000 --- a/mcs/class/Facades/System.Reflection.Emit.ILGeneration/System.Reflection.Emit.ILGeneration-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A949F801-D918-4A92-9E85-937B461F35A8} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Reflection.Emit.ILGeneration - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Reflection.Emit.Lightweight/AssemblyInfo.cs b/mcs/class/Facades/System.Reflection.Emit.Lightweight/AssemblyInfo.cs index cd48993eda7..ff2b551f822 100644 --- a/mcs/class/Facades/System.Reflection.Emit.Lightweight/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Reflection.Emit.Lightweight/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Reflection.Emit.Lightweight/System.Reflection.Emit.Lightweight-net_4_x.csproj b/mcs/class/Facades/System.Reflection.Emit.Lightweight/System.Reflection.Emit.Lightweight-net_4_x.csproj deleted file mode 100644 index 3212863624e..00000000000 --- a/mcs/class/Facades/System.Reflection.Emit.Lightweight/System.Reflection.Emit.Lightweight-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {1CBCA63A-7FA1-47CB-A3F3-670530AA890A} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Reflection.Emit.Lightweight - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Reflection.Emit/AssemblyInfo.cs b/mcs/class/Facades/System.Reflection.Emit/AssemblyInfo.cs index 03e71faf4b5..060e128cf54 100644 --- a/mcs/class/Facades/System.Reflection.Emit/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Reflection.Emit/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Reflection.Emit/System.Reflection.Emit-net_4_x.csproj b/mcs/class/Facades/System.Reflection.Emit/System.Reflection.Emit-net_4_x.csproj deleted file mode 100644 index 1797d1c2a86..00000000000 --- a/mcs/class/Facades/System.Reflection.Emit/System.Reflection.Emit-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {6C04AED4-77F1-4DBA-B6CE-905FAD88F79C} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Reflection.Emit - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Reflection.Extensions/AssemblyInfo.cs b/mcs/class/Facades/System.Reflection.Extensions/AssemblyInfo.cs index 5cd81bd4d49..09e2f056c6a 100644 --- a/mcs/class/Facades/System.Reflection.Extensions/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Reflection.Extensions/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Reflection.Extensions/System.Reflection.Extensions-net_4_x.csproj b/mcs/class/Facades/System.Reflection.Extensions/System.Reflection.Extensions-net_4_x.csproj deleted file mode 100644 index 5098f161d23..00000000000 --- a/mcs/class/Facades/System.Reflection.Extensions/System.Reflection.Extensions-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {94F93C37-CCB7-4C86-B2F6-267AF4F10E26} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Reflection.Extensions - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Reflection.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.Reflection.Primitives/AssemblyInfo.cs index 02571396897..1460f1c4b41 100644 --- a/mcs/class/Facades/System.Reflection.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Reflection.Primitives/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Reflection.Primitives/System.Reflection.Primitives-net_4_x.csproj b/mcs/class/Facades/System.Reflection.Primitives/System.Reflection.Primitives-net_4_x.csproj deleted file mode 100644 index 17d46b87fde..00000000000 --- a/mcs/class/Facades/System.Reflection.Primitives/System.Reflection.Primitives-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C330F2FA-614F-4633-902A-C62C1B173C5C} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Reflection.Primitives - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Reflection.TypeExtensions/AssemblyInfo.cs b/mcs/class/Facades/System.Reflection.TypeExtensions/AssemblyInfo.cs index 918e35f600a..f60f7d0e6eb 100644 --- a/mcs/class/Facades/System.Reflection.TypeExtensions/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Reflection.TypeExtensions/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Reflection.TypeExtensions/System.Reflection.TypeExtensions-net_4_x.csproj b/mcs/class/Facades/System.Reflection.TypeExtensions/System.Reflection.TypeExtensions-net_4_x.csproj deleted file mode 100644 index a8ac1b6e16b..00000000000 --- a/mcs/class/Facades/System.Reflection.TypeExtensions/System.Reflection.TypeExtensions-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {651B4F97-21A0-426B-97EB-843CC703C2A2} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Reflection.TypeExtensions - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Reflection/AssemblyInfo.cs b/mcs/class/Facades/System.Reflection/AssemblyInfo.cs index ef752e22d25..243e4061c77 100644 --- a/mcs/class/Facades/System.Reflection/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Reflection/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Reflection/System.Reflection-net_4_x.csproj b/mcs/class/Facades/System.Reflection/System.Reflection-net_4_x.csproj deleted file mode 100644 index b5494ffe714..00000000000 --- a/mcs/class/Facades/System.Reflection/System.Reflection-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C95FD088-DE10-4756-B328-A7EFD320CA4D} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Reflection - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Resources.ReaderWriter/AssemblyInfo.cs b/mcs/class/Facades/System.Resources.ReaderWriter/AssemblyInfo.cs index f68c22a2d36..9648e7244ba 100644 --- a/mcs/class/Facades/System.Resources.ReaderWriter/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Resources.ReaderWriter/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Resources.ReaderWriter/System.Resources.ReaderWriter-net_4_x.csproj b/mcs/class/Facades/System.Resources.ReaderWriter/System.Resources.ReaderWriter-net_4_x.csproj deleted file mode 100644 index 9d72308f11f..00000000000 --- a/mcs/class/Facades/System.Resources.ReaderWriter/System.Resources.ReaderWriter-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {4B3B2617-E4F3-497E-80CC-3E3B0BB9B0AA} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Resources.ReaderWriter - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Resources.ResourceManager/AssemblyInfo.cs b/mcs/class/Facades/System.Resources.ResourceManager/AssemblyInfo.cs index 1d626a478c4..3fc6df3b8b3 100644 --- a/mcs/class/Facades/System.Resources.ResourceManager/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Resources.ResourceManager/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Resources.ResourceManager/System.Resources.ResourceManager-net_4_x.csproj b/mcs/class/Facades/System.Resources.ResourceManager/System.Resources.ResourceManager-net_4_x.csproj deleted file mode 100644 index cc6a5aaebd6..00000000000 --- a/mcs/class/Facades/System.Resources.ResourceManager/System.Resources.ResourceManager-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {B71D4E2C-AE91-4056-B1BC-E3D680854D81} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Resources.ResourceManager - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/AssemblyInfo.cs index 7476a7fd949..8b8c3c16364 100644 --- a/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/System.Runtime.CompilerServices.VisualC-net_4_x.csproj b/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/System.Runtime.CompilerServices.VisualC-net_4_x.csproj deleted file mode 100644 index 1ce276ace6c..00000000000 --- a/mcs/class/Facades/System.Runtime.CompilerServices.VisualC/System.Runtime.CompilerServices.VisualC-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {4934413F-59A2-40A7-A57F-5B4CED7E57D9} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime.CompilerServices.VisualC - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime.Extensions/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.Extensions/AssemblyInfo.cs index 3104f8b2b81..8c2d9748ad6 100644 --- a/mcs/class/Facades/System.Runtime.Extensions/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.Extensions/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.Extensions/System.Runtime.Extensions-net_4_x.csproj b/mcs/class/Facades/System.Runtime.Extensions/System.Runtime.Extensions-net_4_x.csproj deleted file mode 100644 index f7c799e25a7..00000000000 --- a/mcs/class/Facades/System.Runtime.Extensions/System.Runtime.Extensions-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {76C79D79-302B-49A2-8AD2-4002A5F69C64} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime.Extensions - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime.Handles/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.Handles/AssemblyInfo.cs index 70a725c14ee..4e28defe020 100644 --- a/mcs/class/Facades/System.Runtime.Handles/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.Handles/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.Handles/System.Runtime.Handles-net_4_x.csproj b/mcs/class/Facades/System.Runtime.Handles/System.Runtime.Handles-net_4_x.csproj deleted file mode 100644 index 7f26d59d123..00000000000 --- a/mcs/class/Facades/System.Runtime.Handles/System.Runtime.Handles-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C6CF11AD-BECC-4125-9DAD-87882946F4F1} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime.Handles - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/AssemblyInfo.cs index 129a31fb0eb..0181d3b50f5 100644 --- a/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/System.Runtime.InteropServices.WindowsRuntime-net_4_x.csproj b/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/System.Runtime.InteropServices.WindowsRuntime-net_4_x.csproj deleted file mode 100644 index d50e0f97547..00000000000 --- a/mcs/class/Facades/System.Runtime.InteropServices.WindowsRuntime/System.Runtime.InteropServices.WindowsRuntime-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {7E6EF582-E263-48F8-9ED3-4436A75BAB20} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime.InteropServices.WindowsRuntime - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime.InteropServices/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.InteropServices/AssemblyInfo.cs index 1279cedbf10..45a118b94c6 100644 --- a/mcs/class/Facades/System.Runtime.InteropServices/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.InteropServices/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.InteropServices/System.Runtime.InteropServices-net_4_x.csproj b/mcs/class/Facades/System.Runtime.InteropServices/System.Runtime.InteropServices-net_4_x.csproj deleted file mode 100644 index 1a215881a34..00000000000 --- a/mcs/class/Facades/System.Runtime.InteropServices/System.Runtime.InteropServices-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {AEE74B47-EF16-4252-9119-03AFFAE8945D} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime.InteropServices - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime.Numerics/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.Numerics/AssemblyInfo.cs index 71a2260ffef..02fbc543c91 100644 --- a/mcs/class/Facades/System.Runtime.Numerics/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.Numerics/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.Numerics/System.Runtime.Numerics-net_4_x.csproj b/mcs/class/Facades/System.Runtime.Numerics/System.Runtime.Numerics-net_4_x.csproj deleted file mode 100644 index 0933011f3ee..00000000000 --- a/mcs/class/Facades/System.Runtime.Numerics/System.Runtime.Numerics-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {30599B6A-5548-42CF-8CCC-0DB4FB047F40} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime.Numerics - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {BD2FFDDC-BD89-4041-82F5-A696C941C7BE} - System.Numerics-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime.Serialization.Formatters/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.Serialization.Formatters/AssemblyInfo.cs index 23d6ff37d9b..b717fe3b09e 100644 --- a/mcs/class/Facades/System.Runtime.Serialization.Formatters/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.Serialization.Formatters/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.Serialization.Json/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.Serialization.Json/AssemblyInfo.cs index 214bd0f5b62..64d9ae3de68 100644 --- a/mcs/class/Facades/System.Runtime.Serialization.Json/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.Serialization.Json/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.Serialization.Json/System.Runtime.Serialization.Json-net_4_x.csproj b/mcs/class/Facades/System.Runtime.Serialization.Json/System.Runtime.Serialization.Json-net_4_x.csproj deleted file mode 100644 index d6190256e6e..00000000000 --- a/mcs/class/Facades/System.Runtime.Serialization.Json/System.Runtime.Serialization.Json-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F94C14B7-F384-4659-AC19-71D1990A199D} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime.Serialization.Json - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {D845AD9D-3CCB-49CB-9543-028678E94938} - System.Runtime.Serialization-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime.Serialization.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.Serialization.Primitives/AssemblyInfo.cs index cfd4036ef67..44acc907615 100644 --- a/mcs/class/Facades/System.Runtime.Serialization.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.Serialization.Primitives/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.Serialization.Primitives/System.Runtime.Serialization.Primitives-net_4_x.csproj b/mcs/class/Facades/System.Runtime.Serialization.Primitives/System.Runtime.Serialization.Primitives-net_4_x.csproj deleted file mode 100644 index ec7621eb2a7..00000000000 --- a/mcs/class/Facades/System.Runtime.Serialization.Primitives/System.Runtime.Serialization.Primitives-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {20379FFB-C614-423F-8B96-6E1ABCF8B726} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime.Serialization.Primitives - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {D845AD9D-3CCB-49CB-9543-028678E94938} - System.Runtime.Serialization-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime.Serialization.Xml/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime.Serialization.Xml/AssemblyInfo.cs index 3683d775f26..e183ae505c2 100644 --- a/mcs/class/Facades/System.Runtime.Serialization.Xml/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime.Serialization.Xml/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime.Serialization.Xml/System.Runtime.Serialization.Xml-net_4_x.csproj b/mcs/class/Facades/System.Runtime.Serialization.Xml/System.Runtime.Serialization.Xml-net_4_x.csproj deleted file mode 100644 index 14c2521fbbd..00000000000 --- a/mcs/class/Facades/System.Runtime.Serialization.Xml/System.Runtime.Serialization.Xml-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {56D65A5E-3E87-41C4-8332-3F03C959FEEE} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime.Serialization.Xml - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {D845AD9D-3CCB-49CB-9543-028678E94938} - System.Runtime.Serialization-net_4_x - - - {87FD2F0F-5222-4AE6-BD63-2D4975E11E5B} - System.Xml-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Runtime/AssemblyInfo.cs b/mcs/class/Facades/System.Runtime/AssemblyInfo.cs index 55cb3dc4679..ecd632ec6d6 100644 --- a/mcs/class/Facades/System.Runtime/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Runtime/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Runtime/System.Runtime-net_4_x.csproj b/mcs/class/Facades/System.Runtime/System.Runtime-net_4_x.csproj deleted file mode 100644 index 055f8a6a16b..00000000000 --- a/mcs/class/Facades/System.Runtime/System.Runtime-net_4_x.csproj +++ /dev/null @@ -1,104 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {27623377-1A83-4EB2-AF9C-97236F60F9B3} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Runtime - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {9091B5ED-8AFF-4B93-801A-9A33E0895A2B} - System.ComponentModel.Composition-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.AccessControl/AssemblyInfo.cs b/mcs/class/Facades/System.Security.AccessControl/AssemblyInfo.cs index 09cb993ae68..db93dea9198 100644 --- a/mcs/class/Facades/System.Security.AccessControl/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.AccessControl/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.AccessControl/System.Security.AccessControl-net_4_x.csproj b/mcs/class/Facades/System.Security.AccessControl/System.Security.AccessControl-net_4_x.csproj deleted file mode 100644 index 59f0bbc25e5..00000000000 --- a/mcs/class/Facades/System.Security.AccessControl/System.Security.AccessControl-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {AD189C25-6290-4167-BC5C-071511A6BAAB} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.AccessControl - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Claims/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Claims/AssemblyInfo.cs index 5afb672be75..b94953810ef 100644 --- a/mcs/class/Facades/System.Security.Claims/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Claims/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Claims/System.Security.Claims-net_4_x.csproj b/mcs/class/Facades/System.Security.Claims/System.Security.Claims-net_4_x.csproj deleted file mode 100644 index 3c5626a5ca7..00000000000 --- a/mcs/class/Facades/System.Security.Claims/System.Security.Claims-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {D6FC8AED-2F7B-42D1-ADD6-BB419729EC6E} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Claims - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.Algorithms/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Algorithms/AssemblyInfo.cs index 554f83b7e71..c41572f45bf 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Algorithms/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Algorithms/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.2.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Algorithms/Facades_System.Security.Cryptography.Algorithms-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.Algorithms/Facades_System.Security.Cryptography.Algorithms-net_4_x.csproj index aecc3154458..09c7e65af4c 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Algorithms/Facades_System.Security.Cryptography.Algorithms-net_4_x.csproj +++ b/mcs/class/Facades/System.Security.Cryptography.Algorithms/Facades_System.Security.Cryptography.Algorithms-net_4_x.csproj @@ -55,7 +55,9 @@ + + - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.Encoding/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Encoding/AssemblyInfo.cs index 4b9af989326..5608c82b84d 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encoding/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Encoding/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Encoding/System.Security.Cryptography.Encoding-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.Encoding/System.Security.Cryptography.Encoding-net_4_x.csproj deleted file mode 100644 index dcbeba54593..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.Encoding/System.Security.Cryptography.Encoding-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {BFFCFADF-8A9C-4C3C-9C51-139600C13693} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.Encoding - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/AssemblyInfo.cs index 6f6c4437a23..98dbe2c1c68 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/System.Security.Cryptography.Encryption.Aes-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/System.Security.Cryptography.Encryption.Aes-net_4_x.csproj deleted file mode 100644 index 2af02486383..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption.Aes/System.Security.Cryptography.Encryption.Aes-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {0599ACA9-6088-4842-B5C2-E2EDB1C8ABD9} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.Encryption.Aes - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/AssemblyInfo.cs index f0dfe1a720f..084e4d2f706 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/System.Security.Cryptography.Encryption.ECDiffieHellman-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/System.Security.Cryptography.Encryption.ECDiffieHellman-net_4_x.csproj deleted file mode 100644 index 2318bf158b9..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDiffieHellman/System.Security.Cryptography.Encryption.ECDiffieHellman-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {7C56A39F-449F-4E16-A7CA-ED94AC21008D} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.Encryption.ECDiffieHellman - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/AssemblyInfo.cs index f462ba4dbcf..a3f3b7301e9 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/System.Security.Cryptography.Encryption.ECDsa-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/System.Security.Cryptography.Encryption.ECDsa-net_4_x.csproj deleted file mode 100644 index 53a7edd7eef..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption.ECDsa/System.Security.Cryptography.Encryption.ECDsa-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {2920BE27-3108-4351-895F-90629C3B0566} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.Encryption.ECDsa - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Encryption/AssemblyInfo.cs index 6fc47e93a62..a0eaad7aad9 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Encryption/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Encryption/System.Security.Cryptography.Encryption-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.Encryption/System.Security.Cryptography.Encryption-net_4_x.csproj deleted file mode 100644 index 356a34fdeb9..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.Encryption/System.Security.Cryptography.Encryption-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {56E07367-C000-48C1-A9AE-AF9C05E479E0} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.Encryption - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/AssemblyInfo.cs index 9e9384b209b..0f1e5fb889b 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/System.Security.Cryptography.Hashing.Algorithms-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/System.Security.Cryptography.Hashing.Algorithms-net_4_x.csproj deleted file mode 100644 index b664dddfecc..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.Hashing.Algorithms/System.Security.Cryptography.Hashing.Algorithms-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {B956309E-12A6-4407-9C1F-7DF913DB20CD} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.Hashing.Algorithms - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.Hashing/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Hashing/AssemblyInfo.cs index 02071a99b0f..da5dcfb19ff 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Hashing/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Hashing/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Hashing/System.Security.Cryptography.Hashing-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.Hashing/System.Security.Cryptography.Hashing-net_4_x.csproj deleted file mode 100644 index 7daa127e541..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.Hashing/System.Security.Cryptography.Hashing-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {EC66863B-4061-4BA5-88C9-5A3395B27A19} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.Hashing - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.OpenSsl/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.OpenSsl/AssemblyInfo.cs index 9c88245aa2c..eb0138f02e1 100644 --- a/mcs/class/Facades/System.Security.Cryptography.OpenSsl/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.OpenSsl/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Pkcs/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Pkcs/AssemblyInfo.cs index 9a1162f702c..1666aa8bfdc 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Pkcs/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Pkcs/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.Primitives/AssemblyInfo.cs index f6634012ff9..5b703ed557d 100644 --- a/mcs/class/Facades/System.Security.Cryptography.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.Primitives/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.ProtectedData/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.ProtectedData/AssemblyInfo.cs index 5b28386b8ef..cccb2f29ca2 100644 --- a/mcs/class/Facades/System.Security.Cryptography.ProtectedData/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.ProtectedData/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.ProtectedData/System.Security.Cryptography.ProtectedData-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.ProtectedData/System.Security.Cryptography.ProtectedData-net_4_x.csproj deleted file mode 100644 index 64f6c2c14de..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.ProtectedData/System.Security.Cryptography.ProtectedData-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {6A5971D9-198E-4EF8-A2BA-9E64C0B36351} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.ProtectedData - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {3ED36717-A9D1-4289-8949-9B7F39766DEB} - System.Security-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.RSA/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.RSA/AssemblyInfo.cs index 95b9a0c51e6..27bf032d6ff 100644 --- a/mcs/class/Facades/System.Security.Cryptography.RSA/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.RSA/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.RSA/System.Security.Cryptography.RSA-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.RSA/System.Security.Cryptography.RSA-net_4_x.csproj deleted file mode 100644 index cad9833452e..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.RSA/System.Security.Cryptography.RSA-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {EFEE5CFF-34DE-4851-9A0F-B95BD790A9E9} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.RSA - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/AssemblyInfo.cs index 79fb0295a47..f5a015dcabc 100644 --- a/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/System.Security.Cryptography.RandomNumberGenerator-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/System.Security.Cryptography.RandomNumberGenerator-net_4_x.csproj deleted file mode 100644 index 8ba6af51e86..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.RandomNumberGenerator/System.Security.Cryptography.RandomNumberGenerator-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {AFFC81C7-0AF7-457F-AA19-95A3F260DBBF} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.RandomNumberGenerator - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Cryptography.X509Certificates/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Cryptography.X509Certificates/AssemblyInfo.cs index efa4c538917..bbfb428285a 100644 --- a/mcs/class/Facades/System.Security.Cryptography.X509Certificates/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Cryptography.X509Certificates/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Cryptography.X509Certificates/System.Security.Cryptography.X509Certificates-net_4_x.csproj b/mcs/class/Facades/System.Security.Cryptography.X509Certificates/System.Security.Cryptography.X509Certificates-net_4_x.csproj deleted file mode 100644 index 048fbc98009..00000000000 --- a/mcs/class/Facades/System.Security.Cryptography.X509Certificates/System.Security.Cryptography.X509Certificates-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {9A600CEA-C20E-4A59-93B6-821B979F4ECC} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Cryptography.X509Certificates - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Principal.Windows/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Principal.Windows/AssemblyInfo.cs index bcb3fc9808d..b7abc6857f9 100644 --- a/mcs/class/Facades/System.Security.Principal.Windows/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Principal.Windows/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Principal.Windows/System.Security.Principal.Windows-net_4_x.csproj b/mcs/class/Facades/System.Security.Principal.Windows/System.Security.Principal.Windows-net_4_x.csproj deleted file mode 100644 index 2c00b362740..00000000000 --- a/mcs/class/Facades/System.Security.Principal.Windows/System.Security.Principal.Windows-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {346A96BA-68AA-4119-9226-D48F82F77EF2} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Principal.Windows - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.Principal/AssemblyInfo.cs b/mcs/class/Facades/System.Security.Principal/AssemblyInfo.cs index e33e72f07ec..0630276ae68 100644 --- a/mcs/class/Facades/System.Security.Principal/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.Principal/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.Principal/System.Security.Principal-net_4_x.csproj b/mcs/class/Facades/System.Security.Principal/System.Security.Principal-net_4_x.csproj deleted file mode 100644 index 82d62f9fc92..00000000000 --- a/mcs/class/Facades/System.Security.Principal/System.Security.Principal-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {750F58A7-780C-4E1A-B09B-C3E9B084140D} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.Principal - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Security.SecureString/AssemblyInfo.cs b/mcs/class/Facades/System.Security.SecureString/AssemblyInfo.cs index 71c3e6756b3..72ee369b044 100644 --- a/mcs/class/Facades/System.Security.SecureString/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Security.SecureString/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Security.SecureString/System.Security.SecureString-net_4_x.csproj b/mcs/class/Facades/System.Security.SecureString/System.Security.SecureString-net_4_x.csproj deleted file mode 100644 index b9500f325e9..00000000000 --- a/mcs/class/Facades/System.Security.SecureString/System.Security.SecureString-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C5EAE616-9D44-4858-A84A-9B0C9A2965E1} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Security.SecureString - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ServiceModel.Duplex/AssemblyInfo.cs b/mcs/class/Facades/System.ServiceModel.Duplex/AssemblyInfo.cs index fc2332957d1..cc10b164832 100644 --- a/mcs/class/Facades/System.ServiceModel.Duplex/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ServiceModel.Duplex/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ServiceModel.Duplex/System.ServiceModel.Duplex-net_4_x.csproj b/mcs/class/Facades/System.ServiceModel.Duplex/System.ServiceModel.Duplex-net_4_x.csproj deleted file mode 100644 index 136211d27b0..00000000000 --- a/mcs/class/Facades/System.ServiceModel.Duplex/System.ServiceModel.Duplex-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {F437829F-5283-4740-9637-7C5682DD11C8} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ServiceModel.Duplex - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {FE596C31-BDA2-4850-8F79-F8F4DF70F44A} - System.ServiceModel-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ServiceModel.Http/AssemblyInfo.cs b/mcs/class/Facades/System.ServiceModel.Http/AssemblyInfo.cs index 6630473daf8..a62721f4228 100644 --- a/mcs/class/Facades/System.ServiceModel.Http/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ServiceModel.Http/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ServiceModel.Http/System.ServiceModel.Http-net_4_x.csproj b/mcs/class/Facades/System.ServiceModel.Http/System.ServiceModel.Http-net_4_x.csproj deleted file mode 100644 index 02f11ee5f31..00000000000 --- a/mcs/class/Facades/System.ServiceModel.Http/System.ServiceModel.Http-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {520E2A44-1534-4AE7-B5B5-CC48752BFAC5} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ServiceModel.Http - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {FE596C31-BDA2-4850-8F79-F8F4DF70F44A} - System.ServiceModel-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ServiceModel.NetTcp/AssemblyInfo.cs b/mcs/class/Facades/System.ServiceModel.NetTcp/AssemblyInfo.cs index 6630473daf8..a62721f4228 100644 --- a/mcs/class/Facades/System.ServiceModel.NetTcp/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ServiceModel.NetTcp/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ServiceModel.NetTcp/System.ServiceModel.NetTcp-net_4_x.csproj b/mcs/class/Facades/System.ServiceModel.NetTcp/System.ServiceModel.NetTcp-net_4_x.csproj deleted file mode 100644 index 530b538c36e..00000000000 --- a/mcs/class/Facades/System.ServiceModel.NetTcp/System.ServiceModel.NetTcp-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C7C9D163-07B0-4BC4-AFF9-6C1604EA1422} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ServiceModel.NetTcp - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {FE596C31-BDA2-4850-8F79-F8F4DF70F44A} - System.ServiceModel-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ServiceModel.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.ServiceModel.Primitives/AssemblyInfo.cs index c00b1d2c35e..d3a2d80f6ce 100644 --- a/mcs/class/Facades/System.ServiceModel.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ServiceModel.Primitives/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ServiceModel.Primitives/System.ServiceModel.Primitives-net_4_x.csproj b/mcs/class/Facades/System.ServiceModel.Primitives/System.ServiceModel.Primitives-net_4_x.csproj deleted file mode 100644 index 5306f530e0c..00000000000 --- a/mcs/class/Facades/System.ServiceModel.Primitives/System.ServiceModel.Primitives-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {5C526F77-70CF-4469-B91D-499C1D39CD11} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ServiceModel.Primitives - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {FE596C31-BDA2-4850-8F79-F8F4DF70F44A} - System.ServiceModel-net_4_x - - - {87FD2F0F-5222-4AE6-BD63-2D4975E11E5B} - System.Xml-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ServiceModel.Security/AssemblyInfo.cs b/mcs/class/Facades/System.ServiceModel.Security/AssemblyInfo.cs index 432e6df602f..d2c63745073 100644 --- a/mcs/class/Facades/System.ServiceModel.Security/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ServiceModel.Security/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ServiceModel.Security/System.ServiceModel.Security-net_4_x.csproj b/mcs/class/Facades/System.ServiceModel.Security/System.ServiceModel.Security-net_4_x.csproj deleted file mode 100644 index 23aecf8acbd..00000000000 --- a/mcs/class/Facades/System.ServiceModel.Security/System.ServiceModel.Security-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {C46FCD98-1619-4B60-BBAD-10F052F26B51} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ServiceModel.Security - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {FE596C31-BDA2-4850-8F79-F8F4DF70F44A} - System.ServiceModel-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ServiceProcess.ServiceController/AssemblyInfo.cs b/mcs/class/Facades/System.ServiceProcess.ServiceController/AssemblyInfo.cs index 9d5c8e1afe7..3abe68c0dce 100644 --- a/mcs/class/Facades/System.ServiceProcess.ServiceController/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ServiceProcess.ServiceController/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ServiceProcess.ServiceController/System.ServiceProcess.ServiceController-net_4_x.csproj b/mcs/class/Facades/System.ServiceProcess.ServiceController/System.ServiceProcess.ServiceController-net_4_x.csproj deleted file mode 100644 index f4bb7201cb9..00000000000 --- a/mcs/class/Facades/System.ServiceProcess.ServiceController/System.ServiceProcess.ServiceController-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {E88B043C-261E-4544-BFD7-AA19C5FDC7BF} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.ServiceProcess.ServiceController - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {CF24A609-AEF3-4E7A-95FC-C7A3CEAA7CC3} - System.ServiceProcess-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Text.Encoding.CodePages/AssemblyInfo.cs b/mcs/class/Facades/System.Text.Encoding.CodePages/AssemblyInfo.cs index 916a1255fa0..dde53209d5a 100644 --- a/mcs/class/Facades/System.Text.Encoding.CodePages/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Text.Encoding.CodePages/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Text.Encoding.Extensions/AssemblyInfo.cs b/mcs/class/Facades/System.Text.Encoding.Extensions/AssemblyInfo.cs index 1e37fcbbd26..15d05b69398 100644 --- a/mcs/class/Facades/System.Text.Encoding.Extensions/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Text.Encoding.Extensions/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions-net_4_5.csproj b/mcs/class/Facades/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions-net_4_5.csproj deleted file mode 100644 index 3d3d748f3fa..00000000000 --- a/mcs/class/Facades/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions-net_4_5.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {DEAA541C-1414-4C17-9DB1-F63F83B0C182} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_5/Facades - True - True - - Properties - - - System.Text.Encoding.Extensions - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {33BF0182-AC5C-464C-995B-C9CFE74E1A95} - corlib-net_4_5 - - - {33BF0182-AC5C-464C-995B-C9CFE74E1A95} - corlib-net_4_5 - - - - - - - diff --git a/mcs/class/Facades/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions-net_4_5.sln b/mcs/class/Facades/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions-net_4_5.sln deleted file mode 100644 index 82d6caa3cc9..00000000000 --- a/mcs/class/Facades/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions-net_4_5.sln +++ /dev/null @@ -1,17 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Text.Encoding.Extensions-net_4_5", "System.Text.Encoding.Extensions-net_4_5.csproj", "{DEAA541C-1414-4C17-9DB1-F63F83B0C182}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {DEAA541C-1414-4C17-9DB1-F63F83B0C182}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DEAA541C-1414-4C17-9DB1-F63F83B0C182}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DEAA541C-1414-4C17-9DB1-F63F83B0C182}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DEAA541C-1414-4C17-9DB1-F63F83B0C182}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection -EndGlobal diff --git a/mcs/class/Facades/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions-net_4_x.csproj b/mcs/class/Facades/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions-net_4_x.csproj deleted file mode 100644 index 4579c0ea809..00000000000 --- a/mcs/class/Facades/System.Text.Encoding.Extensions/System.Text.Encoding.Extensions-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {1EC7070C-EA2E-44F4-9C90-8EB863CBA812} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Text.Encoding.Extensions - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Text.Encoding/AssemblyInfo.cs b/mcs/class/Facades/System.Text.Encoding/AssemblyInfo.cs index b05d88342b5..a841f3dc494 100644 --- a/mcs/class/Facades/System.Text.Encoding/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Text.Encoding/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Text.Encoding/System.Text.Encoding-net_4_x.csproj b/mcs/class/Facades/System.Text.Encoding/System.Text.Encoding-net_4_x.csproj deleted file mode 100644 index 3b52841c713..00000000000 --- a/mcs/class/Facades/System.Text.Encoding/System.Text.Encoding-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {8188B86C-187D-47EB-B5B4-FD835E500B3C} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Text.Encoding - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Text.RegularExpressions/AssemblyInfo.cs b/mcs/class/Facades/System.Text.RegularExpressions/AssemblyInfo.cs index 22cb1124c8f..ed8ea686203 100644 --- a/mcs/class/Facades/System.Text.RegularExpressions/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Text.RegularExpressions/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.1.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Text.RegularExpressions/System.Text.RegularExpressions-net_4_x.csproj b/mcs/class/Facades/System.Text.RegularExpressions/System.Text.RegularExpressions-net_4_x.csproj deleted file mode 100644 index 0ffb389ee3a..00000000000 --- a/mcs/class/Facades/System.Text.RegularExpressions/System.Text.RegularExpressions-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {5E307FDA-74F0-4E12-81E9-B01B93089813} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Text.RegularExpressions - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Threading.AccessControl/AssemblyInfo.cs b/mcs/class/Facades/System.Threading.AccessControl/AssemblyInfo.cs index cd7868f27b9..818bdcee0c1 100644 --- a/mcs/class/Facades/System.Threading.AccessControl/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Threading.AccessControl/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Threading.AccessControl/System.Threading.AccessControl-net_4_x.csproj b/mcs/class/Facades/System.Threading.AccessControl/System.Threading.AccessControl-net_4_x.csproj deleted file mode 100644 index 9708970fff4..00000000000 --- a/mcs/class/Facades/System.Threading.AccessControl/System.Threading.AccessControl-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {0C477170-E4CE-4EEF-8EF4-AAE8C943E867} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Threading.AccessControl - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Threading.Overlapped/AssemblyInfo.cs b/mcs/class/Facades/System.Threading.Overlapped/AssemblyInfo.cs index 5a2feb5f974..84dca4216ad 100644 --- a/mcs/class/Facades/System.Threading.Overlapped/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Threading.Overlapped/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Threading.Overlapped/System.Threading.Overlapped-net_4_x.csproj b/mcs/class/Facades/System.Threading.Overlapped/System.Threading.Overlapped-net_4_x.csproj deleted file mode 100644 index 60756d0e55d..00000000000 --- a/mcs/class/Facades/System.Threading.Overlapped/System.Threading.Overlapped-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {884A1C69-6876-4F89-8FA7-18B51C4E4D57} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Threading.Overlapped - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Threading.Tasks.Parallel/AssemblyInfo.cs b/mcs/class/Facades/System.Threading.Tasks.Parallel/AssemblyInfo.cs index 4a0f27fbc8f..f167c14f6de 100644 --- a/mcs/class/Facades/System.Threading.Tasks.Parallel/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Threading.Tasks.Parallel/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Threading.Tasks.Parallel/System.Threading.Tasks.Parallel-net_4_x.csproj b/mcs/class/Facades/System.Threading.Tasks.Parallel/System.Threading.Tasks.Parallel-net_4_x.csproj deleted file mode 100644 index f8046814b8c..00000000000 --- a/mcs/class/Facades/System.Threading.Tasks.Parallel/System.Threading.Tasks.Parallel-net_4_x.csproj +++ /dev/null @@ -1,92 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {D14EB78A-B8D4-4615-89A0-3662FBA2A7A1} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Threading.Tasks.Parallel - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Threading.Tasks/AssemblyInfo.cs b/mcs/class/Facades/System.Threading.Tasks/AssemblyInfo.cs index 347f3be59c6..13ede1c949b 100644 --- a/mcs/class/Facades/System.Threading.Tasks/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Threading.Tasks/AssemblyInfo.cs @@ -33,6 +33,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Threading.Tasks/System.Threading.Tasks-net_4_x.csproj b/mcs/class/Facades/System.Threading.Tasks/System.Threading.Tasks-net_4_x.csproj deleted file mode 100644 index 9eca61dc656..00000000000 --- a/mcs/class/Facades/System.Threading.Tasks/System.Threading.Tasks-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {D63B779F-18EC-4C7E-B649-B1090446E931} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Threading.Tasks - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Threading.Thread/AssemblyInfo.cs b/mcs/class/Facades/System.Threading.Thread/AssemblyInfo.cs index 7914509da0a..b971d115942 100644 --- a/mcs/class/Facades/System.Threading.Thread/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Threading.Thread/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Threading.Thread/System.Threading.Thread-net_4_x.csproj b/mcs/class/Facades/System.Threading.Thread/System.Threading.Thread-net_4_x.csproj deleted file mode 100644 index 2d5cf5ef3bf..00000000000 --- a/mcs/class/Facades/System.Threading.Thread/System.Threading.Thread-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {9E19393F-54A5-4B4C-A58F-EC697F35F57B} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Threading.Thread - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Threading.ThreadPool/AssemblyInfo.cs b/mcs/class/Facades/System.Threading.ThreadPool/AssemblyInfo.cs index 338c9dafeb4..99f1affe3ae 100644 --- a/mcs/class/Facades/System.Threading.ThreadPool/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Threading.ThreadPool/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Threading.ThreadPool/System.Threading.ThreadPool-net_4_x.csproj b/mcs/class/Facades/System.Threading.ThreadPool/System.Threading.ThreadPool-net_4_x.csproj deleted file mode 100644 index 3ed6be30822..00000000000 --- a/mcs/class/Facades/System.Threading.ThreadPool/System.Threading.ThreadPool-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {433024D9-0988-4BC3-A695-40780BE3E264} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Threading.ThreadPool - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Threading.Timer/AssemblyInfo.cs b/mcs/class/Facades/System.Threading.Timer/AssemblyInfo.cs index 75e5c0bb5a2..f7c9b197e47 100644 --- a/mcs/class/Facades/System.Threading.Timer/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Threading.Timer/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Threading.Timer/System.Threading.Timer-net_4_x.csproj b/mcs/class/Facades/System.Threading.Timer/System.Threading.Timer-net_4_x.csproj deleted file mode 100644 index 811340b66f6..00000000000 --- a/mcs/class/Facades/System.Threading.Timer/System.Threading.Timer-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {01D536EF-E24C-4104-A77C-4274F80B143E} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Threading.Timer - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Threading/AssemblyInfo.cs b/mcs/class/Facades/System.Threading/AssemblyInfo.cs index 181b40912c4..cbfb02ddb05 100644 --- a/mcs/class/Facades/System.Threading/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Threading/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Threading/System.Threading-net_4_x.csproj b/mcs/class/Facades/System.Threading/System.Threading-net_4_x.csproj deleted file mode 100644 index bbfdcafa605..00000000000 --- a/mcs/class/Facades/System.Threading/System.Threading-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {DD071CF1-7FED-485C-9C20-6F48DC7C749B} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Threading - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - {359142A1-D80F-401E-AA64-7167C9317649} - System.Core-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.ValueTuple/AssemblyInfo.cs b/mcs/class/Facades/System.ValueTuple/AssemblyInfo.cs index fed0afdbd9a..fda0d3b249e 100644 --- a/mcs/class/Facades/System.ValueTuple/AssemblyInfo.cs +++ b/mcs/class/Facades/System.ValueTuple/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.ValueTuple/Makefile b/mcs/class/Facades/System.ValueTuple/Makefile index bee5b4a0301..b8c4fda3869 100644 --- a/mcs/class/Facades/System.ValueTuple/Makefile +++ b/mcs/class/Facades/System.ValueTuple/Makefile @@ -9,10 +9,13 @@ LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades LIBRARY = System.ValueTuple.dll -KEY_FILE = ../../msfinal.pub +KEY_FILE = ../../Open.snk +LIBRARY_SNK = $(KEY_FILE) SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 LIB_REFS = -LIB_MCS_FLAGS = $(SIGN_FLAGS) +LIB_MCS_FLAGS = $(SIGN_FLAGS) + +PLATFORM_DEBUG_FLAGS = NO_TEST = yes diff --git a/mcs/class/Facades/System.Xml.ReaderWriter/AssemblyInfo.cs b/mcs/class/Facades/System.Xml.ReaderWriter/AssemblyInfo.cs index 7746bcf5692..1f288e75f86 100644 --- a/mcs/class/Facades/System.Xml.ReaderWriter/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Xml.ReaderWriter/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Xml.ReaderWriter/System.Xml.ReaderWriter-net_4_x.csproj b/mcs/class/Facades/System.Xml.ReaderWriter/System.Xml.ReaderWriter-net_4_x.csproj deleted file mode 100644 index 8ad566639dc..00000000000 --- a/mcs/class/Facades/System.Xml.ReaderWriter/System.Xml.ReaderWriter-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {053DF84B-ACC6-4FA7-B5A9-5701E6D648D2} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Xml.ReaderWriter - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {87FD2F0F-5222-4AE6-BD63-2D4975E11E5B} - System.Xml-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Xml.XDocument/AssemblyInfo.cs b/mcs/class/Facades/System.Xml.XDocument/AssemblyInfo.cs index e99e1d6d96c..dc88141a8c9 100644 --- a/mcs/class/Facades/System.Xml.XDocument/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Xml.XDocument/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Xml.XDocument/System.Xml.XDocument-net_4_x.csproj b/mcs/class/Facades/System.Xml.XDocument/System.Xml.XDocument-net_4_x.csproj deleted file mode 100644 index b848d32e9d1..00000000000 --- a/mcs/class/Facades/System.Xml.XDocument/System.Xml.XDocument-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {FB305A65-1838-41E4-8A7C-7C601E3C42DB} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Xml.XDocument - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {526286D5-38D9-4579-B001-471440D57752} - System.Xml.Linq-net_4_x - - - {87FD2F0F-5222-4AE6-BD63-2D4975E11E5B} - System.Xml-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Xml.XPath.XDocument/AssemblyInfo.cs b/mcs/class/Facades/System.Xml.XPath.XDocument/AssemblyInfo.cs index a779abc7c70..00626f58ee4 100644 --- a/mcs/class/Facades/System.Xml.XPath.XDocument/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Xml.XPath.XDocument/AssemblyInfo.cs @@ -33,6 +33,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Xml.XPath.XDocument/System.Xml.XPath.XDocument-net_4_x.csproj b/mcs/class/Facades/System.Xml.XPath.XDocument/System.Xml.XPath.XDocument-net_4_x.csproj deleted file mode 100644 index 47a725fc399..00000000000 --- a/mcs/class/Facades/System.Xml.XPath.XDocument/System.Xml.XPath.XDocument-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {84405A33-4886-4DFF-B20A-B425EB6C4D76} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Xml.XPath.XDocument - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {526286D5-38D9-4579-B001-471440D57752} - System.Xml.Linq-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Xml.XPath/AssemblyInfo.cs b/mcs/class/Facades/System.Xml.XPath/AssemblyInfo.cs index 8994ef19e33..9041c500166 100644 --- a/mcs/class/Facades/System.Xml.XPath/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Xml.XPath/AssemblyInfo.cs @@ -33,6 +33,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Xml.XPath/System.Xml.XPath-net_4_x.csproj b/mcs/class/Facades/System.Xml.XPath/System.Xml.XPath-net_4_x.csproj deleted file mode 100644 index 776dbaffe34..00000000000 --- a/mcs/class/Facades/System.Xml.XPath/System.Xml.XPath-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {E0408453-A814-4A71-98E2-3B49ACA8001D} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Xml.XPath - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {87FD2F0F-5222-4AE6-BD63-2D4975E11E5B} - System.Xml-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Xml.XmlDocument/AssemblyInfo.cs b/mcs/class/Facades/System.Xml.XmlDocument/AssemblyInfo.cs index f4ddb69f5c7..685580cbc91 100644 --- a/mcs/class/Facades/System.Xml.XmlDocument/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Xml.XmlDocument/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.1.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Xml.XmlDocument/System.Xml.XmlDocument-net_4_x.csproj b/mcs/class/Facades/System.Xml.XmlDocument/System.Xml.XmlDocument-net_4_x.csproj deleted file mode 100644 index 7e61f29cb7c..00000000000 --- a/mcs/class/Facades/System.Xml.XmlDocument/System.Xml.XmlDocument-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {7D5C18A0-EA5E-4489-93F0-444E2F5895B7} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Xml.XmlDocument - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {87FD2F0F-5222-4AE6-BD63-2D4975E11E5B} - System.Xml-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Xml.XmlSerializer/AssemblyInfo.cs b/mcs/class/Facades/System.Xml.XmlSerializer/AssemblyInfo.cs index 58c284e6276..bc8cf651533 100644 --- a/mcs/class/Facades/System.Xml.XmlSerializer/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Xml.XmlSerializer/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.10.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Xml.XmlSerializer/System.Xml.XmlSerializer-net_4_x.csproj b/mcs/class/Facades/System.Xml.XmlSerializer/System.Xml.XmlSerializer-net_4_x.csproj deleted file mode 100644 index 73d89036060..00000000000 --- a/mcs/class/Facades/System.Xml.XmlSerializer/System.Xml.XmlSerializer-net_4_x.csproj +++ /dev/null @@ -1,96 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {2716796C-3A71-464D-843A-0DE00243233A} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Xml.XmlSerializer - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {87FD2F0F-5222-4AE6-BD63-2D4975E11E5B} - System.Xml-net_4_x - - - - - - - diff --git a/mcs/class/Facades/System.Xml.Xsl.Primitives/AssemblyInfo.cs b/mcs/class/Facades/System.Xml.Xsl.Primitives/AssemblyInfo.cs index e08674f7e69..70b36c22b38 100644 --- a/mcs/class/Facades/System.Xml.Xsl.Primitives/AssemblyInfo.cs +++ b/mcs/class/Facades/System.Xml.Xsl.Primitives/AssemblyInfo.cs @@ -33,6 +33,4 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("4.0.0.0")] [assembly: AssemblyInformationalVersion ("4.0.0.0")] [assembly: AssemblyFileVersion ("4.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/System.Xml.Xsl.Primitives/System.Xml.Xsl.Primitives-net_4_x.csproj b/mcs/class/Facades/System.Xml.Xsl.Primitives/System.Xml.Xsl.Primitives-net_4_x.csproj deleted file mode 100644 index c8c4d891da5..00000000000 --- a/mcs/class/Facades/System.Xml.Xsl.Primitives/System.Xml.Xsl.Primitives-net_4_x.csproj +++ /dev/null @@ -1,100 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {59C3AB68-DEC2-4A13-983E-55E2DB09BF61} - Library - 1699,1616,1699 - ./../../../class/lib/net_4_x/Facades - True - True - - Properties - - - System.Xml.Xsl.Primitives - v4.5 - 512 - - - true - true - - - ../../msfinal.pub - - - true - full - 1699,1616,1699 - false - DEBUG;TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - pdbonly - 1699,1616,1699 - true - NET_4_0;NET_4_5;NET_4_6;MONO;DISABLE_CAS_USE - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {2CA6026B-2DC8-4C4C-A12C-1E8234049DB7} - corlib-net_4_x - - - {87FD2F0F-5222-4AE6-BD63-2D4975E11E5B} - System.Xml-net_4_x - - - {2762E921-91A8-4C87-91E9-BA628013F753} - System-net_4_x - - - - - - - diff --git a/mcs/class/Facades/netstandard/AssemblyInfo.cs b/mcs/class/Facades/netstandard/AssemblyInfo.cs index 519caa1a9ca..5580b633bd6 100644 --- a/mcs/class/Facades/netstandard/AssemblyInfo.cs +++ b/mcs/class/Facades/netstandard/AssemblyInfo.cs @@ -33,5 +33,3 @@ using System.Runtime.CompilerServices; [assembly: AssemblyVersion ("2.0.0.0")] [assembly: AssemblyInformationalVersion ("2.0.0.0")] [assembly: AssemblyFileVersion ("2.0.0.0")] -[assembly: AssemblyDelaySign (true)] -[assembly: AssemblyKeyFile ("../../msfinal.pub")] diff --git a/mcs/class/Facades/netstandard/Makefile b/mcs/class/Facades/netstandard/Makefile index e416180ca5e..7c6e2c69ac6 100644 --- a/mcs/class/Facades/netstandard/Makefile +++ b/mcs/class/Facades/netstandard/Makefile @@ -12,7 +12,8 @@ LIBRARY = netstandard.dll KEY_FILE = ../../msfinal.pub SIGN_FLAGS = /delaysign /keyfile:$(KEY_FILE) /nowarn:1616,1699 /nowarn:618 LIB_REFS = System System.Xml System.Xml.Linq System.Runtime.Serialization System.Core System.Numerics System.Net.Http \ -System.IO.Compression System.Data System.ComponentModel.Composition System.IO.Compression.FileSystem +System.IO.Compression System.Data System.ComponentModel.Composition System.IO.Compression.FileSystem \ +Facades/System.Security.Cryptography.Algorithms ifeq (2.1, $(FRAMEWORK_VERSION)) LIB_REFS += System.Web.Services diff --git a/mcs/class/Facades/subdirs.make b/mcs/class/Facades/subdirs.make index 1c3272da8f3..cae2d391a4b 100644 --- a/mcs/class/Facades/subdirs.make +++ b/mcs/class/Facades/subdirs.make @@ -38,8 +38,8 @@ drawing_DEPS_SUBDIRS = System.Drawing.Primitives monotouch_SUBDIRS = $(common_DEPS_SUBDIRS) $(mobile_only_DEPS_SUBDIRS) monotouch_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS) -aot_only_SUBDIRS = $(monotouch_SUBDIRS) -aot_only_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) +testing_aot_full_SUBDIRS = $(monotouch_SUBDIRS) +testing_aot_full_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) net_4_x_SUBDIRS = $(common_DEPS_SUBDIRS) $(drawing_DEPS_SUBDIRS) net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS) @@ -68,6 +68,8 @@ monotouch_watch_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) monotouch_tv_SUBDIRS = $(monotouch_SUBDIRS) monotouch_tv_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS) +winaot_PARALLEL_SUBDIRS := + mobile_only_SUBDIRS = System.Net.Ping System.Runtime.Serialization.Formatters System.Security.Cryptography.Csp System.Security.Cryptography.Pkcs \ System.Security.Cryptography.Cng diff --git a/mcs/class/Mainsoft.Configuration/makefile.build b/mcs/class/Mainsoft.Configuration/makefile.build deleted file mode 100755 index 37b03a0e2ab..00000000000 --- a/mcs/class/Mainsoft.Configuration/makefile.build +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/Makefile b/mcs/class/Makefile index 50a4fcfa4ae..2bdbf2d96b0 100644 --- a/mcs/class/Makefile +++ b/mcs/class/Makefile @@ -32,6 +32,8 @@ build_SUBDIRS := \ System.Xml.Linq \ System.Runtime.InteropServices.RuntimeInformation \ Mono.Cecil \ + Mono.CompilerServices.SymbolWriter \ + PEAPI \ ../tools/cil-stringreplacer -include ../build/config.make @@ -83,18 +85,13 @@ mobile_common_dirs := \ System.Reflection.Context \ System.Net.Http.WinHttpHandler -aot_only_dirs := \ +testing_aot_full_dirs := \ $(mobile_common_dirs) \ - Mono.Dynamic.Interpreter \ - PEAPI \ - Mono.CompilerServices.SymbolWriter \ Mono.Simd \ $(pcl_facade_dirs) -aot_hybrid_dirs := \ +testing_aot_hybrid_dirs := \ $(mobile_common_dirs) \ - PEAPI \ - Mono.CompilerServices.SymbolWriter \ Mono.Simd \ $(pcl_facade_dirs) @@ -110,7 +107,7 @@ monodroid_dirs := \ $(pcl_facade_dirs) monotouch_dirs := \ - $(aot_only_dirs) + $(testing_aot_full_dirs) monotouch_watch_dirs := $(filter-out Mono.Security Mono.Data.Tds,$(monotouch_dirs)) monotouch_tv_dirs := $(monotouch_dirs) @@ -126,6 +123,8 @@ monotouch_runtime_dirs := \ monotouch_watch_runtime_dirs := $(filter-out Mono.Security Mono.Data.Tds,$(monotouch_runtime_dirs)) monotouch_tv_runtime_dirs := $(monotouch_runtime_dirs) +winaot_dirs := $(monotouch_dirs) System.Drawing + xammac_4_5_dirs := \ corlib \ Mono.Security \ @@ -335,8 +334,8 @@ monotouch_tv_SUBDIRS := $(monotouch_tv_dirs) monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs) monotouch_watch_runtime_SUBDIRS := $(monotouch_watch_runtime_dirs) monotouch_tv_runtime_SUBDIRS := $(monotouch_tv_runtime_dirs) -aot_only_SUBDIRS := $(aot_only_dirs) -aot_hybrid_SUBDIRS := $(aot_hybrid_dirs) +testing_aot_full_SUBDIRS := $(testing_aot_full_dirs) +testing_aot_hybrid_SUBDIRS := $(testing_aot_hybrid_dirs) xammac_SUBDIRS := $(xammac_dirs) xammac_net_4_5_SUBDIRS := $(xammac_4_5_dirs) binary_reference_assemblies_SUBDIRS := reference-assemblies @@ -344,10 +343,11 @@ net_4_x_SUBDIRS := $(net_4_x_dirs) $(xbuild_4_0_dirs) net_4_x_PARALLEL_SUBDIRS := $(net_4_x_parallel_dirs) xbuild_12_SUBDIRS := $(xbuild_4_0_dirs) xbuild_14_SUBDIRS := $(xbuild_4_0_dirs) Microsoft.NuGet.Build.Tasks +winaot_SUBDIRS := $(winaot_dirs) include ../build/rules.make -SUBDIRS = $(aot_only_dirs) $(aot_hybrid_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_x_dirs) $(net_4_x_parallel_dirs) $(xammac_net_4_5_SUBDIRS) +SUBDIRS = $(testing_aot_full_dirs) $(testing_aot_hybrid_dirs) $(monotouch_dirs) $(monodroid_dirs) $(xammac_dirs) $(net_4_x_dirs) $(net_4_x_parallel_dirs) $(xammac_net_4_5_SUBDIRS) DIST_ONLY_SUBDIRS = dlr aot-compiler reference-assemblies $(xbuild_4_0_dirs) Microsoft.NuGet.Build.Tasks @@ -363,6 +363,7 @@ DISTFILES = \ silverlight.pub \ reactive.pub \ mono.snk \ + Open.snk \ LICENSE \ README \ doc/API-notes \ diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-net_3_5.csproj b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-net_3_5.csproj deleted file mode 100644 index 8af157b4fe2..00000000000 --- a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-net_3_5.csproj +++ /dev/null @@ -1,141 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {88FC8C2C-9157-41EB-A47C-981B2205ED7E} - Library - 1699 - ./../../class/lib/net_3_5 - True - True - - Properties - - - Microsoft.Build.Framework - v3.5 - 512 - - - true - full - 1699 - false - DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_5 - prompt - 4 - - - pdbonly - 1699 - true - NET_1_1;NET_2_0;NET_3_5 - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {5A00133C-6D08-48F7-A164-8B796CE6DB83} - corlib\corlib-net_2_0 - - - {1F3B168C-A4D0-44AA-B116-792D8804971F} - System\System-net_2_0-2 - - - - - - - diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-tests-net_3_5.csproj b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-tests-net_3_5.csproj deleted file mode 100644 index 396b12807d2..00000000000 --- a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework-tests-net_3_5.csproj +++ /dev/null @@ -1,97 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {3816DD7B-7954-4002-BFFD-4E059FBD5B36} - Library - 1699 - bin\Debug\Microsoft.Build.Framework-tests-net_3_5 - True - False - - Properties - - - Microsoft.Build.Framework_test_net_3_5 - v3.5 - 512 - - - true - full - 1699 - false - DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_5 - prompt - 4 - - - pdbonly - 1699 - true - NET_1_1;NET_2_0;NET_3_5 - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {5A00133C-6D08-48F7-A164-8B796CE6DB83} - corlib\corlib-net_2_0 - - - {88FC8C2C-9157-41EB-A47C-981B2205ED7E} - Microsoft.Build.Framework\Microsoft.Build.Framework-net_3_5 - - - - - - - diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mdp b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mdp deleted file mode 100644 index 1a7f4e38f0a..00000000000 --- a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mdp +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mds b/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mds deleted file mode 100644 index ee7ead51def..00000000000 --- a/mcs/class/Microsoft.Build.Framework/Microsoft.Build.Framework.mds +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ManagedCompiler.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ManagedCompiler.cs index 5aa6412baf6..19eec868654 100644 --- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ManagedCompiler.cs +++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ManagedCompiler.cs @@ -71,7 +71,7 @@ namespace Microsoft.Build.Tasks { commandLine.AppendSwitch ("/delaysign-"); if (Bag ["EmitDebugInformation"] != null) if (EmitDebugInformation) - commandLine.AppendSwitch ("/debug+"); + commandLine.AppendSwitch ("/debug:portable"); else commandLine.AppendSwitch ("/debug-"); //fileAlignment diff --git a/mcs/class/Microsoft.Build/Microsoft.Build.sln b/mcs/class/Microsoft.Build/Microsoft.Build.sln deleted file mode 100644 index e9322e6e73a..00000000000 --- a/mcs/class/Microsoft.Build/Microsoft.Build.sln +++ /dev/null @@ -1,54 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Build", "Microsoft.Build.csproj", "{B2012E7F-8F8D-4908-8045-413F2BD1022D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Build.Test", "Test\Microsoft.Build.Test.csproj", "{5C1BA631-5120-4930-A112-80783328B72B}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5C1BA631-5120-4930-A112-80783328B72B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5C1BA631-5120-4930-A112-80783328B72B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5C1BA631-5120-4930-A112-80783328B72B}.Debug|x86.ActiveCfg = Debug|Any CPU - {5C1BA631-5120-4930-A112-80783328B72B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5C1BA631-5120-4930-A112-80783328B72B}.Release|Any CPU.Build.0 = Release|Any CPU - {5C1BA631-5120-4930-A112-80783328B72B}.Release|x86.ActiveCfg = Release|Any CPU - {B2012E7F-8F8D-4908-8045-413F2BD1022D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B2012E7F-8F8D-4908-8045-413F2BD1022D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B2012E7F-8F8D-4908-8045-413F2BD1022D}.Debug|x86.ActiveCfg = Debug|Any CPU - {B2012E7F-8F8D-4908-8045-413F2BD1022D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B2012E7F-8F8D-4908-8045-413F2BD1022D}.Release|Any CPU.Build.0 = Release|Any CPU - {B2012E7F-8F8D-4908-8045-413F2BD1022D}.Release|x86.ActiveCfg = Release|Any CPU - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = Microsoft.Build.csproj - Policies = $0 - $0.TextStylePolicy = $1 - $1.FileWidth = 120 - $1.TabWidth = 8 - $1.NoTabsAfterNonTabs = True - $1.RemoveTrailingWhitespace = True - $1.inheritsSet = VisualStudio - $1.inheritsScope = text/plain - $1.scope = text/plain - $0.TextStylePolicy = $2 - $2.inheritsSet = null - $2.scope = text/x-csharp - $0.CSharpFormattingPolicy = $3 - $3.inheritsSet = Mono - $3.inheritsScope = text/x-csharp - $3.scope = text/x-csharp - $0.StandardHeader = $4 - $4.Text = - $4.inheritsSet = Apache2License - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/mcs/class/Mono.CSharp/aot_only_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/aot_only_Mono.CSharp.dll.sources deleted file mode 100644 index 4c30fc6e148..00000000000 --- a/mcs/class/Mono.CSharp/aot_only_Mono.CSharp.dll.sources +++ /dev/null @@ -1,4 +0,0 @@ -#include Mono.CSharp.dll.sources -../corlib/System.Reflection.Emit/PEFileKinds.cs -../corlib/System.Reflection.Emit/MethodToken.cs -monotouch.cs diff --git a/mcs/class/Mono.CSharp/aot_only_Mono.CSharp_test.dll.exclude.sources b/mcs/class/Mono.CSharp/aot_only_Mono.CSharp_test.dll.exclude.sources deleted file mode 100644 index c433add3996..00000000000 --- a/mcs/class/Mono.CSharp/aot_only_Mono.CSharp_test.dll.exclude.sources +++ /dev/null @@ -1,6 +0,0 @@ -Evaluator/BuildinCommands.cs -Evaluator/CompletionTest.cs -Evaluator/EvaluatorFixture.cs -Evaluator/EvaluatorTest.cs -Evaluator/ExpressionsTest.cs -Evaluator/TypesTest.cs diff --git a/mcs/class/Mono.CSharp/aot_only_Mono.CSharp_test.dll.sources b/mcs/class/Mono.CSharp/aot_only_Mono.CSharp_test.dll.sources deleted file mode 100644 index 64b774be65d..00000000000 --- a/mcs/class/Mono.CSharp/aot_only_Mono.CSharp_test.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include Mono.CSharp_test.dll.sources diff --git a/mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources index d2f37605a4d..083e61afd3f 100644 --- a/mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources +++ b/mcs/class/Mono.CSharp/monotouch_Mono.CSharp.dll.sources @@ -1 +1 @@ -#include aot_only_Mono.CSharp.dll.sources +#include testing_aot_full_Mono.CSharp.dll.sources diff --git a/mcs/class/Mono.CSharp/monotouch_tv_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/monotouch_tv_Mono.CSharp.dll.sources index d2f37605a4d..083e61afd3f 100644 --- a/mcs/class/Mono.CSharp/monotouch_tv_Mono.CSharp.dll.sources +++ b/mcs/class/Mono.CSharp/monotouch_tv_Mono.CSharp.dll.sources @@ -1 +1 @@ -#include aot_only_Mono.CSharp.dll.sources +#include testing_aot_full_Mono.CSharp.dll.sources diff --git a/mcs/class/Mono.CSharp/monotouch_watch_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/monotouch_watch_Mono.CSharp.dll.sources index d2f37605a4d..083e61afd3f 100644 --- a/mcs/class/Mono.CSharp/monotouch_watch_Mono.CSharp.dll.sources +++ b/mcs/class/Mono.CSharp/monotouch_watch_Mono.CSharp.dll.sources @@ -1 +1 @@ -#include aot_only_Mono.CSharp.dll.sources +#include testing_aot_full_Mono.CSharp.dll.sources diff --git a/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp.dll.sources new file mode 100644 index 00000000000..4c30fc6e148 --- /dev/null +++ b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp.dll.sources @@ -0,0 +1,4 @@ +#include Mono.CSharp.dll.sources +../corlib/System.Reflection.Emit/PEFileKinds.cs +../corlib/System.Reflection.Emit/MethodToken.cs +monotouch.cs diff --git a/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.exclude.sources b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.exclude.sources new file mode 100644 index 00000000000..c433add3996 --- /dev/null +++ b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.exclude.sources @@ -0,0 +1,6 @@ +Evaluator/BuildinCommands.cs +Evaluator/CompletionTest.cs +Evaluator/EvaluatorFixture.cs +Evaluator/EvaluatorTest.cs +Evaluator/ExpressionsTest.cs +Evaluator/TypesTest.cs diff --git a/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.sources b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.sources new file mode 100644 index 00000000000..64b774be65d --- /dev/null +++ b/mcs/class/Mono.CSharp/testing_aot_full_Mono.CSharp_test.dll.sources @@ -0,0 +1 @@ +#include Mono.CSharp_test.dll.sources diff --git a/mcs/class/Mono.CSharp/winaot_Mono.CSharp.dll.sources b/mcs/class/Mono.CSharp/winaot_Mono.CSharp.dll.sources new file mode 100644 index 00000000000..4c30fc6e148 --- /dev/null +++ b/mcs/class/Mono.CSharp/winaot_Mono.CSharp.dll.sources @@ -0,0 +1,4 @@ +#include Mono.CSharp.dll.sources +../corlib/System.Reflection.Emit/PEFileKinds.cs +../corlib/System.Reflection.Emit/MethodToken.cs +monotouch.cs diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources index 206efb2edd3..e17c152506a 100644 --- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources +++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.sources @@ -1,8 +1,6 @@ Assembly/AssemblyInfo.cs ../../build/common/Consts.cs -../../build/common/Locale.cs -../../build/common/MonoTODOAttribute.cs -Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs +../System/Mono.Util/MonoPInvokeCallbackAttribute.cs Mono.Data.Sqlite_2.0/SQLite3.cs Mono.Data.Sqlite_2.0/SQLite3_UTF16.cs Mono.Data.Sqlite_2.0/SQLiteBase.cs diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs deleted file mode 100644 index 1546be907f6..00000000000 --- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/MonoPInvokeCallbackAttribute.cs +++ /dev/null @@ -1,36 +0,0 @@ -// -// MonoPInvokeCallbackAttribute.cs: necessary for AOT ports of Mono -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -#if MONOTOUCH - -using System; - -namespace MonoTouch { - - [AttributeUsage (AttributeTargets.Method)] - sealed class MonoPInvokeCallbackAttribute : Attribute { - public MonoPInvokeCallbackAttribute (Type t) {} - } -} - -#endif diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs index 34556edb930..6b2ee13e03a 100644 --- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs +++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLite3.cs @@ -706,7 +706,7 @@ namespace Mono.Data.Sqlite } #if MONOTOUCH - [MonoTouch.MonoPInvokeCallback(typeof(SQLiteCallback))] + [Mono.Util.MonoPInvokeCallback(typeof(SQLiteCallback))] internal static void scalar_callback(IntPtr context, int nArgs, IntPtr argsptr) { var handle = GCHandle.FromIntPtr (UnsafeNativeMethods.sqlite3_user_data(context)); @@ -714,7 +714,7 @@ namespace Mono.Data.Sqlite func.Func(context, nArgs, argsptr); } - [MonoTouch.MonoPInvokeCallback(typeof(SQLiteCallback))] + [Mono.Util.MonoPInvokeCallback(typeof(SQLiteCallback))] internal static void step_callback(IntPtr context, int nArgs, IntPtr argsptr) { var handle = GCHandle.FromIntPtr(UnsafeNativeMethods.sqlite3_user_data(context)); @@ -722,7 +722,7 @@ namespace Mono.Data.Sqlite func.FuncStep(context, nArgs, argsptr); } - [MonoTouch.MonoPInvokeCallback(typeof(SQLiteFinalCallback))] + [Mono.Util.MonoPInvokeCallback(typeof(SQLiteFinalCallback))] internal static void final_callback(IntPtr context) { var handle = GCHandle.FromIntPtr(UnsafeNativeMethods.sqlite3_user_data(context)); @@ -730,7 +730,7 @@ namespace Mono.Data.Sqlite func.FuncFinal(context); } - [MonoTouch.MonoPInvokeCallback(typeof(SQLiteFinalCallback))] + [Mono.Util.MonoPInvokeCallback(typeof(SQLiteFinalCallback))] internal static void destroy_callback(IntPtr context) { GCHandle.FromIntPtr(context).Free(); @@ -958,7 +958,7 @@ namespace Mono.Data.Sqlite SQLiteCommitCallback commit_callback; SQLiteRollbackCallback rollback_callback; - [MonoTouch.MonoPInvokeCallback (typeof (SQLiteUpdateCallback))] + [Mono.Util.MonoPInvokeCallback (typeof (SQLiteUpdateCallback))] static void update (IntPtr puser, int type, IntPtr database, IntPtr table, Int64 rowid) { SQLite3 instance = GCHandle.FromIntPtr (puser).Target as SQLite3; @@ -974,7 +974,7 @@ namespace Mono.Data.Sqlite UnsafeNativeMethods.sqlite3_update_hook (_sql, update, GCHandle.ToIntPtr (gch)); } - [MonoTouch.MonoPInvokeCallback (typeof (SQLiteCommitCallback))] + [Mono.Util.MonoPInvokeCallback (typeof (SQLiteCommitCallback))] static int commit (IntPtr puser) { SQLite3 instance = GCHandle.FromIntPtr (puser).Target as SQLite3; @@ -990,7 +990,7 @@ namespace Mono.Data.Sqlite UnsafeNativeMethods.sqlite3_commit_hook (_sql, commit, GCHandle.ToIntPtr (gch)); } - [MonoTouch.MonoPInvokeCallback (typeof (SQLiteRollbackCallback))] + [Mono.Util.MonoPInvokeCallback (typeof (SQLiteRollbackCallback))] static void rollback (IntPtr puser) { SQLite3 instance = GCHandle.FromIntPtr (puser).Target as SQLite3; diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs index 4d9c7cad293..eda2283684d 100644 --- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs +++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteDataReader.cs @@ -555,8 +555,8 @@ namespace Mono.Data.Sqlite return GetSchemaTable(true, false); } - static bool hasColumnMetadataSupport = true; - + static bool hasColumnMetadataSupport = true; + internal DataTable GetSchemaTable(bool wantUniqueInfo, bool wantDefaultValue) { CheckClosed(); @@ -565,7 +565,9 @@ namespace Mono.Data.Sqlite DataTable tblIndexes = null; DataTable tblIndexColumns; DataRow row; +#if !MONOTOUCH string temp; +#endif string strCatalog = ""; string strTable = ""; string strColumn = ""; @@ -622,34 +624,34 @@ namespace Mono.Data.Sqlite row[SchemaTableColumn.DataType] = GetFieldType(n); row[SchemaTableOptionalColumn.IsHidden] = false; - // HACK: Prevent exploding if Sqlite was built without the SQLITE_ENABLE_COLUMN_METADATA option. - // - // This code depends on sqlite3_column_origin_name, which only exists if Sqlite was built with - // the SQLITE_ENABLE_COLUMN_METADATA option. This is not the case on iOS, MacOS or (most?) - // Androids, so we exclude it from the MONOTOUCH build, and degrade on other systems by simply - // omitting the metadata from the result. - // - // TODO: we could implement better fallbacks as proposed in - // https://bugzilla.xamarin.com/show_bug.cgi?id=2128 - // -#if !MONOTOUCH - if (hasColumnMetadataSupport) { - try { - strColumn = _command.Connection._sql.ColumnOriginalName(_activeStatement, n); - if (String.IsNullOrEmpty(strColumn) == false) row[SchemaTableColumn.BaseColumnName] = strColumn; - - row[SchemaTableColumn.IsExpression] = String.IsNullOrEmpty(strColumn); - row[SchemaTableColumn.IsAliased] = (String.Compare(GetName(n), strColumn, true, CultureInfo.InvariantCulture) != 0); - - temp = _command.Connection._sql.ColumnTableName(_activeStatement, n); - if (String.IsNullOrEmpty(temp) == false) row[SchemaTableColumn.BaseTableName] = temp; - - temp = _command.Connection._sql.ColumnDatabaseName(_activeStatement, n); - if (String.IsNullOrEmpty(temp) == false) row[SchemaTableOptionalColumn.BaseCatalogName] = temp; - } catch (EntryPointNotFoundException) { - hasColumnMetadataSupport = false; - } - } + // HACK: Prevent exploding if Sqlite was built without the SQLITE_ENABLE_COLUMN_METADATA option. + // + // This code depends on sqlite3_column_origin_name, which only exists if Sqlite was built with + // the SQLITE_ENABLE_COLUMN_METADATA option. This is not the case on iOS, MacOS or (most?) + // Androids, so we exclude it from the MONOTOUCH build, and degrade on other systems by simply + // omitting the metadata from the result. + // + // TODO: we could implement better fallbacks as proposed in + // https://bugzilla.xamarin.com/show_bug.cgi?id=2128 + // +#if !MONOTOUCH + if (hasColumnMetadataSupport) { + try { + strColumn = _command.Connection._sql.ColumnOriginalName(_activeStatement, n); + if (String.IsNullOrEmpty(strColumn) == false) row[SchemaTableColumn.BaseColumnName] = strColumn; + + row[SchemaTableColumn.IsExpression] = String.IsNullOrEmpty(strColumn); + row[SchemaTableColumn.IsAliased] = (String.Compare(GetName(n), strColumn, true, CultureInfo.InvariantCulture) != 0); + + temp = _command.Connection._sql.ColumnTableName(_activeStatement, n); + if (String.IsNullOrEmpty(temp) == false) row[SchemaTableColumn.BaseTableName] = temp; + + temp = _command.Connection._sql.ColumnDatabaseName(_activeStatement, n); + if (String.IsNullOrEmpty(temp) == false) row[SchemaTableOptionalColumn.BaseCatalogName] = temp; + } catch (EntryPointNotFoundException) { + hasColumnMetadataSupport = false; + } + } #endif string dataType = null; diff --git a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs index 6aefe804586..db1e14db02a 100644 --- a/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs +++ b/mcs/class/Mono.Data.Sqlite/Mono.Data.Sqlite_2.0/SQLiteFunction.cs @@ -528,7 +528,7 @@ namespace Mono.Data.Sqlite } #if MONOTOUCH - [MonoTouch.MonoPInvokeCallback (typeof (SQLiteCollation))] + [Mono.Util.MonoPInvokeCallback (typeof (SQLiteCollation))] internal static int collation_callback (IntPtr puser, int len1, IntPtr pv1, int len2, IntPtr pv2) { var handle = GCHandle.FromIntPtr (puser); @@ -536,7 +536,7 @@ namespace Mono.Data.Sqlite return func._CompareFunc (IntPtr.Zero, len1, pv1, len2, pv2); } - [MonoTouch.MonoPInvokeCallback (typeof (SQLiteCollation))] + [Mono.Util.MonoPInvokeCallback (typeof (SQLiteCollation))] internal static int collation_callback16 (IntPtr puser, int len1, IntPtr pv1, int len2, IntPtr pv2) { var handle = GCHandle.FromIntPtr (puser); diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index 05896473e39..dbc13f065e6 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -608,7 +608,6 @@ public class DebuggerTests } [Test] - [Category ("NotWorking")] // https://bugzilla.xamarin.com/show_bug.cgi?id=44974 public void SingleStepping () { Event e = run_until ("single_stepping"); @@ -751,6 +750,14 @@ public class DebuggerTests e = step_over (); assert_location (e, "ss_nested"); e = step_into (); + assert_location (e, "ss_nested_2"); + e = step_into (); + assert_location (e, "ss_nested_2"); + e = step_into (); + assert_location (e, "ss_nested_2"); + e = step_into (); + assert_location (e, "ss_nested"); + e = step_into (); assert_location (e, "ss_nested_1"); e = step_into (); assert_location (e, "ss_nested_1"); @@ -819,6 +826,7 @@ public class DebuggerTests req.Size = StepSize.Line; e = step_out (); + e = step_over ();//Stepout gets us to ss_recursive2_trap ();, move to ss_recursive2 (next); line assert_location (e, "ss_recursive2"); // Stack should consist of Main + single_stepping + (1 ss_recursive2 frame per loop iteration) diff --git a/mcs/class/Mono.Dynamic.Interpreter/Assembly/AssemblyInfo.cs b/mcs/class/Mono.Dynamic.Interpreter/Assembly/AssemblyInfo.cs deleted file mode 100644 index 9613d894e82..00000000000 --- a/mcs/class/Mono.Dynamic.Interpreter/Assembly/AssemblyInfo.cs +++ /dev/null @@ -1,53 +0,0 @@ -// -// AssemblyInfo.cs -// -// Authors: -// Marek Safar (marek.safar@gmail.com) -// -// Copyright (c) 2014 Xamarin Inc. (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -using System; -using System.Reflection; -using System.Resources; -using System.Security; -using System.Security.Permissions; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about the assembly - -[assembly: AssemblyTitle ("Mono.Dynamic.Interpreter.dll")] -[assembly: AssemblyDescription ("Mono.Dynamic.Interpreter.dll")] -[assembly: AssemblyDefaultAlias ("Mono.Dynamic.Interpreter.dll")] - -[assembly: AssemblyCompany (Consts.MonoCompany)] -[assembly: AssemblyProduct (Consts.MonoProduct)] -[assembly: AssemblyCopyright (Consts.MonoCopyright)] -[assembly: AssemblyVersion (Consts.FxVersion)] -[assembly: SatelliteContractVersion (Consts.FxVersion)] -[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)] -[assembly: AssemblyFileVersion (Consts.FxFileVersion)] - -[assembly: CLSCompliant (true)] - diff --git a/mcs/class/Mono.Dynamic.Interpreter/Makefile b/mcs/class/Mono.Dynamic.Interpreter/Makefile deleted file mode 100644 index 256eb7cd7e6..00000000000 --- a/mcs/class/Mono.Dynamic.Interpreter/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -thisdir = class/Mono.Dynamic.Interpreter -SUBDIRS = -include ../../build/rules.make - -LIBRARY = Mono.Dynamic.Interpreter.dll - -LIB_REFS = System -LIB_MCS_FLAGS = \ - -d:FEATURE_CORE_DLR,FEATURE_DBNULL,FEATURE_DEFAULT_PARAMETER_VALUE,FEATURE_GET_TYPE_INFO,FEATURE_VARIANCE,FEATURE_SERIALIZATION,CLR45 \ - -d:MONO_INTERPRETER \ - -delaysign -keyfile:../mono.pub - -ifdef AOT_FRIENDLY_PROFILE -mono_dynamic_interpreter_deps = $(the_libdir_base)plaincore/System.Core.dll -LIB_REFS += plaincore/System.Core -else -LIB_REFS += System.Core -endif - -include ../../build/library.make - -$(the_libdir_base)Mono.Dynamic.Interpreter.dll: $(mono_dynamic_interpreter_deps) - -$(the_libdir_base)plaincore/System.Core.dll: - (cd ../System.Core; $(MAKE) $@) - -.NOTPARALLEL: $(the_libdir_base)plaincore/System.Core.dll diff --git a/mcs/class/Mono.Dynamic.Interpreter/Mono.Dynamic.Interpreter.dll.sources b/mcs/class/Mono.Dynamic.Interpreter/Mono.Dynamic.Interpreter.dll.sources deleted file mode 100644 index 82f0d084199..00000000000 --- a/mcs/class/Mono.Dynamic.Interpreter/Mono.Dynamic.Interpreter.dll.sources +++ /dev/null @@ -1,103 +0,0 @@ -../../build/common/Consts.cs -Assembly/AssemblyInfo.cs - -../dlr/Runtime/Microsoft.Scripting/ArgumentTypeException.cs -../dlr/Runtime/Microsoft.Scripting/InvalidImplementationException.cs -../dlr/Runtime/Microsoft.Scripting/PlatformAdaptationLayer.cs -../dlr/Runtime/Microsoft.Scripting/Stubs.cs - -../dlr/Runtime/Microsoft.Scripting/Runtime/NotNullAttribute.cs -../dlr/Runtime/Microsoft.Scripting/Runtime/ParamDictionaryAttribute.cs - -../dlr/Runtime/Microsoft.Dynamic/DebugOptions.cs -../dlr/Runtime/Microsoft.Dynamic/MultiRuntimeAwareAttribute.cs -../dlr/Runtime/Microsoft.Dynamic/PerfTrack.cs - -../dlr/Runtime/Microsoft.Dynamic/Actions/Dummy.cs - -../dlr/Runtime/Microsoft.Dynamic/Ast/BinaryExpression.cs -../dlr/Runtime/Microsoft.Dynamic/Ast/ConstantExpression.cs -../dlr/Runtime/Microsoft.Dynamic/Ast/EmptyStatements.cs -../dlr/Runtime/Microsoft.Dynamic/Ast/LightLambdaExpression.cs -../dlr/Runtime/Microsoft.Dynamic/Ast/UnaryExpression.cs -../dlr/Runtime/Microsoft.Dynamic/Ast/Utils.cs - -../dlr/Runtime/Microsoft.Dynamic/Generation/CompilerHelpers.cs -../dlr/Runtime/Microsoft.Dynamic/Generation/ConstantCheck.cs -../dlr/Runtime/Microsoft.Dynamic/Generation/DelegateHelpers.cs -../dlr/Runtime/Microsoft.Dynamic/Generation/DelegateHelpers.Generated.cs - -../dlr/Runtime/Microsoft.Dynamic/Interpreter/BranchLabel.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/ILightCallSiteBinder.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/InterpretedFrame.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Interpreter.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/LightDelegateCreator.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambda.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambda.Generated.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambdaClosureVisitor.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/LocalVariables.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/LoopCompiler.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/RuntimeVariables.cs - -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/AddInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/AndInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ArithmeticInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ArrayOperations.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ComparisonInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ConstantInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.Generated.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ControlFlowInstructions.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DivInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicInstructionN.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicInstructions.Generated.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicSplatInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/EqualInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/FieldOperations.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/GreaterThanInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/GreaterThanOrEqualInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/Instruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionFactory.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LabelInfo.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LessThanInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LessThanOrEqualInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LocalAccess.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ModInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/MulInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NegateInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NotInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NotEqualInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NumericConvertInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/OrInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/StackOperations.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ShlInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ShrInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/SubInstruction.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/TypeOperations.cs -../dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/XorInstruction.cs - -../dlr/Runtime/Microsoft.Dynamic/Math/Complex64.cs - -../dlr/Runtime/Microsoft.Dynamic/Runtime/ArgumentArray.cs -../dlr/Runtime/Microsoft.Dynamic/Runtime/DynamicNull.cs -../dlr/Runtime/Microsoft.Dynamic/Runtime/ExceptionHelpers.cs -../dlr/Runtime/Microsoft.Dynamic/Runtime/ScriptingRuntimeHelpers.cs - -../dlr/Runtime/Microsoft.Dynamic/Utils/ArrayUtils.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/Assert.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/CacheDict.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/ContractUtils.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/CollectionExtensions.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/CollectionUtils.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/DynamicUtils.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/ExceptionUtils.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/ExceptionFactory.Generated.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/HybridReferenceDictionary.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/ListEqualityComparer.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/MathUtils.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/ReferenceEqualityComparer.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/ReflectionUtils.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/StringUtils.cs -../dlr/Runtime/Microsoft.Dynamic/Utils/TypeUtils.cs diff --git a/mcs/class/Mono.Security/Mono.Security.Cryptography/ARC4Managed.cs b/mcs/class/Mono.Security/Mono.Security.Cryptography/ARC4Managed.cs index 78cda036a91..dc987b05cfc 100644 --- a/mcs/class/Mono.Security/Mono.Security.Cryptography/ARC4Managed.cs +++ b/mcs/class/Mono.Security/Mono.Security.Cryptography/ARC4Managed.cs @@ -24,6 +24,8 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // +#if !MONOTOUCH && !XAMMAC + using System; using System.Globalization; using System.Security.Cryptography; @@ -199,3 +201,5 @@ namespace Mono.Security.Cryptography { } } } + +#endif \ No newline at end of file diff --git a/mcs/class/Mono.Security/aot_hybrid_Mono.Security.dll.sources b/mcs/class/Mono.Security/aot_hybrid_Mono.Security.dll.sources deleted file mode 100644 index 87eaa009cd8..00000000000 --- a/mcs/class/Mono.Security/aot_hybrid_Mono.Security.dll.sources +++ /dev/null @@ -1,5 +0,0 @@ -#include mobile_Mono.Security.dll.sources -./Mono.Security.Cryptography/ARC4Managed.cs -./Mono.Security.Cryptography/MD2Managed.cs -./Mono.Security.Cryptography/MD4Managed.cs -./Mono.Security.Cryptography/SHA224Managed.cs diff --git a/mcs/class/Mono.Security/aot_only_Mono.Security.dll.sources b/mcs/class/Mono.Security/aot_only_Mono.Security.dll.sources deleted file mode 100644 index 87eaa009cd8..00000000000 --- a/mcs/class/Mono.Security/aot_only_Mono.Security.dll.sources +++ /dev/null @@ -1,5 +0,0 @@ -#include mobile_Mono.Security.dll.sources -./Mono.Security.Cryptography/ARC4Managed.cs -./Mono.Security.Cryptography/MD2Managed.cs -./Mono.Security.Cryptography/MD4Managed.cs -./Mono.Security.Cryptography/SHA224Managed.cs diff --git a/mcs/class/Mono.Security/mobile_Mono.Security.dll.sources b/mcs/class/Mono.Security/mobile_Mono.Security.dll.sources deleted file mode 100644 index 2e938683b3a..00000000000 --- a/mcs/class/Mono.Security/mobile_Mono.Security.dll.sources +++ /dev/null @@ -1,129 +0,0 @@ -./Assembly/AssemblyInfo.cs -../../build/common/Consts.cs -../../build/common/Locale.cs -./Mono.Math/BigInteger.cs -./Mono.Math.Prime/ConfidenceFactor.cs -./Mono.Math.Prime/PrimalityTests.cs -./Mono.Math.Prime.Generator/NextPrimeFinder.cs -./Mono.Math.Prime.Generator/PrimeGeneratorBase.cs -./Mono.Math.Prime.Generator/SequentialSearchPrimeGeneratorBase.cs -./Mono.Security/ASN1.cs -./Mono.Security/ASN1Convert.cs -./Mono.Security/BitConverterLE.cs -./Mono.Security/PKCS7.cs -./Mono.Security/StrongName.cs -./Mono.Security.Authenticode/AuthenticodeBase.cs -./Mono.Security.Authenticode/AuthenticodeDeformatter.cs -./Mono.Security.Authenticode/AuthenticodeFormatter.cs -./Mono.Security.Authenticode/SoftwarePublisherCertificate.cs -./Mono.Security.Authenticode/PrivateKey.cs -./Mono.Security.Cryptography/CryptoConvert.cs -./Mono.Security.Cryptography/CryptoTools.cs -./Mono.Security.Cryptography/DHKeyGeneration.cs -./Mono.Security.Cryptography/DHParameters.cs -./Mono.Security.Cryptography/DiffieHellman.cs -./Mono.Security.Cryptography/DiffieHellmanManaged.cs -./Mono.Security.Cryptography/KeyPairPersistence.cs -./Mono.Security.Cryptography/MD2.cs -./Mono.Security.Cryptography/MD4.cs -./Mono.Security.Cryptography/PKCS1.cs -./Mono.Security.Cryptography/PKCS8.cs -./Mono.Security.Cryptography/RC4.cs -./Mono.Security.Cryptography/RSAManaged.cs -./Mono.Security.Cryptography/SHA224.cs -./Mono.Security.Cryptography/SymmetricTransform.cs -./Mono.Security.X509/PKCS12.cs -./Mono.Security.X509/X501Name.cs -./Mono.Security.X509/X509Builder.cs -./Mono.Security.X509/X509Certificate.cs -./Mono.Security.X509/X509CertificateCollection.cs -./Mono.Security.X509/X509CertificateBuilder.cs -./Mono.Security.X509/X509Chain.cs -./Mono.Security.X509/X509ChainStatusFlags.cs -./Mono.Security.X509/X509CRL.cs -./Mono.Security.X509/X509Extension.cs -./Mono.Security.X509/X509Extensions.cs -./Mono.Security.X509/X509Store.cs -./Mono.Security.X509/X509StoreManager.cs -./Mono.Security.X509/X509Stores.cs -./Mono.Security.X509/X520Attributes.cs -./Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs -./Mono.Security.X509.Extensions/BasicConstraintsExtension.cs -./Mono.Security.X509.Extensions/CRLDistributionPointsExtension.cs -./Mono.Security.X509.Extensions/CertificatePoliciesExtension.cs -./Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs -./Mono.Security.X509.Extensions/GeneralNames.cs -./Mono.Security.X509.Extensions/KeyAttributesExtension.cs -./Mono.Security.X509.Extensions/KeyUsageExtension.cs -./Mono.Security.X509.Extensions/NetscapeCertTypeExtension.cs -./Mono.Security.X509.Extensions/PrivateKeyUsagePeriodExtension.cs -./Mono.Security.X509.Extensions/SubjectAltNameExtension.cs -./Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs -./Mono.Security.Cryptography/TlsHMAC.cs -./Mono.Security.Cryptography/MD5SHA1.cs -./Mono.Security.Protocol.Tls/Alert.cs -./Mono.Security.Protocol.Tls/CipherAlgorithmType.cs -./Mono.Security.Protocol.Tls/CipherSuite.cs -./Mono.Security.Protocol.Tls/CipherSuiteCollection.cs -./Mono.Security.Protocol.Tls/CipherSuiteFactory.cs -./Mono.Security.Protocol.Tls/ClientContext.cs -./Mono.Security.Protocol.Tls/ClientRecordProtocol.cs -./Mono.Security.Protocol.Tls/ClientSessionCache.cs -./Mono.Security.Protocol.Tls/ContentType.cs -./Mono.Security.Protocol.Tls/Context.cs -./Mono.Security.Protocol.Tls/DebugHelper.cs -./Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs -./Mono.Security.Protocol.Tls/HandshakeState.cs -./Mono.Security.Protocol.Tls/HashAlgorithmType.cs -./Mono.Security.Protocol.Tls/HttpsClientStream.cs -./Mono.Security.Protocol.Tls/RecordProtocol.cs -./Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs -./Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs -./Mono.Security.Protocol.Tls/SecurityCompressionType.cs -./Mono.Security.Protocol.Tls/SecurityParameters.cs -./Mono.Security.Protocol.Tls/SecurityProtocolType.cs -./Mono.Security.Protocol.Tls/ServerContext.cs -./Mono.Security.Protocol.Tls/ServerRecordProtocol.cs -./Mono.Security.Protocol.Tls/SslClientStream.cs -./Mono.Security.Protocol.Tls/SslCipherSuite.cs -./Mono.Security.Protocol.Tls/SslHandshakeHash.cs -./Mono.Security.Protocol.Tls/SslServerStream.cs -./Mono.Security.Protocol.Tls/SslStreamBase.cs -./Mono.Security.Protocol.Tls/TlsCipherSuite.cs -./Mono.Security.Protocol.Tls/TlsClientSettings.cs -./Mono.Security.Protocol.Tls/TlsException.cs -./Mono.Security.Protocol.Tls/TlsServerSettings.cs -./Mono.Security.Protocol.Tls/TlsStream.cs -./Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs -./Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs -./Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs -./Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs -./Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs -./Mono.Xml/MiniParser.cs -./Mono.Xml/SecurityParser.cs - -./Mono.Security.Interface/BufferOffsetSize.cs -./Mono.Security.Interface/SecretParameters.cs -./Mono.Security.Interface/SecureBuffer.cs -./Mono.Security.Interface/TlsBuffer.cs -./Mono.Security.Interface/TlsMultiBuffer.cs diff --git a/mcs/class/Mono.Security/monodroid_Mono.Security.dll.sources b/mcs/class/Mono.Security/monodroid_Mono.Security.dll.sources deleted file mode 100644 index 87eaa009cd8..00000000000 --- a/mcs/class/Mono.Security/monodroid_Mono.Security.dll.sources +++ /dev/null @@ -1,5 +0,0 @@ -#include mobile_Mono.Security.dll.sources -./Mono.Security.Cryptography/ARC4Managed.cs -./Mono.Security.Cryptography/MD2Managed.cs -./Mono.Security.Cryptography/MD4Managed.cs -./Mono.Security.Cryptography/SHA224Managed.cs diff --git a/mcs/class/Mono.Security/monotouch_Mono.Security.dll.sources b/mcs/class/Mono.Security/monotouch_Mono.Security.dll.sources index 36918de7763..463682e1d99 100644 --- a/mcs/class/Mono.Security/monotouch_Mono.Security.dll.sources +++ b/mcs/class/Mono.Security/monotouch_Mono.Security.dll.sources @@ -1,3 +1,4 @@ -#include mobile_Mono.Security.dll.sources +#include Mono.Security.dll.sources ../corlib/CommonCrypto/CommonCrypto.cs ../corlib/CommonCrypto/RC4CommonCrypto.cs +Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs diff --git a/mcs/class/Mono.Security/monotouch_watch_Mono.Security.dll.sources b/mcs/class/Mono.Security/monotouch_watch_Mono.Security.dll.sources deleted file mode 100644 index 8e39387108d..00000000000 --- a/mcs/class/Mono.Security/monotouch_watch_Mono.Security.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include monotouch_Mono.Security.dll.sources diff --git a/mcs/class/Mono.Security/xammac_Mono.Security.dll.sources b/mcs/class/Mono.Security/xammac_Mono.Security.dll.sources index 698996a1d70..8e39387108d 100644 --- a/mcs/class/Mono.Security/xammac_Mono.Security.dll.sources +++ b/mcs/class/Mono.Security/xammac_Mono.Security.dll.sources @@ -1,4 +1 @@ #include monotouch_Mono.Security.dll.sources -../corlib/CommonCrypto/CommonCrypto.cs -../corlib/CommonCrypto/RC4CommonCrypto.cs - diff --git a/mcs/class/Mono.XBuild.Tasks/Mono.XBuild.Tasks-net_3_5.csproj b/mcs/class/Mono.XBuild.Tasks/Mono.XBuild.Tasks-net_3_5.csproj deleted file mode 100644 index 3ae1d8b6a2f..00000000000 --- a/mcs/class/Mono.XBuild.Tasks/Mono.XBuild.Tasks-net_3_5.csproj +++ /dev/null @@ -1,89 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {A5EB5B9E-9335-43AD-A9C7-41FDF9A52045} - Library - 1699 - ./../../class/lib/net_3_5 - True - True - - Properties - - - Mono.XBuild.Tasks - v3.5 - 512 - - - true - full - 1699 - false - DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_5 - prompt - 4 - - - pdbonly - 1699 - true - NET_1_1;NET_2_0;NET_3_5 - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - - - - - {5A00133C-6D08-48F7-A164-8B796CE6DB83} - corlib\corlib-net_2_0 - - - {1F3B168C-A4D0-44AA-B116-792D8804971F} - System\System-net_2_0-2 - - - {080698DE-8AF0-496E-9AD7-58B6C605328A} - System.XML\System.Xml-net_2_0-1 - - - - - - - diff --git a/mcs/class/Mono.XBuild.Tasks/Mono.XBuild.Tasks-tests-net_3_5.csproj b/mcs/class/Mono.XBuild.Tasks/Mono.XBuild.Tasks-tests-net_3_5.csproj deleted file mode 100644 index c800cc03528..00000000000 --- a/mcs/class/Mono.XBuild.Tasks/Mono.XBuild.Tasks-tests-net_3_5.csproj +++ /dev/null @@ -1,81 +0,0 @@ - - - - Debug - AnyCPU - 9.0.30729 - 2.0 - {8FF7B0C0-D1B4-4E21-9AF3-589587E610E3} - Library - 1699 - bin\Debug\Mono.XBuild.Tasks-tests-net_3_5 - True - False - - Properties - - - Mono.XBuild.Tasks_test_net_3_5 - v3.5 - 512 - - - true - full - 1699 - false - DEBUG;TRACE;NET_1_1;NET_2_0;NET_3_5 - prompt - 4 - - - pdbonly - 1699 - true - NET_1_1;NET_2_0;NET_3_5 - prompt - 4 - - - - false - - - - - - - - - - - - - - - - - - - - {5A00133C-6D08-48F7-A164-8B796CE6DB83} - corlib\corlib-net_2_0 - - - {A5EB5B9E-9335-43AD-A9C7-41FDF9A52045} - Mono.XBuild.Tasks\Mono.XBuild.Tasks-net_3_5 - - - - - - - diff --git a/mcs/class/Novell.Directory.Ldap/makefile.build b/mcs/class/Novell.Directory.Ldap/makefile.build deleted file mode 100755 index 99964e0337a..00000000000 --- a/mcs/class/Novell.Directory.Ldap/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/Open.snk b/mcs/class/Open.snk new file mode 100644 index 00000000000..22a3cbd253a Binary files /dev/null and b/mcs/class/Open.snk differ diff --git a/mcs/class/System.Configuration/makefile.build b/mcs/class/System.Configuration/makefile.build deleted file mode 100755 index c6f0660ad20..00000000000 --- a/mcs/class/System.Configuration/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Configuration/run-tests.bat b/mcs/class/System.Configuration/run-tests.bat deleted file mode 100644 index aca403870ce..00000000000 --- a/mcs/class/System.Configuration/run-tests.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch call all the test batches with default parameters -REM ******************************************************** -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM ******************************************************** - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -set OUTPUT_FILE_PREFIX=MonoTests.System.DirectoryServices -set RUNNING_FIXTURE=MonoTests.System.Configuration - -call run-tests.test.bat %BUILD_OPTION% %SECURE_MODE% %OUTPUT_FILE_PREFIX% %RUNNING_FIXTURE% diff --git a/mcs/class/System.Configuration/run-tests.test.bat b/mcs/class/System.Configuration/run-tests.test.bat deleted file mode 100644 index e1b1189e231..00000000000 --- a/mcs/class/System.Configuration/run-tests.test.bat +++ /dev/null @@ -1,183 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set OUTPUT_FILE_PREFIX=System_Configuration_MonoTests -set RUNNING_FIXTURE=MonoTests.System.Configuration -set TEST_SOLUTION=Test\System.Configuration.Test20.sln -set TEST_ASSEMBLY=System.Configuration.Test20.jar -set PROJECT_CONFIGURATION=Debug_Java20 - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Web.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Configuration.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -rem devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . - -@echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -@echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.Core/Makefile b/mcs/class/System.Core/Makefile index 9548ea7c89e..f0b40ac2ec4 100644 --- a/mcs/class/System.Core/Makefile +++ b/mcs/class/System.Core/Makefile @@ -8,37 +8,27 @@ REFERENCE_SOURCES_FLAGS = -d:FEATURE_PAL,PFX_LEGACY_3_5,FEATURE_NETCORE LIB_REFS = System LIB_MCS_FLAGS = $(REFERENCE_SOURCES_FLAGS) -d:INSIDE_SYSCORE -d:LIBC -unsafe -nowarn:436 TXT_RESOURCE_STRINGS = ../referencesource/System.Core/System.Core.txt +RESX_RESOURCE_STRING = \ + ../../../external/corefx/src/System.Linq.Expressions/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Linq/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Linq.Parallel/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Linq.Queryable/src/Resources/Strings.resx ifneq (2.1, $(FRAMEWORK_VERSION)) -LIB_MCS_FLAGS += -d:NET_3_5 -nowarn:1720 +LIB_MCS_FLAGS += -d:NET_3_5 endif -ifdef MOBILE_DYNAMIC -LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT -endif - -system_core_plain_libdir = $(the_libdir_base)plaincore - ifdef AOT_FRIENDLY_PROFILE extra_test_flags := -exclude:NotWorkingInterpreter -system_core_library_deps = $(the_libdir_base)Mono.Dynamic.Interpreter.dll $(system_core_plain_libdir)/System.Core.dll -LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR - -ifneq (plaincore/,$(intermediate)) -LIB_REFS += Mono.Dynamic.Interpreter -LIB_MCS_FLAGS += -d:MONO_INTERPRETER -endif - +LIB_MCS_FLAGS += -d:NO_FEATURE_STATIC_DELEGATE,FEATURE_MAKE_RUN_METHODS +else +LIB_MCS_FLAGS += -d:FEATURE_COMPILE,FEATURE_COMPILE_TO_METHODBUILDER,FEATURE_PDB_GENERATOR endif ifeq (monotouch_runtime, $(PROFILE)) LIB_MCS_FLAGS += -d:FULL_AOT_RUNTIME endif -ifeq (4, $(FRAMEWORK_VERSION_MAJOR)) -LIB_MCS_FLAGS += -d:FEATURE_CORE_DLR,FEATURE_REFEMIT,FEATURE_PDBEMIT -endif - ifneq (basic, $(PROFILE)) CLR_PROFILE := $(filter 2.0 4.0 4.5, $(FRAMEWORK_VERSION)) endif @@ -61,25 +51,9 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) include ../../build/library.make -$(the_libdir_base)System.Core.dll: $(system_core_library_deps) - -.NOTPARALLEL: $(system_core_plain_libdir)/System.Core.dll $(the_libdir_base)Mono.Dynamic.Interpreter.dll - -ifneq (plaincore/,$(intermediate)) -$(system_core_plain_libdir)/System.Core.dll: - $(MAKE) intermediate=plaincore/ $(system_core_plain_libdir)/System.Core.dll -endif - -$(the_libdir_base)Mono.Dynamic.Interpreter.dll: - (cd ../Mono.Dynamic.Interpreter; $(MAKE)) - TEST_HARNESS_EXCLUDES += $(extra_test_flags) -CLEAN_FILES = $(system_core_plain_libdir)/System.Core.dll - -ifndef intermediate ifneq ($(PROFILE),basic) csproj-local: - $(MAKE) csproj-local intermediate=plaincore/ -endif + $(MAKE) csproj-local endif diff --git a/mcs/class/System.Core/ReferenceSources/Error.cs b/mcs/class/System.Core/ReferenceSources/Error.cs deleted file mode 100644 index 58c966fdd29..00000000000 --- a/mcs/class/System.Core/ReferenceSources/Error.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; - -namespace System.Linq -{ - static class Error - { - public static ArgumentNullException ArgumentNull (string parameter) - { - return new ArgumentNullException (parameter); - } - - public static ArgumentOutOfRangeException ArgumentOutOfRange (string parameter) - { - return new ArgumentOutOfRangeException (parameter); - } - - public static ArgumentException ArgumentNotValid (string parameter) - { - return new ArgumentException (parameter); - } - - public static NotSupportedException NotSupported () - { - return new NotSupportedException (); - } - - public static InvalidOperationException NoElements () - { - return new InvalidOperationException (Strings.NoElements); - } - - public static InvalidOperationException NoMatch () - { - return new InvalidOperationException (Strings.NoMatch); - } - - public static InvalidOperationException MoreThanOneElement () - { - return new InvalidOperationException (Strings.MoreThanOneElement); - } - - public static InvalidOperationException MoreThanOneMatch () - { - return new InvalidOperationException (Strings.MoreThanOneMatch); - } - - public static ArgumentException ArgumentNotIEnumerableGeneric (object message) - { - return new ArgumentException (String.Format ("{0} is not IEnumerable<>", message)); - } - - public static InvalidOperationException NoMethodOnTypeMatchingArguments (object p0, object p1) - { - return new InvalidOperationException (Strings.NoMethodOnTypeMatchingArguments (p0, p1)); - } - - public static InvalidOperationException NoMethodOnType (object p0, object p1) - { - return new InvalidOperationException (Strings.NoMethodOnType (p0, p1)); - } - } -} \ No newline at end of file diff --git a/mcs/class/System.Core/ReferenceSources/SR.missing.cs b/mcs/class/System.Core/ReferenceSources/SR.missing.cs index 7cdf18262ae..b91bd7018c3 100644 --- a/mcs/class/System.Core/ReferenceSources/SR.missing.cs +++ b/mcs/class/System.Core/ReferenceSources/SR.missing.cs @@ -28,30 +28,6 @@ partial class SR { - public const string MoreThanOneMatch = "MoreThanOneMatch"; - public const string NoElements = "NoElements"; - public const string PLINQ_CommonEnumerator_Current_NotStarted = "PLINQ_CommonEnumerator_Current_NotStarted"; - public const string PLINQ_DisposeRequested = "PLINQ_DisposeRequested"; - public const string PLINQ_EnumerationPreviouslyFailed = "PLINQ_EnumerationPreviouslyFailed"; - public const string PLINQ_ExternalCancellationRequested = "PLINQ_ExternalCancellationRequested"; - public const string ParallelEnumerable_BinaryOpMustUseAsParallel = "ParallelEnumerable_BinaryOpMustUseAsParallel"; - public const string ParallelEnumerable_WithCancellation_TokenSourceDisposed = "ParallelEnumerable_WithCancellation_TokenSourceDisposed"; - public const string ParallelEnumerable_WithMergeOptions_InvalidOptions = "ParallelEnumerable_WithMergeOptions_InvalidOptions"; - public const string ParallelEnumerable_WithQueryExecutionMode_InvalidMode = "ParallelEnumerable_WithQueryExecutionMode_InvalidMode"; - public const string ParallelPartitionable_IncorretElementCount = "ParallelPartitionable_IncorretElementCount"; - public const string ParallelPartitionable_NullElement = "ParallelPartitionable_NullElement"; - public const string ParallelPartitionable_NullReturn = "ParallelPartitionable_NullReturn"; - public const string ParallelQuery_DuplicateDOP = "ParallelQuery_DuplicateDOP"; - public const string ParallelQuery_DuplicateExecutionMode = "The WithExecutionMode operator may be used at most once in a query."; - public const string ParallelQuery_DuplicateMergeOptions = "ParallelQuery_DuplicateMergeOptions"; - public const string ParallelQuery_DuplicateTaskScheduler = "ParallelQuery_DuplicateTaskScheduler"; - public const string ParallelQuery_DuplicateWithCancellation = "ParallelQuery_DuplicateWithCancellation"; - public const string ParallelQuery_InvalidAsOrderedCall = "AsOrdered may only be called on the result of AsParallel, ParallelEnumerable.Range, or ParallelEnumerable.Repeat."; - public const string ParallelQuery_InvalidNonGenericAsOrderedCall = "ParallelQuery_InvalidNonGenericAsOrderedCall"; - public const string ParallelQuery_PartitionerNotOrderable = "ParallelQuery_PartitionerNotOrderable"; - public const string PartitionerQueryOperator_NullPartition = "PartitionerQueryOperator_NullPartition"; - public const string PartitionerQueryOperator_NullPartitionList = "PartitionerQueryOperator_NullPartitionList"; - public const string PartitionerQueryOperator_WrongNumberOfPartitions = "PartitionerQueryOperator_WrongNumberOfPartitions"; public const string Cryptography_HashAlgorithmNameNullOrEmpty = "Cryptography_HashAlgorithmNameNullOrEmpty"; public const string NotSupported_SubclassOverride = "NotSupported_SubclassOverride"; } diff --git a/mcs/class/System.Core/ReferenceSources/Strings.cs b/mcs/class/System.Core/ReferenceSources/Strings.cs deleted file mode 100644 index bc5e1335f51..00000000000 --- a/mcs/class/System.Core/ReferenceSources/Strings.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; - -namespace System.Linq -{ - static class Strings - { - public static string EmptyEnumerable - { - get { return "EmptyEnumerable"; } - } - - public static string NoElements - { - get { return Locale.GetText ("Sequence contains no elements"); } - } - - public static string NoMatch - { - get { return Locale.GetText ("Sequence contains no matching element"); } - } - - public static string MoreThanOneElement - { - get { return Locale.GetText ("Sequence contains more than one element"); } - } - - public static string MoreThanOneMatch - { - get { return Locale.GetText ("Sequence contains more than one matching element"); } - } - - public static string NoMethodOnTypeMatchingArguments (object p0, object p1) - { - return String.Format (Locale.GetText ("No method '{0}' on type '{1}' is compatible with the supplied arguments"), p0, p1); - } - - public static string NoMethodOnType (object p0, object p1) - { - return String.Format (Locale.GetText ("No method '{0}' on type '{1}'"), p0, p1);; - } - } -} \ No newline at end of file diff --git a/mcs/class/System.Core/System.Core_test.dll.sources b/mcs/class/System.Core/System.Core_test.dll.sources index e631691981f..01ae2e35ae3 100644 --- a/mcs/class/System.Core/System.Core_test.dll.sources +++ b/mcs/class/System.Core/System.Core_test.dll.sources @@ -34,6 +34,7 @@ System.Linq.Expressions/ExpressionTest_LeftShift.cs System.Linq.Expressions/ExpressionTest_Lift.cs System.Linq.Expressions/ExpressionTest_ListBind.cs System.Linq.Expressions/ExpressionTest_ListInit.cs +System.Linq.Expressions/ExpressionTest_Loop.cs System.Linq.Expressions/ExpressionTest_MakeBinary.cs System.Linq.Expressions/ExpressionTest_MemberBind.cs System.Linq.Expressions/ExpressionTest_MemberInit.cs diff --git a/mcs/class/System.Core/System.Linq.Expressions.Interpret/LambdaCompiler.cs b/mcs/class/System.Core/System.Linq.Expressions.Interpret/LambdaCompiler.cs deleted file mode 100644 index 23d623a633f..00000000000 --- a/mcs/class/System.Core/System.Linq.Expressions.Interpret/LambdaCompiler.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// LambdaCompiler.cs: System.Linq.Expression interpreter entry point -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System.Runtime.CompilerServices; -#if MONO_INTERPRETER -using Microsoft.Scripting.Generation; -#endif - -namespace System.Linq.Expressions.Compiler -{ - static class LambdaCompiler - { - public static Delegate Compile (LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator) - { -#if MONO_INTERPRETER - return lambda.LightCompile (); -#else - throw new NotSupportedException ("System.Linq.Expression interpreter is missing"); -#endif - } - } -} \ No newline at end of file diff --git a/mcs/class/System.Core/System.Security.Cryptography/SHA256CryptoServiceProvider.cs b/mcs/class/System.Core/System.Security.Cryptography/SHA256CryptoServiceProvider.cs index 9012c58b216..197b00f9d94 100644 --- a/mcs/class/System.Core/System.Security.Cryptography/SHA256CryptoServiceProvider.cs +++ b/mcs/class/System.Core/System.Security.Cryptography/SHA256CryptoServiceProvider.cs @@ -29,8 +29,6 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if !MOBILE - namespace System.Security.Cryptography { // this is a wrapper around SHA256Managed @@ -78,5 +76,3 @@ namespace System.Security.Cryptography { } } } - -#endif diff --git a/mcs/class/System.Core/System.Security.Cryptography/SHA384CryptoServiceProvider.cs b/mcs/class/System.Core/System.Security.Cryptography/SHA384CryptoServiceProvider.cs index af0abc744bf..2f4aaf8fbeb 100644 --- a/mcs/class/System.Core/System.Security.Cryptography/SHA384CryptoServiceProvider.cs +++ b/mcs/class/System.Core/System.Security.Cryptography/SHA384CryptoServiceProvider.cs @@ -29,8 +29,6 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if !MOBILE - namespace System.Security.Cryptography { // this is a wrapper around SHA384Managed @@ -78,5 +76,3 @@ namespace System.Security.Cryptography { } } } - -#endif diff --git a/mcs/class/System.Core/System.Security.Cryptography/SHA512CryptoServiceProvider.cs b/mcs/class/System.Core/System.Security.Cryptography/SHA512CryptoServiceProvider.cs index 9425a94e0c0..95b7cd4f439 100644 --- a/mcs/class/System.Core/System.Security.Cryptography/SHA512CryptoServiceProvider.cs +++ b/mcs/class/System.Core/System.Security.Cryptography/SHA512CryptoServiceProvider.cs @@ -29,8 +29,6 @@ // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // -#if !MOBILE - namespace System.Security.Cryptography { // this is a wrapper around SHA512Managed @@ -78,5 +76,3 @@ namespace System.Security.Cryptography { } } } - -#endif diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Add.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Add.cs index b13a6499a9b..ced567853d4 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Add.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Add.cs @@ -183,7 +183,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void AddTestNullable () { var a = Expression.Parameter (typeof (int?), "a"); @@ -238,7 +237,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedAddLifted () { var l = Expression.Parameter (typeof (Slot?), "l"); @@ -378,7 +376,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void AddLiftedDecimals () { var l = Expression.Parameter (typeof (decimal?), "l"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_AndAlso.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_AndAlso.cs index 01f3cbf7b6f..89a83eaec73 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_AndAlso.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_AndAlso.cs @@ -143,7 +143,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void AndAlsoTestNullable () { var a = Expression.Parameter (typeof (bool?), "a"); @@ -187,7 +186,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void AndAlsoNullableBoolItem () { var i = Expression.Parameter (typeof (Item), "i"); @@ -233,7 +231,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedAndAlso () { var l = Expression.Parameter (typeof (Slot), "l"); @@ -254,7 +251,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedAndAlsoShortCircuit () { var i = Expression.Parameter (typeof (Item), "i"); @@ -270,7 +266,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=350228 public void UserDefinedLiftedAndAlsoShortCircuit () { @@ -287,7 +282,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedAndAlsoLiftedToNull () { var l = Expression.Parameter (typeof (Slot?), "l"); @@ -366,7 +360,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] // from https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=350487 - [Category ("NotWorkingInterpreter")] public void Connect350487 () { var p = Expression.Parameter (typeof (B), "b"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Bind.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Bind.cs index 3fd2b598221..177e6280089 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Bind.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Bind.cs @@ -145,7 +145,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void BindValueTypes () { var i = Expression.Parameter (typeof (int), "i"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs index 85e011bc277..4fca0b34f42 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Call.cs @@ -224,7 +224,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void CallMethodOnStruct () { var param = Expression.Parameter (typeof (EineStrukt), "s"); @@ -272,7 +271,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void CallStaticMethodWithRefParameter () { var p = Expression.Parameter (typeof (int), "i"); @@ -284,7 +282,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void CallStaticMethodWithRefParameterAndOtherParameter () { var i = Expression.Parameter (typeof (int), "i"); @@ -296,6 +293,7 @@ namespace MonoTests.System.Linq.Expressions { Assert.AreEqual ("foo42", lamda (42, "foo")); } +#if !FULL_AOT_RUNTIME [Test] public void CallDynamicMethod_ToString () { @@ -325,6 +323,7 @@ namespace MonoTests.System.Linq.Expressions { var lambda = Expression.Lambda> (e, i).Compile (); Assert.AreEqual (42, lambda (42)); } +#endif public static int Bang (Expression i) { @@ -339,7 +338,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void Connect282729 () { // test from https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=282729 @@ -366,8 +364,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorking")] - [Category ("NotWorkingInterpreter")] public void Connect290278 () { // test from https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=290278 @@ -390,7 +386,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void Connect297597 () { // test from https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=297597 @@ -408,6 +403,7 @@ namespace MonoTests.System.Linq.Expressions { [Test] [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=319190 + [Category ("NotWorkingInterpreter")] public void Connect319190 () { var lambda = Expression.Lambda> ( @@ -513,7 +509,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void CallNullableGetValueOrDefault () // #568989 { var value = Expression.Parameter (typeof (int?), "value"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Coalesce.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Coalesce.cs index e9c43fe4da1..2ab978d5187 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Coalesce.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Coalesce.cs @@ -87,7 +87,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void CoalesceNullableInt () { var a = Expression.Parameter (typeof (int?), "a"); @@ -116,7 +115,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void CoalesceNullableToNonNullable () { var a = Expression.Parameter (typeof (int?), "a"); @@ -134,7 +132,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=349822 public void CoalesceUserDefinedConversion () { @@ -166,9 +163,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - // #12987 - [Category ("MobileNotWorking")] - [Category ("NotWorkingInterpreter")] public void CoalesceNullableSlotIntoInteger () { var s = Expression.Parameter (typeof (Slot?), "s"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Convert.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Convert.cs index d2cbd1013ab..168b7a5892f 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Convert.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Convert.cs @@ -71,7 +71,7 @@ namespace MonoTests.System.Linq.Expressions { var c = Expression.Convert ( Expression.Constant (null, typeof (Bar)), typeof (Foo)); - Assert.AreEqual ("Convert(null)", c.ToString ()); + Assert.AreEqual ("Convert(null, Foo)", c.ToString ()); } [Test] @@ -94,7 +94,7 @@ namespace MonoTests.System.Linq.Expressions { Expression.Constant (2, typeof (int)), typeof (long)); Assert.AreEqual (ExpressionType.ConvertChecked, c.NodeType); - Assert.AreEqual ("ConvertChecked(2)", c.ToString ()); + Assert.AreEqual ("ConvertChecked(2, Int64)", c.ToString ()); } [Test] @@ -359,7 +359,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void CompileNullableToNotNullable () { var p = Expression.Parameter (typeof (int?), "i"); @@ -452,7 +451,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void ConvertImplicitToShortToNullableInt () { var a = Expression.Parameter (typeof (ImplicitToShort?), "a"); @@ -478,7 +476,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void NullableImplicitToShort () { var i = Expression.Parameter (typeof (ImplicitToShort?), "i"); @@ -514,7 +511,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void ConvertNullableULongToNullableDecimal () { var p = Expression.Parameter (typeof (ulong?), "l"); @@ -559,7 +555,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void ConvertNullableImplictToIntToNullableLong () { var i = Expression.Parameter (typeof (ImplicitToInt?), "i"); @@ -577,7 +572,6 @@ namespace MonoTests.System.Linq.Expressions { [Test] [ExpectedException (typeof (InvalidOperationException))] - [Category ("NotWorking")] public void ConvertNullableIntToStringWithConvertMethod () { Expression.Convert ( diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs index 5364c0fe3ab..d483cf778b6 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Equal.cs @@ -248,7 +248,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedEqualLifted () { var l = Expression.Parameter (typeof (Slot?), "l"); @@ -270,7 +269,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedEqualLiftedToNull () { var l = Expression.Parameter (typeof (Slot?), "l"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_GreaterThan.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_GreaterThan.cs index 06aaa4ab66f..bc21ff6fe0e 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_GreaterThan.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_GreaterThan.cs @@ -191,7 +191,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedGreaterThanLifted () { var l = Expression.Parameter (typeof (Slot?), "l"); @@ -214,7 +213,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedGreaterThanLiftedToNull () { var l = Expression.Parameter (typeof (Slot?), "l"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_GreaterThanOrEqual.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_GreaterThanOrEqual.cs index 96220fdc948..bde5f1fa701 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_GreaterThanOrEqual.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_GreaterThanOrEqual.cs @@ -165,7 +165,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedGreaterThanOrEqualLifted () { var l = Expression.Parameter (typeof (Slot?), "l"); @@ -188,7 +187,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedGreaterThanOrEqualLiftedToNull () { var l = Expression.Parameter (typeof (Slot?), "l"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Invoke.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Invoke.cs index f9839433400..afbb4bcce4f 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Invoke.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Invoke.cs @@ -130,7 +130,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void InvokeWithExpressionLambdaAsArguments () { var p = Expression.Parameter (typeof (string), "s"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Lambda.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Lambda.cs index 07b8f038182..e2f3260f3b3 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Lambda.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Lambda.cs @@ -194,7 +194,7 @@ namespace MonoTests.System.Linq.Expressions { var l = Expression.Lambda ("foo".ToConstant ()); - Assert.AreEqual (typeof (Expression>), l.GetType ()); + Assert.AreEqual (typeof (Func), l.Type); } public static int CallDelegate (Func e) diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_LessThan.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_LessThan.cs index b9285ecbf9d..7a24ea29111 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_LessThan.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_LessThan.cs @@ -165,7 +165,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedLessThanLifted () { var l = Expression.Parameter (typeof (Slot?), "l"); @@ -188,7 +187,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedLessThanLiftedToNull () { var l = Expression.Parameter (typeof (Slot?), "l"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_LessThanOrEqual.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_LessThanOrEqual.cs index 5e89cd0e194..da9473bee12 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_LessThanOrEqual.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_LessThanOrEqual.cs @@ -165,7 +165,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedLessThanOrEqualLifted () { var l = Expression.Parameter (typeof (Slot?), "l"); @@ -188,7 +187,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedLessThanOrEqualLiftedToNull () { var l = Expression.Parameter (typeof (Slot?), "l"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_ListBind.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_ListBind.cs index 7800818d019..70b75148d7f 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_ListBind.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_ListBind.cs @@ -99,7 +99,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void CompiledListBinding () { var add = typeof (List).GetMethod ("Add"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_ListInit.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_ListInit.cs index 4e4425b2772..4abca78cc2b 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_ListInit.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_ListInit.cs @@ -126,7 +126,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void CompileListOfStringsInit () { var add = typeof (List).GetMethod ("Add"); @@ -146,7 +145,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] [Category ("NotDotNet")] public void CompileArrayListOfStringsInit () { diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Loop.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Loop.cs new file mode 100644 index 00000000000..1b254ef457a --- /dev/null +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Loop.cs @@ -0,0 +1,81 @@ +// +// ExpressionTest_Loop.cs +// +// Author: +// Marek Safar (marek.safar@gmail.com) +// +// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + +using System; +using System.Reflection; +using System.Linq; +using System.Linq.Expressions; + +using NUnit.Framework; + +namespace MonoTests.System.Linq.Expressions { + + [TestFixture] + public class ExpressionTest_Loop { + + [Test] + public void ComplexTest () + { + var breakLabel = Expression.Label ("LoopBreak"); + var counter = Expression.Variable (typeof (int), "counter"); + + var l = Expression.Block (new[] { counter }, + Expression.Assign (counter, Expression.Constant (-1)), + Expression.Loop ( + Expression.Block (Expression.IfThenElse ( + Expression.Equal (Expression.Assign (counter, Expression.Add (counter, Expression.Constant (1))), Expression.Constant (1000)), + Expression.Block (Expression.Break (breakLabel)), + Expression.Call (null, typeof (Console).GetMethod ("WriteLine", new Type[] { typeof (int) }), counter) + )), + breakLabel) + ); + + var res = Expression.Lambda (l).Compile (); + } + + [Test] + public void ComplexTest_2 () + { + var breakLabel = Expression.Label ("LoopBreak"); + var counter = Expression.Variable (typeof (int), "counter"); + + var l = Expression.Block (new[] { counter }, + Expression.Assign (counter, Expression.Constant(-1)), + Expression.Loop ( + Expression.IfThenElse ( + Expression.Equal (Expression.Assign (counter, Expression.Add (counter, Expression.Constant (1))), Expression.Constant (1000)), + Expression.Break (breakLabel), + Expression.Call (null, typeof (Console).GetMethod ("WriteLine", new Type[] { typeof (int) }), counter) + ), + breakLabel) + ); + + var res = Expression.Lambda (l).Compile (); + } + } +} diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_MemberBind.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_MemberBind.cs index 1592f02c4d3..0512378e24c 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_MemberBind.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_MemberBind.cs @@ -139,7 +139,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void CompiledMemberBinding () { var getfoo = Expression.Lambda> ( diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_MemberInit.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_MemberInit.cs index 292931fe0c5..73921f1b448 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_MemberInit.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_MemberInit.cs @@ -93,7 +93,6 @@ namespace MonoTests.System.Linq.Expressions { } [Test] - [Category ("NotWorkingInterpreter")] public void CompiledInit () { var i = Expression.Lambda> ( diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Negate.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Negate.cs index 6eefbf93b44..9a5dcb9a7bc 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Negate.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Negate.cs @@ -155,7 +155,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedNotNullableNegateNullable () { var s = Expression.Parameter (typeof (Slot?), "s"); @@ -297,7 +296,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void NegateLiftedDecimal () { var d = Expression.Parameter (typeof (decimal?), "l"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Not.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Not.cs index 3dc4401d729..3a8f86e1f89 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Not.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Not.cs @@ -163,7 +163,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedNotNullable () { var s = Expression.Parameter (typeof (Slot?), "s"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_OrElse.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_OrElse.cs index 44e89e185c2..17cac44c87f 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_OrElse.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_OrElse.cs @@ -173,7 +173,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void OrElseTestNullable () { var a = Expression.Parameter (typeof (bool?), "a"); @@ -217,7 +216,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void OrElseNullableBoolItem () { var i = Expression.Parameter (typeof (Item), "i"); @@ -258,7 +256,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedOrElse () { var l = Expression.Parameter (typeof (Slot), "l"); @@ -276,8 +273,8 @@ namespace MonoTests.System.Linq.Expressions Assert.AreEqual (new Slot (64), orelse (new Slot (64), new Slot (64))); Assert.AreEqual (new Slot (32), orelse (new Slot (32), new Slot (64))); } + [Test] - [Category ("NotWorkingInterpreter")] public void UserDefinedOrElseShortCircuit () { var i = Expression.Parameter (typeof (Item), "i"); @@ -294,7 +291,6 @@ namespace MonoTests.System.Linq.Expressions [Test] [Category ("NotDotNet")] // https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=350228 - [Category ("NotWorkingInterpreter")] public void UserDefinedLiftedOrElseShortCircuit () { var i = Expression.Parameter (typeof (Item), "i"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Power.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Power.cs index a161b482a1a..1e7ec15dd2c 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Power.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Power.cs @@ -73,7 +73,7 @@ namespace MonoTests.System.Linq.Expressions Assert.AreEqual (ExpressionType.Power, p.NodeType, "Power#01"); Assert.AreEqual (typeof (double), p.Type, "Add#02"); - Assert.AreEqual ("(1 ^ 2)", p.ToString ()); + Assert.AreEqual ("(1 ** 2)", p.ToString ()); } [Test] @@ -90,7 +90,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void NullablePower () { var a = Expression.Parameter (typeof (double?), "a"); diff --git a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Quote.cs b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Quote.cs index d32918d75b2..0bb1381e0b6 100644 --- a/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Quote.cs +++ b/mcs/class/System.Core/Test/System.Linq.Expressions/ExpressionTest_Quote.cs @@ -58,7 +58,6 @@ namespace MonoTests.System.Linq.Expressions } [Test] - [Category ("NotWorkingInterpreter")] public void ParameterInQuotedExpression () // #550722 { // Expression>>> e = (string s) => () => s; diff --git a/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs b/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs index ceef4c02157..67d1a5df1f7 100644 --- a/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs +++ b/mcs/class/System.Core/Test/System.Linq/EnumerableFixture.cs @@ -2166,14 +2166,14 @@ namespace MonoTests.System.Linq // then check that the source enumerator will be disposed // by the time the test is torn. // - +/* var disposed = false; var enumerated = false; reader.Disposed += delegate { disposed = true; }; reader.Enumerated += delegate { enumerated = true; }; AssertionHandler assertion = () => Assert.That (!enumerated || disposed, Is.True, "Enumerator not disposed."); tearDownAssertions = (AssertionHandler) Delegate.Combine (tearDownAssertions, assertion); - +*/ return reader; } } diff --git a/mcs/class/System.Core/aot_hybrid_System.Core.dll.sources b/mcs/class/System.Core/aot_hybrid_System.Core.dll.sources deleted file mode 100644 index 11a92dbb1d2..00000000000 --- a/mcs/class/System.Core/aot_hybrid_System.Core.dll.sources +++ /dev/null @@ -1,17 +0,0 @@ -#include common_System.Core.dll.sources -#include dynamic_System.Core.dll.sources - -System.Security.Cryptography/AesCryptoServiceProvider.cs -System.Security.Cryptography/AesTransform.cs -System.Security.Cryptography/MD5Cng.cs -System.Security.Cryptography/SHA1Cng.cs -System.Security.Cryptography/SHA256Cng.cs -System.Security.Cryptography/SHA256CryptoServiceProvider.cs -System.Security.Cryptography/SHA384Cng.cs -System.Security.Cryptography/SHA384CryptoServiceProvider.cs -System.Security.Cryptography/SHA512Cng.cs -System.Security.Cryptography/SHA512CryptoServiceProvider.cs - -../referencesource/System.Core/System/Security/Cryptography/AesManaged.cs -../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs -../referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs diff --git a/mcs/class/System.Core/aot_only_System.Core.dll.sources b/mcs/class/System.Core/aot_only_System.Core.dll.sources deleted file mode 100644 index 8b8fef0e40e..00000000000 --- a/mcs/class/System.Core/aot_only_System.Core.dll.sources +++ /dev/null @@ -1,17 +0,0 @@ -#include common_System.Core.dll.sources -#include interpreter_System.Core.dll.sources - -System.Security.Cryptography/AesCryptoServiceProvider.cs -System.Security.Cryptography/AesTransform.cs -System.Security.Cryptography/MD5Cng.cs -System.Security.Cryptography/SHA1Cng.cs -System.Security.Cryptography/SHA256Cng.cs -System.Security.Cryptography/SHA256CryptoServiceProvider.cs -System.Security.Cryptography/SHA384Cng.cs -System.Security.Cryptography/SHA384CryptoServiceProvider.cs -System.Security.Cryptography/SHA512Cng.cs -System.Security.Cryptography/SHA512CryptoServiceProvider.cs - -../referencesource/System.Core/System/Security/Cryptography/AesManaged.cs -../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs -../referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs diff --git a/mcs/class/System.Core/aot_only_System.Core_test.dll.exclude.sources b/mcs/class/System.Core/aot_only_System.Core_test.dll.exclude.sources deleted file mode 100644 index f98bf051bef..00000000000 --- a/mcs/class/System.Core/aot_only_System.Core_test.dll.exclude.sources +++ /dev/null @@ -1 +0,0 @@ -System.IO.Pipes/PipeSecurityTest.cs diff --git a/mcs/class/System.Core/aot_only_System.Core_test.dll.sources b/mcs/class/System.Core/aot_only_System.Core_test.dll.sources deleted file mode 100644 index 33e2a105847..00000000000 --- a/mcs/class/System.Core/aot_only_System.Core_test.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include System.Core_test.dll.sources diff --git a/mcs/class/System.Core/common_System.Core.dll.sources b/mcs/class/System.Core/common_System.Core.dll.sources index dd5aa084c11..004f2f31c29 100644 --- a/mcs/class/System.Core/common_System.Core.dll.sources +++ b/mcs/class/System.Core/common_System.Core.dll.sources @@ -34,13 +34,10 @@ System.IO.Pipes/PipeTransmissionMode.cs ReferenceSources/SR.cs ReferenceSources/SR.missing.cs -ReferenceSources/Error.cs -ReferenceSources/Strings.cs -../referencesource/System.Core/Microsoft/Scripting/Ast/DynamicExpression.cs -../referencesource/System.Core/Microsoft/Scripting/Ast/ExpressionVisitor.cs -../referencesource/System.Core/Microsoft/Scripting/Ast/IArgumentProvider.cs -../referencesource/System.Core/Microsoft/Scripting/Ast/IDynamicExpression.cs +corefx/LambdaExpression.cs +corefx/SR.cs +corefx/SR.missing.cs ../referencesource/System.Core/Microsoft/Scripting/Utils/Action.cs ../referencesource/System.Core/Microsoft/Scripting/Utils/Extension.cs @@ -64,148 +61,6 @@ ReferenceSources/Strings.cs ../referencesource/System.Core/System/IO/MemoryMappedFiles/MemoryMappedViewAccessor.cs ../referencesource/System.Core/System/IO/MemoryMappedFiles/MemoryMappedViewStream.cs -../referencesource/System.Core/System/Linq/Enumerable.cs -../referencesource/System.Core/System/Linq/IQueryable.cs -../referencesource/System.Core/System/Linq/SequenceQuery.cs -../referencesource/System.Core/System/Linq/TypeHelper.cs -../referencesource/System.Core/System/Linq/Expressions/ExpressionVisitor.cs - -../referencesource/System.Core/System/Linq/ParallelEnumerable.cs -../referencesource/System.Core/System/Linq/ParallelMergeOptions.cs -../referencesource/System.Core/System/Linq/ParallelExecutionMode.cs -../referencesource/System.Core/System/Linq/Parallel/Channels/AsynchronousChannel.cs -../referencesource/System.Core/System/Linq/Parallel/Channels/SynchronousChannel.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/AggregationMinMaxHelpers.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/EmptyEnumerable.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/EnumerableWrapperWeakToStrong.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/IParallelPartitionable.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/OrderedParallelQuery.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/ParallelEnumerableWrapper.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/ParallelQuery.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/QueryAggregationOptions.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/RangeEnumerable.cs -../referencesource/System.Core/System/Linq/Parallel/Enumerables/RepeatEnumerable.cs -../referencesource/System.Core/System/Linq/Parallel/Merging/ArrayMergeHelper.cs -../referencesource/System.Core/System/Linq/Parallel/Merging/AsynchronousChannelMergeEnumerator.cs -../referencesource/System.Core/System/Linq/Parallel/Merging/DefaultMergeHelper.cs -../referencesource/System.Core/System/Linq/Parallel/Merging/IMergeHelper.cs -../referencesource/System.Core/System/Linq/Parallel/Merging/MergeEnumerator.cs -../referencesource/System.Core/System/Linq/Parallel/Merging/MergeExecutor.cs -../referencesource/System.Core/System/Linq/Parallel/Merging/OrderPreservingMergeHelper.cs -../referencesource/System.Core/System/Linq/Parallel/Merging/OrderPreservingPipeliningMergeHelper.cs -../referencesource/System.Core/System/Linq/Parallel/Merging/SynchronousChannelMergeEnumerator.cs -../referencesource/System.Core/System/Linq/Parallel/Partitioning/HashRepartitionEnumerator.cs -../referencesource/System.Core/System/Linq/Parallel/Partitioning/HashRepartitionStream.cs -../referencesource/System.Core/System/Linq/Parallel/Partitioning/IPartitionedStreamRecipient.cs -../referencesource/System.Core/System/Linq/Parallel/Partitioning/OrderedHashRepartitionEnumerator.cs -../referencesource/System.Core/System/Linq/Parallel/Partitioning/OrderedHashRepartitionStream.cs -../referencesource/System.Core/System/Linq/Parallel/Partitioning/PartitionedDataSource.cs -../referencesource/System.Core/System/Linq/Parallel/Partitioning/PartitionedStream.cs -../referencesource/System.Core/System/Linq/Parallel/Partitioning/UnorderedHashRepartitionStream.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/AssociativeAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/ExceptQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/GroupJoinQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/HashJoinQueryOperatorEnumerator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/IntersectQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/JoinQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/UnionQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Binary/ZipQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/BinaryQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/CountAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/DecimalAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/DecimalMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/DecimalSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/DoubleAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/DoubleMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/DoubleSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/FloatAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/FloatMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/FloatSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/InlinedAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/InlinedAggregationOperatorEnumerator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/IntAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/IntMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/IntSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/LongAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/LongCountAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/LongMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/LongSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableDecimalAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableDecimalMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableDecimalSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableDoubleAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableDoubleMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableDoubleSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableFloatAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableFloatMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableFloatSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableIntAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableIntMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableIntSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableLongAverageAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableLongMinMaxAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Inlined/NullableLongSumAggregationOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/ListQueryResults.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Options/OrderingQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Options/QueryExecutionOption.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/OrdinalIndexState.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/PartitionedStreamMerger.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/PartitionerQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/QueryOpeningEnumerator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/QueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/QueryOperatorEnumerator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/QueryResults.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/QuerySettings.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/ScanQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/AnyAllSearchOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ConcatQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ContainsSearchOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/DefaultIfEmptyQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/DistinctQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ElementAtQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/FirstQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ForAllOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/GroupByQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/IndexedSelectQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/IndexedWhereQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/LastQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/ReverseQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/SelectManyQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/SelectQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/SingleQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/TakeOrSkipQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/TakeOrSkipWhileQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/Unary/WhereQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/QueryOperators/UnaryQueryOperator.cs -../referencesource/System.Core/System/Linq/Parallel/Scheduling/CancellationState.cs -../referencesource/System.Core/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs -../referencesource/System.Core/System/Linq/Parallel/Scheduling/OrderPreservingSpoolingTask.cs -../referencesource/System.Core/System/Linq/Parallel/Scheduling/QueryLifecycle.cs -../referencesource/System.Core/System/Linq/Parallel/Scheduling/QueryTask.cs -../referencesource/System.Core/System/Linq/Parallel/Scheduling/QueryTaskGroupState.cs -../referencesource/System.Core/System/Linq/Parallel/Scheduling/Scheduling.cs -../referencesource/System.Core/System/Linq/Parallel/Scheduling/SpoolingTask.cs -../referencesource/System.Core/System/Linq/Parallel/Scheduling/SpoolingTaskBase.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/CancellableEnumerable.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/ExceptionAggregator.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/ExchangeUtilities.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/FixedMaxHeap.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/GrowingArray.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/HashLookup.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/IntValueEvent.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/ListChunk.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/Lookup.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/Pair.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/PairComparer.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/ReverseComparer.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/Shared.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/Sorting.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/TraceHelpers.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/Util.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/Wrapper.cs -../referencesource/System.Core/System/Linq/Parallel/Utils/WrapperEqualityComparer.cs - ../referencesource/System.Core/System/Runtime/CompilerServices/DynamicAttribute.cs ../referencesource/System.Core/System/Runtime/CompilerServices/ExecutionScope.cs @@ -234,3 +89,205 @@ System.Runtime.InteropServices/ComAwareEventInfo.cs System.Security.Cryptography/ECCurve.cs System.Security.Cryptography/ECPoint.cs System.Security.Cryptography/ECParameters.cs +System.Security.Cryptography/SHA256CryptoServiceProvider.cs +System.Security.Cryptography/SHA384CryptoServiceProvider.cs +System.Security.Cryptography/SHA512CryptoServiceProvider.cs + + +../../../external/corefx/src/System.Linq/src/System/Linq/*.cs + +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/*.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/CachedReflectionInfo.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/CollectionExtensions.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/EmptyReadOnlyCollection.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/ExpressionUtils.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/ExpressionVisitorUtils.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/ListArgumentProvider.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/ListParameterProvider.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeUtils.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/TypeExtensions.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/IQueryable.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/*.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Common/ArrayBuilderExtensions.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Common/ConstantCheck.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/DelegateHelpers.Generated.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/DelegateHelpers.netstandard1.7.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/HoistedLocals.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/TypeInfoExtensions.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSite.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSiteBinder.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSiteHelpers.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/CallSiteOps.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/Closure.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/DebugInfoGenerator.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/IRuntimeVariables.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/ReadOnlyCollectionBuilder.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/RuleCache.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/RuntimeOps.ExpressionQuoter.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/RuntimeOps.RuntimeVariableList.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/RuntimeOps.MergedRuntimeVariables.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/RuntimeOps.RuntimeVariables.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Runtime/CompilerServices/TrueReadOnlyCollection.cs + +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/ParallelEnumerable.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/ParallelExecutionMode.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/ParallelMergeOptions.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Channels/AsynchronousChannel.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Channels/SynchronousChannel.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/AggregationMinMaxHelpers.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/EmptyEnumerable.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/EnumerableWrapperWeakToStrong.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/IParallelPartitionable.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/OrderedParallelQuery.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/ParallelEnumerableWrapper.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/ParallelQuery.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/QueryAggregationOptions.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/RangeEnumerable.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Enumerables/RepeatEnumerable.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Helpers.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/ArrayMergeHelper.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/AsynchronousChannelMergeEnumerator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/DefaultMergeHelper.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/IMergeHelper.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/MergeEnumerator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/MergeExecutor.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/OrderPreservingMergeHelper.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/OrderPreservingPipeliningMergeHelper.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Merging/SynchronousChannelMergeEnumerator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Partitioning/HashRepartitionEnumerator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Partitioning/HashRepartitionStream.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Partitioning/IPartitionedStreamRecipient.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Partitioning/OrderedHashRepartitionEnumerator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Partitioning/OrderedHashRepartitionStream.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Partitioning/PartitionedDataSource.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Partitioning/PartitionedStream.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Partitioning/UnorderedHashRepartitionStream.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/AssociativeAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Binary/ConcatQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Binary/ExceptQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Binary/GroupJoinQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Binary/HashJoinQueryOperatorEnumerator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Binary/IntersectQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Binary/JoinQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Binary/UnionQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Binary/ZipQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/BinaryQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/CountAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/DecimalAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/DecimalMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/DecimalSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/DoubleAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/DoubleMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/DoubleSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/FloatAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/FloatMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/FloatSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/InlinedAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/InlinedAggregationOperatorEnumerator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/IntAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/IntMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/IntSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/LongAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/LongCountAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/LongMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/LongSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableDecimalAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableDecimalMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableDecimalSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableDoubleAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableDoubleMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableDoubleSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableFloatAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableFloatMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableFloatSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableIntAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableIntMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableIntSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableLongAverageAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableLongMinMaxAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Inlined/NullableLongSumAggregationOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/ListQueryResults.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Options/OrderingQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Options/QueryExecutionOption.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/OrdinalIndexState.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/PartitionedStreamMerger.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/PartitionerQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/QueryOpeningEnumerator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/QueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/QueryOperatorEnumerator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/QueryResults.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/QuerySettings.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/ScanQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/AnyAllSearchOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/ContainsSearchOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/DefaultIfEmptyQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/DistinctQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/ElementAtQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/FirstQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/ForAllOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/GroupByQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/IndexedSelectQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/IndexedWhereQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/LastQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/ReverseQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/SelectManyQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/SelectQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/SingleQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/SortQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/TakeOrSkipQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/TakeOrSkipWhileQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/Unary/WhereQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/QueryOperators/UnaryQueryOperator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/CancellationState.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingPipeliningSpoolingTask.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/OrderPreservingSpoolingTask.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/QueryLifecycle.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/QueryTask.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/QueryTaskGroupState.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/Scheduling.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/SpoolingTask.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Scheduling/SpoolingTaskBase.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/CancellableEnumerable.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/ExceptionAggregator.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/ExchangeUtilities.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/FixedMaxHeap.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/GrowingArray.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/HashLookup.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/IntValueEvent.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/ListChunk.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Lookup.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Pair.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/PairComparer.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/PLINQETWProvider.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/ReverseComparer.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Shared.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Sorting.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/TraceHelpers.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Util.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/Wrapper.cs +../../../external/corefx/src/System.Linq.Parallel/src/System/Linq/Parallel/Utils/WrapperEqualityComparer.cs + +../../../external/corefx/src/System.Linq.Queryable/src/System/Linq/CachedReflection.cs +../../../external/corefx/src/System.Linq.Queryable/src/System/Linq/EnumerableExecutor.cs +../../../external/corefx/src/System.Linq.Queryable/src/System/Linq/EnumerableQuery.cs +../../../external/corefx/src/System.Linq.Queryable/src/System/Linq/EnumerableRewriter.cs +../../../external/corefx/src/System.Linq.Queryable/src/System/Linq/Error.cs +../../../external/corefx/src/System.Linq.Queryable/src/System/Linq/Queryable.cs +../../../external/corefx/src/System.Linq.Queryable/src/System/Linq/Strings.cs +../../../external/corefx/src/System.Linq.Queryable/src/System/Linq/TypeHelper.cs + +../../../external/corefx/src/Common/src/System/Collections/Generic/ArrayBuilder.cs +../../../external/corefx/src/Common/src/System/Collections/Generic/EnumerableHelpers.cs +../../../external/corefx/src/Common/src/System/Collections/Generic/LargeArrayBuilder.cs + +../../../external/corefx/src/Common/src/System/Dynamic/Utils/CacheDict.cs +../../../external/corefx/src/Common/src/System/Dynamic/Utils/ContractUtils.cs +../../../external/corefx/src/Common/src/System/Dynamic/Utils/ContractUtils.RequiresArrayRange.cs +../../../external/corefx/src/Common/src/System/Dynamic/Utils/Error.cs +../../../external/corefx/src/Common/src/System/Dynamic/Utils/ExpressionUtils.cs +../../../external/corefx/src/Common/src/System/Dynamic/Utils/Strings.cs +../../../external/corefx/src/Common/src/System/Dynamic/Utils/TypeExtensions.cs +../../../external/corefx/src/Common/src/System/Dynamic/Utils/TypeUtils.cs + +../../../external/corefx/src/Common/src/System/Linq/Expressions/Compiler/DelegateHelpers.cs +../../../external/corefx/src/Common/src/System/Linq/Expressions/Compiler/DelegateHelpers.Generated.cs diff --git a/mcs/class/System.Core/corefx/LambdaExpression.cs b/mcs/class/System.Core/corefx/LambdaExpression.cs new file mode 100644 index 00000000000..e2a83ce407a --- /dev/null +++ b/mcs/class/System.Core/corefx/LambdaExpression.cs @@ -0,0 +1,17 @@ +#if FEATURE_COMPILE_TO_METHODBUILDER + +using System.Reflection.Emit; +using System.Runtime.CompilerServices; + +namespace System.Linq.Expressions +{ + partial class LambdaExpression + { + public void CompileToMethod (MethodBuilder method, DebugInfoGenerator debugInfoGenerator) + { + CompileToMethod (method); + } + } +} + +#endif \ No newline at end of file diff --git a/mcs/class/System.Core/corefx/SR.cs b/mcs/class/System.Core/corefx/SR.cs new file mode 100644 index 00000000000..66bccace597 --- /dev/null +++ b/mcs/class/System.Core/corefx/SR.cs @@ -0,0 +1,214 @@ +// +// This file was generated by resx2sr tool +// + +partial class SR +{ + public const string ReducibleMustOverrideReduce = "reducible nodes must override Expression.Reduce()"; + public const string MustReduceToDifferent = "node cannot reduce to itself or null"; + public const string ReducedNotCompatible = "cannot assign from the reduced node type to the original node type"; + public const string SetterHasNoParams = "Setter must have parameters."; + public const string PropertyCannotHaveRefType = "Property cannot have a managed pointer type."; + public const string IndexesOfSetGetMustMatch = "Indexing parameters of getter and setter must match."; + public const string AccessorsCannotHaveVarArgs = "Accessor method should not have VarArgs."; + public const string AccessorsCannotHaveByRefArgs = "Accessor indexes cannot be passed ByRef."; + public const string BoundsCannotBeLessThanOne = "Bounds count cannot be less than 1"; + public const string TypeMustNotBeByRef = "Type must not be ByRef"; + public const string TypeMustNotBePointer = "Type must not be a pointer type"; + public const string TypeDoesNotHaveConstructorForTheSignature = "Type doesn't have constructor with a given signature"; + public const string SetterMustBeVoid = "Setter should have void type."; + public const string PropertyTypeMustMatchGetter = "Property type must match the value type of getter"; + public const string PropertyTypeMustMatchSetter = "Property type must match the value type of setter"; + public const string BothAccessorsMustBeStatic = "Both accessors must be static."; + public const string OnlyStaticFieldsHaveNullInstance = "Static field requires null instance, non-static field requires non-null instance."; + public const string OnlyStaticPropertiesHaveNullInstance = "Static property requires null instance, non-static property requires non-null instance."; + public const string OnlyStaticMethodsHaveNullInstance = "Static method requires null instance, non-static method requires non-null instance."; + public const string PropertyTypeCannotBeVoid = "Property cannot have a void type."; + public const string InvalidUnboxType = "Can only unbox from an object or interface type to a value type."; + public const string ExpressionMustBeWriteable = "Expression must be writeable"; + public const string ArgumentMustNotHaveValueType = "Argument must not have a value type."; + public const string MustBeReducible = "must be reducible node"; + public const string AllTestValuesMustHaveSameType = "All test values must have the same type."; + public const string AllCaseBodiesMustHaveSameType = "All case bodies and the default body must have the same type."; + public const string DefaultBodyMustBeSupplied = "Default body must be supplied if case bodies are not System.Void."; + public const string LabelMustBeVoidOrHaveExpression = "Label type must be System.Void if an expression is not supplied"; + public const string LabelTypeMustBeVoid = "Type must be System.Void for this label argument"; + public const string QuotedExpressionMustBeLambda = "Quoted expression must be a lambda"; + public const string VariableMustNotBeByRef = "Variable '{0}' uses unsupported type '{1}'. Reference types are not supported for variables."; + public const string DuplicateVariable = "Found duplicate parameter '{0}'. Each ParameterExpression in the list must be a unique object."; + public const string StartEndMustBeOrdered = "Start and End must be well ordered"; + public const string FaultCannotHaveCatchOrFinally = "fault cannot be used with catch or finally clauses"; + public const string TryMustHaveCatchFinallyOrFault = "try must have at least one catch, finally, or fault clause"; + public const string BodyOfCatchMustHaveSameTypeAsBodyOfTry = "Body of catch must have the same type as body of try."; + public const string ExtensionNodeMustOverrideProperty = "Extension node must override the property {0}."; + public const string UserDefinedOperatorMustBeStatic = "User-defined operator method '{0}' must be static."; + public const string UserDefinedOperatorMustNotBeVoid = "User-defined operator method '{0}' must not be void."; + public const string CoercionOperatorNotDefined = "No coercion operator is defined between types '{0}' and '{1}'."; + public const string UnaryOperatorNotDefined = "The unary operator {0} is not defined for the type '{1}'."; + public const string BinaryOperatorNotDefined = "The binary operator {0} is not defined for the types '{1}' and '{2}'."; + public const string ReferenceEqualityNotDefined = "Reference equality is not defined for the types '{0}' and '{1}'."; + public const string OperandTypesDoNotMatchParameters = "The operands for operator '{0}' do not match the parameters of method '{1}'."; + public const string OverloadOperatorTypeDoesNotMatchConversionType = "The return type of overload method for operator '{0}' does not match the parameter type of conversion method '{1}'."; + public const string ConversionIsNotSupportedForArithmeticTypes = "Conversion is not supported for arithmetic types without operator overloading."; + public const string ArgumentMustBeArray = "Argument must be array"; + public const string ArgumentMustBeBoolean = "Argument must be boolean"; + public const string EqualityMustReturnBoolean = "The user-defined equality method '{0}' must return a boolean value."; + public const string ArgumentMustBeFieldInfoOrPropertyInfo = "Argument must be either a FieldInfo or PropertyInfo"; + public const string ArgumentMustBeFieldInfoOrPropertyInfoOrMethod = "Argument must be either a FieldInfo, PropertyInfo or MethodInfo"; + public const string ArgumentMustBeInstanceMember = "Argument must be an instance member"; + public const string ArgumentMustBeInteger = "Argument must be of an integer type"; + public const string ArgumentMustBeArrayIndexType = "Argument for array index must be of type Int32"; + public const string ArgumentMustBeSingleDimensionalArrayType = "Argument must be single-dimensional, zero-based array type"; + public const string ArgumentTypesMustMatch = "Argument types do not match"; + public const string CannotAutoInitializeValueTypeElementThroughProperty = "Cannot auto initialize elements of value type through property '{0}', use assignment instead"; + public const string CannotAutoInitializeValueTypeMemberThroughProperty = "Cannot auto initialize members of value type through property '{0}', use assignment instead"; + public const string IncorrectTypeForTypeAs = "The type used in TypeAs Expression must be of reference or nullable type, {0} is neither"; + public const string CoalesceUsedOnNonNullType = "Coalesce used with type that cannot be null"; + public const string ExpressionTypeCannotInitializeArrayType = "An expression of type '{0}' cannot be used to initialize an array of type '{1}'"; + public const string ArgumentTypeDoesNotMatchMember = " Argument type '{0}' does not match the corresponding member type '{1}'"; + public const string ArgumentMemberNotDeclOnType = " The member '{0}' is not declared on type '{1}' being created"; + public const string ExpressionTypeDoesNotMatchReturn = "Expression of type '{0}' cannot be used for return type '{1}'"; + public const string ExpressionTypeDoesNotMatchAssignment = "Expression of type '{0}' cannot be used for assignment to type '{1}'"; + public const string ExpressionTypeDoesNotMatchLabel = "Expression of type '{0}' cannot be used for label of type '{1}'"; + public const string ExpressionTypeNotInvocable = "Expression of type '{0}' cannot be invoked"; + public const string FieldNotDefinedForType = "Field '{0}' is not defined for type '{1}'"; + public const string InstanceFieldNotDefinedForType = "Instance field '{0}' is not defined for type '{1}'"; + public const string FieldInfoNotDefinedForType = "Field '{0}.{1}' is not defined for type '{2}'"; + public const string IncorrectNumberOfIndexes = "Incorrect number of indexes"; + public const string IncorrectNumberOfLambdaDeclarationParameters = "Incorrect number of parameters supplied for lambda declaration"; + public const string IncorrectNumberOfMembersForGivenConstructor = " Incorrect number of members for constructor"; + public const string IncorrectNumberOfArgumentsForMembers = "Incorrect number of arguments for the given members "; + public const string LambdaTypeMustBeDerivedFromSystemDelegate = "Lambda type parameter must be derived from System.MulticastDelegate"; + public const string MemberNotFieldOrProperty = "Member '{0}' not field or property"; + public const string MethodContainsGenericParameters = "Method {0} contains generic parameters"; + public const string MethodIsGeneric = "Method {0} is a generic method definition"; + public const string MethodNotPropertyAccessor = "The method '{0}.{1}' is not a property accessor"; + public const string PropertyDoesNotHaveGetter = "The property '{0}' has no 'get' accessor"; + public const string PropertyDoesNotHaveSetter = "The property '{0}' has no 'set' accessor"; + public const string PropertyDoesNotHaveAccessor = "The property '{0}' has no 'get' or 'set' accessors"; + public const string NotAMemberOfType = "'{0}' is not a member of type '{1}'"; + public const string ExpressionNotSupportedForType = "The expression '{0}' is not supported for type '{1}'"; + public const string UnsupportedExpressionType = "The expression type '{0}' is not supported"; + public const string ParameterExpressionNotValidAsDelegate = "ParameterExpression of type '{0}' cannot be used for delegate parameter of type '{1}'"; + public const string PropertyNotDefinedForType = "Property '{0}' is not defined for type '{1}'"; + public const string InstancePropertyNotDefinedForType = "Instance property '{0}' is not defined for type '{1}'"; + public const string InstancePropertyWithoutParameterNotDefinedForType = "Instance property '{0}' that takes no argument is not defined for type '{1}'"; + public const string InstancePropertyWithSpecifiedParametersNotDefinedForType = "Instance property '{0}{1}' is not defined for type '{2}'"; + public const string InstanceAndMethodTypeMismatch = "Method '{0}' declared on type '{1}' cannot be called with instance of type '{2}'"; + public const string TypeContainsGenericParameters = "Type {0} contains generic parameters"; + public const string TypeIsGeneric = "Type {0} is a generic type definition"; + public const string TypeMissingDefaultConstructor = "Type '{0}' does not have a default constructor"; + public const string ElementInitializerMethodNotAdd = "Element initializer method must be named 'Add'"; + public const string ElementInitializerMethodNoRefOutParam = "Parameter '{0}' of element initializer method '{1}' must not be a pass by reference parameter"; + public const string ElementInitializerMethodWithZeroArgs = "Element initializer method must have at least 1 parameter"; + public const string ElementInitializerMethodStatic = "Element initializer method must be an instance method"; + public const string TypeNotIEnumerable = "Type '{0}' is not IEnumerable"; + public const string UnexpectedCoalesceOperator = "Unexpected coalesce operator."; + public const string InvalidCast = "Cannot cast from type '{0}' to type '{1}"; + public const string UnhandledBinary = "Unhandled binary: {0}"; + public const string UnhandledBinding = "Unhandled binding "; + public const string UnhandledBindingType = "Unhandled Binding Type: {0}"; + public const string UnhandledConvert = "Unhandled convert: {0}"; + public const string UnhandledUnary = "Unhandled unary: {0}"; + public const string UnknownBindingType = "Unknown binding type"; + public const string UserDefinedOpMustHaveConsistentTypes = "The user-defined operator method '{1}' for operator '{0}' must have identical parameter and return types."; + public const string UserDefinedOpMustHaveValidReturnType = "The user-defined operator method '{1}' for operator '{0}' must return the same type as its parameter or a derived type."; + public const string LogicalOperatorMustHaveBooleanOperators = "The user-defined operator method '{1}' for operator '{0}' must have associated boolean True and False operators."; + public const string MethodWithArgsDoesNotExistOnType = "No method '{0}' on type '{1}' is compatible with the supplied arguments."; + public const string GenericMethodWithArgsDoesNotExistOnType = "No generic method '{0}' on type '{1}' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. "; + public const string MethodWithMoreThanOneMatch = "More than one method '{0}' on type '{1}' is compatible with the supplied arguments."; + public const string PropertyWithMoreThanOneMatch = "More than one property '{0}' on type '{1}' is compatible with the supplied arguments."; + public const string IncorrectNumberOfTypeArgsForFunc = "An incorrect number of type arguments were specified for the declaration of a Func type."; + public const string IncorrectNumberOfTypeArgsForAction = "An incorrect number of type arguments were specified for the declaration of an Action type."; + public const string ArgumentCannotBeOfTypeVoid = "Argument type cannot be System.Void."; + public const string OutOfRange = "{0} must be greater than or equal to {1}"; + public const string LabelTargetAlreadyDefined = "Cannot redefine label '{0}' in an inner block."; + public const string LabelTargetUndefined = "Cannot jump to undefined label '{0}'."; + public const string ControlCannotLeaveFinally = "Control cannot leave a finally block."; + public const string ControlCannotLeaveFilterTest = "Control cannot leave a filter test."; + public const string AmbiguousJump = "Cannot jump to ambiguous label '{0}'."; + public const string ControlCannotEnterTry = "Control cannot enter a try block."; + public const string ControlCannotEnterExpression = "Control cannot enter an expression--only statements can be jumped into."; + public const string NonLocalJumpWithValue = "Cannot jump to non-local label '{0}' with a value. Only jumps to labels defined in outer blocks can pass values."; + public const string ExtensionNotReduced = "Extension should have been reduced."; + public const string CannotCompileConstant = "CompileToMethod cannot compile constant '{0}' because it is a non-trivial value, such as a live object. Instead, create an expression tree that can construct this value."; + public const string CannotCompileDynamic = "Dynamic expressions are not supported by CompileToMethod. Instead, create an expression tree that uses System.Runtime.CompilerServices.CallSite."; + public const string InvalidLvalue = "Invalid lvalue for assignment: {0}."; + public const string UnknownLiftType = "unknown lift type: '{0}'."; + public const string UndefinedVariable = "variable '{0}' of type '{1}' referenced from scope '{2}', but it is not defined"; + public const string CannotCloseOverByRef = "Cannot close over byref parameter '{0}' referenced in lambda '{1}'"; + public const string UnexpectedVarArgsCall = "Unexpected VarArgs call to method '{0}'"; + public const string RethrowRequiresCatch = "Rethrow statement is valid only inside a Catch block."; + public const string TryNotAllowedInFilter = "Try expression is not allowed inside a filter body."; + public const string MustRewriteToSameNode = "When called from '{0}', rewriting a node of type '{1}' must return a non-null value of the same type. Alternatively, override '{2}' and change it to not visit children of this type."; + public const string MustRewriteChildToSameType = "Rewriting child expression from type '{0}' to type '{1}' is not allowed, because it would change the meaning of the operation. If this is intentional, override '{2}' and change it to allow this rewrite."; + public const string MustRewriteWithoutMethod = "Rewritten expression calls operator method '{0}', but the original node had no operator method. If this is intentional, override '{1}' and change it to allow this rewrite."; + public const string InvalidNullValue = "The value null is not of type '{0}' and cannot be used in this collection."; + public const string InvalidObjectType = "The value '{0}' is not of type '{1}' and cannot be used in this collection."; + public const string TryNotSupportedForMethodsWithRefArgs = "TryExpression is not supported as an argument to method '{0}' because it has an argument with by-ref type. Construct the tree so the TryExpression is not nested inside of this expression."; + public const string TryNotSupportedForValueTypeInstances = "TryExpression is not supported as a child expression when accessing a member on type '{0}' because it is a value type. Construct the tree so the TryExpression is not nested inside of this expression."; + public const string EnumerationIsDone = "Enumeration has either not started or has already finished."; + public const string TestValueTypeDoesNotMatchComparisonMethodParameter = "Test value of type '{0}' cannot be used for the comparison method parameter of type '{1}'"; + public const string SwitchValueTypeDoesNotMatchComparisonMethodParameter = "Switch value of type '{0}' cannot be used for the comparison method parameter of type '{1}'"; + public const string PdbGeneratorNeedsExpressionCompiler = "DebugInfoGenerator created by CreatePdbGenerator can only be used with LambdaExpression.CompileToMethod."; + public const string InvalidArgumentValue = "Invalid argument value"; + public const string NonEmptyCollectionRequired = "Non-empty collection required"; + public const string CollectionModifiedWhileEnumerating = "Collection was modified; enumeration operation may not execute."; + public const string ExpressionMustBeReadable = "Expression must be readable"; + public const string ExpressionTypeDoesNotMatchMethodParameter = "Expression of type '{0}' cannot be used for parameter of type '{1}' of method '{2}'"; + public const string ExpressionTypeDoesNotMatchParameter = "Expression of type '{0}' cannot be used for parameter of type '{1}'"; + public const string ExpressionTypeDoesNotMatchConstructorParameter = "Expression of type '{0}' cannot be used for constructor parameter of type '{1}'"; + public const string IncorrectNumberOfMethodCallArguments = "Incorrect number of arguments supplied for call to method '{0}'"; + public const string IncorrectNumberOfLambdaArguments = "Incorrect number of arguments supplied for lambda invocation"; + public const string IncorrectNumberOfConstructorArguments = "Incorrect number of arguments for constructor"; + public const string OperatorNotImplementedForType = "The operator '{0}' is not implemented for type '{1}'"; + public const string NonStaticConstructorRequired = "The constructor should not be static"; + public const string NonAbstractConstructorRequired = "Can't compile a NewExpression with a constructor declared on an abstract class"; + public const string FirstArgumentMustBeCallSite = "First argument of delegate must be CallSite"; + public const string NoOrInvalidRuleProduced = "No or Invalid rule produced"; + public const string TypeMustBeDerivedFromSystemDelegate = "Type must be derived from System.Delegate"; + public const string TypeParameterIsNotDelegate = "Type parameter is {0}. Expected a delegate."; + public const string ArgumentTypeCannotBeVoid = "Argument type cannot be void"; + public const string ArgCntMustBeGreaterThanNameCnt = "Argument count must be greater than number of named arguments."; + public const string BinderNotCompatibleWithCallSite = "The result type '{0}' of the binder '{1}' is not compatible with the result type '{2}' expected by the call site."; + public const string BindingCannotBeNull = "Bind cannot return null."; + public const string DynamicBinderResultNotAssignable = "The result type '{0}' of the dynamic binding produced by binder '{1}' is not compatible with the result type '{2}' expected by the call site."; + public const string DynamicBindingNeedsRestrictions = "The result of the dynamic binding produced by the object with type '{0}' for the binder '{1}' needs at least one restriction."; + public const string DynamicObjectResultNotAssignable = "The result type '{0}' of the dynamic binding produced by the object with type '{1}' for the binder '{2}' is not compatible with the result type '{3}' expected by the call site."; + public const string InvalidMetaObjectCreated = "An IDynamicMetaObjectProvider {0} created an invalid DynamicMetaObject instance."; + public const string AmbiguousMatchInExpandoObject = "More than one key matching '{0}' was found in the ExpandoObject."; + public const string CollectionReadOnly = "Collection is read-only."; + public const string KeyDoesNotExistInExpando = "The specified key '{0}' does not exist in the ExpandoObject."; + public const string SameKeyExistsInExpando = "An element with the same key '{0}' already exists in the ExpandoObject."; + public const string EmptyEnumerable = "Enumeration yielded no results"; + public const string MoreThanOneElement = "Sequence contains more than one element"; + public const string MoreThanOneMatch = "Sequence contains more than one matching element"; + public const string NoElements = "Sequence contains no elements"; + public const string NoMatch = "Sequence contains no matching element"; + public const string ParallelPartitionable_NullReturn = "The return value must not be null."; + public const string ParallelPartitionable_IncorretElementCount = "The returned array's length must equal the number of partitions requested."; + public const string ParallelPartitionable_NullElement = "Elements returned must not be null."; + public const string PLINQ_CommonEnumerator_Current_NotStarted = "Enumeration has not started. MoveNext must be called to initiate enumeration."; + public const string PLINQ_ExternalCancellationRequested = "The query has been canceled via the token supplied to WithCancellation."; + public const string PLINQ_DisposeRequested = "The query enumerator has been disposed."; + public const string ParallelQuery_DuplicateTaskScheduler = "The WithTaskScheduler operator may be used at most once in a query."; + public const string ParallelQuery_DuplicateDOP = "The WithDegreeOfParallelism operator may be used at most once in a query."; + public const string ParallelQuery_DuplicateExecutionMode = "The WithExecutionMode operator may be used at most once in a query."; + public const string PartitionerQueryOperator_NullPartitionList = "Partitioner returned null instead of a list of partitions."; + public const string PartitionerQueryOperator_WrongNumberOfPartitions = "Partitioner returned a wrong number of partitions."; + public const string PartitionerQueryOperator_NullPartition = "Partitioner returned a null partition."; + public const string ParallelQuery_DuplicateWithCancellation = "The WithCancellation operator may by used at most once in a query."; + public const string ParallelQuery_DuplicateMergeOptions = "The WithMergeOptions operator may be used at most once in a query."; + public const string PLINQ_EnumerationPreviouslyFailed = "The query enumerator previously threw an exception."; + public const string ParallelQuery_PartitionerNotOrderable = "AsOrdered may not be used with a partitioner that is not orderable."; + public const string ParallelQuery_InvalidAsOrderedCall = "AsOrdered may only be called on the result of AsParallel, ParallelEnumerable.Range, or ParallelEnumerable.Repeat."; + public const string ParallelQuery_InvalidNonGenericAsOrderedCall = "Non-generic AsOrdered may only be called on the result of the non-generic AsParallel."; + public const string ParallelEnumerable_BinaryOpMustUseAsParallel = "The second data source of a binary operator must be of type System.Linq.ParallelQuery rather than System.Collections.Generic.IEnumerable. To fix this problem, use the AsParallel() extension method to convert the right data source to System.Linq.ParallelQuery."; + public const string ParallelEnumerable_WithQueryExecutionMode_InvalidMode = "The executionMode argument contains an invalid value."; + public const string ParallelEnumerable_WithMergeOptions_InvalidOptions = "The mergeOptions argument contains an invalid value."; + public const string ArgumentNotIEnumerableGeneric = "{0} is not IEnumerable<>"; + public const string ArgumentNotValid = "Argument {0} is not valid"; + public const string NoMethodOnType = "There is no method '{0}' on type '{1}'"; + public const string NoMethodOnTypeMatchingArguments = "There is no method '{0}' on type '{1}' that matches the specified arguments"; + public const string EnumeratingNullEnumerableExpression = "Cannot enumerate a query created from a null IEnumerable<>"; +} diff --git a/mcs/class/System.Core/corefx/SR.missing.cs b/mcs/class/System.Core/corefx/SR.missing.cs new file mode 100644 index 00000000000..f8f2e491a8c --- /dev/null +++ b/mcs/class/System.Core/corefx/SR.missing.cs @@ -0,0 +1,4 @@ +partial class SR +{ + public const string MethodBuilderDoesNotHaveTypeBuilder = "MethodBuilder does not have a valid TypeBuilder"; +} \ No newline at end of file diff --git a/mcs/class/System.Core/dynamic_System.Core.dll.sources b/mcs/class/System.Core/dynamic_System.Core.dll.sources index 212c2d3891d..73362840547 100644 --- a/mcs/class/System.Core/dynamic_System.Core.dll.sources +++ b/mcs/class/System.Core/dynamic_System.Core.dll.sources @@ -1,117 +1,34 @@ -../dlr/Runtime/Microsoft.Scripting.Core/Actions/BinaryOperationBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/BindingRestrictions.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallInfo.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSite.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteHelpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteOps.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/ConvertBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CreateInstanceBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteIndexBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObject.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObjectBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoClass.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoObject.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/GetIndexBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/GetMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/IDynamicMetaObjectProvider.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/IInvokeOnGetBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/RuleCache.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/SetIndexBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/SetMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/UnaryOperationBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/UpdateDelegates.Generated.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Common/CachedReflectionInfo.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/BinaryExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/BlockExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/CatchBlock.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ConditionalExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ConstantExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugInfoExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugViewWriter.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DefaultExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ElementInit.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.DebuggerProxy.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionStringBuilder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionType.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/GotoExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/IndexExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/InvocationExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelTarget.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ListArgumentProvider.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ListInitExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LoopExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberAssignment.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberBinding.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberInitExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberListBinding.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberMemberBinding.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MethodCallExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/NewArrayExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ParameterExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/RuntimeVariablesExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchCase.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/SymbolDocumentInfo.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/TryExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeBinaryExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeUtils.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/UnaryExpression.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Dynamic/Utils/Helpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/AnalyzedTree.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/AssemblyGen.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/BoundConstants.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.Storage.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/ConstantCheck.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/ExpressionQuoter.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/ILGen.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/KeyedQueue.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LabelInfo.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Address.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.ControlFlow.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Expressions.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Lambda.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Logical.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Statements.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Unary.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/OffsetTrackingILGenerator.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/RuntimeVariableList.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Set.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Bindings.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Temps.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolDocumentGenerator.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolGuids.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/VariableBinder.cs +../../../external/corefx/src/Common/src/System/NotImplemented.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/CacheDict.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/CollectionExtensions.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ContractUtils.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ExceptionFactory.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/Helpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/IRuntimeVariables.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyCollectionBuilder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyDictionary.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReferenceEqualityComparer.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReflectionUtils.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/TrueReadOnlyCollection.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs +../../../external/corefx/src/Common/src/System/Collections/Generic/ReferenceEqualityComparer.cs + +../../../external/corefx/src/Common/src/System/Linq/Expressions/Compiler/AssemblyGen.cs + +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/AnalyzedTree.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/BoundConstants.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/CompilerScope.Storage.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/CompilerScope.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/ILGen.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/KeyedQueue.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LabelInfo.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Address.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Binary.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.ControlFlow.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Expressions.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Generated.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Lambda.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Logical.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Statements.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.Unary.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/LambdaCompiler.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.Bindings.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.ChildRewriter.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.Generated.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.SpilledExpressionBlock.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.Temps.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/StackSpiller.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Compiler/VariableBinder.cs diff --git a/mcs/class/System.Core/interpreter_System.Core.dll.sources b/mcs/class/System.Core/interpreter_System.Core.dll.sources index d7d4730292a..4c4e18f10d9 100644 --- a/mcs/class/System.Core/interpreter_System.Core.dll.sources +++ b/mcs/class/System.Core/interpreter_System.Core.dll.sources @@ -1,89 +1,4 @@ -../dlr/Runtime/Microsoft.Scripting.Core/Actions/BinaryOperationBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/BindingRestrictions.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallInfo.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSite.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteHelpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteOps.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/ConvertBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/CreateInstanceBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteIndexBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObject.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObjectBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoClass.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoObject.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/GetIndexBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/GetMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/IDynamicMetaObjectProvider.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/IInvokeOnGetBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/RuleCache.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/SetIndexBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/SetMemberBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/UnaryOperationBinder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Actions/UpdateDelegates.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/BinaryExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/BlockExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/CatchBlock.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ConditionalExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ConstantExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugInfoExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugViewWriter.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/DefaultExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ElementInit.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.DebuggerProxy.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionStringBuilder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionType.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/GotoExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/IndexExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/InvocationExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelTarget.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ListArgumentProvider.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ListInitExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/LoopExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberAssignment.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberBinding.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberInitExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberListBinding.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberMemberBinding.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/MethodCallExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/NewArrayExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/ParameterExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/RuntimeVariablesExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchCase.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/SymbolDocumentInfo.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/TryExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeBinaryExpression.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeUtils.cs -../dlr/Runtime/Microsoft.Scripting.Core/Ast/UnaryExpression.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Interpreter/*.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/Set.cs -../dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolGuids.cs - -../dlr/Runtime/Microsoft.Scripting.Core/Utils/CacheDict.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/CollectionExtensions.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ContractUtils.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ExceptionFactory.Generated.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/Helpers.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/IRuntimeVariables.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyCollectionBuilder.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyDictionary.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReferenceEqualityComparer.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/ReflectionUtils.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/TrueReadOnlyCollection.cs -../dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs - -System.Linq.Expressions.Interpret/LambdaCompiler.cs +../../../external/corefx/src/System.Linq.Expressions/src/System/Linq/Expressions/Common/CachedReflectionInfo.cs diff --git a/mcs/class/System.Core/monodroid_System.Core_test.dll.exclude.sources b/mcs/class/System.Core/monodroid_System.Core_test.dll.exclude.sources index 65a50af7238..05e6552db87 100644 --- a/mcs/class/System.Core/monodroid_System.Core_test.dll.exclude.sources +++ b/mcs/class/System.Core/monodroid_System.Core_test.dll.exclude.sources @@ -1,2 +1,2 @@ -#include aot_only_System.Core_test.dll.exclude.sources +#include testing_aot_full_System.Core_test.dll.exclude.sources #include monodroid_System.Core_test.dll.new-exclude.sources diff --git a/mcs/class/System.Core/net_4_x_System.Core.dll.sources b/mcs/class/System.Core/net_4_x_System.Core.dll.sources index 72d78659215..215215e76a2 100644 --- a/mcs/class/System.Core/net_4_x_System.Core.dll.sources +++ b/mcs/class/System.Core/net_4_x_System.Core.dll.sources @@ -9,11 +9,8 @@ System.Security.Cryptography/AesTransform.cs System.Security.Cryptography/MD5Cng.cs System.Security.Cryptography/SHA1Cng.cs System.Security.Cryptography/SHA256Cng.cs -System.Security.Cryptography/SHA256CryptoServiceProvider.cs System.Security.Cryptography/SHA384Cng.cs -System.Security.Cryptography/SHA384CryptoServiceProvider.cs System.Security.Cryptography/SHA512Cng.cs -System.Security.Cryptography/SHA512CryptoServiceProvider.cs ../referencesource/System.Core/System/Security/Cryptography/AesManaged.cs ../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs diff --git a/mcs/class/System.Core/run-tests.bat b/mcs/class/System.Core/run-tests.bat deleted file mode 100644 index 2523375b026..00000000000 --- a/mcs/class/System.Core/run-tests.bat +++ /dev/null @@ -1,185 +0,0 @@ -REM @echo on -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - -IF "%1"=="rebuild" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=build -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set OUTPUT_FILE_PREFIX=System_Core_MonoTests -set RUNNING_FIXTURE=MonoTests -set TEST_SOLUTION=Test\System.Core.Tests-2008.JavaEE.csproj -set TEST_ASSEMBLY=System.Core.Tests.jar -set PROJECT_CONFIGURATION=Debug_Java20 - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Configuration.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Drawing.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Core.jar -set NUNIT_OPTIONS=/exclude=NotWorking,NotDotNet,TargetJvmNotSupported,TargetJvmNotWorking,NotDotNet - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set OUTPUT_DIR=.. -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%framework\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%util\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%core\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -rem @echo Building GH solution... -REM ******************************************************** - -rem devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -rem @echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -rem msbuild %NUNIT_PATH%nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . - -set TEST_TEMP=C:\MonoTemp -mkdir %TEST_TEMP% - -REM @echo on -echo "%JAVA_HOME%\bin\java" -server -Xmx1024M -Djava.io.tmpdir="%TEST_TEMP%" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% -"%JAVA_HOME%\bin\java" -server -Xmx1024M -Djava.io.tmpdir="%TEST_TEMP%" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM jdb -server -Xmx1024M -Djava.io.tmpdir="%TEST_TEMP%" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% -REM @echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% %OUTPUT_DIR% -copy %BUILD_LOG% %OUTPUT_DIR% -copy %GH_OUTPUT_XML% %OUTPUT_DIR% - -REM EXIT 0 diff --git a/mcs/class/System.Core/testing_aot_full_System.Core.dll.sources b/mcs/class/System.Core/testing_aot_full_System.Core.dll.sources new file mode 100644 index 00000000000..8b8fef0e40e --- /dev/null +++ b/mcs/class/System.Core/testing_aot_full_System.Core.dll.sources @@ -0,0 +1,17 @@ +#include common_System.Core.dll.sources +#include interpreter_System.Core.dll.sources + +System.Security.Cryptography/AesCryptoServiceProvider.cs +System.Security.Cryptography/AesTransform.cs +System.Security.Cryptography/MD5Cng.cs +System.Security.Cryptography/SHA1Cng.cs +System.Security.Cryptography/SHA256Cng.cs +System.Security.Cryptography/SHA256CryptoServiceProvider.cs +System.Security.Cryptography/SHA384Cng.cs +System.Security.Cryptography/SHA384CryptoServiceProvider.cs +System.Security.Cryptography/SHA512Cng.cs +System.Security.Cryptography/SHA512CryptoServiceProvider.cs + +../referencesource/System.Core/System/Security/Cryptography/AesManaged.cs +../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs +../referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs diff --git a/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.exclude.sources b/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.exclude.sources new file mode 100644 index 00000000000..f98bf051bef --- /dev/null +++ b/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.exclude.sources @@ -0,0 +1 @@ +System.IO.Pipes/PipeSecurityTest.cs diff --git a/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.sources b/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.sources new file mode 100644 index 00000000000..33e2a105847 --- /dev/null +++ b/mcs/class/System.Core/testing_aot_full_System.Core_test.dll.sources @@ -0,0 +1 @@ +#include System.Core_test.dll.sources diff --git a/mcs/class/System.Core/testing_aot_hybrid_System.Core.dll.sources b/mcs/class/System.Core/testing_aot_hybrid_System.Core.dll.sources new file mode 100644 index 00000000000..11a92dbb1d2 --- /dev/null +++ b/mcs/class/System.Core/testing_aot_hybrid_System.Core.dll.sources @@ -0,0 +1,17 @@ +#include common_System.Core.dll.sources +#include dynamic_System.Core.dll.sources + +System.Security.Cryptography/AesCryptoServiceProvider.cs +System.Security.Cryptography/AesTransform.cs +System.Security.Cryptography/MD5Cng.cs +System.Security.Cryptography/SHA1Cng.cs +System.Security.Cryptography/SHA256Cng.cs +System.Security.Cryptography/SHA256CryptoServiceProvider.cs +System.Security.Cryptography/SHA384Cng.cs +System.Security.Cryptography/SHA384CryptoServiceProvider.cs +System.Security.Cryptography/SHA512Cng.cs +System.Security.Cryptography/SHA512CryptoServiceProvider.cs + +../referencesource/System.Core/System/Security/Cryptography/AesManaged.cs +../referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs +../referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs diff --git a/mcs/class/System.Core/winaot_System.Core.dll.sources b/mcs/class/System.Core/winaot_System.Core.dll.sources new file mode 100644 index 00000000000..a7b1796f147 --- /dev/null +++ b/mcs/class/System.Core/winaot_System.Core.dll.sources @@ -0,0 +1 @@ +#include testing_aot_full_System.Core.dll.sources diff --git a/mcs/class/System.Data.DataSetExtensions/makefile.build b/mcs/class/System.Data.DataSetExtensions/makefile.build deleted file mode 100644 index d1e427c8f44..00000000000 --- a/mcs/class/System.Data.DataSetExtensions/makefile.build +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Data.DataSetExtensions/run-tests.bat b/mcs/class/System.Data.DataSetExtensions/run-tests.bat deleted file mode 100644 index f998ee02f25..00000000000 --- a/mcs/class/System.Data.DataSetExtensions/run-tests.bat +++ /dev/null @@ -1,186 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set OUTPUT_FILE_PREFIX=System_Data_DataSetExtensions -set RUNNING_FIXTURE=System.Data.DataSetExtensions.Test -set TEST_SOLUTION=Test\System.Data.DataSetExtensions.Test.JavaEE.csproj -set TEST_ASSEMBLY=System.Data.DataSetExtensions.Test.jar -set PROJECT_CONFIGURATION=Debug_Java -set APP_CONFIG_FILE=app_test_2.0.config - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - -set NUNIT_OPTIONS=/exclude:NotWorking,ValueAdd,CAS,InetAccess - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Data.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Core.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Data.DataSetExtensions.jar -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -rem devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . -copy %APP_CONFIG_FILE% nunit-console.exe.config - -@echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -@echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.Data.OracleClient/makefile.build b/mcs/class/System.Data.OracleClient/makefile.build deleted file mode 100755 index 0dc3914df57..00000000000 --- a/mcs/class/System.Data.OracleClient/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Data.OracleClient/run-tests.bat b/mcs/class/System.Data.OracleClient/run-tests.bat deleted file mode 100644 index 046c9be683d..00000000000 --- a/mcs/class/System.Data.OracleClient/run-tests.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch call all the test batches with default parameters -REM ******************************************************** -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM ******************************************************** - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - - -call run-tests.test.bat %BUILD_OPTION% - - diff --git a/mcs/class/System.Data.OracleClient/run-tests.test.bat b/mcs/class/System.Data.OracleClient/run-tests.test.bat deleted file mode 100644 index 20d982c4d92..00000000000 --- a/mcs/class/System.Data.OracleClient/run-tests.test.bat +++ /dev/null @@ -1,188 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set OUTPUT_FILE_PREFIX=System_Data_OracleClient -set RUNNING_FIXTURE=MonoTests.System.Data.OracleClient -set TEST_SOLUTION=Test\System.Data.OracleClient.Tests20.J2EE.sln -set TEST_ASSEMBLY=System.Data.OracleClient.Tests20.J2EE.jar -set PROJECT_CONFIGURATION=Debug_Java20 -set APP_CONFIG_FILE=Test\System.Data.OracleClient.J2EE.config - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Data.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Data.OracleClient.jar - -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\ojdbc14.jar - -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -REM devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . -copy %APP_CONFIG_FILE% nunit-console.exe.config - -REM @echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% Debug_Java >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.vmwcsproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild]" -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.Data/aot_hybrid_System.Data.dll.sources b/mcs/class/System.Data/aot_hybrid_System.Data.dll.sources deleted file mode 100644 index bbc860b8cd7..00000000000 --- a/mcs/class/System.Data/aot_hybrid_System.Data.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.Data.dll.sources diff --git a/mcs/class/System.Data/aot_hybrid_System.Data_test.dll.exclude.sources b/mcs/class/System.Data/aot_hybrid_System.Data_test.dll.exclude.sources deleted file mode 100644 index 0022a9e9f1b..00000000000 --- a/mcs/class/System.Data/aot_hybrid_System.Data_test.dll.exclude.sources +++ /dev/null @@ -1,18 +0,0 @@ -System.Data.Odbc/OdbcCommandBuilderTest.cs -System.Data.Odbc/OdbcCommandTest.cs -System.Data.Odbc/OdbcConnectionStringBuilderTest.cs -System.Data.Odbc/OdbcConnectionTest.cs -System.Data.Odbc/OdbcDataAdapterTest.cs -System.Data.Odbc/OdbcDataReaderTest.cs -System.Data.Odbc/OdbcMetaDataCollectionNamesTest.cs -System.Data.Odbc/OdbcParameterCollectionTest.cs -System.Data.Odbc/OdbcParameterTest.cs -System.Data.Odbc/OdbcPermissionAttributeTest.cs -System.Data.Odbc/OdbcPermissionTest.cs -System.Data.OleDb/OleDbCommandTest.cs -System.Data.OleDb/OleDbConnectionTest.cs -System.Data.OleDb/OleDbDataAdapterTest.cs -System.Data.OleDb/OleDbMetaDataCollectionNamesTest.cs -System.Data.OleDb/OleDbParameterCollectionTest.cs -System.Data.OleDb/OleDbPermissionAttributeTest.cs -System.Data.OleDb/OleDbPermissionTest.cs diff --git a/mcs/class/System.Data/aot_only_System.Data.dll.sources b/mcs/class/System.Data/aot_only_System.Data.dll.sources deleted file mode 100644 index bbc860b8cd7..00000000000 --- a/mcs/class/System.Data/aot_only_System.Data.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.Data.dll.sources diff --git a/mcs/class/System.Data/aot_only_System.Data_test.dll.exclude.sources b/mcs/class/System.Data/aot_only_System.Data_test.dll.exclude.sources deleted file mode 100644 index 0022a9e9f1b..00000000000 --- a/mcs/class/System.Data/aot_only_System.Data_test.dll.exclude.sources +++ /dev/null @@ -1,18 +0,0 @@ -System.Data.Odbc/OdbcCommandBuilderTest.cs -System.Data.Odbc/OdbcCommandTest.cs -System.Data.Odbc/OdbcConnectionStringBuilderTest.cs -System.Data.Odbc/OdbcConnectionTest.cs -System.Data.Odbc/OdbcDataAdapterTest.cs -System.Data.Odbc/OdbcDataReaderTest.cs -System.Data.Odbc/OdbcMetaDataCollectionNamesTest.cs -System.Data.Odbc/OdbcParameterCollectionTest.cs -System.Data.Odbc/OdbcParameterTest.cs -System.Data.Odbc/OdbcPermissionAttributeTest.cs -System.Data.Odbc/OdbcPermissionTest.cs -System.Data.OleDb/OleDbCommandTest.cs -System.Data.OleDb/OleDbConnectionTest.cs -System.Data.OleDb/OleDbDataAdapterTest.cs -System.Data.OleDb/OleDbMetaDataCollectionNamesTest.cs -System.Data.OleDb/OleDbParameterCollectionTest.cs -System.Data.OleDb/OleDbPermissionAttributeTest.cs -System.Data.OleDb/OleDbPermissionTest.cs diff --git a/mcs/class/System.Data/aot_only_System.Data_test.dll.sources b/mcs/class/System.Data/aot_only_System.Data_test.dll.sources deleted file mode 100644 index 310b8c2fb3d..00000000000 --- a/mcs/class/System.Data/aot_only_System.Data_test.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include System.Data_test.dll.sources diff --git a/mcs/class/System.Data/app_test_aot_hybrid.config b/mcs/class/System.Data/app_test_aot_hybrid.config deleted file mode 100644 index 4f315973f1e..00000000000 --- a/mcs/class/System.Data/app_test_aot_hybrid.config +++ /dev/null @@ -1,48 +0,0 @@ - - - -
-
- - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Data/jay.bat b/mcs/class/System.Data/jay.bat deleted file mode 100755 index b6a6fef06e6..00000000000 --- a/mcs/class/System.Data/jay.bat +++ /dev/null @@ -1,3 +0,0 @@ -echo on -@echo "processing Parser.jay..." -"%1\..\..\jay\jay.exe" -ct < "%1..\..\jay\skeleton.cs" "%1Mono.Data.SqlExpressions\Parser.jay" > "%1Mono.Data.SqlExpressions\Parser.cs" diff --git a/mcs/class/System.Data/makefile.build b/mcs/class/System.Data/makefile.build deleted file mode 100755 index 493cb135d91..00000000000 --- a/mcs/class/System.Data/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Data/run-tests.bat b/mcs/class/System.Data/run-tests.bat deleted file mode 100644 index eb417176dea..00000000000 --- a/mcs/class/System.Data/run-tests.bat +++ /dev/null @@ -1,21 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch call all the test batches with default parameters -REM ******************************************************** -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM ******************************************************** - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - - -call run-tests.test.disconnected.bat %BUILD_OPTION% - -call run-tests.test.connected.bat %BUILD_OPTION% - diff --git a/mcs/class/System.Data/run-tests.test.connected.bat b/mcs/class/System.Data/run-tests.test.connected.bat deleted file mode 100644 index ad5f2deaff6..00000000000 --- a/mcs/class/System.Data/run-tests.test.connected.bat +++ /dev/null @@ -1,199 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set OUTPUT_FILE_PREFIX=System_Data_connected -set RUNNING_FIXTURE=MonoTests.System.Data -set TEST_SOLUTION=Test\ProviderTests\System.Data.OleDb.Tests20.J2EE.sln -set TEST_ASSEMBLY=System.Data.OleDb.Tests.J2EE.jar -set PROJECT_CONFIGURATION=Debug_Java20 -set APP_CONFIG_FILE=Test\ProviderTests\System.Data.OleDb.J2EE.config - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Data.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar - -rem set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\msbase.jar -rem set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\mssqlserver.jar -rem set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\msutil.jar - -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\sqljdbc.jar - -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\postgresql-8.0.309.jdbc3.jar - -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\ojdbc14.jar - -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\db2jcc.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\db2jcc_license_cu.jar - -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -rem devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.%RUN_ID%.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -rem devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.%RUN_ID%.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\ProviderTests\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . -copy %APP_CONFIG_FILE% nunit-console.exe.config - -REM @echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -rem devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.%RUN_ID%.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.vmwcsproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild]" -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.Data/run-tests.test.disconnected.bat b/mcs/class/System.Data/run-tests.test.disconnected.bat deleted file mode 100644 index 2ab22fdefda..00000000000 --- a/mcs/class/System.Data/run-tests.test.disconnected.bat +++ /dev/null @@ -1,186 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set OUTPUT_FILE_PREFIX=System_Data_disconnected -set RUNNING_FIXTURE=MonoTests.System.Data -set TEST_SOLUTION=Test\System.Data.Test20.sln -set TEST_ASSEMBLY=System.Data.Test.jar -set PROJECT_CONFIGURATION=Debug_Java20 -set APP_CONFIG_FILE=app_test_2.0.config - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - -set NUNIT_OPTIONS=/exclude:NotWorking,ValueAdd,CAS,InetAccess - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Data.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -rem devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . -copy %APP_CONFIG_FILE% nunit-console.exe.config - -REM @echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.vmwcsproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.Data/testing_aot_full_System.Data.dll.sources b/mcs/class/System.Data/testing_aot_full_System.Data.dll.sources new file mode 100644 index 00000000000..bbc860b8cd7 --- /dev/null +++ b/mcs/class/System.Data/testing_aot_full_System.Data.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Data.dll.sources diff --git a/mcs/class/System.Data/testing_aot_full_System.Data_test.dll.exclude.sources b/mcs/class/System.Data/testing_aot_full_System.Data_test.dll.exclude.sources new file mode 100644 index 00000000000..0022a9e9f1b --- /dev/null +++ b/mcs/class/System.Data/testing_aot_full_System.Data_test.dll.exclude.sources @@ -0,0 +1,18 @@ +System.Data.Odbc/OdbcCommandBuilderTest.cs +System.Data.Odbc/OdbcCommandTest.cs +System.Data.Odbc/OdbcConnectionStringBuilderTest.cs +System.Data.Odbc/OdbcConnectionTest.cs +System.Data.Odbc/OdbcDataAdapterTest.cs +System.Data.Odbc/OdbcDataReaderTest.cs +System.Data.Odbc/OdbcMetaDataCollectionNamesTest.cs +System.Data.Odbc/OdbcParameterCollectionTest.cs +System.Data.Odbc/OdbcParameterTest.cs +System.Data.Odbc/OdbcPermissionAttributeTest.cs +System.Data.Odbc/OdbcPermissionTest.cs +System.Data.OleDb/OleDbCommandTest.cs +System.Data.OleDb/OleDbConnectionTest.cs +System.Data.OleDb/OleDbDataAdapterTest.cs +System.Data.OleDb/OleDbMetaDataCollectionNamesTest.cs +System.Data.OleDb/OleDbParameterCollectionTest.cs +System.Data.OleDb/OleDbPermissionAttributeTest.cs +System.Data.OleDb/OleDbPermissionTest.cs diff --git a/mcs/class/System.Data/testing_aot_full_System.Data_test.dll.sources b/mcs/class/System.Data/testing_aot_full_System.Data_test.dll.sources new file mode 100644 index 00000000000..310b8c2fb3d --- /dev/null +++ b/mcs/class/System.Data/testing_aot_full_System.Data_test.dll.sources @@ -0,0 +1 @@ +#include System.Data_test.dll.sources diff --git a/mcs/class/System.Data/testing_aot_hybrid_System.Data.dll.sources b/mcs/class/System.Data/testing_aot_hybrid_System.Data.dll.sources new file mode 100644 index 00000000000..bbc860b8cd7 --- /dev/null +++ b/mcs/class/System.Data/testing_aot_hybrid_System.Data.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Data.dll.sources diff --git a/mcs/class/System.Data/testing_aot_hybrid_System.Data_test.dll.exclude.sources b/mcs/class/System.Data/testing_aot_hybrid_System.Data_test.dll.exclude.sources new file mode 100644 index 00000000000..0022a9e9f1b --- /dev/null +++ b/mcs/class/System.Data/testing_aot_hybrid_System.Data_test.dll.exclude.sources @@ -0,0 +1,18 @@ +System.Data.Odbc/OdbcCommandBuilderTest.cs +System.Data.Odbc/OdbcCommandTest.cs +System.Data.Odbc/OdbcConnectionStringBuilderTest.cs +System.Data.Odbc/OdbcConnectionTest.cs +System.Data.Odbc/OdbcDataAdapterTest.cs +System.Data.Odbc/OdbcDataReaderTest.cs +System.Data.Odbc/OdbcMetaDataCollectionNamesTest.cs +System.Data.Odbc/OdbcParameterCollectionTest.cs +System.Data.Odbc/OdbcParameterTest.cs +System.Data.Odbc/OdbcPermissionAttributeTest.cs +System.Data.Odbc/OdbcPermissionTest.cs +System.Data.OleDb/OleDbCommandTest.cs +System.Data.OleDb/OleDbConnectionTest.cs +System.Data.OleDb/OleDbDataAdapterTest.cs +System.Data.OleDb/OleDbMetaDataCollectionNamesTest.cs +System.Data.OleDb/OleDbParameterCollectionTest.cs +System.Data.OleDb/OleDbPermissionAttributeTest.cs +System.Data.OleDb/OleDbPermissionTest.cs diff --git a/mcs/class/System.Data/winaot_System.Data.dll.sources b/mcs/class/System.Data/winaot_System.Data.dll.sources new file mode 100644 index 00000000000..bbc860b8cd7 --- /dev/null +++ b/mcs/class/System.Data/winaot_System.Data.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Data.dll.sources diff --git a/mcs/class/System.DirectoryServices/makefile.build b/mcs/class/System.DirectoryServices/makefile.build deleted file mode 100755 index 5c5750558a2..00000000000 --- a/mcs/class/System.DirectoryServices/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.DirectoryServices/run-tests.bat b/mcs/class/System.DirectoryServices/run-tests.bat deleted file mode 100644 index 0385b153ed8..00000000000 --- a/mcs/class/System.DirectoryServices/run-tests.bat +++ /dev/null @@ -1,27 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch call all the test batches with default parameters -REM ******************************************************** -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM ******************************************************** - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -set SECURE_MODE=nonsecure -set OUTPUT_FILE_PREFIX=System_DirectoryServices -set RUNNING_FIXTURE=MonoTests.System.DirectoryServices - -call run-tests.test.bat %BUILD_OPTION% %SECURE_MODE% %OUTPUT_FILE_PREFIX% %RUNNING_FIXTURE% - -set SECURE_MODE=secure -set OUTPUT_FILE_PREFIX=System_DirectoryServices -set RUNNING_FIXTURE=MonoTests.System.DirectoryServices - -call run-tests.test.bat %BUILD_OPTION% %SECURE_MODE% %OUTPUT_FILE_PREFIX% %RUNNING_FIXTURE% \ No newline at end of file diff --git a/mcs/class/System.DirectoryServices/run-tests.test.bat b/mcs/class/System.DirectoryServices/run-tests.test.bat deleted file mode 100644 index 75aff8320ce..00000000000 --- a/mcs/class/System.DirectoryServices/run-tests.test.bat +++ /dev/null @@ -1,193 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM secure mode (mandratory): secure or non-secure mode indicator -REM test fixture name (optional) : if you want to run some particular test fixture -REM example run-tests build GhTests Test.Sys.Drawing -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set SECURE_MODE=%2 -set OUTPUT_FILE_PREFIX=%3 -set RUNNING_FIXTURE=%4 -set TEST_SOLUTION=Test\System.DirectoryServices.Test20.sln -set TEST_ASSEMBLY=System.DirectoryServices.Test20.jar -set PROJECT_CONFIGURATION=Debug_Java20 - -set OUTPUT_FILE_PREFIX=%OUTPUT_FILE_PREFIX%_%SECURE_MODE% - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Configuration.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.DirectoryServices.jar; -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%Novell.Directory.Ldap.jar; -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -rem devenv Test\System.DirectoryServices.sln /%BUILD_OPTION% Debug_Java >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -rem devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% Debug_Java >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\Debug_Java20\%TEST_ASSEMBLY% . - -IF "%SECURE_MODE%" NEQ "secure" ( - copy App.config nunit-console.exe.config - set JVM_OPTIONS=-Xmx1024M -) ELSE ( - copy Secure.config nunit-console.exe.config - set JVM_OPTIONS=-Djava.security.krb5.conf=Test\krb5.conf.example -Djava.security.auth.login.config=Test\java.login.sun.config -Xmx1024M -) - -REM @echo on -"%JAVA_HOME%\bin\java" %JVM_OPTIONS% -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -rem devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% Debug_Java >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.vmwcsproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.Drawing/Makefile b/mcs/class/System.Drawing/Makefile index e815bbf4afb..ed784833306 100644 --- a/mcs/class/System.Drawing/Makefile +++ b/mcs/class/System.Drawing/Makefile @@ -5,11 +5,17 @@ SUBDIRS = LIBRARY = System.Drawing.dll LIB_REFS = System -LIB_MCS_FLAGS = /unsafe -d:FEATURE_TYPECONVERTER \ +LIB_MCS_FLAGS = /unsafe \ -resource:Assembly/Mono.ico,Mono.ico -resource:Assembly/Information.ico,Information.ico \ -resource:Assembly/Error.ico,Error.ico -resource:Assembly/Warning.ico,Warning.ico \ -resource:Assembly/Question.ico,Question.ico -resource:Assembly/Shield.ico,Shield.ico +ifneq (winaot, $(PROFILE)) +LIB_MCS_FLAGS += -d:FEATURE_TYPECONVERTER,SUPPORTS_WINDOWS_COLORS +else +LIB_MCS_FLAGS += /keyfile:../msfinal.pub +endif + TEST_LIB_REFS = System.Drawing System.Runtime.Serialization.Formatters.Soap System.Xml TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -define:TEST -resource:Test/resources/indexed.png,indexed.png \ diff --git a/mcs/class/System.Drawing/System.Drawing/Color.cs b/mcs/class/System.Drawing/System.Drawing/Color.cs index 6e72b0ecb69..31b4842c845 100644 --- a/mcs/class/System.Drawing/System.Drawing/Color.cs +++ b/mcs/class/System.Drawing/System.Drawing/Color.cs @@ -38,7 +38,7 @@ using System.Runtime.InteropServices; namespace System.Drawing { -#if !MONOTOUCH && !MONOMAC +#if !MONOTOUCH && !MONOMAC && FEATURE_TYPECONVERTER [TypeConverter(typeof(ColorConverter))] [Editor ("System.Drawing.Design.ColorEditor, " + Consts.AssemblySystem_Drawing_Design, typeof (System.Drawing.Design.UITypeEditor))] #endif diff --git a/mcs/class/System.Drawing/System.Drawing/KnownColors.cs b/mcs/class/System.Drawing/System.Drawing/KnownColors.cs index 0440d8e3059..77b1b16251d 100644 --- a/mcs/class/System.Drawing/System.Drawing/KnownColors.cs +++ b/mcs/class/System.Drawing/System.Drawing/KnownColors.cs @@ -210,7 +210,7 @@ namespace System.Drawing { 0xFF316AC5, /* 174 - MenuHighlight */ }; -#if !MONOTOUCH && !MONOMAC +#if !MONOTOUCH && !MONOMAC && SUPPORTS_WINDOWS_COLORS static KnownColors () { if (GDIPlus.RunningOnWindows ()) { diff --git a/mcs/class/System.Drawing/makefile.build b/mcs/class/System.Drawing/makefile.build deleted file mode 100755 index 963910d6980..00000000000 --- a/mcs/class/System.Drawing/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Drawing/netstandard.sources b/mcs/class/System.Drawing/netstandard.sources new file mode 100644 index 00000000000..809285b4854 --- /dev/null +++ b/mcs/class/System.Drawing/netstandard.sources @@ -0,0 +1,10 @@ +System.Drawing/Color.cs +System.Drawing/KnownColor.cs +System.Drawing/KnownColors.cs +System.Drawing/Point.cs +System.Drawing/PointF.cs +System.Drawing/Rectangle.cs +System.Drawing/RectangleF.cs +System.Drawing/Size.cs +System.Drawing/SizeF.cs + diff --git a/mcs/class/System.Drawing/run-tests.bat b/mcs/class/System.Drawing/run-tests.bat deleted file mode 100644 index c1171713089..00000000000 --- a/mcs/class/System.Drawing/run-tests.bat +++ /dev/null @@ -1,52 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch call all the test batches with default parameters -REM ******************************************************** -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM ******************************************************** - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -IF "%2"=="" ( - set OUTPUT_FILE_PREFIX=System_Drawing_MonoTests -) ELSE ( - set OUTPUT_FILE_PREFIX=%2 -) - - -IF "%3"=="" ( - set RUNNING_FIXTURE=MonoTests -) ELSE ( - set RUNNING_FIXTURE=%3 -) - -call run-tests.test.bat %BUILD_OPTION% %OUTPUT_FILE_PREFIX% %RUNNING_FIXTURE% "" "" - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -IF "%2"=="" ( - set OUTPUT_FILE_PREFIX=System_Drawing_Test -) ELSE ( - set OUTPUT_FILE_PREFIX=%2 -) - - -IF "%3"=="" ( - set RUNNING_FIXTURE=Test -) ELSE ( - set RUNNING_FIXTURE=%3 -) - -@echo on -call run-tests.test.bat %BUILD_OPTION% %OUTPUT_FILE_PREFIX% %RUNNING_FIXTURE% "Test\DrawingTest\Test" "..\..\..\" \ No newline at end of file diff --git a/mcs/class/System.Drawing/run-tests.test.bat b/mcs/class/System.Drawing/run-tests.test.bat deleted file mode 100644 index ee3fc84c267..00000000000 --- a/mcs/class/System.Drawing/run-tests.test.bat +++ /dev/null @@ -1,237 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set OUTPUT_FILE_PREFIX=%2 -set RUNNING_FIXTURE=%3 -set RUNNING_DIR=%~4 -set BACK_TO_ROOT_DIR=%~5 - -set TEST_J2EE_SOLUTION=Test\System.Drawing.Test20.J2EE.sln -set TEST_NET_SOLUTION=Test\System.Drawing.Test20.sln -set TEST_J2EE_ASSEMBLY=System.Drawing.Test20.J2EE.jar -set TEST_NET_ASSEMBLY=System.Drawing.Test.dll -set PROJECT_J2EE_CONFIGURATION=Debug_Java20 -set PROJECT_NET_CONFIGURATION=Debug - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%jai_imageio.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Drawing.jar; -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set NET_OUTPUT_XML=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.Net.1.%USERNAME%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=%BACK_TO_ROOT_DIR%..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_J2EE_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_J2EE_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_J2EE_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_J2EE_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_J2EE_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -REM devenv Test\DrawingTest\System.Drawing.Test.sln /%BUILD_OPTION% Debug_Java >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_J2EE_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_J2EE_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% Debug_Java >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_J2EE_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building .Net solution... -REM ******************************************************** - -REM devenv Test\DrawingTest\System.Drawing.Test.dotnet.sln /%BUILD_OPTION% Debug >%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_NET_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_NET_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running Net reference tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" (in .NET) -REM ******************************************************** - -if "%RUNNING_DIR%" NEQ "" ( - cd %RUNNING_DIR% ) - -if not exist Exocortex.DSP.v1.dll ( - copy %BACK_TO_ROOT_DIR%Test\DrawingTest\Test\Exocortex.DSP.v1.dll .) - -if not exist DrawingTest.dll ( - copy %BACK_TO_ROOT_DIR%Test\DrawingTest\Test\DrawingTest.dll . ) - -if not exist %TEST_NET_ASSEMBLY% ( - copy %BACK_TO_ROOT_DIR%Test\DrawingTest\Test\%TEST_NET_ASSEMBLY% . ) - -copy "%NUNIT_PATH%nunit-console\bin\%PROJECT_J2EE_CONFIGURATION%\nunit-console.exe" . -copy "%NUNIT_PATH%nunit-console\bin\%PROJECT_J2EE_CONFIGURATION%\nunit.util.dll" . -copy "%NUNIT_PATH%nunit-console\bin\%PROJECT_J2EE_CONFIGURATION%\nunit.core.dll" . -copy "%NUNIT_PATH%nunit-console\bin\%PROJECT_J2EE_CONFIGURATION%\nunit.framework.dll" . -echo "==== .NET reference ===" >> %RUN_LOG% -nunit-console.exe /fixture:%RUNNING_FIXTURE% %TEST_NET_ASSEMBLY% %NUNIT_OPTIONS% /xml=%NET_OUTPUT_XML% >>%RUN_LOG% 2<&1 -echo "==== End .NET reference ===" >> %RUN_LOG% - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy %BACK_TO_ROOT_DIR%Test\DrawingTest\Test\bin\%PROJECT_J2EE_CONFIGURATION%\Exocortex.DSP.v1.jar . -copy %BACK_TO_ROOT_DIR%Test\DrawingTest\Test\bin\%PROJECT_J2EE_CONFIGURATION%\DrawingTest.jar . -copy %BACK_TO_ROOT_DIR%Test\DrawingTest\Test\bin\%PROJECT_J2EE_CONFIGURATION%\%TEST_J2EE_ASSEMBLY% . - - -REM @echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_J2EE_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -if "%RUNNING_DIR%" NEQ "" ( - copy %NET_OUTPUT_XML% %BACK_TO_ROOT_DIR% - copy %GH_OUTPUT_XML% %BACK_TO_ROOT_DIR% - copy %RUN_LOG% %BACK_TO_ROOT_DIR% - cd %BACK_TO_ROOT_DIR% ) - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% Debug_Java >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_J2EE_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_J2EE_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END - - -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.Drawing/runmonotestfixture.bat b/mcs/class/System.Drawing/runmonotestfixture.bat deleted file mode 100644 index 0f201c89d4b..00000000000 --- a/mcs/class/System.Drawing/runmonotestfixture.bat +++ /dev/null @@ -1 +0,0 @@ -run-tests.test.bat build %1 %1 "" "" \ No newline at end of file diff --git a/mcs/class/System.Drawing/runtestfixture.bat b/mcs/class/System.Drawing/runtestfixture.bat deleted file mode 100644 index 306dab973ee..00000000000 --- a/mcs/class/System.Drawing/runtestfixture.bat +++ /dev/null @@ -1 +0,0 @@ -run-tests.test.bat build %1 %1 Test\DrawingTest\Test ..\..\..\ \ No newline at end of file diff --git a/mcs/class/System.Drawing/winaot_System.Drawing.dll.sources b/mcs/class/System.Drawing/winaot_System.Drawing.dll.sources new file mode 100644 index 00000000000..c7c763e880b --- /dev/null +++ b/mcs/class/System.Drawing/winaot_System.Drawing.dll.sources @@ -0,0 +1,3 @@ +Assembly/AssemblyInfo.cs +../../build/common/Consts.cs +#include netstandard.sources \ No newline at end of file diff --git a/mcs/class/System.IO.Compression.FileSystem/Makefile b/mcs/class/System.IO.Compression.FileSystem/Makefile index 7cfa024a71d..9e7a4b0efcc 100644 --- a/mcs/class/System.IO.Compression.FileSystem/Makefile +++ b/mcs/class/System.IO.Compression.FileSystem/Makefile @@ -4,8 +4,12 @@ include ../../build/rules.make LIBRARY = System.IO.Compression.FileSystem.dll LIB_REFS = System System.IO.Compression -LIB_MCS_FLAGS = +LIB_MCS_FLAGS = -unsafe TEST_MCS_FLAGS = TEST_LIB_REFS = System System.Core System.IO.Compression +RESX_RESOURCE_STRING = \ + ../../../external/corefx/src/System.IO.Compression.FileSystem/src/Resources/Strings.resx \ + ../../../external/corefx/src/System.Buffers/src/Resources/Strings.resx + include ../../build/library.make diff --git a/mcs/class/System.IO.Compression.FileSystem/System.IO.Compression.FileSystem.dll.sources b/mcs/class/System.IO.Compression.FileSystem/System.IO.Compression.FileSystem.dll.sources index b16ec7b45e4..e4bd34fd2d0 100644 --- a/mcs/class/System.IO.Compression.FileSystem/System.IO.Compression.FileSystem.dll.sources +++ b/mcs/class/System.IO.Compression.FileSystem/System.IO.Compression.FileSystem.dll.sources @@ -1,5 +1,14 @@ AssemblyInfo.cs -ZipFile.cs -ZipFileExtensions.cs ../../build/common/Consts.cs -../../build/common/MonoTODOAttribute.cs + +corefx/SR.cs + +../../../external/corefx/src/Common/src/System/IO/PathInternal.CaseSensitivity.cs +../../../external/corefx/src/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFile.cs +../../../external/corefx/src/System.IO.Compression.ZipFile/src/System/IO/Compression/ZipFileExtensions.cs + +../../../external/corefx/src/System.Buffers/src/System/Buffers/ArrayPool.cs +../../../external/corefx/src/System.Buffers/src/System/Buffers/ArrayPoolEventSource.cs +../../../external/corefx/src/System.Buffers/src/System/Buffers/DefaultArrayPool.cs +../../../external/corefx/src/System.Buffers/src/System/Buffers/DefaultArrayPoolBucket.cs +../../../external/corefx/src/System.Buffers/src/System/Buffers/Utilities.cs \ No newline at end of file diff --git a/mcs/class/System.IO.Compression.FileSystem/ZipFile.cs b/mcs/class/System.IO.Compression.FileSystem/ZipFile.cs deleted file mode 100644 index 7750335af3e..00000000000 --- a/mcs/class/System.IO.Compression.FileSystem/ZipFile.cs +++ /dev/null @@ -1,182 +0,0 @@ -// -// ZipFile.cs -// -// Author: -// João Matos -// Martin Baulig -// -// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; -using System.Text; - -namespace System.IO.Compression -{ - public static class ZipFile - { - public static void CreateFromDirectory ( - string sourceDirectoryName, string destinationArchiveFileName) - { - CreateFromDirectory (sourceDirectoryName, destinationArchiveFileName, - CompressionLevel.Fastest, includeBaseDirectory: false); - } - - public static void CreateFromDirectory ( - string sourceDirectoryName, string destinationArchiveFileName, - CompressionLevel compressionLevel, bool includeBaseDirectory) - { - CreateFromDirectory (sourceDirectoryName, destinationArchiveFileName, - compressionLevel, includeBaseDirectory, Encoding.UTF8); - } - - public static void CreateFromDirectory ( - string sourceDirectoryName, - string destinationArchiveFileName, - CompressionLevel compressionLevel, - bool includeBaseDirectory, - Encoding entryNameEncoding) - { - if (sourceDirectoryName == null) - throw new ArgumentNullException ("sourceDirectoryName"); - - if (destinationArchiveFileName == null) - throw new ArgumentNullException ("destinationArchiveFileName"); - - if (string.IsNullOrWhiteSpace (sourceDirectoryName)) - throw new ArgumentException ("sourceDirectoryName"); - - if (string.IsNullOrWhiteSpace (destinationArchiveFileName)) - throw new ArgumentException ("destinationArchiveFileName"); - - if (entryNameEncoding == Encoding.Unicode || - entryNameEncoding == Encoding.UTF32 || - entryNameEncoding == Encoding.UTF7) - throw new ArgumentException ("entryNameEncoding"); - - if (entryNameEncoding == null) - entryNameEncoding = Encoding.UTF8; - - if (!Directory.Exists (sourceDirectoryName)) - throw new DirectoryNotFoundException ("sourceDirectoryName is invalid or does not exist"); - - var sourceDir = new DirectoryInfo (Path.GetFullPath (sourceDirectoryName)); - - string fullBaseName = sourceDir.FullName; - if (includeBaseDirectory && sourceDir.Parent != null) - fullBaseName = sourceDir.Parent.FullName; - - bool hasEntries = false; - char[] separators = new char[] { - Path.DirectorySeparatorChar, - Path.AltDirectorySeparatorChar - }; - - using (var zipFile = ZipFile.Open (destinationArchiveFileName, ZipArchiveMode.Create, - entryNameEncoding)) { - var entries = sourceDir.EnumerateFileSystemInfos ("*", SearchOption.AllDirectories); - foreach (var entry in entries) { - hasEntries = true; - - int length = entry.FullName.Length - fullBaseName.Length; - string entryName = entry.FullName.Substring(fullBaseName.Length, length); - - entryName = entryName.TrimStart(separators); - - if (entry is FileInfo) - zipFile.CreateEntryFromFile (entry.FullName, entryName, compressionLevel); - else - zipFile.CreateEntry (entryName + Path.DirectorySeparatorChar); - } - - // Create the base directory even if we had no entries - if (includeBaseDirectory && !hasEntries) - zipFile.CreateEntry(sourceDir.Name + Path.DirectorySeparatorChar); - } - } - - public static void ExtractToDirectory ( - string sourceArchiveFileName, string destinationDirectoryName) - { - ExtractToDirectory (sourceArchiveFileName, destinationDirectoryName, - Encoding.UTF8); - } - - public static void ExtractToDirectory ( - string sourceArchiveFileName, string destinationDirectoryName, - Encoding entryNameEncoding) - { - if (sourceArchiveFileName == null) - throw new ArgumentNullException ("sourceArchiveFileName"); - - using (ZipArchive zipArchive = ZipFile.Open(sourceArchiveFileName, - ZipArchiveMode.Read, entryNameEncoding)) - { - zipArchive.ExtractToDirectory(destinationDirectoryName); - } - } - - public static ZipArchive Open ( - string archiveFileName, ZipArchiveMode mode) - { - return Open (archiveFileName, mode, entryNameEncoding: null); - } - - public static ZipArchive Open ( - string archiveFileName, ZipArchiveMode mode, - Encoding entryNameEncoding) - { - if (archiveFileName == null) - throw new ArgumentNullException ("archiveFileName"); - - if (string.IsNullOrWhiteSpace (archiveFileName)) - throw new ArgumentException ("archiveFileName"); - - FileStream stream; - - switch (mode) { - case ZipArchiveMode.Read: - if (!File.Exists (archiveFileName)) - throw new FileNotFoundException (); - stream = new FileStream (archiveFileName, FileMode.Open, FileAccess.Read, - FileShare.Read); - break; - case ZipArchiveMode.Create: - if (File.Exists (archiveFileName)) - throw new IOException ("mode is set to Create but the file already exists"); - stream = new FileStream (archiveFileName, FileMode.CreateNew, FileAccess.Write); - break; - case ZipArchiveMode.Update: - stream = new FileStream (archiveFileName, FileMode.OpenOrCreate, - FileAccess.ReadWrite); - break; - default: - throw new ArgumentOutOfRangeException (); - } - - return new ZipArchive (stream, mode, false, entryNameEncoding); - } - - public static ZipArchive OpenRead (string archiveFileName) - { - return ZipFile.Open (archiveFileName, ZipArchiveMode.Read); - } - } -} - diff --git a/mcs/class/System.IO.Compression.FileSystem/ZipFileExtensions.cs b/mcs/class/System.IO.Compression.FileSystem/ZipFileExtensions.cs deleted file mode 100644 index 36c4146b485..00000000000 --- a/mcs/class/System.IO.Compression.FileSystem/ZipFileExtensions.cs +++ /dev/null @@ -1,124 +0,0 @@ -// -// ZipFileExtensions.cs -// -// Author: -// João Matos -// Martin Baulig -// -// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -// THE SOFTWARE. -using System; - -namespace System.IO.Compression -{ - public static class ZipFileExtensions - { - public static ZipArchiveEntry CreateEntryFromFile ( - this ZipArchive destination, string sourceFileName, - string entryName) - { - return CreateEntryFromFile (destination, sourceFileName, entryName, - CompressionLevel.Fastest); - } - - public static ZipArchiveEntry CreateEntryFromFile ( - this ZipArchive destination, string sourceFileName, - string entryName, CompressionLevel compressionLevel) - { - if (destination == null) - throw new ArgumentNullException ("destination"); - - if (sourceFileName == null) - throw new ArgumentNullException ("sourceFileName"); - - if (entryName == null) - throw new ArgumentNullException ("entryName"); - - ZipArchiveEntry entry; - using (Stream stream = File.Open (sourceFileName, FileMode.Open, - FileAccess.Read, FileShare.Read)) - { - var zipArchiveEntry = destination.CreateEntry (entryName, compressionLevel); - zipArchiveEntry.LastWriteTime = File.GetLastWriteTimeUtc(sourceFileName); - - using (Stream entryStream = zipArchiveEntry.Open ()) - stream.CopyTo (entryStream); - - entry = zipArchiveEntry; - } - - return entry; - } - - public static void ExtractToDirectory ( - this ZipArchive source, - string destinationDirectoryName) - { - if (source == null) - throw new ArgumentNullException ("source"); - - if (destinationDirectoryName == null) - throw new ArgumentNullException ("destinationDirectoryName"); - - var destDirInfo = Directory.CreateDirectory (destinationDirectoryName); - string fullName = destDirInfo.FullName; - - foreach (var zipEntry in source.Entries) - { - var fullPath = Path.GetFullPath (Path.Combine (fullName, zipEntry.FullName)); - - var isFileName = Path.GetFileName (fullPath).Length != 0; - var dirPath = isFileName ? Path.GetDirectoryName (fullPath) : fullPath; - Directory.CreateDirectory (dirPath); - - if (isFileName) - zipEntry.ExtractToFile (fullPath, false); - } - } - - public static void ExtractToFile ( - this ZipArchiveEntry source, - string destinationFileName) - { - ExtractToFile (source, destinationFileName, overwrite: false); - } - - public static void ExtractToFile ( - this ZipArchiveEntry source, string destinationFileName, - bool overwrite) - { - if (source == null) - throw new ArgumentNullException ("source"); - - if (destinationFileName == null) - throw new ArgumentNullException ("destinationFileName"); - - var mode = overwrite ? FileMode.Create : FileMode.CreateNew; - using (var stream = File.Open (destinationFileName, mode, FileAccess.Write)) - { - using (var stream2 = source.Open ()) - stream2.CopyTo(stream); - } - - File.SetLastWriteTime(destinationFileName, source.LastWriteTime.DateTime); - } - } -} - diff --git a/mcs/class/System.IO.Compression.FileSystem/corefx/SR.cs b/mcs/class/System.IO.Compression.FileSystem/corefx/SR.cs new file mode 100644 index 00000000000..0a253cb8916 --- /dev/null +++ b/mcs/class/System.IO.Compression.FileSystem/corefx/SR.cs @@ -0,0 +1,10 @@ +// +// This file was generated by resx2sr tool +// + +partial class SR +{ + public const string IO_DirectoryNameWithData = "Zip entry name ends in directory separator character but contains data."; + public const string IO_ExtractingResultsInOutside = "Extracting Zip entry would have resulted in a file outside the specified destination directory."; + public const string ArgumentException_BufferNotFromPool = "The buffer is not associated with this pool and may not be returned to it."; +} diff --git a/mcs/class/System.IO.Compression/Test/System.IO.Compression/ZipTest.cs b/mcs/class/System.IO.Compression/Test/System.IO.Compression/ZipTest.cs index f1b83746b47..343746863e3 100644 --- a/mcs/class/System.IO.Compression/Test/System.IO.Compression/ZipTest.cs +++ b/mcs/class/System.IO.Compression/Test/System.IO.Compression/ZipTest.cs @@ -507,6 +507,11 @@ namespace MonoTests.System.IO.Compression /// Simulate "CanSeek" is false, which is the case when you are retreiving data from web. /// public override bool CanSeek => false; + + public override long Position { + get {throw new NotSupportedException();} + set {throw new NotSupportedException();} + } } [Test] @@ -517,5 +522,16 @@ namespace MonoTests.System.IO.Compression { } } + + [Test] + public void ZipWriteNonSeekableStream() { + var stream = new MyFakeStream( "test.nupkg", FileMode.Open ); + using ( var archive = new ZipArchive( stream, ZipArchiveMode.Create ) ) { + var entry = archive.CreateEntry( "foo" ); + using ( var es = entry.Open() ) { + es.Write( new byte[] { 4, 2 }, 0, 2 ); + } + } + } } } diff --git a/mcs/class/System.IO.Compression/ZipArchive.cs b/mcs/class/System.IO.Compression/ZipArchive.cs index 5df9434321c..4aa7318e4c8 100644 --- a/mcs/class/System.IO.Compression/ZipArchive.cs +++ b/mcs/class/System.IO.Compression/ZipArchive.cs @@ -227,13 +227,20 @@ namespace System.IO.Compression private void Save() { - using (var newZip = new MemoryStream()) { - zipFile.SaveTo(newZip, CompressionType.Deflate, entryNameEncoding ?? Encoding.UTF8); + if (mode == ZipArchiveMode.Create) + { + zipFile.SaveTo(stream, CompressionType.Deflate, entryNameEncoding ?? Encoding.UTF8); + } + else { + using (var newZip = new MemoryStream()) + { + zipFile.SaveTo(newZip, CompressionType.Deflate, entryNameEncoding ?? Encoding.UTF8); - stream.SetLength(0); - stream.Position = 0; - newZip.Position = 0; - newZip.CopyTo(stream); + stream.SetLength(0); + stream.Position = 0; + newZip.Position = 0; + newZip.CopyTo(stream); + } } } diff --git a/mcs/class/System.IdentityModel/aot_hybrid_System.IdentityModel.dll.sources b/mcs/class/System.IdentityModel/aot_hybrid_System.IdentityModel.dll.sources deleted file mode 100644 index 429636751c2..00000000000 --- a/mcs/class/System.IdentityModel/aot_hybrid_System.IdentityModel.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.IdentityModel.dll.sources diff --git a/mcs/class/System.IdentityModel/aot_only_System.IdentityModel.dll.sources b/mcs/class/System.IdentityModel/aot_only_System.IdentityModel.dll.sources deleted file mode 100644 index 429636751c2..00000000000 --- a/mcs/class/System.IdentityModel/aot_only_System.IdentityModel.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.IdentityModel.dll.sources diff --git a/mcs/class/System.IdentityModel/testing_aot_full_System.IdentityModel.dll.sources b/mcs/class/System.IdentityModel/testing_aot_full_System.IdentityModel.dll.sources new file mode 100644 index 00000000000..429636751c2 --- /dev/null +++ b/mcs/class/System.IdentityModel/testing_aot_full_System.IdentityModel.dll.sources @@ -0,0 +1 @@ +#include mobile_System.IdentityModel.dll.sources diff --git a/mcs/class/System.IdentityModel/testing_aot_hybrid_System.IdentityModel.dll.sources b/mcs/class/System.IdentityModel/testing_aot_hybrid_System.IdentityModel.dll.sources new file mode 100644 index 00000000000..429636751c2 --- /dev/null +++ b/mcs/class/System.IdentityModel/testing_aot_hybrid_System.IdentityModel.dll.sources @@ -0,0 +1 @@ +#include mobile_System.IdentityModel.dll.sources diff --git a/mcs/class/System.IdentityModel/winaot_System.IdentityModel.dll.sources b/mcs/class/System.IdentityModel/winaot_System.IdentityModel.dll.sources new file mode 100644 index 00000000000..429636751c2 --- /dev/null +++ b/mcs/class/System.IdentityModel/winaot_System.IdentityModel.dll.sources @@ -0,0 +1 @@ +#include mobile_System.IdentityModel.dll.sources diff --git a/mcs/class/System.Net.Http/System.Net.Http-net_4_5.sln b/mcs/class/System.Net.Http/System.Net.Http-net_4_5.sln deleted file mode 100644 index 2e55bf7af8d..00000000000 --- a/mcs/class/System.Net.Http/System.Net.Http-net_4_5.sln +++ /dev/null @@ -1,26 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{9862694d-e4fa-418b-8692-a0280feddf36}") = "System.Net.Http-net_4_5", "System.Net.Http-net_4_5.csproj", "{9862694d-e4fa-418b-8692-a0280feddf36}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Net.Http-tests-net_4_5", "System.Net.Http-tests-net_4_5.csproj", "{155AEF28-C81F-405D-9072-9D52780E3E70}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {9862694d-e4fa-418b-8692-a0280feddf36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9862694d-e4fa-418b-8692-a0280feddf36}.Debug|Any CPU.Build.0 = Debug|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9862694d-e4fa-418b-8692-a0280feddf36}.Release|Any CPU.ActiveCfg = Release|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9862694d-e4fa-418b-8692-a0280feddf36}.Release|Any CPU.Build.0 = Release|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = System.Net.Http-net_4_5.csproj - EndGlobalSection -EndGlobal diff --git a/mcs/class/System.Numerics.Vectors/Makefile b/mcs/class/System.Numerics.Vectors/Makefile index 42fb194dbfb..6500f93995c 100644 --- a/mcs/class/System.Numerics.Vectors/Makefile +++ b/mcs/class/System.Numerics.Vectors/Makefile @@ -6,6 +6,8 @@ LIBRARY = System.Numerics.Vectors.dll LIB_REFS = System System.Numerics LIB_MCS_FLAGS = -unsafe +RESX_RESOURCE_STRING = ../../../external/corefx/src/System.Numerics.Vectors/src/Resources/Strings.resx + EXTRA_DISTFILES = include ../../build/library.make diff --git a/mcs/class/System.Numerics.Vectors/SR.cs b/mcs/class/System.Numerics.Vectors/SR.cs index 72e9cfb0ac1..6c04e222d68 100644 --- a/mcs/class/System.Numerics.Vectors/SR.cs +++ b/mcs/class/System.Numerics.Vectors/SR.cs @@ -1,17 +1,14 @@ -// generated from Strings.resx in corefx +// +// This file was generated by resx2sr tool +// partial class SR { - public const string Arg_ArgumentOutOfRangeException="Index was out of bounds:"; - public const string Arg_ElementsInSourceIsGreaterThanDestination="Number of elements in source vector is greater than the destination array"; - public const string Arg_MultiDimArrayNotSupported="Only one-dimensional arrays are supported"; - public const string Arg_NullArgumentNullRef="The method was called with a null array argument."; - public const string Arg_RegisterLengthOfRangeException="length must be less than"; - public const string Arg_TypeNotSupported="Specified type is not supported"; - public const string Reflection_MethodNotSupported="Vector.Count cannot be called via reflection when intrinsics are enabled."; - - public static string Format (string message, object data) - { - return string.Format (message, data); - } + public const string Arg_ArgumentOutOfRangeException = "Index was out of bounds:"; + public const string Arg_ElementsInSourceIsGreaterThanDestination = "Number of elements in source vector is greater than the destination array"; + public const string Arg_MultiDimArrayNotSupported = "Only one-dimensional arrays are supported"; + public const string Arg_NullArgumentNullRef = "The method was called with a null array argument."; + public const string Arg_RegisterLengthOfRangeException = "length must be less than"; + public const string Arg_TypeNotSupported = "Specified type is not supported"; + public const string Reflection_MethodNotSupported = "Vector.Count cannot be called via reflection when intrinsics are enabled."; } diff --git a/mcs/class/System.Numerics.Vectors/System.Numerics.Vectors-net_4_x.csproj b/mcs/class/System.Numerics.Vectors/System.Numerics.Vectors-net_4_x.csproj index 622801b60a8..27f6f05a6f0 100644 --- a/mcs/class/System.Numerics.Vectors/System.Numerics.Vectors-net_4_x.csproj +++ b/mcs/class/System.Numerics.Vectors/System.Numerics.Vectors-net_4_x.csproj @@ -49,10 +49,17 @@ + + + + + + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Runtime.Serialization.Formatters.Soap/makefile.build b/mcs/class/System.Runtime.Serialization.Formatters.Soap/makefile.build deleted file mode 100755 index 820584d844b..00000000000 --- a/mcs/class/System.Runtime.Serialization.Formatters.Soap/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Runtime.Serialization/aot_hybrid_System.Runtime.Serialization.dll.sources b/mcs/class/System.Runtime.Serialization/aot_hybrid_System.Runtime.Serialization.dll.sources deleted file mode 100644 index 6caafd41198..00000000000 --- a/mcs/class/System.Runtime.Serialization/aot_hybrid_System.Runtime.Serialization.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.Runtime.Serialization.dll.sources diff --git a/mcs/class/System.Runtime.Serialization/aot_only_System.Runtime.Serialization.dll.sources b/mcs/class/System.Runtime.Serialization/aot_only_System.Runtime.Serialization.dll.sources deleted file mode 100644 index 6caafd41198..00000000000 --- a/mcs/class/System.Runtime.Serialization/aot_only_System.Runtime.Serialization.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.Runtime.Serialization.dll.sources diff --git a/mcs/class/System.Runtime.Serialization/testing_aot_full_System.Runtime.Serialization.dll.sources b/mcs/class/System.Runtime.Serialization/testing_aot_full_System.Runtime.Serialization.dll.sources new file mode 100644 index 00000000000..6caafd41198 --- /dev/null +++ b/mcs/class/System.Runtime.Serialization/testing_aot_full_System.Runtime.Serialization.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Runtime.Serialization.dll.sources diff --git a/mcs/class/System.Runtime.Serialization/testing_aot_hybrid_System.Runtime.Serialization.dll.sources b/mcs/class/System.Runtime.Serialization/testing_aot_hybrid_System.Runtime.Serialization.dll.sources new file mode 100644 index 00000000000..6caafd41198 --- /dev/null +++ b/mcs/class/System.Runtime.Serialization/testing_aot_hybrid_System.Runtime.Serialization.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Runtime.Serialization.dll.sources diff --git a/mcs/class/System.Runtime.Serialization/winaot_System.Runtime.Serialization.dll.sources b/mcs/class/System.Runtime.Serialization/winaot_System.Runtime.Serialization.dll.sources new file mode 100644 index 00000000000..6caafd41198 --- /dev/null +++ b/mcs/class/System.Runtime.Serialization/winaot_System.Runtime.Serialization.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Runtime.Serialization.dll.sources diff --git a/mcs/class/System.Security/aot_only_System.Security.dll.sources b/mcs/class/System.Security/aot_only_System.Security.dll.sources deleted file mode 100644 index 599b7fa67f7..00000000000 --- a/mcs/class/System.Security/aot_only_System.Security.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include common_System.Security.dll.sources diff --git a/mcs/class/System.Security/testing_aot_full_System.Security.dll.sources b/mcs/class/System.Security/testing_aot_full_System.Security.dll.sources new file mode 100644 index 00000000000..599b7fa67f7 --- /dev/null +++ b/mcs/class/System.Security/testing_aot_full_System.Security.dll.sources @@ -0,0 +1 @@ +#include common_System.Security.dll.sources diff --git a/mcs/class/System.ServiceModel.Internals/aot_hybrid_System.ServiceModel.Internals.dll.sources b/mcs/class/System.ServiceModel.Internals/aot_hybrid_System.ServiceModel.Internals.dll.sources deleted file mode 100644 index f51db672e59..00000000000 --- a/mcs/class/System.ServiceModel.Internals/aot_hybrid_System.ServiceModel.Internals.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.ServiceModel.Internals.dll.sources diff --git a/mcs/class/System.ServiceModel.Internals/testing_aot_hybrid_System.ServiceModel.Internals.dll.sources b/mcs/class/System.ServiceModel.Internals/testing_aot_hybrid_System.ServiceModel.Internals.dll.sources new file mode 100644 index 00000000000..f51db672e59 --- /dev/null +++ b/mcs/class/System.ServiceModel.Internals/testing_aot_hybrid_System.ServiceModel.Internals.dll.sources @@ -0,0 +1 @@ +#include mobile_System.ServiceModel.Internals.dll.sources diff --git a/mcs/class/System.ServiceModel.Web/aot_hybrid_System.ServiceModel.Web.dll.sources b/mcs/class/System.ServiceModel.Web/aot_hybrid_System.ServiceModel.Web.dll.sources deleted file mode 100644 index cbea0fae7b4..00000000000 --- a/mcs/class/System.ServiceModel.Web/aot_hybrid_System.ServiceModel.Web.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.ServiceModel.Web.dll.sources diff --git a/mcs/class/System.ServiceModel.Web/aot_only_System.ServiceModel.Web.dll.sources b/mcs/class/System.ServiceModel.Web/aot_only_System.ServiceModel.Web.dll.sources deleted file mode 100644 index cbea0fae7b4..00000000000 --- a/mcs/class/System.ServiceModel.Web/aot_only_System.ServiceModel.Web.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.ServiceModel.Web.dll.sources diff --git a/mcs/class/System.ServiceModel.Web/testing_aot_full_System.ServiceModel.Web.dll.sources b/mcs/class/System.ServiceModel.Web/testing_aot_full_System.ServiceModel.Web.dll.sources new file mode 100644 index 00000000000..cbea0fae7b4 --- /dev/null +++ b/mcs/class/System.ServiceModel.Web/testing_aot_full_System.ServiceModel.Web.dll.sources @@ -0,0 +1 @@ +#include mobile_System.ServiceModel.Web.dll.sources diff --git a/mcs/class/System.ServiceModel.Web/testing_aot_hybrid_System.ServiceModel.Web.dll.sources b/mcs/class/System.ServiceModel.Web/testing_aot_hybrid_System.ServiceModel.Web.dll.sources new file mode 100644 index 00000000000..cbea0fae7b4 --- /dev/null +++ b/mcs/class/System.ServiceModel.Web/testing_aot_hybrid_System.ServiceModel.Web.dll.sources @@ -0,0 +1 @@ +#include mobile_System.ServiceModel.Web.dll.sources diff --git a/mcs/class/System.ServiceModel.Web/winaot_System.ServiceModel.Web.dll.sources b/mcs/class/System.ServiceModel.Web/winaot_System.ServiceModel.Web.dll.sources new file mode 100644 index 00000000000..cbea0fae7b4 --- /dev/null +++ b/mcs/class/System.ServiceModel.Web/winaot_System.ServiceModel.Web.dll.sources @@ -0,0 +1 @@ +#include mobile_System.ServiceModel.Web.dll.sources diff --git a/mcs/class/System.ServiceModel/aot_hybrid_System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/aot_hybrid_System.ServiceModel.dll.sources deleted file mode 100644 index 22ece5ce8ce..00000000000 --- a/mcs/class/System.ServiceModel/aot_hybrid_System.ServiceModel.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.ServiceModel.dll.sources diff --git a/mcs/class/System.ServiceModel/aot_hybrid_System.ServiceModel_test.dll.exclude.sources b/mcs/class/System.ServiceModel/aot_hybrid_System.ServiceModel_test.dll.exclude.sources deleted file mode 100644 index 350444a823a..00000000000 --- a/mcs/class/System.ServiceModel/aot_hybrid_System.ServiceModel_test.dll.exclude.sources +++ /dev/null @@ -1,151 +0,0 @@ -FeatureBased/Features.Contracts/AsyncCallTester.cs -FeatureBased/Features.Contracts/FaultsTester.cs -FeatureBased/Features.Serialization/AsyncCallTest.cs -FeatureBased/Features.Serialization/AsyncPatternTester.cs -FeatureBased/Features.Serialization/DataContractSerializerTest.cs -FeatureBased/Features.Serialization/DualContractTester.cs -FeatureBased/Features.Serialization/ExitProcessHelper.cs -FeatureBased/Features.Serialization/FaultsTest.cs -FeatureBased/Features.Serialization/KnownTypeTest.cs -FeatureBased/Features.Serialization/MessageContractTest.cs -FeatureBased/Features.Serialization/OperationContractTester.cs -FeatureBased/Features.Serialization/PrimitiveTesterTest.cs -FeatureBased/Features.Serialization/UntypedMessageTest.cs -FeatureBased/TestFixtureBase.cs -MetadataTests/BindingTestAssertions.cs -MetadataTests/ExportTests.cs -MetadataTests/ImportTests.cs -MetadataTests/ImportTests_CreateMetadata.cs -MetadataTests/ImportTests_LoadMetadata.cs -MetadataTests/ImportTests_RoundTrip.cs -MetadataTests/MetadataSamples.cs -MetadataTests/MiscImportTests.cs -MetadataTests/TestContext.cs -System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs -System.ServiceModel.Channels/BinaryMessageEncodingBindingElementTest.cs -System.ServiceModel.Channels/BindingElementTest.cs -System.ServiceModel.Channels/CalcSampleProxy.cs -System.ServiceModel.Channels/CommunicationObjectTest.cs -System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs -System.ServiceModel.Channels/CustomBindingTest.cs -System.ServiceModel.Channels/CustomPolicyConversionContext.cs -System.ServiceModel.Channels/HandlerTransportBindingElement.cs -System.ServiceModel.Channels/HttpTransportBindingElementTest.cs -System.ServiceModel.Channels/HttpsTransportBindingElementTest.cs -System.ServiceModel.Channels/InterceptorBindingElement.cs -System.ServiceModel.Channels/LocalClientSecuritySettingsTest.cs -System.ServiceModel.Channels/MessageBufferTest.cs -System.ServiceModel.Channels/MessageEncoderTest.cs -System.ServiceModel.Channels/MsmqBindingElementBaseTest.cs -System.ServiceModel.Channels/MsmqTransportBindingElementTest.cs -System.ServiceModel.Channels/NamedPipeTransportBindingElementTest.cs -System.ServiceModel.Channels/OneWayBindingElementTest.cs -System.ServiceModel.Channels/PeerTransportBindingElementTest.cs -System.ServiceModel.Channels/ReplyChannelBase.cs -System.ServiceModel.Channels/SecurityAssert.cs -System.ServiceModel.Channels/SecurityBindingElementTest.cs -System.ServiceModel.Channels/SslStreamSecurityBindingElementTest.cs -System.ServiceModel.Channels/SymmetricSecurityBindingElementTest.cs -System.ServiceModel.Channels/TcpTransportBindingElementTest.cs -System.ServiceModel.Channels/TextMessageEncodingBindingElementTest.cs -System.ServiceModel.Channels/TransactionFlowBindingElementTest.cs -System.ServiceModel.Configuration/AddressHeaderCollectionElementTest.cs -System.ServiceModel.Configuration/BasicHttpBindingElementTest.cs -System.ServiceModel.Configuration/BehaviorsSectionTest.cs -System.ServiceModel.Configuration/BindingsSectionTest.cs -System.ServiceModel.Configuration/ChannelEndpointElementTest.cs -System.ServiceModel.Configuration/CustomBindingElementTest.cs -System.ServiceModel.Configuration/EndpointBehaviorElementTest.cs -System.ServiceModel.Configuration/ExtensionsSectionTest.cs -System.ServiceModel.Configuration/MetadataElementTest.cs -System.ServiceModel.Configuration/MexBindingElementTest.cs -System.ServiceModel.Configuration/NetNamedPipeBindingElementTest.cs -System.ServiceModel.Configuration/NetPeerTcpBindingElementTest.cs -System.ServiceModel.Configuration/NetTcpBindingElementTest.cs -System.ServiceModel.Configuration/ServiceBehaviorElementTest.cs -System.ServiceModel.Configuration/ServiceElementTest.cs -System.ServiceModel.Configuration/ServiceModelConfigurationElementCollectionTest.cs -System.ServiceModel.Configuration/ServiceModelSectionGroupTest.cs -System.ServiceModel.Configuration/StandardBindingCollectionElementTest.cs -System.ServiceModel.Configuration/StandardBindingElementCollectionTest.cs -System.ServiceModel.Configuration/StandardBindingElementTest.cs -System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs -System.ServiceModel.Configuration/UserBinding.cs -System.ServiceModel.Description/ClientCredentialsTest.cs -System.ServiceModel.Description/ContractDescriptionTest.cs -System.ServiceModel.Description/MetadataExchangeBindingsTest.cs -System.ServiceModel.Description/MetadataResolverTest.cs -System.ServiceModel.Description/MetadataSetTest.cs -System.ServiceModel.Description/ServiceAuthorizationBehaviorTest.cs -System.ServiceModel.Description/ServiceContractGeneratorTest.cs -System.ServiceModel.Description/ServiceCredentialsTest.cs -System.ServiceModel.Description/ServiceDebugBehaviorTest.cs -System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs -System.ServiceModel.Description/ServiceMetadataEndpointTest.cs -System.ServiceModel.Description/ServiceThrottlingBehaviorTest.cs -System.ServiceModel.Description/TypedMessageConverterTest.cs -System.ServiceModel.Description/WsdlExporterTest.cs -System.ServiceModel.Description/WsdlImporterTest.cs -System.ServiceModel.Dispatcher/ActionFilterTest.cs -System.ServiceModel.Dispatcher/Bug32886Test.cs -System.ServiceModel.Dispatcher/Bug652331Test.cs -System.ServiceModel.Dispatcher/Bug652331_2Test.cs -System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs -System.ServiceModel.Dispatcher/DispatchOperationTest.cs -System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs -System.ServiceModel.Dispatcher/EndpointAddressMessageFilterTest.cs -System.ServiceModel.Dispatcher/EndpointDispatcherTest.cs -System.ServiceModel.Dispatcher/ExceptionHandlerTest.cs -System.ServiceModel.Dispatcher/FilterTableTest.cs -System.ServiceModel.Dispatcher/InvalidBodyAccessExceptionTest.cs -System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs -System.ServiceModel.Dispatcher/XPathMessageContextTest.cs -System.ServiceModel.PeerResolvers/CustomPeerResolverServiceTest.cs -System.ServiceModel.PeerResolvers/PeerResolverSerializationTest.cs -System.ServiceModel.Security.Tokens/IssuedSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/IssuedSecurityTokenProviderTest.cs -System.ServiceModel.Security.Tokens/RsaSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/SecurityContextSecurityTokenTest.cs -System.ServiceModel.Security.Tokens/SecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypesTest.cs -System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/UserNameSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/WrappedKeySecurityTokenTest.cs -System.ServiceModel.Security.Tokens/X509ListedCertificateValidator.cs -System.ServiceModel.Security.Tokens/X509SecurityTokenParametersTest.cs -System.ServiceModel.Security/ChannelProtectionRequirementsTest.cs -System.ServiceModel.Security/MessagePartSpecificationTest.cs -System.ServiceModel.Security/ScopedMessagePartSpecificationTest.cs -System.ServiceModel.Security/SecurityAlgorithmSuiteTest.cs -System.ServiceModel.Security/SecurityMessagePropertyTest.cs -System.ServiceModel.Security/SecurityTokenSpeficicationTest.cs -System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs -System.ServiceModel.Security/ServiceSecurityContextTest.cs -System.ServiceModel.Security/SupportingTokenParametersTest.cs -System.ServiceModel.Security/TransportSecurityBindingElementTest.cs -System.ServiceModel.Security/WSSecurityTokenSerializerTest.cs -System.ServiceModel/BasicHttpBindingTest.cs -System.ServiceModel/CallbackBehaviorAttributeTest.cs -System.ServiceModel/ChannelFactoryTest.cs -System.ServiceModel/ChannelFactory_1Test.cs -System.ServiceModel/ClientBaseTest.cs -System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs -System.ServiceModel/EndpointAddress10Test.cs -System.ServiceModel/EndpointAddressBuilderTest.cs -System.ServiceModel/EndpointAddressTest.cs -System.ServiceModel/EndpointIdentityTest.cs -System.ServiceModel/IntegratedConnectionTest.cs -System.ServiceModel/MessageSecurityVersionTest.cs -System.ServiceModel/MsmqTransportSecurityTest.cs -System.ServiceModel/NetMsmqBindingTest.cs -System.ServiceModel/NetPeerTcpBindingTest.cs -System.ServiceModel/NetTcpBindingTest.cs -System.ServiceModel/OperationContextTest.cs -System.ServiceModel/PeerNodeAddressTest.cs -System.ServiceModel/ServiceHostBaseTest.cs -System.ServiceModel/ServiceHostTest.cs -System.ServiceModel/TransactionProtocolTest.cs -System.ServiceModel/WSFederationHttpBindingTest.cs -System.ServiceModel/WSHttpBindingTest.cs diff --git a/mcs/class/System.ServiceModel/aot_only_System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/aot_only_System.ServiceModel.dll.sources deleted file mode 100644 index 22ece5ce8ce..00000000000 --- a/mcs/class/System.ServiceModel/aot_only_System.ServiceModel.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.ServiceModel.dll.sources diff --git a/mcs/class/System.ServiceModel/aot_only_System.ServiceModel_test.dll.exclude.sources b/mcs/class/System.ServiceModel/aot_only_System.ServiceModel_test.dll.exclude.sources deleted file mode 100644 index 350444a823a..00000000000 --- a/mcs/class/System.ServiceModel/aot_only_System.ServiceModel_test.dll.exclude.sources +++ /dev/null @@ -1,151 +0,0 @@ -FeatureBased/Features.Contracts/AsyncCallTester.cs -FeatureBased/Features.Contracts/FaultsTester.cs -FeatureBased/Features.Serialization/AsyncCallTest.cs -FeatureBased/Features.Serialization/AsyncPatternTester.cs -FeatureBased/Features.Serialization/DataContractSerializerTest.cs -FeatureBased/Features.Serialization/DualContractTester.cs -FeatureBased/Features.Serialization/ExitProcessHelper.cs -FeatureBased/Features.Serialization/FaultsTest.cs -FeatureBased/Features.Serialization/KnownTypeTest.cs -FeatureBased/Features.Serialization/MessageContractTest.cs -FeatureBased/Features.Serialization/OperationContractTester.cs -FeatureBased/Features.Serialization/PrimitiveTesterTest.cs -FeatureBased/Features.Serialization/UntypedMessageTest.cs -FeatureBased/TestFixtureBase.cs -MetadataTests/BindingTestAssertions.cs -MetadataTests/ExportTests.cs -MetadataTests/ImportTests.cs -MetadataTests/ImportTests_CreateMetadata.cs -MetadataTests/ImportTests_LoadMetadata.cs -MetadataTests/ImportTests_RoundTrip.cs -MetadataTests/MetadataSamples.cs -MetadataTests/MiscImportTests.cs -MetadataTests/TestContext.cs -System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs -System.ServiceModel.Channels/BinaryMessageEncodingBindingElementTest.cs -System.ServiceModel.Channels/BindingElementTest.cs -System.ServiceModel.Channels/CalcSampleProxy.cs -System.ServiceModel.Channels/CommunicationObjectTest.cs -System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs -System.ServiceModel.Channels/CustomBindingTest.cs -System.ServiceModel.Channels/CustomPolicyConversionContext.cs -System.ServiceModel.Channels/HandlerTransportBindingElement.cs -System.ServiceModel.Channels/HttpTransportBindingElementTest.cs -System.ServiceModel.Channels/HttpsTransportBindingElementTest.cs -System.ServiceModel.Channels/InterceptorBindingElement.cs -System.ServiceModel.Channels/LocalClientSecuritySettingsTest.cs -System.ServiceModel.Channels/MessageBufferTest.cs -System.ServiceModel.Channels/MessageEncoderTest.cs -System.ServiceModel.Channels/MsmqBindingElementBaseTest.cs -System.ServiceModel.Channels/MsmqTransportBindingElementTest.cs -System.ServiceModel.Channels/NamedPipeTransportBindingElementTest.cs -System.ServiceModel.Channels/OneWayBindingElementTest.cs -System.ServiceModel.Channels/PeerTransportBindingElementTest.cs -System.ServiceModel.Channels/ReplyChannelBase.cs -System.ServiceModel.Channels/SecurityAssert.cs -System.ServiceModel.Channels/SecurityBindingElementTest.cs -System.ServiceModel.Channels/SslStreamSecurityBindingElementTest.cs -System.ServiceModel.Channels/SymmetricSecurityBindingElementTest.cs -System.ServiceModel.Channels/TcpTransportBindingElementTest.cs -System.ServiceModel.Channels/TextMessageEncodingBindingElementTest.cs -System.ServiceModel.Channels/TransactionFlowBindingElementTest.cs -System.ServiceModel.Configuration/AddressHeaderCollectionElementTest.cs -System.ServiceModel.Configuration/BasicHttpBindingElementTest.cs -System.ServiceModel.Configuration/BehaviorsSectionTest.cs -System.ServiceModel.Configuration/BindingsSectionTest.cs -System.ServiceModel.Configuration/ChannelEndpointElementTest.cs -System.ServiceModel.Configuration/CustomBindingElementTest.cs -System.ServiceModel.Configuration/EndpointBehaviorElementTest.cs -System.ServiceModel.Configuration/ExtensionsSectionTest.cs -System.ServiceModel.Configuration/MetadataElementTest.cs -System.ServiceModel.Configuration/MexBindingElementTest.cs -System.ServiceModel.Configuration/NetNamedPipeBindingElementTest.cs -System.ServiceModel.Configuration/NetPeerTcpBindingElementTest.cs -System.ServiceModel.Configuration/NetTcpBindingElementTest.cs -System.ServiceModel.Configuration/ServiceBehaviorElementTest.cs -System.ServiceModel.Configuration/ServiceElementTest.cs -System.ServiceModel.Configuration/ServiceModelConfigurationElementCollectionTest.cs -System.ServiceModel.Configuration/ServiceModelSectionGroupTest.cs -System.ServiceModel.Configuration/StandardBindingCollectionElementTest.cs -System.ServiceModel.Configuration/StandardBindingElementCollectionTest.cs -System.ServiceModel.Configuration/StandardBindingElementTest.cs -System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs -System.ServiceModel.Configuration/UserBinding.cs -System.ServiceModel.Description/ClientCredentialsTest.cs -System.ServiceModel.Description/ContractDescriptionTest.cs -System.ServiceModel.Description/MetadataExchangeBindingsTest.cs -System.ServiceModel.Description/MetadataResolverTest.cs -System.ServiceModel.Description/MetadataSetTest.cs -System.ServiceModel.Description/ServiceAuthorizationBehaviorTest.cs -System.ServiceModel.Description/ServiceContractGeneratorTest.cs -System.ServiceModel.Description/ServiceCredentialsTest.cs -System.ServiceModel.Description/ServiceDebugBehaviorTest.cs -System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs -System.ServiceModel.Description/ServiceMetadataEndpointTest.cs -System.ServiceModel.Description/ServiceThrottlingBehaviorTest.cs -System.ServiceModel.Description/TypedMessageConverterTest.cs -System.ServiceModel.Description/WsdlExporterTest.cs -System.ServiceModel.Description/WsdlImporterTest.cs -System.ServiceModel.Dispatcher/ActionFilterTest.cs -System.ServiceModel.Dispatcher/Bug32886Test.cs -System.ServiceModel.Dispatcher/Bug652331Test.cs -System.ServiceModel.Dispatcher/Bug652331_2Test.cs -System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs -System.ServiceModel.Dispatcher/DispatchOperationTest.cs -System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs -System.ServiceModel.Dispatcher/EndpointAddressMessageFilterTest.cs -System.ServiceModel.Dispatcher/EndpointDispatcherTest.cs -System.ServiceModel.Dispatcher/ExceptionHandlerTest.cs -System.ServiceModel.Dispatcher/FilterTableTest.cs -System.ServiceModel.Dispatcher/InvalidBodyAccessExceptionTest.cs -System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs -System.ServiceModel.Dispatcher/XPathMessageContextTest.cs -System.ServiceModel.PeerResolvers/CustomPeerResolverServiceTest.cs -System.ServiceModel.PeerResolvers/PeerResolverSerializationTest.cs -System.ServiceModel.Security.Tokens/IssuedSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/IssuedSecurityTokenProviderTest.cs -System.ServiceModel.Security.Tokens/RsaSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/SecurityContextSecurityTokenTest.cs -System.ServiceModel.Security.Tokens/SecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypesTest.cs -System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/UserNameSecurityTokenParametersTest.cs -System.ServiceModel.Security.Tokens/WrappedKeySecurityTokenTest.cs -System.ServiceModel.Security.Tokens/X509ListedCertificateValidator.cs -System.ServiceModel.Security.Tokens/X509SecurityTokenParametersTest.cs -System.ServiceModel.Security/ChannelProtectionRequirementsTest.cs -System.ServiceModel.Security/MessagePartSpecificationTest.cs -System.ServiceModel.Security/ScopedMessagePartSpecificationTest.cs -System.ServiceModel.Security/SecurityAlgorithmSuiteTest.cs -System.ServiceModel.Security/SecurityMessagePropertyTest.cs -System.ServiceModel.Security/SecurityTokenSpeficicationTest.cs -System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs -System.ServiceModel.Security/ServiceSecurityContextTest.cs -System.ServiceModel.Security/SupportingTokenParametersTest.cs -System.ServiceModel.Security/TransportSecurityBindingElementTest.cs -System.ServiceModel.Security/WSSecurityTokenSerializerTest.cs -System.ServiceModel/BasicHttpBindingTest.cs -System.ServiceModel/CallbackBehaviorAttributeTest.cs -System.ServiceModel/ChannelFactoryTest.cs -System.ServiceModel/ChannelFactory_1Test.cs -System.ServiceModel/ClientBaseTest.cs -System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs -System.ServiceModel/EndpointAddress10Test.cs -System.ServiceModel/EndpointAddressBuilderTest.cs -System.ServiceModel/EndpointAddressTest.cs -System.ServiceModel/EndpointIdentityTest.cs -System.ServiceModel/IntegratedConnectionTest.cs -System.ServiceModel/MessageSecurityVersionTest.cs -System.ServiceModel/MsmqTransportSecurityTest.cs -System.ServiceModel/NetMsmqBindingTest.cs -System.ServiceModel/NetPeerTcpBindingTest.cs -System.ServiceModel/NetTcpBindingTest.cs -System.ServiceModel/OperationContextTest.cs -System.ServiceModel/PeerNodeAddressTest.cs -System.ServiceModel/ServiceHostBaseTest.cs -System.ServiceModel/ServiceHostTest.cs -System.ServiceModel/TransactionProtocolTest.cs -System.ServiceModel/WSFederationHttpBindingTest.cs -System.ServiceModel/WSHttpBindingTest.cs diff --git a/mcs/class/System.ServiceModel/aot_only_System.ServiceModel_test.dll.sources b/mcs/class/System.ServiceModel/aot_only_System.ServiceModel_test.dll.sources deleted file mode 100644 index 275d9f33056..00000000000 --- a/mcs/class/System.ServiceModel/aot_only_System.ServiceModel_test.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include System.ServiceModel_test.dll.sources diff --git a/mcs/class/System.ServiceModel/run-tests.client.bat b/mcs/class/System.ServiceModel/run-tests.client.bat deleted file mode 100644 index c9b5932af65..00000000000 --- a/mcs/class/System.ServiceModel/run-tests.client.bat +++ /dev/null @@ -1,4 +0,0 @@ -Test\SwitchMode\bin\Debug\SwitchMode.exe System.ServiceModel_test_net_3_0.dll.config client -start WCFServers.exe -nunit-console.exe System.ServiceModel_test_net_3_0.dll /out:TestResults.txt /exclude:NotWorking -WCFServers.exe shutdown diff --git a/mcs/class/System.ServiceModel/run-tests.inproc.bat b/mcs/class/System.ServiceModel/run-tests.inproc.bat deleted file mode 100644 index b62fa0dceda..00000000000 --- a/mcs/class/System.ServiceModel/run-tests.inproc.bat +++ /dev/null @@ -1,2 +0,0 @@ -Test\SwitchMode\bin\Debug\SwitchMode.exe System.ServiceModel_test_net_3_0.dll.config inproc -nunit-console.exe System.ServiceModel_test_net_3_0.dll /out:TestResults.txt /exclude:NotWorking diff --git a/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel.dll.sources new file mode 100644 index 00000000000..22ece5ce8ce --- /dev/null +++ b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel.dll.sources @@ -0,0 +1 @@ +#include mobile_System.ServiceModel.dll.sources diff --git a/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.exclude.sources b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.exclude.sources new file mode 100644 index 00000000000..350444a823a --- /dev/null +++ b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.exclude.sources @@ -0,0 +1,151 @@ +FeatureBased/Features.Contracts/AsyncCallTester.cs +FeatureBased/Features.Contracts/FaultsTester.cs +FeatureBased/Features.Serialization/AsyncCallTest.cs +FeatureBased/Features.Serialization/AsyncPatternTester.cs +FeatureBased/Features.Serialization/DataContractSerializerTest.cs +FeatureBased/Features.Serialization/DualContractTester.cs +FeatureBased/Features.Serialization/ExitProcessHelper.cs +FeatureBased/Features.Serialization/FaultsTest.cs +FeatureBased/Features.Serialization/KnownTypeTest.cs +FeatureBased/Features.Serialization/MessageContractTest.cs +FeatureBased/Features.Serialization/OperationContractTester.cs +FeatureBased/Features.Serialization/PrimitiveTesterTest.cs +FeatureBased/Features.Serialization/UntypedMessageTest.cs +FeatureBased/TestFixtureBase.cs +MetadataTests/BindingTestAssertions.cs +MetadataTests/ExportTests.cs +MetadataTests/ImportTests.cs +MetadataTests/ImportTests_CreateMetadata.cs +MetadataTests/ImportTests_LoadMetadata.cs +MetadataTests/ImportTests_RoundTrip.cs +MetadataTests/MetadataSamples.cs +MetadataTests/MiscImportTests.cs +MetadataTests/TestContext.cs +System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/BinaryMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/BindingElementTest.cs +System.ServiceModel.Channels/CalcSampleProxy.cs +System.ServiceModel.Channels/CommunicationObjectTest.cs +System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs +System.ServiceModel.Channels/CustomBindingTest.cs +System.ServiceModel.Channels/CustomPolicyConversionContext.cs +System.ServiceModel.Channels/HandlerTransportBindingElement.cs +System.ServiceModel.Channels/HttpTransportBindingElementTest.cs +System.ServiceModel.Channels/HttpsTransportBindingElementTest.cs +System.ServiceModel.Channels/InterceptorBindingElement.cs +System.ServiceModel.Channels/LocalClientSecuritySettingsTest.cs +System.ServiceModel.Channels/MessageBufferTest.cs +System.ServiceModel.Channels/MessageEncoderTest.cs +System.ServiceModel.Channels/MsmqBindingElementBaseTest.cs +System.ServiceModel.Channels/MsmqTransportBindingElementTest.cs +System.ServiceModel.Channels/NamedPipeTransportBindingElementTest.cs +System.ServiceModel.Channels/OneWayBindingElementTest.cs +System.ServiceModel.Channels/PeerTransportBindingElementTest.cs +System.ServiceModel.Channels/ReplyChannelBase.cs +System.ServiceModel.Channels/SecurityAssert.cs +System.ServiceModel.Channels/SecurityBindingElementTest.cs +System.ServiceModel.Channels/SslStreamSecurityBindingElementTest.cs +System.ServiceModel.Channels/SymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/TcpTransportBindingElementTest.cs +System.ServiceModel.Channels/TextMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/TransactionFlowBindingElementTest.cs +System.ServiceModel.Configuration/AddressHeaderCollectionElementTest.cs +System.ServiceModel.Configuration/BasicHttpBindingElementTest.cs +System.ServiceModel.Configuration/BehaviorsSectionTest.cs +System.ServiceModel.Configuration/BindingsSectionTest.cs +System.ServiceModel.Configuration/ChannelEndpointElementTest.cs +System.ServiceModel.Configuration/CustomBindingElementTest.cs +System.ServiceModel.Configuration/EndpointBehaviorElementTest.cs +System.ServiceModel.Configuration/ExtensionsSectionTest.cs +System.ServiceModel.Configuration/MetadataElementTest.cs +System.ServiceModel.Configuration/MexBindingElementTest.cs +System.ServiceModel.Configuration/NetNamedPipeBindingElementTest.cs +System.ServiceModel.Configuration/NetPeerTcpBindingElementTest.cs +System.ServiceModel.Configuration/NetTcpBindingElementTest.cs +System.ServiceModel.Configuration/ServiceBehaviorElementTest.cs +System.ServiceModel.Configuration/ServiceElementTest.cs +System.ServiceModel.Configuration/ServiceModelConfigurationElementCollectionTest.cs +System.ServiceModel.Configuration/ServiceModelSectionGroupTest.cs +System.ServiceModel.Configuration/StandardBindingCollectionElementTest.cs +System.ServiceModel.Configuration/StandardBindingElementCollectionTest.cs +System.ServiceModel.Configuration/StandardBindingElementTest.cs +System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs +System.ServiceModel.Configuration/UserBinding.cs +System.ServiceModel.Description/ClientCredentialsTest.cs +System.ServiceModel.Description/ContractDescriptionTest.cs +System.ServiceModel.Description/MetadataExchangeBindingsTest.cs +System.ServiceModel.Description/MetadataResolverTest.cs +System.ServiceModel.Description/MetadataSetTest.cs +System.ServiceModel.Description/ServiceAuthorizationBehaviorTest.cs +System.ServiceModel.Description/ServiceContractGeneratorTest.cs +System.ServiceModel.Description/ServiceCredentialsTest.cs +System.ServiceModel.Description/ServiceDebugBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataEndpointTest.cs +System.ServiceModel.Description/ServiceThrottlingBehaviorTest.cs +System.ServiceModel.Description/TypedMessageConverterTest.cs +System.ServiceModel.Description/WsdlExporterTest.cs +System.ServiceModel.Description/WsdlImporterTest.cs +System.ServiceModel.Dispatcher/ActionFilterTest.cs +System.ServiceModel.Dispatcher/Bug32886Test.cs +System.ServiceModel.Dispatcher/Bug652331Test.cs +System.ServiceModel.Dispatcher/Bug652331_2Test.cs +System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs +System.ServiceModel.Dispatcher/DispatchOperationTest.cs +System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs +System.ServiceModel.Dispatcher/EndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/EndpointDispatcherTest.cs +System.ServiceModel.Dispatcher/ExceptionHandlerTest.cs +System.ServiceModel.Dispatcher/FilterTableTest.cs +System.ServiceModel.Dispatcher/InvalidBodyAccessExceptionTest.cs +System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/XPathMessageContextTest.cs +System.ServiceModel.PeerResolvers/CustomPeerResolverServiceTest.cs +System.ServiceModel.PeerResolvers/PeerResolverSerializationTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenProviderTest.cs +System.ServiceModel.Security.Tokens/RsaSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecurityContextSecurityTokenTest.cs +System.ServiceModel.Security.Tokens/SecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypesTest.cs +System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/UserNameSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/WrappedKeySecurityTokenTest.cs +System.ServiceModel.Security.Tokens/X509ListedCertificateValidator.cs +System.ServiceModel.Security.Tokens/X509SecurityTokenParametersTest.cs +System.ServiceModel.Security/ChannelProtectionRequirementsTest.cs +System.ServiceModel.Security/MessagePartSpecificationTest.cs +System.ServiceModel.Security/ScopedMessagePartSpecificationTest.cs +System.ServiceModel.Security/SecurityAlgorithmSuiteTest.cs +System.ServiceModel.Security/SecurityMessagePropertyTest.cs +System.ServiceModel.Security/SecurityTokenSpeficicationTest.cs +System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs +System.ServiceModel.Security/ServiceSecurityContextTest.cs +System.ServiceModel.Security/SupportingTokenParametersTest.cs +System.ServiceModel.Security/TransportSecurityBindingElementTest.cs +System.ServiceModel.Security/WSSecurityTokenSerializerTest.cs +System.ServiceModel/BasicHttpBindingTest.cs +System.ServiceModel/CallbackBehaviorAttributeTest.cs +System.ServiceModel/ChannelFactoryTest.cs +System.ServiceModel/ChannelFactory_1Test.cs +System.ServiceModel/ClientBaseTest.cs +System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs +System.ServiceModel/EndpointAddress10Test.cs +System.ServiceModel/EndpointAddressBuilderTest.cs +System.ServiceModel/EndpointAddressTest.cs +System.ServiceModel/EndpointIdentityTest.cs +System.ServiceModel/IntegratedConnectionTest.cs +System.ServiceModel/MessageSecurityVersionTest.cs +System.ServiceModel/MsmqTransportSecurityTest.cs +System.ServiceModel/NetMsmqBindingTest.cs +System.ServiceModel/NetPeerTcpBindingTest.cs +System.ServiceModel/NetTcpBindingTest.cs +System.ServiceModel/OperationContextTest.cs +System.ServiceModel/PeerNodeAddressTest.cs +System.ServiceModel/ServiceHostBaseTest.cs +System.ServiceModel/ServiceHostTest.cs +System.ServiceModel/TransactionProtocolTest.cs +System.ServiceModel/WSFederationHttpBindingTest.cs +System.ServiceModel/WSHttpBindingTest.cs diff --git a/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.sources b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.sources new file mode 100644 index 00000000000..275d9f33056 --- /dev/null +++ b/mcs/class/System.ServiceModel/testing_aot_full_System.ServiceModel_test.dll.sources @@ -0,0 +1 @@ +#include System.ServiceModel_test.dll.sources diff --git a/mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel.dll.sources new file mode 100644 index 00000000000..22ece5ce8ce --- /dev/null +++ b/mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel.dll.sources @@ -0,0 +1 @@ +#include mobile_System.ServiceModel.dll.sources diff --git a/mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel_test.dll.exclude.sources b/mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel_test.dll.exclude.sources new file mode 100644 index 00000000000..350444a823a --- /dev/null +++ b/mcs/class/System.ServiceModel/testing_aot_hybrid_System.ServiceModel_test.dll.exclude.sources @@ -0,0 +1,151 @@ +FeatureBased/Features.Contracts/AsyncCallTester.cs +FeatureBased/Features.Contracts/FaultsTester.cs +FeatureBased/Features.Serialization/AsyncCallTest.cs +FeatureBased/Features.Serialization/AsyncPatternTester.cs +FeatureBased/Features.Serialization/DataContractSerializerTest.cs +FeatureBased/Features.Serialization/DualContractTester.cs +FeatureBased/Features.Serialization/ExitProcessHelper.cs +FeatureBased/Features.Serialization/FaultsTest.cs +FeatureBased/Features.Serialization/KnownTypeTest.cs +FeatureBased/Features.Serialization/MessageContractTest.cs +FeatureBased/Features.Serialization/OperationContractTester.cs +FeatureBased/Features.Serialization/PrimitiveTesterTest.cs +FeatureBased/Features.Serialization/UntypedMessageTest.cs +FeatureBased/TestFixtureBase.cs +MetadataTests/BindingTestAssertions.cs +MetadataTests/ExportTests.cs +MetadataTests/ImportTests.cs +MetadataTests/ImportTests_CreateMetadata.cs +MetadataTests/ImportTests_LoadMetadata.cs +MetadataTests/ImportTests_RoundTrip.cs +MetadataTests/MetadataSamples.cs +MetadataTests/MiscImportTests.cs +MetadataTests/TestContext.cs +System.ServiceModel.Channels/AsymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/BinaryMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/BindingElementTest.cs +System.ServiceModel.Channels/CalcSampleProxy.cs +System.ServiceModel.Channels/CommunicationObjectTest.cs +System.ServiceModel.Channels/ConnectionOrientedTransportBindingElementTest.cs +System.ServiceModel.Channels/CustomBindingTest.cs +System.ServiceModel.Channels/CustomPolicyConversionContext.cs +System.ServiceModel.Channels/HandlerTransportBindingElement.cs +System.ServiceModel.Channels/HttpTransportBindingElementTest.cs +System.ServiceModel.Channels/HttpsTransportBindingElementTest.cs +System.ServiceModel.Channels/InterceptorBindingElement.cs +System.ServiceModel.Channels/LocalClientSecuritySettingsTest.cs +System.ServiceModel.Channels/MessageBufferTest.cs +System.ServiceModel.Channels/MessageEncoderTest.cs +System.ServiceModel.Channels/MsmqBindingElementBaseTest.cs +System.ServiceModel.Channels/MsmqTransportBindingElementTest.cs +System.ServiceModel.Channels/NamedPipeTransportBindingElementTest.cs +System.ServiceModel.Channels/OneWayBindingElementTest.cs +System.ServiceModel.Channels/PeerTransportBindingElementTest.cs +System.ServiceModel.Channels/ReplyChannelBase.cs +System.ServiceModel.Channels/SecurityAssert.cs +System.ServiceModel.Channels/SecurityBindingElementTest.cs +System.ServiceModel.Channels/SslStreamSecurityBindingElementTest.cs +System.ServiceModel.Channels/SymmetricSecurityBindingElementTest.cs +System.ServiceModel.Channels/TcpTransportBindingElementTest.cs +System.ServiceModel.Channels/TextMessageEncodingBindingElementTest.cs +System.ServiceModel.Channels/TransactionFlowBindingElementTest.cs +System.ServiceModel.Configuration/AddressHeaderCollectionElementTest.cs +System.ServiceModel.Configuration/BasicHttpBindingElementTest.cs +System.ServiceModel.Configuration/BehaviorsSectionTest.cs +System.ServiceModel.Configuration/BindingsSectionTest.cs +System.ServiceModel.Configuration/ChannelEndpointElementTest.cs +System.ServiceModel.Configuration/CustomBindingElementTest.cs +System.ServiceModel.Configuration/EndpointBehaviorElementTest.cs +System.ServiceModel.Configuration/ExtensionsSectionTest.cs +System.ServiceModel.Configuration/MetadataElementTest.cs +System.ServiceModel.Configuration/MexBindingElementTest.cs +System.ServiceModel.Configuration/NetNamedPipeBindingElementTest.cs +System.ServiceModel.Configuration/NetPeerTcpBindingElementTest.cs +System.ServiceModel.Configuration/NetTcpBindingElementTest.cs +System.ServiceModel.Configuration/ServiceBehaviorElementTest.cs +System.ServiceModel.Configuration/ServiceElementTest.cs +System.ServiceModel.Configuration/ServiceModelConfigurationElementCollectionTest.cs +System.ServiceModel.Configuration/ServiceModelSectionGroupTest.cs +System.ServiceModel.Configuration/StandardBindingCollectionElementTest.cs +System.ServiceModel.Configuration/StandardBindingElementCollectionTest.cs +System.ServiceModel.Configuration/StandardBindingElementTest.cs +System.ServiceModel.Configuration/StandardEndpointsSectionTest.cs +System.ServiceModel.Configuration/UserBinding.cs +System.ServiceModel.Description/ClientCredentialsTest.cs +System.ServiceModel.Description/ContractDescriptionTest.cs +System.ServiceModel.Description/MetadataExchangeBindingsTest.cs +System.ServiceModel.Description/MetadataResolverTest.cs +System.ServiceModel.Description/MetadataSetTest.cs +System.ServiceModel.Description/ServiceAuthorizationBehaviorTest.cs +System.ServiceModel.Description/ServiceContractGeneratorTest.cs +System.ServiceModel.Description/ServiceCredentialsTest.cs +System.ServiceModel.Description/ServiceDebugBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataBehaviorTest.cs +System.ServiceModel.Description/ServiceMetadataEndpointTest.cs +System.ServiceModel.Description/ServiceThrottlingBehaviorTest.cs +System.ServiceModel.Description/TypedMessageConverterTest.cs +System.ServiceModel.Description/WsdlExporterTest.cs +System.ServiceModel.Description/WsdlImporterTest.cs +System.ServiceModel.Dispatcher/ActionFilterTest.cs +System.ServiceModel.Dispatcher/Bug32886Test.cs +System.ServiceModel.Dispatcher/Bug652331Test.cs +System.ServiceModel.Dispatcher/Bug652331_2Test.cs +System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs +System.ServiceModel.Dispatcher/DispatchOperationTest.cs +System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs +System.ServiceModel.Dispatcher/EndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/EndpointDispatcherTest.cs +System.ServiceModel.Dispatcher/ExceptionHandlerTest.cs +System.ServiceModel.Dispatcher/FilterTableTest.cs +System.ServiceModel.Dispatcher/InvalidBodyAccessExceptionTest.cs +System.ServiceModel.Dispatcher/PrefixEndpointAddressMessageFilterTest.cs +System.ServiceModel.Dispatcher/XPathMessageContextTest.cs +System.ServiceModel.PeerResolvers/CustomPeerResolverServiceTest.cs +System.ServiceModel.PeerResolvers/PeerResolverSerializationTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/IssuedSecurityTokenProviderTest.cs +System.ServiceModel.Security.Tokens/RsaSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecureConversationSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SecurityContextSecurityTokenTest.cs +System.ServiceModel.Security.Tokens/SecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/ServiceModelSecurityTokenTypesTest.cs +System.ServiceModel.Security.Tokens/SslSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/SspiSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/UserNameSecurityTokenParametersTest.cs +System.ServiceModel.Security.Tokens/WrappedKeySecurityTokenTest.cs +System.ServiceModel.Security.Tokens/X509ListedCertificateValidator.cs +System.ServiceModel.Security.Tokens/X509SecurityTokenParametersTest.cs +System.ServiceModel.Security/ChannelProtectionRequirementsTest.cs +System.ServiceModel.Security/MessagePartSpecificationTest.cs +System.ServiceModel.Security/ScopedMessagePartSpecificationTest.cs +System.ServiceModel.Security/SecurityAlgorithmSuiteTest.cs +System.ServiceModel.Security/SecurityMessagePropertyTest.cs +System.ServiceModel.Security/SecurityTokenSpeficicationTest.cs +System.ServiceModel.Security/ServiceCredentialsSecurityTokenManagerTest.cs +System.ServiceModel.Security/ServiceSecurityContextTest.cs +System.ServiceModel.Security/SupportingTokenParametersTest.cs +System.ServiceModel.Security/TransportSecurityBindingElementTest.cs +System.ServiceModel.Security/WSSecurityTokenSerializerTest.cs +System.ServiceModel/BasicHttpBindingTest.cs +System.ServiceModel/CallbackBehaviorAttributeTest.cs +System.ServiceModel/ChannelFactoryTest.cs +System.ServiceModel/ChannelFactory_1Test.cs +System.ServiceModel/ClientBaseTest.cs +System.ServiceModel/ClientCredentialsSecurityTokenManagerTest.cs +System.ServiceModel/EndpointAddress10Test.cs +System.ServiceModel/EndpointAddressBuilderTest.cs +System.ServiceModel/EndpointAddressTest.cs +System.ServiceModel/EndpointIdentityTest.cs +System.ServiceModel/IntegratedConnectionTest.cs +System.ServiceModel/MessageSecurityVersionTest.cs +System.ServiceModel/MsmqTransportSecurityTest.cs +System.ServiceModel/NetMsmqBindingTest.cs +System.ServiceModel/NetPeerTcpBindingTest.cs +System.ServiceModel/NetTcpBindingTest.cs +System.ServiceModel/OperationContextTest.cs +System.ServiceModel/PeerNodeAddressTest.cs +System.ServiceModel/ServiceHostBaseTest.cs +System.ServiceModel/ServiceHostTest.cs +System.ServiceModel/TransactionProtocolTest.cs +System.ServiceModel/WSFederationHttpBindingTest.cs +System.ServiceModel/WSHttpBindingTest.cs diff --git a/mcs/class/System.ServiceModel/winaot_System.ServiceModel.dll.sources b/mcs/class/System.ServiceModel/winaot_System.ServiceModel.dll.sources new file mode 100644 index 00000000000..22ece5ce8ce --- /dev/null +++ b/mcs/class/System.ServiceModel/winaot_System.ServiceModel.dll.sources @@ -0,0 +1 @@ +#include mobile_System.ServiceModel.dll.sources diff --git a/mcs/class/System.Web.Extensions.Design/makefile.build b/mcs/class/System.Web.Extensions.Design/makefile.build deleted file mode 100755 index 37e8b94a6e2..00000000000 --- a/mcs/class/System.Web.Extensions.Design/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Web.Extensions/makefile.build b/mcs/class/System.Web.Extensions/makefile.build deleted file mode 100755 index 1fa53ddda0d..00000000000 --- a/mcs/class/System.Web.Extensions/makefile.build +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Web.Extensions/run-tests-nunit.bat b/mcs/class/System.Web.Extensions/run-tests-nunit.bat deleted file mode 100644 index 2a0a0861593..00000000000 --- a/mcs/class/System.Web.Extensions/run-tests-nunit.bat +++ /dev/null @@ -1,198 +0,0 @@ -@echo off -setlocal -@REM ******************************************************** -@REM This batch file receives the follwing parameters: -@REM build/rebuild (optional): should the solution file be rebuilded -@REM or just builded before test run (default is rebuild) -@REM output files name prefix (mandratory) : prefix for naming output xml files -@REM test fixture name (optional) : if you want to run some particular test fixture -@REM directory to run tests (optional) -@REM path back to root directory (opposite to previous param) -@REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -@REM will cause to build (and not rebuild) test solutions, -@REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -@REM with output files named GhTests.Net.xml and GhTests.GH.xml -@REM ******************************************************** - - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -@REM ******************************************************** -@REM Set parameters -@REM ******************************************************** - -set OUTPUT_FILE_PREFIX=System_Web_Extensions -set TEST_SOLUTION=Test\System.Web.Extensions.Test.sln -set TEST_ASSEMBLY=System.Web.Extensions.Test.jar -set PROJECT_CONFIGURATION=Debug_Java -set NUNIT_CONFIGURATION=Debug_Java20 - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - -@rem set NUNIT_OPTIONS=/exclude:NotWorking,ValueAdd,CAS,InetAccess - - -@REM ******************************************************** -@REM @echo Set environment -@REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -if not defined JAVA_HOME set JAVA_HOME=%VMW_HOME%\jre -echo using JAVA_HOME=%JAVA_HOME% - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Drawing.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Configuration.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Drawing.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Web.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Web.Extensions.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar - -set FACES_PATH=%JGAC_PATH%myfaces\ -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-beanutils-1.7.0.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-codec-1.3.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-collections-3.1.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-digester-1.6.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-el-1.0.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-lang-2.1.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-logging-1.0.4.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%jstl-1.1.0.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%myfaces-api-1.1.5.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%myfaces-impl-1.1.5.jar - -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%framework\bin\%NUNIT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%util\bin\%NUNIT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%core\bin\%NUNIT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%NUNIT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -@REM ******************************************************** -@echo Building GH solution... -@REM ******************************************************** - -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -@REM ******************************************************** -@echo Building NUnit solution... -@REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%NUNIT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -@REM ******************************************************** -@echo Running GH tests... -@REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . - -set TMPDIR=%TMP% - -@REM @echo on -echo "%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -@REM @echo off - -@REM ******************************************************** -@echo Build XmlTool -@REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%NUNIT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%NUNIT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -@REM ******************************************************** -@echo Analyze and print results -@REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -@REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running tests. See %RUN_LOG% for details... -@REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild]" -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -@REM EXIT 0 -endlocal \ No newline at end of file diff --git a/mcs/class/System.Web.Extensions/run-tests.cmd b/mcs/class/System.Web.Extensions/run-tests.cmd deleted file mode 100755 index 5a0ba989c41..00000000000 --- a/mcs/class/System.Web.Extensions/run-tests.cmd +++ /dev/null @@ -1,6 +0,0 @@ - -call run-tests-nunit.bat - -call run-tests.selenium.cmd - - \ No newline at end of file diff --git a/mcs/class/System.Web.Extensions/run-tests.selenium.cmd b/mcs/class/System.Web.Extensions/run-tests.selenium.cmd deleted file mode 100644 index d2edcc63a96..00000000000 --- a/mcs/class/System.Web.Extensions/run-tests.selenium.cmd +++ /dev/null @@ -1,130 +0,0 @@ -@echo off -setlocal - -:loop -if "%1" == "" goto break -if "%1" == "skip_selenium" ( - set SKIP_SELENIUM="True" -) -if "%1" == "skip_app" ( - set SKIP_APP="True" -) -if "%1" == "skip_tests" ( - set SKIP_TESTS="True" -) -shift /1 -goto loop -:break - -rem SETUP ENVIRONMENT FOR RUNNING SELENIUM TESTS -rem ============================================ -if "%VMW_HOME%" == "" set VMW_HOME=C:\Program Files\Mainsoft for Java EE - -if NOT "%SELENIUM_HOME%" == "" goto after_set_SELENIUM_HOME -set SELENIUM_HOME=%~dp0 -set SELENIUM_HOME=%SELENIUM_HOME:class\System.Web.Extensions=selenium% -:after_set_SELENIUM_HOME -echo SELENIUM_HOME=%SELENIUM_HOME% - -set Browser=C:\Program Files\Internet Explorer\iexplore.exe -set HTTPServer=http://localhost:8080 -set SeleniumURL=%HTTPServer%/Selenium - -rem ================================================= -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - -set ResultsURL=/PostResults -set ResultsDir=FuncTests%TIMESTAMP% -set OUTPUT_FILE_PREFIX=SystemWebExtensionsSelenium - -set COMMON_PREFIX=%cd%\%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set SELENIUM_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -rem DEPLOY SELENIUM WITH TESTS TO SERVER -rem ==================================== -if DEFINED SKIP_SELENIUM goto after_selenium -echo Deploying Selenium -call %SELENIUM_HOME%\DeploySelenium.cmd "Tomcat" "%SELENIUM_HOME%\TomcatDeploy.cmd" "http://admin:admin@localhost:8080" >>%BUILD_LOG% 2<&1 -:after_selenium - -rem BUILD APPLICATION UNDER TEST -rem ============================================ -if DEFINED SKIP_APP goto after_app -pushd Test\AUT -echo Building %cd%\SystemWebExtensionsAUT.JavaEE.csproj -del /F /Q bin_Java\deployedFiles bin_Java\outputFiles.list -msbuild SystemWebExtensionsAUT.JavaEE.csproj /t:Rebuild /t:Deploy /p:Configuration=Debug_Java >>%BUILD_LOG% 2<&1 -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION -popd -:after_app - -if DEFINED SKIP_TESTS goto after_tests - -echo Running Functional Test Suites - -mkdir %ResultsDir% -type %SELENIUM_HOME%\SeleniumTestResultsHead.txt >%SELENIUM_OUTPUT_XML% - -wget -O .\nul "%HTTPServer%%ResultsURL%/Default.ashx" >>%RUN_LOG% 2<&1 -wget -O "%ResultsDir%\selenium-test.css" "%HTTPServer%%ResultsURL%/selenium-test.css" >>%RUN_LOG% 2<&1 - -rem RUN THE TEST SUITES ONE AFTER THE OTHER -rem ============================================ - -call :executeTestSuite /SystemWebExtensionsAUT/Selenium/System.Web.UI/UpdatePanel/UpdatePanelTestSuite.html -call :executeTestSuite /SystemWebExtensionsAUT/Selenium/Sys.WebForms/PageRequestManager/PageRequestManagerTestSuite.html -call :executeTestSuite /SystemWebExtensionsAUT/Selenium/QuickStarts/QuickStartTestSuite.html - - -rem ADD MORE TEST SUITES ABOVE THIS LINE -rem ==================================== - -type %SELENIUM_HOME%\SeleniumTestResultsTail.txt >>%SELENIUM_OUTPUT_XML% - -:after_tests -goto afterExecuteTestSuite - -rem INTERNAL SCRIPT FUNCTION TO RUN SPECIFIC TEST SUITE -rem =================================================== -:executeTestSuite - -set TestSuiteRelativePath=%1 -set SuiteName=%~n1 -set ResultsAsXML=%ResultsDir%\%SuiteName%Results.xml -set ResultsAsHtml=%ResultsDir%\%SuiteName%Results.html - -echo Test suite: %SuiteName% -echo Test suite: %SuiteName% >>%RUN_LOG% 2<&1 -"%Browser%" "%SeleniumURL%/core/TestRunner.html?test=%TestSuiteRelativePath%&auto=true&close=on&multiWindow=off&resultsUrl=%ResultsURL%/Default.ashx" - -if NOT %ResultsAsXML%=="" ( - wget -O "%ResultsAsXML%" "%HTTPServer%%ResultsURL%/GetLastResults.ashx" >>%RUN_LOG% 2<&1 - type "%ResultsAsXML%" >>%SELENIUM_OUTPUT_XML% -) - -if NOT %ResultsAsHtml%=="" ( - wget -O "%ResultsAsHtml%" "%HTTPServer%%ResultsURL%/GetLastResults.ashx?Html" >>%RUN_LOG% 2<&1 -) - -exit /B - -goto END -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:afterExecuteTestSuite -:END -endlocal - diff --git a/mcs/class/System.Web.Services/aot_hybrid_System.Web.Services.dll.sources b/mcs/class/System.Web.Services/aot_hybrid_System.Web.Services.dll.sources deleted file mode 100644 index 9e39dcc73b1..00000000000 --- a/mcs/class/System.Web.Services/aot_hybrid_System.Web.Services.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.Web.Services.dll.sources diff --git a/mcs/class/System.Web.Services/aot_hybrid_System.Web.Services_test.dll.exclude.sources b/mcs/class/System.Web.Services/aot_hybrid_System.Web.Services_test.dll.exclude.sources deleted file mode 100644 index 0dee611d624..00000000000 --- a/mcs/class/System.Web.Services/aot_hybrid_System.Web.Services_test.dll.exclude.sources +++ /dev/null @@ -1,8 +0,0 @@ -System.Web.Services.Configuration/DiagnosticsElementTest.cs -System.Web.Services.Configuration/ProtocolElementTest.cs -System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs -System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs -System.Web.Services.Configuration/TypeElementTest.cs -System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs -System.Web.Services.Configuration/WsiProfilesElementTest.cs -System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs diff --git a/mcs/class/System.Web.Services/aot_only_System.Web.Services.dll.sources b/mcs/class/System.Web.Services/aot_only_System.Web.Services.dll.sources deleted file mode 100644 index 9e39dcc73b1..00000000000 --- a/mcs/class/System.Web.Services/aot_only_System.Web.Services.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.Web.Services.dll.sources diff --git a/mcs/class/System.Web.Services/aot_only_System.Web.Services_test.dll.exclude.sources b/mcs/class/System.Web.Services/aot_only_System.Web.Services_test.dll.exclude.sources deleted file mode 100644 index 0dee611d624..00000000000 --- a/mcs/class/System.Web.Services/aot_only_System.Web.Services_test.dll.exclude.sources +++ /dev/null @@ -1,8 +0,0 @@ -System.Web.Services.Configuration/DiagnosticsElementTest.cs -System.Web.Services.Configuration/ProtocolElementTest.cs -System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs -System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs -System.Web.Services.Configuration/TypeElementTest.cs -System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs -System.Web.Services.Configuration/WsiProfilesElementTest.cs -System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs diff --git a/mcs/class/System.Web.Services/aot_only_System.Web.Services_test.dll.sources b/mcs/class/System.Web.Services/aot_only_System.Web.Services_test.dll.sources deleted file mode 100644 index 915ba6cbbec..00000000000 --- a/mcs/class/System.Web.Services/aot_only_System.Web.Services_test.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include System.Web.Services_test.dll.sources diff --git a/mcs/class/System.Web.Services/makefile.build b/mcs/class/System.Web.Services/makefile.build deleted file mode 100755 index 734f56ec6fd..00000000000 --- a/mcs/class/System.Web.Services/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services.dll.sources b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services.dll.sources new file mode 100644 index 00000000000..9e39dcc73b1 --- /dev/null +++ b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Web.Services.dll.sources diff --git a/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.exclude.sources b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.exclude.sources new file mode 100644 index 00000000000..0dee611d624 --- /dev/null +++ b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.exclude.sources @@ -0,0 +1,8 @@ +System.Web.Services.Configuration/DiagnosticsElementTest.cs +System.Web.Services.Configuration/ProtocolElementTest.cs +System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs +System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs +System.Web.Services.Configuration/TypeElementTest.cs +System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs +System.Web.Services.Configuration/WsiProfilesElementTest.cs +System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs diff --git a/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.sources b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.sources new file mode 100644 index 00000000000..915ba6cbbec --- /dev/null +++ b/mcs/class/System.Web.Services/testing_aot_full_System.Web.Services_test.dll.sources @@ -0,0 +1 @@ +#include System.Web.Services_test.dll.sources diff --git a/mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services.dll.sources b/mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services.dll.sources new file mode 100644 index 00000000000..9e39dcc73b1 --- /dev/null +++ b/mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Web.Services.dll.sources diff --git a/mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services_test.dll.exclude.sources b/mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services_test.dll.exclude.sources new file mode 100644 index 00000000000..0dee611d624 --- /dev/null +++ b/mcs/class/System.Web.Services/testing_aot_hybrid_System.Web.Services_test.dll.exclude.sources @@ -0,0 +1,8 @@ +System.Web.Services.Configuration/DiagnosticsElementTest.cs +System.Web.Services.Configuration/ProtocolElementTest.cs +System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs +System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs +System.Web.Services.Configuration/TypeElementTest.cs +System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs +System.Web.Services.Configuration/WsiProfilesElementTest.cs +System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs diff --git a/mcs/class/System.Web.Services/winaot_System.Web.Services.dll.sources b/mcs/class/System.Web.Services/winaot_System.Web.Services.dll.sources new file mode 100644 index 00000000000..9e39dcc73b1 --- /dev/null +++ b/mcs/class/System.Web.Services/winaot_System.Web.Services.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Web.Services.dll.sources diff --git a/mcs/class/System.Web/System.Web.Phantom/makefile.build b/mcs/class/System.Web/System.Web.Phantom/makefile.build deleted file mode 100755 index d3eebf1f759..00000000000 --- a/mcs/class/System.Web/System.Web.Phantom/makefile.build +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Web/Test/mainsoft/run-test.bat b/mcs/class/System.Web/Test/mainsoft/run-test.bat deleted file mode 100755 index 076773c749c..00000000000 --- a/mcs/class/System.Web/Test/mainsoft/run-test.bat +++ /dev/null @@ -1,130 +0,0 @@ -@ECHO OFF - -rem ================================================= -if "%GH_HOME%" == "" (set GH_HOME=c:\Program Files\Mainsoft\Visual MainWin for J2EE) -if "%JAVA_HOME%" == "" (set JAVA_HOME=%GH_HOME%\jre5) -set JGAC_PATH=%GH_HOME%\java_refs\framework - -rem ================================================= -echo Hiding svn... -pushd MainsoftWebApp -FOR /R %%f IN (.svn) DO IF EXIST "%%f" ( -ATTRIB -h "%%f" -RENAME "%%f" _svn -) - -rem ================================================= -if "%1"=="JBoss" ( -echo Building JBoss web project... -"%VS71COMNTOOLS%..\IDE\devenv.com" MainsoftWebApp.JBoss.vmwcsproj /build Debug_Java > nul -) else ( -echo Building Tomcat web project... -"%VS71COMNTOOLS%..\IDE\devenv.com" MainsoftWebApp.Tomcat.vmwcsproj /build Debug_Java > nul -) - -IF NOT ERRORLEVEL==0 (set BUILD_FAILED=TRUE) - -rem ================================================= -echo Restoring svn... -FOR /R %%f IN (_svn) DO IF EXIST "%%f" ( -RENAME "%%f" .svn -ATTRIB +h "%%~pf\.svn" -) -popd - -rem ================================================= -IF "%BUILD_FAILED%"=="TRUE" GOTO FAILURE - -rem ================================================= -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP -echo Build NUnit... -pushd ..\..\..\..\nunit20\ -"%VS71COMNTOOLS%..\IDE\devenv.com" nunit.java.sln /build Debug_Java > nul -popd - -goto NUNITREADY -:NUNITSKIP -echo Skipping NUnit Build... -:NUNITREADY -set NUNIT_BUILD=DONE - -rem ================================================= -echo Build System.Web test client side... -pushd MainsoftWebTest -"%VS71COMNTOOLS%..\IDE\devenv.com" SystemWebTest.vmwcsproj /build Debug_Java_NUnit > nul -popd - -rem ================================================= -if "%TEST_17%" == "TRUE" goto SKIPMONO3 -echo Build System.Web mono tests... -pushd .. -dos2unix System.Web.UI.HtmlControls\HtmlSelectTest.cs > nul -dos2unix System.Web.UI.WebControls\CheckBoxListTest.cs > nul -dos2unix System.Web.UI.WebControls\RepeatInfoTest.auto.cs > nul -"%VS71COMNTOOLS%..\IDE\devenv.com" TestMonoWeb_jvm.vmwcsproj /build Debug_Java > nul -popd -:SKIPMONO3 - -rem ================================================= -copy MainsoftWebTest\almost_config.xml MainsoftWebTest\bin\almost_config.xml /Y > nul -copy MainsoftWebTest\test_catalog.xml MainsoftWebTest\bin\test_catalog.xml /Y > nul -copy MainsoftWebTest\App.gh.config MainsoftWebTest\bin\nunit-console.exe.config /Y > nul -copy ..\..\..\..\nunit20\core\bin\Debug_Java\nunit.core.jar MainsoftWebTest\bin\nunit.core.jar /Y > nul -copy ..\..\..\..\nunit20\framework\bin\Debug_Java\nunit.framework.jar MainsoftWebTest\bin\nunit.framework.jar /Y > nul -copy ..\..\..\..\nunit20\util\bin\Debug_Java\nunit.util.jar MainsoftWebTest\bin\nunit.util.jar /Y > nul -copy ..\..\..\..\nunit20\nunit-console\bin\Debug_Java\nunit-console.jar MainsoftWebTest\bin\nunit-console.jar /Y > nul - -rem ================================================= -echo Buildinig xmltool... -pushd ..\..\..\..\tools\mono-xmltool -"%VS71COMNTOOLS%..\IDE\devenv.com" XmlTool.sln /build Debug_Java > nul -popd -copy ..\..\..\..\tools\mono-xmltool\bin\Debug_Java\xmltool.exe MainsoftWebTest\bin\xmltool.exe > nul -copy ..\..\..\..\tools\mono-xmltool\nunit_transform.xslt MainsoftWebTest\bin\nunit_transform.xslt > nul - -rem ================================================= -set GH_CP=%JGAC_PATH%\mscorlib.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.Xml.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.Web.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.Data.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.Drawing.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\J2SE.Helpers.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\J2EE.Helpers.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\vmwutils.jar - -set GH_CP=%GH_CP%;nunit.core.jar -set GH_CP=%GH_CP%;nunit.framework.jar -set GH_CP=%GH_CP%;nunit.util.jar -set GH_CP=%GH_CP%;nunit-console.jar - -set ghlogfile=logfile.xml -set monologfile=mono.xml - -pushd MainsoftWebTest\bin - -echo Running Mainsoft tests... -"%JAVA_HOME%\bin\java.exe" -cp .;"%GH_CP%" NUnit.Console.ConsoleUi SystemWebTest.jar /xml=%ghlogfile% /fixture:MonoTests.stand_alone.WebHarness.Harness > nul - -if "%TEST_17%" == "TRUE" goto SKIPMONO -echo Running Mono tests... -"%JAVA_HOME%\bin\java.exe" -cp .;"%GH_CP%" NUnit.Console.ConsoleUi TestMonoWeb_jvm.jar /xml=%monologfile% /exclude:NotWorking,ValueAdd,InetAccess /fixture:MonoTests.System.Web > nul -:SKIPMONO - -echo Finished... -xmltool.exe --transform nunit_transform.xslt %ghlogfile% - -if "%TEST_17%" == "TRUE" goto SKIPMONO2 -xmltool.exe --transform nunit_transform.xslt %monologfile% -:SKIPMONO2 - -popd - -goto :END -:FAILURE -popd -echo Failed during build... -set BUILD_FAILED= -:END - - diff --git a/mcs/class/System.Web/Test/mainsoft/run-test20.bat b/mcs/class/System.Web/Test/mainsoft/run-test20.bat deleted file mode 100644 index 5c97ccfe172..00000000000 --- a/mcs/class/System.Web/Test/mainsoft/run-test20.bat +++ /dev/null @@ -1,106 +0,0 @@ -@ECHO OFF - -rem ================================================= -if "%GH_HOME%" == "" (set GH_HOME=c:\Program Files\Mainsoft\Visual MainWin for J2EE V2) -if "%VMW_HOME%" == "" (set VMW_HOME=%GH_HOME%) -if "%JAVA_HOME%" == "" (set JAVA_HOME=%GH_HOME%\jre) -set JGAC_PATH=%GH_HOME%\java_refs\framework - -rem ================================================= -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - -set OUTPUT_FILE_PREFIX=System_Web_Services -set RUNNING_FIXTURE=System.Web.Services - -set COMMON_PREFIX=%cd%\%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -rem ================================================= -pushd MainsoftWebApp -echo Building Tomcat web project... -msbuild MainsoftWebApp20.Tomcat.csproj /t:deploy /p:Configuration=Debug_Java >>%BUILD_LOG% 2<&1 -popd - -IF NOT ERRORLEVEL==0 GOTO FAILURE - -rem ================================================= -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP -echo Build NUnit... -pushd ..\..\..\..\nunit20\ -msbuild nunit20.java.sln /t:build /p:Configuration=Debug_Java20 >>%BUILD_LOG% 2<&1 -popd - -goto NUNITREADY -:NUNITSKIP -echo Skipping NUnit Build... -:NUNITREADY -set NUNIT_BUILD=DONE - -rem ================================================= -echo Build System.Web test client side... -pushd MainsoftWebTest -msbuild SystemWebTest20.J2EE.csproj /t:build /p:Configuration=Debug_Java_Nunit >>%BUILD_LOG% 2<&1 -popd - - -rem ================================================= -copy MainsoftWebTest\almost_config.xml MainsoftWebTest\bin\almost_config.xml /Y -copy MainsoftWebTest\test_catalog.xml MainsoftWebTest\bin\test_catalog.xml /Y -copy MainsoftWebTest\App.gh20.config MainsoftWebTest\bin\nunit-console.exe.config /Y -copy ..\..\..\..\nunit20\core\bin\Debug_Java\nunit.core.jar MainsoftWebTest\bin\nunit.core.jar /Y -copy ..\..\..\..\nunit20\framework\bin\Debug_Java\nunit.framework.jar MainsoftWebTest\bin\nunit.framework.jar /Y -copy ..\..\..\..\nunit20\util\bin\Debug_Java\nunit.util.jar MainsoftWebTest\bin\nunit.util.jar /Y -copy ..\..\..\..\nunit20\nunit-console\bin\Debug_Java\nunit-console.jar MainsoftWebTest\bin\nunit-console.jar /Y - -rem ================================================= -echo Buildinig xmltool... -pushd ..\..\..\..\tools\mono-xmltool -msbuild XmlTool20.csproj /p:Configuration=Debug_Java20 >>%BUILD_LOG% 2<&1 -popd -copy ..\..\..\..\tools\mono-xmltool\bin\Debug_Java\xmltool.exe MainsoftWebTest\bin\xmltool.exe -copy ..\..\..\..\tools\mono-xmltool\nunit_transform.xslt MainsoftWebTest\bin\nunit_transform.xslt - -rem ================================================= -set GH_CP=%JGAC_PATH%\mscorlib.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.Xml.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.Web.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.Data.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\System.Drawing.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\J2SE.Helpers.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\J2EE.Helpers.jar -set GH_CP=%GH_CP%;%JGAC_PATH%\vmwutils.jar - -set GH_CP=%GH_CP%;nunit.core.jar -set GH_CP=%GH_CP%;nunit.framework.jar -set GH_CP=%GH_CP%;nunit.util.jar -set GH_CP=%GH_CP%;nunit-console.jar - -pushd MainsoftWebTest\bin - -echo Running Mainsoft tests... -"%JAVA_HOME%\bin\java.exe" -cp .;"%GH_CP%" NUnit.Console.ConsoleUi SystemWebTest.jar /xml=%GH_OUTPUT_XML% /fixture:MonoTests.stand_alone.WebHarness.Harness >>%RUN_LOG% 2<&1 - -echo Finished... -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% - -popd - -goto :END -:FAILURE -popd -echo Failed during build... -set BUILD_FAILED= -:END - - diff --git a/mcs/class/System.Web/makefile.build b/mcs/class/System.Web/makefile.build deleted file mode 100755 index 31857b371b9..00000000000 --- a/mcs/class/System.Web/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System.Web/run-mono-tests.bat b/mcs/class/System.Web/run-mono-tests.bat deleted file mode 100755 index ceba63c6c98..00000000000 --- a/mcs/class/System.Web/run-mono-tests.bat +++ /dev/null @@ -1,239 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM example run-tests build -REM will cause to build (and not rebuild) test solutions, -REM ******************************************************** - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=build -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set OUTPUT_FILE_PREFIX=System_Web -set RUNNING_FIXTURE=System.Web -set TEST_SOLUTION=Test\TestMonoWeb.J2EE20.sln -set DEPLOY_PROJECT=Test\mainsoft\MainsoftWebApp20\MainsoftWebApp20.csproj -set TEST_ASSEMBLY=TestMonoWeb.jar -set PROJECT_CONFIGURATION=Debug_Java20 - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set TOMCAT_PATH=%VMW_HOME%\jakarta-tomcat\common\lib\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Web.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Runtime.Serialization.Formatters.Soap.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%Mainsoft.Web.jar -rem set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Drawing.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar - -set FACES_PATH=%JGAC_PATH%myfaces\ -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-beanutils-1.7.0.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-codec-1.3.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-collections-3.1.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-digester-1.6.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-el-1.0.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-lang-2.1.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%commons-logging-1.0.4.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%jstl-1.1.0.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%myfaces-api-1.1.5.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%FACES_PATH%myfaces-impl-1.1.5.jar - -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%VMW_HOME%\java_refs\jdbc\derby.jar - -rem ./Test/mainsoft/MainsoftWebTest/bin/Debug_Java20/HtmlCompare.jar - -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;Test\mainsoft\NunitWeb\NunitWeb\bin\Debug_Java20\NunitWeb.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;Test\mainsoft\MainsoftWebTest\bin\Debug_Java20\HtmlCompare.jar - -set TOMCAT_CLASSPATH=%TOMCAT_PATH%servlet-api.jar -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%;%TOMCAT_CLASSPATH%" - -IF "%BUILD_OPTION%"=="nobuild" GOTO RUN - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** -xcopy /y Test\mainsoft\NunitWeb\NunitWeb\Resources\*.as* Test\mainsoft\MainsoftWebApp20\ -xcopy /y Test\mainsoft\NunitWeb\NunitWeb\Resources\*.master Test\mainsoft\MainsoftWebApp20\ -xcopy /y Test\mainsoft\NunitWebResources\*.* Test\mainsoft\MainsoftWebApp20\ -pushd Test\mainsoft\MainsoftWebApp20\ -xcopy /y WizardTest.skin App_Themes\Theme1\ -xcopy /y Theme1.skin App_Themes\Theme1\ -xcopy /y Theme2.skin App_Themes\Theme2\ -xcopy /y ResolveUrl.ascx Folder\ -mkdir XXX -for %%i in (*.as*) DO sed "s/CodeFile=/CodeBehind=/" %%i > XXX\%%i -move /Y XXX\* . -rmdir XXX -popd - -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Deploying GH solution to tomcat... -REM ******************************************************** -IF NOT DEFINED VMW_BUILDER GOTO MSBUILD_DEPLOY -set CATALINA_HOME=%VMW_HOME%\jakarta-tomcat -call "%VMW_HOME%\jakarta-tomcat\bin\shutdown.bat" -echo Waiting 5 sec for tomcat to stop.... -@ping 127.0.0.1 -n 5 -w 1000 > nul -del /q "%VMW_HOME%\jakarta-tomcat\webapps\MainsoftWebApp20.war" -rmdir /s /q "%VMW_HOME%\jakarta-tomcat\webapps\MainsoftWebApp20" -xcopy /Y Test\mainsoft\MainsoftWebApp20\bin\%PROJECT_CONFIGURATION%\MainsoftWebApp20.war "%VMW_HOME%\jakarta-tomcat\webapps" -call "%VMW_HOME%\jakarta-tomcat\bin\startup.bat" -echo Waiting 5 sec for tomcat to start.... -@ping 127.0.0.1 -n 5 -w 1000 > nul -GOTO AFTER_DEPLOY -:MSBUILD_DEPLOY -echo msbuild %DEPLOY_PROJECT% /t:Deploy /p:Configuration=%PROJECT_CONFIGURATION% /p:Platform=AnyCPU >>%BUILD_LOG% -msbuild %DEPLOY_PROJECT% /t:Deploy /p:Configuration=%PROJECT_CONFIGURATION% /p:Platform=AnyCPU >>%BUILD_LOG% 2<&1 -:AFTER_DEPLOY - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -IF "%BUILD_OPTION%"=="nobuild" GOTO RUN - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP -msbuild %NUNIT_PATH%\nunit20.java.sln /t:%BUILD_OPTION% /p:configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -:RUN -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . - -REM @echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -XX:MaxPermSize=128m -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -IF NOT DEFINED VMW_BUILDER GOTO DONT_SHUTDOWN_TOMCAT -set CATALINA_HOME=%VMW_HOME%\jakarta-tomcat -call "%VMW_HOME%\jakarta-tomcat\bin\shutdown.bat" -:DONT_SHUTDOWN_TOMCAT - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.Web/run-tests.bat b/mcs/class/System.Web/run-tests.bat deleted file mode 100644 index 93f31a31029..00000000000 --- a/mcs/class/System.Web/run-tests.bat +++ /dev/null @@ -1,4 +0,0 @@ -@echo off -pushd Test\mainsoft -call run-test.bat -popd diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms-net_2_0.sln b/mcs/class/System.Windows.Forms/System.Windows.Forms-net_2_0.sln deleted file mode 100644 index 384393e7eb5..00000000000 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms-net_2_0.sln +++ /dev/null @@ -1,41 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Windows.Forms-net_2_0", "System.Windows.Forms-net_2_0.csproj", "{155AEF28-C81F-405D-9072-9D52780E3E70}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {155AEF28-C81F-405D-9072-9D52780E3E70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Debug|Any CPU.Build.0 = Debug|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Release|Any CPU.ActiveCfg = Release|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = System.Windows.Forms-net_2_0.csproj - Policies = $0 - $0.DotNetNamingPolicy = $1 - $1.DirectoryNamespaceAssociation = None - $1.ResourceNamePolicy = FileFormatDefault - $0.TextStylePolicy = $2 - $2.inheritsSet = null - $2.scope = text/x-csharp - $0.CSharpFormattingPolicy = $3 - $3.NamespaceBraceStyle = EndOfLine - $3.ClassBraceStyle = EndOfLine - $3.InterfaceBraceStyle = EndOfLine - $3.StructBraceStyle = EndOfLine - $3.EnumBraceStyle = EndOfLine - $3.inheritsSet = Mono - $3.inheritsScope = text/x-csharp - $3.scope = text/x-csharp - $0.TextStylePolicy = $4 - $4.FileWidth = 120 - $4.inheritsSet = Mono - $4.inheritsScope = text/plain - $4.scope = text/plain - EndGlobalSection -EndGlobal diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms-tests-net_2_0.sln b/mcs/class/System.Windows.Forms/System.Windows.Forms-tests-net_2_0.sln deleted file mode 100644 index 8718e02ba20..00000000000 --- a/mcs/class/System.Windows.Forms/System.Windows.Forms-tests-net_2_0.sln +++ /dev/null @@ -1,20 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Windows.Forms-tests-net_2_0", "System.Windows.Forms-tests-net_2_0.csproj", "{155AEF28-C81F-405D-9072-9D52780E3E70}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {155AEF28-C81F-405D-9072-9D52780E3E70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Debug|Any CPU.Build.0 = Debug|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Release|Any CPU.ActiveCfg = Release|Any CPU - {155AEF28-C81F-405D-9072-9D52780E3E70}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(MonoDevelopProperties) = preSolution - StartupItem = System.Windows.Forms-tests-net_2_0.csproj - EndGlobalSection -EndGlobal diff --git a/mcs/class/System.XML/Test/System.Xml.Xsl/MsxslScriptTests.cs b/mcs/class/System.XML/Test/System.Xml.Xsl/MsxslScriptTests.cs index 8396ac1be88..55ec88ab4cc 100644 --- a/mcs/class/System.XML/Test/System.Xml.Xsl/MsxslScriptTests.cs +++ b/mcs/class/System.XML/Test/System.Xml.Xsl/MsxslScriptTests.cs @@ -106,7 +106,7 @@ namespace MonoTests.System.Xml.Xsl } [Test] - [Category ("NotWorking")] // it depends on "mcs" existence + [Category ("MobileNotWorking")] public void TestCSharp () { string style = xslstring.Replace ("***** rewrite here *****", cs1); @@ -136,8 +136,8 @@ namespace MonoTests.System.Xml.Xsl } [Test] - [Ignore ("Actually it should throw compile exception")] [ExpectedException (typeof (XsltException))] + [Category ("MobileNotWorking")] public void InvalidScript () { string script = @""))), null, sw); } + [Test] + [Category ("MobileNotWorking")] + public void MSXslFormatDate () + { + var arguments = new XsltArgumentList(); + arguments.AddParam("date", "", new DateTime (2010, 11, 22, 5, 4, 3)); + + string xsl = @" + + + + +

The current date is and current time is .

+
+
+
"; + + StringWriter sw = new StringWriter (); + var t = new XslCompiledTransform (); + t.Load (new XPathDocument (new StringReader (xsl))); + + t.Transform (new XPathDocument (new XmlTextReader (new StringReader (""))), arguments, sw); + + Assert.AreEqual ("

The current date is 22 November 2010 and current time is 05:04.

", sw.ToString ()); + } + + [Test] public void EvaluateEmptyVariableAsBoolean () { @@ -1026,7 +1053,6 @@ xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-micros } [Test] - [Category ("NotWorking")] // bug #77081: mono does not output newline and indentation for non-html elements public void Output_Indent_Html_DocType () { XsltArgumentList xsltArgs = new XsltArgumentList (); @@ -1065,7 +1091,7 @@ xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-micros " {0}" + " {0}" + " {0}" + - "", Environment.NewLine), sw.ToString (), "#1"); + "", end_of_line), sw.ToString (), "#1"); // set indent to no sw.GetStringBuilder ().Length = 0; @@ -1093,7 +1119,7 @@ xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-micros " {0}" + " {0}" + " {0}" + - "", Environment.NewLine), sw.ToString (), "#3"); + "", end_of_line), sw.ToString (), "#3"); } [Test] @@ -1159,7 +1185,6 @@ xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-micros } [Test] - [Category ("NotWorking")] // bug #77081: mono does not output newline and indentation for non-html elements public void Output_Indent_Html () { XsltArgumentList xsltArgs = new XsltArgumentList (); @@ -1213,7 +1238,7 @@ xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-micros " {0}" + "

{0}" + " {0}" + - "", Environment.NewLine), sw.ToString (), "#1"); + "", end_of_line), sw.ToString (), "#1"); // set indent to no sw.GetStringBuilder ().Length = 0; @@ -1249,7 +1274,7 @@ xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-micros " {0}" + "

{0}" + " {0}" + - "", Environment.NewLine), sw.ToString (), "#3"); + "", end_of_line), sw.ToString (), "#3"); } [Test] @@ -2276,8 +2301,7 @@ NO } [Test] // reverse case of #349375 - [Category ("NotWorking")] -// [Category ("NotDotNet")] + [Category ("MobileNotWorking")] public void PreserveWhitespace2 () { XslCompiledTransform xslt = new XslCompiledTransform (); @@ -2361,7 +2385,7 @@ NO } [Test] - [Category ("NotWorking")] // FIXME: SRE related regression + [Category ("MobileNotWorking")] public void Bug487065 () { using (XmlReader input = GetInput ()) { diff --git a/mcs/class/System.XML/aot_hybrid_System.Xml.dll.sources b/mcs/class/System.XML/aot_hybrid_System.Xml.dll.sources deleted file mode 100644 index b6630930f75..00000000000 --- a/mcs/class/System.XML/aot_hybrid_System.Xml.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.Xml.dll.sources diff --git a/mcs/class/System.XML/aot_only_System.Xml.dll.sources b/mcs/class/System.XML/aot_only_System.Xml.dll.sources deleted file mode 100644 index b6630930f75..00000000000 --- a/mcs/class/System.XML/aot_only_System.Xml.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.Xml.dll.sources diff --git a/mcs/class/System.XML/run-W3C-tests.bat b/mcs/class/System.XML/run-W3C-tests.bat deleted file mode 100644 index dc36393b6c0..00000000000 --- a/mcs/class/System.XML/run-W3C-tests.bat +++ /dev/null @@ -1,191 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM example run-tests build -REM will cause to build (and not rebuild) test solutions, -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set OUTPUT_FILE_PREFIX=System_XML_W3C -set RUNNING_FIXTURE=MonoTests.W3C_xmlconf.CleanTests -set TEST_SOLUTION=W3c20.J2EE.sln -set TEST_ASSEMBLY=W3C.jar -set PROJECT_CONFIGURATION=Debug_Java20 - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\..\..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" -set W3C_DIR=Test\System.Xml\W3C - -pushd %W3C_DIR% - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** -del %TEST_ASSEMBLY% - -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building test catalog... -REM ******************************************************** -del xmlts20031210.zip -wget http://www.w3.org/XML/Test/xmlts20031210.zip -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -mkdir xmlconf -unzip -un xmlts20031210.zip -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - - -msbuild %NUNIT_PATH%\nunit20.java.sln /t:%BUILD_OPTION% /p:configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -REM @echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -popd - -copy %W3C_DIR%\%GH_OUTPUT_XML% . -copy %W3C_DIR%\%RUN_LOG% . - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variables JAVA_HOME and GH_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -popd -@echo Error in building solutions. See %BUILD_LOG% for details... -GOTO END - -:RUN_EXCEPTION -popd -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.XML/run-XSLT-tests.bat b/mcs/class/System.XML/run-XSLT-tests.bat deleted file mode 100644 index 5322a17d980..00000000000 --- a/mcs/class/System.XML/run-XSLT-tests.bat +++ /dev/null @@ -1,199 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM example run-tests build -REM will cause to build (and not rebuild) test solutions, -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set OUTPUT_FILE_PREFIX=System_XML_XSLT -set RUNNING_FIXTURE=MonoTests.oasis_xslt.SuiteBuilder -set TEST_SOLUTION=xslt20.J2EE.sln -set TEST_ASSEMBLY=xslt.jar -set PROJECT_CONFIGURATION=Debug_Java20 - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set NUNIT_OPTIONS=/include=Clean - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\..\..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" -set XSLT_DIR=Test\System.Xml.XSL\standalone_tests\ - -pushd %XSLT_DIR% -IF "%BUILD_OPTION%"=="nobuild" GOTO RUN - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building test catalog... -REM ******************************************************** -del xslt-testsuite-03.ZIP -wget http://www.oasis-open.org/committees/download.php/9584/xslt-testsuite-03.ZIP -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION -unzip -un xslt-testsuite-03.ZIP -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION -del xslt-reference-results.tar.gz -wget http://anonsvn.mono-project.com/source/trunk/release/test-ext/xslt-standalone/xslt-reference-results.tar.gz -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION -tar -xzf xslt-reference-results.tar.gz -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION -sed -f catalog.sed testsuite/TESTS/catalog.xml > testsuite/TESTS/catalog-fixed.xml -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION -patch -p0 -i catalog-fixed.diff -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - - -msbuild %NUNIT_PATH%\nunit20.java.sln /t:%BUILD_OPTION% /p:configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -:RUN -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -REM @echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -popd - -copy %XSLT_DIR%\%GH_OUTPUT_XML% . -copy %XSLT_DIR%\%RUN_LOG% . - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variables JAVA_HOME and GH_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -popd -@echo Error in building solutions. See %BUILD_LOG% for details... -GOTO END - -:RUN_EXCEPTION - -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.XML/run-tests.api.bat b/mcs/class/System.XML/run-tests.api.bat deleted file mode 100755 index c075cb4584e..00000000000 --- a/mcs/class/System.XML/run-tests.api.bat +++ /dev/null @@ -1,181 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set OUTPUT_FILE_PREFIX=System_Xml -set RUNNING_FIXTURE=MonoTests.System.Xml -set TEST_SOLUTION=Test\System.Xml.Test20.sln -set TEST_ASSEMBLY=System.Xml.Test.jar -set PROJECT_CONFIGURATION=Debug_Java20 - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - -set NUNIT_OPTIONS=/exclude:NotWorking,ValueAdd,CAS,InetAccess - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Data.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -rem devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . - -REM @echo on -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System.XML/run-tests.bat b/mcs/class/System.XML/run-tests.bat deleted file mode 100644 index c46d5e31784..00000000000 --- a/mcs/class/System.XML/run-tests.bat +++ /dev/null @@ -1,12 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM example run-tests build -REM will cause to build (and not rebuild) test solutions, -REM ******************************************************** - -call run-W3C-tests.bat rebuild -call run-XSLT-tests.bat rebuild -call run-tests.api.bat rebuild \ No newline at end of file diff --git a/mcs/class/System.XML/testing_aot_full_System.Xml.dll.sources b/mcs/class/System.XML/testing_aot_full_System.Xml.dll.sources new file mode 100644 index 00000000000..b6630930f75 --- /dev/null +++ b/mcs/class/System.XML/testing_aot_full_System.Xml.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Xml.dll.sources diff --git a/mcs/class/System.XML/testing_aot_hybrid_System.Xml.dll.sources b/mcs/class/System.XML/testing_aot_hybrid_System.Xml.dll.sources new file mode 100644 index 00000000000..b6630930f75 --- /dev/null +++ b/mcs/class/System.XML/testing_aot_hybrid_System.Xml.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Xml.dll.sources diff --git a/mcs/class/System.XML/winaot_System.Xml.dll.sources b/mcs/class/System.XML/winaot_System.Xml.dll.sources new file mode 100644 index 00000000000..b6630930f75 --- /dev/null +++ b/mcs/class/System.XML/winaot_System.Xml.dll.sources @@ -0,0 +1 @@ +#include mobile_System.Xml.dll.sources diff --git a/mcs/class/System.Xml.Linq/makefile.build b/mcs/class/System.Xml.Linq/makefile.build deleted file mode 100644 index a281e13ffc4..00000000000 --- a/mcs/class/System.Xml.Linq/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/mcs/class/System.Xml.Linq/run-tests.bat b/mcs/class/System.Xml.Linq/run-tests.bat deleted file mode 100644 index 809cec192a5..00000000000 --- a/mcs/class/System.Xml.Linq/run-tests.bat +++ /dev/null @@ -1,17 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch call all the test batches with default parameters -REM ******************************************************** -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM ******************************************************** - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -call run-tests.test.bat %BUILD_OPTION% diff --git a/mcs/class/System.Xml.Linq/run-tests.test.bat b/mcs/class/System.Xml.Linq/run-tests.test.bat deleted file mode 100644 index fe93d9d5001..00000000000 --- a/mcs/class/System.Xml.Linq/run-tests.test.bat +++ /dev/null @@ -1,182 +0,0 @@ -REM @echo on -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set OUTPUT_FILE_PREFIX=System_Xml_Linq_MonoTests -set RUNNING_FIXTURE=MonoTests.System.Xml.Linq -set TEST_PROJECT=Test\System.Xml.Linq.Tests.csproj -set TEST_ASSEMBLY=System.Xml.Linq.Tests.jar -set PROJECT_CONFIGURATION=Debug_Java - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Configuration.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Drawing.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.Linq.jar -set NUNIT_OPTIONS=/exclude=NotWorking,NotDotNet,TargetJvmNotSupported,TargetJvmNotWorking,NotDotNet - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set OUTPUT_DIR=..\.. -set NUNIT_PATH=..\..\nunit20 -set NUNIT_CONFIGURATION=Debug_Java20 -set NUNIT_CLASSPATH=%NUNIT_PATH%\nunit-console\bin\%NUNIT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%\nunit-console\bin\%NUNIT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%\nunit-console\bin\%NUNIT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%\nunit-console\bin\%NUNIT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -msbuild %TEST_PROJECT% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -rem @echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -rem msbuild %NUNIT_PATH%nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . - -set TEST_TEMP=C:\MonoTemp -mkdir %TEST_TEMP% - -REM @echo on -echo "%JAVA_HOME%\bin\java" -server -Xmx1024M -Djava.io.tmpdir="%TEST_TEMP%" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% -"%JAVA_HOME%\bin\java" -server -Xmx1024M -Djava.io.tmpdir="%TEST_TEMP%" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM jdb -server -Xmx1024M -Djava.io.tmpdir="%TEST_TEMP%" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% -REM @echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% %OUTPUT_DIR% -copy %BUILD_LOG% %OUTPUT_DIR% -copy %GH_OUTPUT_XML% %OUTPUT_DIR% - -REM EXIT 0 diff --git a/mcs/class/System/Assembly/AssemblyInfo.cs b/mcs/class/System/Assembly/AssemblyInfo.cs index 6ed83d7c1e0..b3c55010f65 100644 --- a/mcs/class/System/Assembly/AssemblyInfo.cs +++ b/mcs/class/System/Assembly/AssemblyInfo.cs @@ -56,25 +56,30 @@ using System.Runtime.InteropServices; [assembly: ComVisible (false)] #if !MOBILE -[assembly: ComCompatibleVersion (1, 0, 3300, 0)] [assembly: AllowPartiallyTrustedCallers] #endif -#if !BOOTSTRAP_WITH_OLDLIB - [assembly: AssemblyDelaySign (true)] +[assembly: AssemblyDelaySign (true)] #if MOBILE - [assembly: AssemblyKeyFile ("../silverlight.pub")] +[assembly: AssemblyKeyFile ("../silverlight.pub")] #else - [assembly: AssemblyKeyFile ("../ecma.pub")] -#endif +[assembly: AssemblyKeyFile ("../ecma.pub")] #endif - [assembly: InternalsVisibleTo ("System.ComponentModel.DataAnnotations, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] - [assembly: InternalsVisibleTo ("System.Net.Http, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] - [assembly: StringFreezing] - [assembly: DefaultDependency (LoadHint.Always)] +[assembly: InternalsVisibleTo ("System.ComponentModel.DataAnnotations, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] +[assembly: InternalsVisibleTo ("System.Net.Http, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")] + +[assembly: InternalsVisibleTo ("btls-cert-sync, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] +[assembly: InternalsVisibleTo ("Mono.Btls.Interface, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] +[assembly: InternalsVisibleTo ("Mono.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] - [assembly: InternalsVisibleTo ("btls-cert-sync, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] - [assembly: InternalsVisibleTo ("Mono.Btls.Interface, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] - [assembly: InternalsVisibleTo ("Mono.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010079159977d2d03a8e6bea7a2e74e8d1afcc93e8851974952bb480a12c9134474d04062447c37e0e68c080536fcf3c3fbe2ff9c979ce998475e506e8ce82dd5b0f350dc10e93bf2eeecf874b24770c5081dbea7447fddafa277b22de47d6ffea449674a4f9fccf84d15069089380284dbdd35f46cdff12a1bd78e4ef0065d016df")] +#if MONOTOUCH +[assembly: InternalsVisibleTo ("monotouch, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] +[assembly: InternalsVisibleTo ("Xamarin.iOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] +[assembly: InternalsVisibleTo ("Xamarin.WatchOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] +[assembly: InternalsVisibleTo ("Xamarin.TVOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] +#endif +#if XAMMAC || XAMMAC_4_5 +[assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] +#endif \ No newline at end of file diff --git a/mcs/class/System/Assembly/AssemblyInfoEx.cs b/mcs/class/System/Assembly/AssemblyInfoEx.cs deleted file mode 100644 index 22e5bcae292..00000000000 --- a/mcs/class/System/Assembly/AssemblyInfoEx.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo ("monotouch, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -[assembly: InternalsVisibleTo ("Xamarin.iOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -[assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -[assembly: InternalsVisibleTo ("Xamarin.WatchOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] -[assembly: InternalsVisibleTo ("Xamarin.TVOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] diff --git a/mcs/class/System/Makefile b/mcs/class/System/Makefile index 65c6be9a314..b637c731656 100644 --- a/mcs/class/System/Makefile +++ b/mcs/class/System/Makefile @@ -19,15 +19,21 @@ TEST_RESOURCES = \ Test/System/test-uri-props-manual.txt \ Test/System/test-uri-relative-props.txt +LIB_MCS_FLAGS = -d:CONFIGURATION_2_0 $(REFERENCE_SOURCES_FLAGS) -unsafe $(RESOURCE_FILES:%=-resource:%) -nowarn:436 + ifndef NO_MONO_SECURITY MONO_SECURITY=Mono.Security MONO_SECURITY_REF=MonoSecurity=Mono.Security MONO_SECURITY_DLL=$(the_libdir_base)Mono.Security.dll +EXTERN_ALIAS_FLAGS = -d:MONO_SECURITY_ALIAS +else +LIB_MCS_FLAGS += -d:INSIDE_SYSTEM endif ifndef MOBILE_PROFILE TEST_LIB_REFS = System.Drawing $(MONO_SECURITY) System.Data System.Xml System.Core System.Configuration else +LIB_MCS_FLAGS += -nowarn:618 TEST_LIB_REFS = $(MONO_SECURITY) System.Data System.Xml System.Core endif @@ -42,8 +48,6 @@ REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_PROCESS_START TEST_MCS_FLAGS += -d:MONO_FEATURE_PROCESS_START endif -LIB_MCS_FLAGS = -d:CONFIGURATION_2_0 $(REFERENCE_SOURCES_FLAGS) -unsafe $(RESOURCE_FILES:%=-resource:%) -nowarn:436 - ifndef PROFILE_DISABLE_BTLS ifdef HAVE_BTLS @@ -69,15 +73,6 @@ endif TXT_RESOURCE_STRINGS = ../referencesource/System/System.txt -# -# MOBILE_PROFILE needs SECURITY_DEP -# -ifdef MOBILE_PROFILE -LIB_MCS_FLAGS += -d:INSIDE_SYSTEM -d:SECURITY_DEP -nowarn:618,1635 -else -EXTERN_ALIAS_FLAGS = -d:MONO_SECURITY_ALIAS -endif - # # Flags used to build the secxml version of System. # diff --git a/mcs/class/System/Mono.Btls/MonoBtlsX509StoreManager.cs b/mcs/class/System/Mono.Btls/MonoBtlsX509StoreManager.cs index 42fbdf7fa1c..0b7fb61f879 100644 --- a/mcs/class/System/Mono.Btls/MonoBtlsX509StoreManager.cs +++ b/mcs/class/System/Mono.Btls/MonoBtlsX509StoreManager.cs @@ -77,9 +77,9 @@ namespace Mono.Btls userUntrustedPath = Path.Combine (userPath, MX.X509Stores.Names.Untrusted); var machinePath = MX.X509StoreManager.NewLocalMachinePath; - machineTrustedRootPath = Path.Combine (userPath, MX.X509Stores.Names.TrustedRoot); - machineIntermediateCAPath = Path.Combine (userPath, MX.X509Stores.Names.IntermediateCA); - machineUntrustedPath = Path.Combine (userPath, MX.X509Stores.Names.Untrusted); + machineTrustedRootPath = Path.Combine (machinePath, MX.X509Stores.Names.TrustedRoot); + machineIntermediateCAPath = Path.Combine (machinePath, MX.X509Stores.Names.IntermediateCA); + machineUntrustedPath = Path.Combine (machinePath, MX.X509Stores.Names.Untrusted); #endif } diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Apple.cs b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Apple.cs index 89735c6bacb..787de757757 100644 --- a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Apple.cs +++ b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Apple.cs @@ -1,7 +1,12 @@ // Copyright 2015 Xamarin Inc. All rights reserved. #if SECURITY_DEP -using System; + +#if MONO_SECURITY_ALIAS +extern alias MonoSecurity; +using MSI = MonoSecurity::Mono.Security.Interface; +#else using MSI = Mono.Security.Interface; +#endif namespace Mono.Net.Security { diff --git a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Droid.cs b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Droid.cs index f9bd47396e6..49ac9fde664 100644 --- a/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Droid.cs +++ b/mcs/class/System/Mono.Net.Security/MonoTlsProviderFactory.Droid.cs @@ -1,11 +1,19 @@ // Copyright 2015 Xamarin Inc. All rights reserved. #if SECURITY_DEP -using System; + +#if MONO_SECURITY_ALIAS +extern alias MonoSecurity; +using MSI = MonoSecurity::Mono.Security.Interface; +#else using MSI = Mono.Security.Interface; +#endif + #if MONO_FEATURE_BTLS using Mono.Btls; #endif +using System; + namespace Mono.Net.Security { static partial class MonoTlsProviderFactory diff --git a/mcs/class/System/Mono.Util/MonoPInvokeCallbackAttribute.cs b/mcs/class/System/Mono.Util/MonoPInvokeCallbackAttribute.cs index bc81433f140..72acfed3d50 100644 --- a/mcs/class/System/Mono.Util/MonoPInvokeCallbackAttribute.cs +++ b/mcs/class/System/Mono.Util/MonoPInvokeCallbackAttribute.cs @@ -1,8 +1,36 @@ +// +// MonoPInvokeCallbackAttribute.cs: necessary for AOT ports of Mono +// +// Permission is hereby granted, free of charge, to any person obtaining +// a copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to +// permit persons to whom the Software is furnished to do so, subject to +// the following conditions: +// +// The above copyright notice and this permission notice shall be +// included in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +// + using System; +using System.Diagnostics; -namespace Mono.Util { - class MonoPInvokeCallbackAttribute : Attribute { - public MonoPInvokeCallbackAttribute (Type t) {} +namespace Mono.Util +{ + [Conditional("MONOTOUCH")] + [Conditional("FULL_AOT_RUNTIME")] + [AttributeUsage (AttributeTargets.Method)] + sealed class MonoPInvokeCallbackAttribute : Attribute + { + public MonoPInvokeCallbackAttribute (Type t) {} } } - diff --git a/mcs/class/System/System.IO.Compression/DeflateStream.cs b/mcs/class/System/System.IO.Compression/DeflateStream.cs index a79f8826a9b..00cb4fd7435 100644 --- a/mcs/class/System/System.IO.Compression/DeflateStream.cs +++ b/mcs/class/System/System.IO.Compression/DeflateStream.cs @@ -379,9 +379,7 @@ namespace System.IO.Compression CheckResult (res, "WriteInternal"); } -#if MONOTOUCH || FULL_AOT_RUNTIME [Mono.Util.MonoPInvokeCallback (typeof (UnmanagedReadOrWrite))] -#endif static int UnmanagedRead (IntPtr buffer, int length, IntPtr data) { GCHandle s = GCHandle.FromIntPtr (data); @@ -404,9 +402,7 @@ namespace System.IO.Compression return n; } -#if MONOTOUCH || FULL_AOT_RUNTIME [Mono.Util.MonoPInvokeCallback (typeof (UnmanagedReadOrWrite))] -#endif static int UnmanagedWrite (IntPtr buffer, int length, IntPtr data) { GCHandle s = GCHandle.FromIntPtr (data); diff --git a/mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs b/mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs index 8ce3daf9436..9b6b1e5df94 100644 --- a/mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs +++ b/mcs/class/System/System.Net.NetworkInformation/NetworkChange.cs @@ -299,9 +299,7 @@ namespace System.Net.NetworkInformation { } } -#if MONOTOUCH || FULL_AOT_RUNTIME [Mono.Util.MonoPInvokeCallback (typeof (SCNetworkReachabilityCallback))] -#endif static void HandleCallback (IntPtr reachability, NetworkReachabilityFlags flags, IntPtr info) { if (info == IntPtr.Zero) diff --git a/mcs/class/System/System.Net.NetworkInformation/Ping.cs b/mcs/class/System/System.Net.NetworkInformation/Ping.cs index c69388a5807..1d2786002e1 100644 --- a/mcs/class/System/System.Net.NetworkInformation/Ping.cs +++ b/mcs/class/System/System.Net.NetworkInformation/Ping.cs @@ -71,6 +71,7 @@ namespace System.Net.NetworkInformation { #endif }; static readonly string PingBinPath; + static bool canSendPrivileged; #endif const int default_timeout = 4000; // 4 sec. ushort identifier; @@ -80,7 +81,6 @@ namespace System.Net.NetworkInformation { const UInt32 linux_cap_version = 0x20071026; static readonly byte [] default_buffer = new byte [0]; - static bool canSendPrivileged; BackgroundWorker worker; diff --git a/mcs/class/System/System.Net.Security/SslStream.platformnotsupported.cs b/mcs/class/System/System.Net.Security/SslStream.platformnotsupported.cs index 1d3f040c082..9024c52306b 100644 --- a/mcs/class/System/System.Net.Security/SslStream.platformnotsupported.cs +++ b/mcs/class/System/System.Net.Security/SslStream.platformnotsupported.cs @@ -36,30 +36,32 @@ namespace System.Net.Security const string EXCEPTION_MESSAGE = "System.Net.Security.SslStream is not supported on the current platform."; public SslStream (Stream innerStream) - : this (innerStream, false, null, null) + : this (innerStream, false) { } public SslStream (Stream innerStream, bool leaveInnerStreamOpen) - : this (innerStream, leaveInnerStreamOpen, null, null) + : base (innerStream, leaveInnerStreamOpen) { + throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback) - : this (innerStream, leaveInnerStreamOpen, userCertificateValidationCallback, null) + : this (innerStream, leaveInnerStreamOpen) { } +#if SECURITY_DEP public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback) - : base (innerStream, leaveInnerStreamOpen) + : this (innerStream, leaveInnerStreamOpen) { - throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } public SslStream (Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificateValidationCallback userCertificateValidationCallback, LocalCertificateSelectionCallback userCertificateSelectionCallback, EncryptionPolicy encryptionPolicy) - : this (innerStream, leaveInnerStreamOpen, userCertificateValidationCallback, userCertificateSelectionCallback) + : this (innerStream, leaveInnerStreamOpen) { } +#endif public virtual void AuthenticateAsClient (string targetHost) { diff --git a/mcs/class/System/System.Net.Sockets/SafeSocketHandle.cs b/mcs/class/System/System.Net.Sockets/SafeSocketHandle.cs index 87f5e3aab3e..25da5dcbba0 100644 --- a/mcs/class/System/System.Net.Sockets/SafeSocketHandle.cs +++ b/mcs/class/System/System.Net.Sockets/SafeSocketHandle.cs @@ -45,7 +45,7 @@ namespace System.Net.Sockets { int error = 0; Socket.Blocking_internal (handle, false, out error); -#if AOT_ONLY_DESKTOP +#if FULL_AOT_DESKTOP /* It's only for platforms that do not have working syscall abort mechanism, like WatchOS and TvOS */ Socket.Shutdown_internal (handle, SocketShutdown.Both, out error); #endif diff --git a/mcs/class/System/System.Net/HttpListener.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListener.platformnotsupported.cs index 88ae1d361e3..c16004e754a 100644 --- a/mcs/class/System/System.Net/HttpListener.platformnotsupported.cs +++ b/mcs/class/System/System.Net/HttpListener.platformnotsupported.cs @@ -46,10 +46,12 @@ namespace System.Net { set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } } +#if SECURITY_DEP public AuthenticationSchemeSelector AuthenticationSchemeSelectorDelegate { get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } } +#endif public bool IgnoreWriteExceptions { get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } diff --git a/mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs b/mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs index 275d6d4ad14..71e3d48649b 100644 --- a/mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs +++ b/mcs/class/System/System.Net/HttpListenerContext.platformnotsupported.cs @@ -49,7 +49,7 @@ namespace System.Net { public IPrincipal User { get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } } - +#if SECURITY_DEP public Task AcceptWebSocketAsync (string subProtocol) { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); @@ -69,5 +69,6 @@ namespace System.Net { { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); } +#endif } } diff --git a/mcs/class/System/System.Net/ServicePoint.cs b/mcs/class/System/System.Net/ServicePoint.cs index 953da503f19..9b6cc5cc5e4 100644 --- a/mcs/class/System/System.Net/ServicePoint.cs +++ b/mcs/class/System/System.Net/ServicePoint.cs @@ -361,7 +361,7 @@ namespace System.Net return host; } - if (!HasTimedOut) + if (!HasTimedOut && host != null) return host; lastDnsResolve = DateTime.UtcNow; diff --git a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509ChainImplMono.cs b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509ChainImplMono.cs index 210bd8fc911..de9b1990e86 100644 --- a/mcs/class/System/System.Security.Cryptography.X509Certificates/X509ChainImplMono.cs +++ b/mcs/class/System/System.Security.Cryptography.X509Certificates/X509ChainImplMono.cs @@ -699,7 +699,7 @@ namespace System.Security.Cryptography.X509Certificates { if (pubkey == null) return false; // Sadly X509Certificate2 doesn't expose the signature nor the tbs (to be signed) structure - MX.X509Certificate mx = signed.MonoCertificate; + var mx = signed.MonoCertificate; return (mx.VerifySignature (pubkey)); } @@ -725,7 +725,7 @@ namespace System.Security.Cryptography.X509Certificates { { if (ext == null) return String.Empty; - MX.Extensions.AuthorityKeyIdentifierExtension aki = new MX.Extensions.AuthorityKeyIdentifierExtension (ext); + var aki = new MX.Extensions.AuthorityKeyIdentifierExtension (ext); byte[] id = aki.Identifier; if (id == null) return String.Empty; diff --git a/mcs/class/System/System.dll.sources b/mcs/class/System/System.dll.sources deleted file mode 100644 index d404a646402..00000000000 --- a/mcs/class/System/System.dll.sources +++ /dev/null @@ -1,1263 +0,0 @@ -../../build/common/SR.cs -Assembly/AssemblyInfo.cs -Microsoft.CSharp/CSharpCodeCompiler.cs -Microsoft.CSharp/CSharpCodeGenerator.cs -Microsoft.CSharp/CSharpCodeProvider.cs -Microsoft.VisualBasic/VBCodeCompiler.cs -Microsoft.VisualBasic/VBCodeGenerator.cs -Microsoft.VisualBasic/VBCodeProvider.cs -Microsoft.Win32/IntranetZoneCredentialPolicy.cs -Microsoft.Win32/PowerModeChangedEventArgs.cs -Microsoft.Win32/PowerModeChangedEventHandler.cs -Microsoft.Win32/PowerModes.cs -Microsoft.Win32/SessionEndedEventArgs.cs -Microsoft.Win32/SessionEndedEventHandler.cs -Microsoft.Win32/SessionEndingEventArgs.cs -Microsoft.Win32/SessionEndingEventHandler.cs -Microsoft.Win32/SessionEndReasons.cs -Microsoft.Win32/SessionSwitchEventArgs.cs -Microsoft.Win32/SessionSwitchEventHandler.cs -Microsoft.Win32/SessionSwitchReason.cs -Microsoft.Win32/SystemEvents.cs -Microsoft.Win32/TimerElapsedEventArgs.cs -Microsoft.Win32/TimerElapsedEventHandler.cs -Microsoft.Win32/UserPreferenceCategory.cs -Microsoft.Win32/UserPreferenceChangedEventArgs.cs -Microsoft.Win32/UserPreferenceChangedEventHandler.cs -Microsoft.Win32/UserPreferenceChangingEventArgs.cs -Microsoft.Win32/UserPreferenceChangingEventHandler.cs -Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs - -Mono.Http/NtlmClient.cs -System.CodeDom.Compiler/CodeCompiler.cs -System.CodeDom.Compiler/CodeDomConfigurationHandler.cs -System.CodeDom.Compiler/CodeDomProvider.cs -System.CodeDom.Compiler/CodeParser.cs -System.CodeDom.Compiler/Compiler.cs -System.CodeDom.Compiler/CompilerCollection.cs -System.CodeDom.Compiler/CompilerInfo.cs -System.CodeDom.Compiler/CompilerProviderOption.cs -System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs -System.CodeDom.Compiler/CompilerResults.cs -System.CodeDom.Compiler/Executor.cs -System.CodeDom.Compiler/TempFileCollection.cs -System.Configuration/ApplicationScopedSettingAttribute.cs -System.Configuration/ApplicationSettingsBase.cs -System.Configuration/ApplicationSettingsGroup.cs -System.Configuration/AppSettingsReader.cs -System.Configuration/ClientSettingsSection.cs -System.Configuration/ConfigHelper.cs -System.Configuration/ConfigurationException.cs -System.Configuration/ConfigurationSettings.cs -System.Configuration/ConfigXmlDocument.cs -System.Configuration/CustomizableFileSettingsProvider.cs -System.Configuration/DefaultSettingValueAttribute.cs -System.Configuration/DictionarySectionHandler.cs -System.Configuration/IApplicationSettingsProvider.cs -System.Configuration/IConfigurationSectionHandler.cs -System.Configuration/IConfigurationSystem.cs -System.Configuration/IConfigXmlNode.cs -System.Configuration/IdnElement.cs -System.Configuration/IgnoreSectionHandler.cs -System.Configuration/IriParsingElement.cs -System.Configuration/IPersistComponentSettings.cs -System.Configuration/ISettingsProviderService.cs -System.Configuration/LocalFileSettingsProvider.cs -System.Configuration/NameValueFileSectionHandler.cs -System.Configuration/NameValueSectionHandler.cs -System.Configuration/NoSettingsVersionUpgradeAttribute.cs -System.Configuration/SettingAttribute.cs -System.Configuration/SettingChangingEventArgs.cs -System.Configuration/SettingChangingEventHandler.cs -System.Configuration/SettingElementCollection.cs -System.Configuration/SettingElement.cs -System.Configuration/SettingsAttributeDictionary.cs -System.Configuration/SettingsBase.cs -System.Configuration/SettingsContext.cs -System.Configuration/SettingsLoadedEventArgs.cs -System.Configuration/SettingsLoadedEventHandler.cs -System.Configuration/SettingsPropertyCollection.cs -System.Configuration/SettingsProperty.cs -System.Configuration/SettingsPropertyIsReadOnlyException.cs -System.Configuration/SettingsPropertyNotFoundException.cs -System.Configuration/SettingsPropertyValueCollection.cs -System.Configuration/SettingsPropertyValue.cs -System.Configuration/SettingsPropertyWrongTypeException.cs -System.Configuration/SettingsProviderAttribute.cs -System.Configuration/SettingsProviderCollection.cs -System.Configuration/SettingsProvider.cs -System.Configuration/SettingsSavingEventHandler.cs -System.Configuration/SettingsSerializeAsAttribute.cs -System.Configuration/SettingsSerializeAs.cs -System.Configuration/SettingValueElement.cs -System.Configuration/SettingsManageability.cs -System.Configuration/SettingsManageabilityAttribute.cs -System.Configuration/SettingsGroupDescriptionAttribute.cs -System.Configuration/SettingsDescriptionAttribute.cs -System.Configuration/SettingsGroupNameAttribute.cs -System.Configuration/SingleTagSectionHandler.cs -System.Configuration/SpecialSetting.cs -System.Configuration/SpecialSettingAttribute.cs -System.Configuration/UriSection.cs -System.Configuration/UserSettingsGroup.cs -System.Configuration/UserScopedSettingAttribute.cs -System.Diagnostics/AlphabeticalEnumConverter.cs -System.Diagnostics/CounterCreationDataCollection.cs -System.Diagnostics/CounterCreationData.cs -System.Diagnostics/CounterSampleCalculator.cs -System.Diagnostics/CounterSample.cs -System.Diagnostics/DataReceivedEventArgs.cs -System.Diagnostics/DataReceivedEventHandler.cs -System.Diagnostics/DefaultTraceListener.cs -System.Diagnostics/DiagnosticsConfigurationHandler.cs -System.Diagnostics/EntryWrittenEventArgs.cs -System.Diagnostics/EntryWrittenEventHandler.cs -System.Diagnostics/EventInstance.cs -System.Diagnostics/EventLog.cs -System.Diagnostics/EventLogEntryCollection.cs -System.Diagnostics/EventLogEntry.cs -System.Diagnostics/EventLogEntryType.cs -System.Diagnostics/EventLogImpl.cs -System.Diagnostics/EventLogInstaller.cs -System.Diagnostics/EventLogPermissionAccess.cs -System.Diagnostics/EventLogPermissionAttribute.cs -System.Diagnostics/EventLogPermission.cs -System.Diagnostics/EventLogPermissionEntryCollection.cs -System.Diagnostics/EventLogPermissionEntry.cs -System.Diagnostics/EventLogTraceListener.cs -System.Diagnostics/EventSourceCreationData.cs -System.Diagnostics/FileVersionInfo.cs -System.Diagnostics/ICollectData.cs -System.Diagnostics/InstanceDataCollectionCollection.cs -System.Diagnostics/InstanceDataCollection.cs -System.Diagnostics/InstanceData.cs -System.Diagnostics/LocalFileEventLog.cs -System.Diagnostics/MonitoringDescriptionAttribute.cs -System.Diagnostics/NullEventLog.cs -System.Diagnostics/OverflowAction.cs -System.Diagnostics/PerformanceCounterCategory.cs -System.Diagnostics/PerformanceCounterCategoryType.cs -System.Diagnostics/PerformanceCounter.cs -System.Diagnostics/PerformanceCounterInstaller.cs -System.Diagnostics/PerformanceCounterInstanceLifetime.cs -System.Diagnostics/PerformanceCounterManager.cs -System.Diagnostics/PerformanceCounterPermissionAccess.cs -System.Diagnostics/PerformanceCounterPermissionAttribute.cs -System.Diagnostics/PerformanceCounterPermission.cs -System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs -System.Diagnostics/PerformanceCounterPermissionEntry.cs -System.Diagnostics/PerformanceCounterType.cs -System.Diagnostics/Process.cs -System.Diagnostics/ProcessModule.cs -System.Diagnostics/ProcessPriorityClass.cs -System.Diagnostics/ProcessStartInfo.cs -System.Diagnostics/ProcessThread.cs -System.Diagnostics/ProcessWindowStyle.cs -System.Diagnostics/Stopwatch.cs -System.Diagnostics/ThreadPriorityLevel.cs -System.Diagnostics/ThreadState.cs -System.Diagnostics/ThreadWaitReason.cs -System.Diagnostics/TraceImpl.cs -System.Diagnostics/TraceSourceInfo.cs -System.Diagnostics/Win32EventLog.cs -System/Platform.cs -System/MonoToolsLocator.cs -System.IO.Compression/CompressionLevel.cs -System.IO.Compression/CompressionMode.cs -System.IO.Compression/DeflateStream.cs -System.IO.Compression/GZipStream.cs -System.IO/DefaultWatcher.cs -System.IO/ErrorEventArgs.cs -System.IO/ErrorEventHandler.cs -System.IO/FAMWatcher.cs -System.IO/NullFileWatcher.cs -System.IO/FileAction.cs -System.IO/FileSystemEventArgs.cs -System.IO/FileSystemEventHandler.cs -System.IO/FileSystemWatcher.cs -System.IO/IFileWatcher.cs -System.IO/InotifyWatcher.cs -System.IO/InternalBufferOverflowException.cs -System.IO/InvalidDataException.cs -System.IO/IODescriptionAttribute.cs -System.IO/KeventWatcher.cs -System.IO/NotifyFilters.cs -System.IO.Ports/Handshake.cs -System.IO.Ports/ISerialStream.cs -System.IO.Ports/Parity.cs -System.IO.Ports/SerialData.cs -System.IO.Ports/SerialError.cs -System.IO.Ports/SerialErrorEventArgs.cs -System.IO.Ports/SerialPinChange.cs -System.IO.Ports/SerialPinChangedEventArgs.cs -System.IO.Ports/SerialPort.cs -System.IO.Ports/SerialPortStream.cs -System.IO.Ports/SerialReceivedEventArgs.cs -System.IO.Ports/SerialSignal.cs -System.IO.Ports/StopBits.cs -System.IO.Ports/WinSerialStream.cs -System.IO/RenamedEventArgs.cs -System.IO/RenamedEventHandler.cs -System.IO/SearchPattern.cs -System.IO/WaitForChangedResult.cs -System.IO/WatcherChangeTypes.cs -System.IO/WindowsWatcher.cs -System.Media/AudioData.cs -System.Media/AudioDevice.cs -System.Media/SoundPlayer.cs -System.Media/SystemSound.cs -System.Media/SystemSounds.cs -System.Media/Win32SoundPlayer.cs -System.Net/AuthenticationManager.cs -System.Net/BasicClient.cs -System.Net/BindIPEndPoint.cs -System.Net/ChunkedInputStream.cs -System.Net/ChunkStream.cs -System.Net.Configuration/AuthenticationModuleElementCollection.cs -System.Net.Configuration/AuthenticationModuleElement.cs -System.Net.Configuration/AuthenticationModulesSection.cs -System.Net.Configuration/BypassElementCollection.cs -System.Net.Configuration/BypassElement.cs -System.Net.Configuration/ConnectionManagementElementCollection.cs -System.Net.Configuration/ConnectionManagementElement.cs -System.Net.Configuration/ConnectionManagementHandler.cs -System.Net.Configuration/ConnectionManagementSection.cs -System.Net.Configuration/DefaultProxyHandler.cs -System.Net.Configuration/DefaultProxySection.cs -System.Net.Configuration/FtpCachePolicyElement.cs -System.Net.Configuration/HttpCachePolicyElement.cs -System.Net.Configuration/HttpWebRequestElement.cs -System.Net.Configuration/Ipv6Element.cs -System.Net.Configuration/MailSettingsSectionGroup.cs -System.Net.Configuration/ModuleElement.cs -System.Net.Configuration/NetAuthenticationModuleHandler.cs -System.Net.Configuration/NetConfigurationHandler.cs -System.Net.Configuration/NetSectionGroup.cs -System.Net.Configuration/PerformanceCountersElement.cs -System.Net.Configuration/ProxyElement.cs -System.Net.Configuration/RequestCachingSection.cs -System.Net.Configuration/ServicePointManagerElement.cs -System.Net.Configuration/SettingsSection.cs -System.Net.Configuration/SmtpNetworkElement.cs -System.Net.Configuration/SmtpSection.cs -System.Net.Configuration/SmtpSpecifiedPickupDirectoryElement.cs -System.Net.Configuration/SocketElement.cs -System.Net.Configuration/WebProxyScriptElement.cs -System.Net.Configuration/WebRequestModuleElementCollection.cs -System.Net.Configuration/WebRequestModuleElement.cs -System.Net.Configuration/WebRequestModuleHandler.cs -System.Net.Configuration/WebRequestModulesSection.cs -System.Net/DecompressionMethods.cs -System.Net/DefaultCertificatePolicy.cs -System.Net/DigestClient.cs -System.Net/Dns.cs -System.Net/DnsPermissionAttribute.cs -System.Net/DnsPermission.cs -System.Net/EndPointListener.cs -System.Net/EndPointManager.cs -System.Net/EndpointPermission.cs -System.Net/FtpAsyncResult.cs -System.Net/FtpDataStream.cs -System.Net/FtpRequestCreator.cs -System.Net/FtpWebRequest.cs -System.Net/FtpStatus.cs -System.Net/FtpWebResponse.cs -System.Net/HttpConnection.cs -System.Net/HttpListenerBasicIdentity.cs -System.Net/HttpListenerContext.cs -System.Net/HttpListener.cs -System.Net/HttpListenerPrefixCollection.cs -System.Net/HttpListenerRequest.cs -System.Net/HttpListenerResponse.cs -System.Net/HttpListenerResponseHelper.cs -System.Net/HttpListenerTimeoutManager.cs -System.Net/HttpRequestCreator.cs -System.Net/HttpStreamAsyncResult.cs -System.Net/HttpWebRequest.cs -System.Net/HttpWebResponse.cs -System.Net/ICredentialPolicy.cs -System.Net/IPv6Address.cs -System.Net/IWebProxyScript.cs -System.Net/IWebConnectionState.cs -System.Net/ListenerAsyncResult.cs -System.Net/ListenerPrefix.cs -System.Net.Mail/AlternateViewCollection.cs -System.Net.Mail/AlternateView.cs -System.Net.Mail/AttachmentBase.cs -System.Net.Mail/AttachmentCollection.cs -System.Net.Mail/Attachment.cs -System.Net.Mail/DeliveryNotificationOptions.cs -System.Net.Mail/LinkedResourceCollection.cs -System.Net.Mail/LinkedResource.cs -System.Net.Mail/MailAddressCollection.cs -System.Net.Mail/MailAddress.cs -System.Net.Mail/MailMessage.cs -System.Net.Mail/MailPriority.cs -System.Net.Mail/SendCompletedEventHandler.cs -System.Net.Mail/SmtpAccess.cs -System.Net.Mail/SmtpClient.cs -System.Net.Mail/SmtpDeliveryFormat.cs -System.Net.Mail/SmtpDeliveryMethod.cs -System.Net.Mail/SmtpException.cs -System.Net.Mail/SmtpFailedRecipientException.cs -System.Net.Mail/SmtpFailedRecipientsException.cs -System.Net.Mail/SmtpPermission.cs -System.Net.Mail/SmtpPermissionAttribute.cs -System.Net.Mail/SmtpStatusCode.cs -../referencesource/System/net/System/Net/mail/Base64Stream.cs -../referencesource/System/net/System/Net/mail/Base64WriteStateInfo.cs -../referencesource/System/net/System/Net/mail/BaseWriter.cs -../referencesource/System/net/System/Net/mail/BufferBuilder.cs -../referencesource/System/net/System/Net/mail/ClosableStream.cs -../referencesource/System/net/System/Net/mail/ContentDisposition.cs -../referencesource/System/net/System/Net/mail/ContentType.cs -../referencesource/System/net/System/Net/mail/DelegatedStream.cs -../referencesource/System/net/System/Net/mail/DispositionTypeNames.cs -../referencesource/System/net/System/Net/mail/EightBitStream.cs -../referencesource/System/net/System/Net/mail/EncodedStreamFactory.cs -../referencesource/System/net/System/Net/mail/HeaderCollection.cs -../referencesource/System/net/System/Net/mail/IEncodableStream.cs -../referencesource/System/net/System/Net/mail/MailBnfHelper.cs -../referencesource/System/net/System/Net/mail/MailHeaderInfo.cs -../referencesource/System/net/System/Net/mail/MimeBasePart.cs -../referencesource/System/net/System/Net/mail/MimeEmbeddedMessagePart.cs -../referencesource/System/net/System/Net/mail/MimeMultiPart.cs -../referencesource/System/net/System/Net/mail/MimeMultiPartType.cs -../referencesource/System/net/System/Net/mail/MimePart.cs -../referencesource/System/net/System/Net/mail/MimeWriter.cs -../referencesource/System/net/System/Net/mail/MultiAsyncResult.cs -../referencesource/System/net/System/Net/mail/QEncodedStream.cs -../referencesource/System/net/System/Net/mail/QuotedPrintableStream.cs -../referencesource/System/net/System/Net/mail/SmtpDateTime.cs -../referencesource/System/net/System/Net/mail/TrackingStringDictionary.cs -../referencesource/System/net/System/Net/mail/TrackingValidationObjectDictionary.cs -../referencesource/System/net/System/Net/mail/TransferEncoding.cs -../referencesource/System/net/System/Net/mail/WriteStateInfoBase.cs -../referencesource/System/net/System/Net/mail/mediatypenames.cs -System.Net/MacProxy.cs -System.Net/MonoHttpDate.cs -System.Net/NetConfig.cs -System.Net.NetworkInformation/IcmpV4Statistics.cs -System.Net.NetworkInformation/IcmpV6Statistics.cs -System.Net.NetworkInformation/IPAddressCollection.cs -System.Net.NetworkInformation/IPGlobalProperties.cs -System.Net.NetworkInformation/IPGlobalStatistics.cs -System.Net.NetworkInformation/IPInterfaceProperties.cs -System.Net.NetworkInformation/IPv4InterfaceProperties.cs -System.Net.NetworkInformation/IPv4InterfaceStatistics.cs -System.Net.NetworkInformation/IPv6InterfaceProperties.cs -System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs -System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs -System.Net.NetworkInformation/NetworkChange.cs -System.Net.NetworkInformation/NetworkInterface.cs -System.Net.NetworkInformation/PingCompletedEventArgs.cs -System.Net.NetworkInformation/PingCompletedEventHandler.cs -System.Net.NetworkInformation/Ping.cs -System.Net.NetworkInformation/TcpStatistics.cs -System.Net.NetworkInformation/UdpStatistics.cs -System.Net.NetworkInformation/UnicastIPAddressInformation.cs -System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs -System.Net/NtlmClient.cs -System.Net/RequestStream.cs -System.Net/ResponseStream.cs -../referencesource/System/net/System/Net/SecureProtocols/AuthenticatedStream.cs -../referencesource/System/net/System/Net/SecureProtocols/NegotiateEnumTypes.cs -System.Net.Security/EncryptionPolicy.cs -System.Net.Security/LocalCertificateSelectionCallback.cs -System.Net.Security/NegotiateStream.cs -System.Net.Security/RemoteCertificateValidationCallback.cs -System.Net.Security/SslStream.cs -System.Net.Security/SslPolicyErrors.cs -System.Net/ServicePoint.cs -System.Net/ServicePointManager.cs -System.Net/ServicePointManager.extra.cs -System.Net/SimpleAsyncResult.cs -System.Net/SocketPermissionAttribute.cs -System.Net/SocketPermission.cs -System.Net.Sockets/SafeSocketHandle.cs -System.Net.Sockets/Socket.cs -System.Net.Sockets/SocketAsyncEventArgs.cs -System.Net.Sockets/SocketAsyncResult.cs -System.Net.Sockets/SocketOperation.cs -System.Net.Sockets/SocketReceiveFromResult.cs -System.Net.Sockets/SocketReceiveMessageFromResult.cs -System.Net.Sockets/SocketTaskExtensions.cs -System.Net/WebAsyncResult.cs -System.Net/WebConnection.cs -System.Net/WebConnectionData.cs -System.Net/WebConnectionGroup.cs -System.Net/WebConnectionStream.cs -System.Net.WebSockets/ClientWebSocket.cs -System.Net.WebSockets/ClientWebSocketOptions.cs -System.Net.WebSockets/HttpListenerWebSocketContext.cs -System.Net.WebSockets/WebSocket.cs -System.Net.WebSockets/WebSocketCloseStatus.cs -System.Net.WebSockets/WebSocketContext.cs -System.Net.WebSockets/WebSocketError.cs -System.Net.WebSockets/WebSocketException.cs -System.Net.WebSockets/WebSocketMessageType.cs -System.Net.WebSockets/WebSocketReceiveResult.cs -System.Net.WebSockets/WebSocketState.cs -System.Security.AccessControl/SemaphoreAccessRule.cs -System.Security.AccessControl/SemaphoreAuditRule.cs -System.Security.AccessControl/SemaphoreRights.cs -System.Security.AccessControl/SemaphoreSecurity.cs -System.Security.Authentication/AuthenticationException.cs -System.Security.Authentication/CipherAlgorithmType.cs -System.Security.Authentication/ExchangeAlgorithmType.cs -System.Security.Authentication/HashAlgorithmType.cs -System.Security.Authentication/SslProtocols.cs -System.Security.Authentication/InvalidCredentialException.cs -System.Security.Authentication.ExtendedProtection/ChannelBinding.cs -System.Security.Authentication.ExtendedProtection/ChannelBindingKind.cs -System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicy.cs -System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs -System.Security.Authentication.ExtendedProtection/PolicyEnforcement.cs -System.Security.Authentication.ExtendedProtection/ProtectionScenario.cs -System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs -System.Security.Authentication.ExtendedProtection.Configuration/ExtendedProtectionPolicyElement.cs -System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElement.cs -System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElementCollection.cs -System.Security.Cryptography/AsnEncodedDataCollection.cs -System.Security.Cryptography/AsnEncodedData.cs -System.Security.Cryptography/AsnEncodedDataEnumerator.cs -System.Security.Cryptography.X509Certificates/OpenFlags.cs -System.Security.Cryptography.X509Certificates/OSX509Certificates.cs -System.Security.Cryptography.X509Certificates/PublicKey.cs -System.Security.Cryptography.X509Certificates/StoreLocation.cs -System.Security.Cryptography.X509Certificates/StoreName.cs -System.Security.Cryptography.X509Certificates/X500DistinguishedName.cs -System.Security.Cryptography.X509Certificates/X500DistinguishedNameFlags.cs -System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs -System.Security.Cryptography.X509Certificates/X509Certificate2Collection.cs -System.Security.Cryptography.X509Certificates/X509Certificate2.cs -System.Security.Cryptography.X509Certificates/X509Certificate2Enumerator.cs -System.Security.Cryptography.X509Certificates/X509Certificate2Impl.cs -System.Security.Cryptography.X509Certificates/X509Certificate2ImplMono.cs -System.Security.Cryptography.X509Certificates/X509CertificateCollection.cs -System.Security.Cryptography.X509Certificates/X509CertificateImplCollection.cs -System.Security.Cryptography.X509Certificates/X509Chain.cs -System.Security.Cryptography.X509Certificates/X509ChainElementCollection.cs -System.Security.Cryptography.X509Certificates/X509ChainElement.cs -System.Security.Cryptography.X509Certificates/X509ChainElementEnumerator.cs -System.Security.Cryptography.X509Certificates/X509ChainImpl.cs -System.Security.Cryptography.X509Certificates/X509ChainImplMono.cs -System.Security.Cryptography.X509Certificates/X509ChainPolicy.cs -System.Security.Cryptography.X509Certificates/X509ChainStatus.cs -System.Security.Cryptography.X509Certificates/X509ChainStatusFlags.cs -System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs -System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs -System.Security.Cryptography.X509Certificates/X509Extension.cs -System.Security.Cryptography.X509Certificates/X509ExtensionEnumerator.cs -System.Security.Cryptography.X509Certificates/X509FindType.cs -System.Security.Cryptography.X509Certificates/X509IncludeOption.cs -System.Security.Cryptography.X509Certificates/X509Helper2.cs -System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs -System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs -System.Security.Cryptography.X509Certificates/X509NameType.cs -System.Security.Cryptography.X509Certificates/X509RevocationFlag.cs -System.Security.Cryptography.X509Certificates/X509RevocationMode.cs -System.Security.Cryptography.X509Certificates/X509Store.cs -System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs -System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierHashAlgorithm.cs -System.Security.Cryptography.X509Certificates/X509VerificationFlags.cs -System.Security.Permissions/PermissionHelper.cs -System.Security.Permissions/ResourcePermissionBase.cs -System.Security.Permissions/ResourcePermissionBaseEntry.cs -System.Security.Permissions/StorePermissionAttribute.cs -System.Security.Permissions/StorePermission.cs -System.Security.Permissions/StorePermissionFlags.cs -System/SRDescriptionAttribute.cs -System.Threading/ThreadExceptionEventArgs.cs -System.Threading/ThreadExceptionEventHandler.cs -System.Timers/ElapsedEventArgs.cs -System/UriTypeConverter.cs -System.Web/AspNetHostingPermissionAttribute.cs -System.Web/AspNetHostingPermission.cs -System.Web/AspNetHostingPermissionLevel.cs - -System.Runtime.InteropServices/StandardOleMarshalObject.cs -System.Runtime.InteropServices.ComTypes/ADVF.cs -System.Runtime.InteropServices.ComTypes/DATADIR.cs -System.Runtime.InteropServices.ComTypes/DVASPECT.cs -System.Runtime.InteropServices.ComTypes/FORMATETC.cs -System.Runtime.InteropServices.ComTypes/IAdviseSink.cs -System.Runtime.InteropServices.ComTypes/IDataObject.cs -System.Runtime.InteropServices.ComTypes/IEnumFORMATETC.cs -System.Runtime.InteropServices.ComTypes/IEnumSTATDATA.cs -System.Runtime.InteropServices.ComTypes/STATDATA.cs -System.Runtime.InteropServices.ComTypes/STGMEDIUM.cs -System.Runtime.InteropServices.ComTypes/TYMED.cs -Mono.Net.Dns/DnsClass.cs -Mono.Net.Dns/DnsHeader.cs -Mono.Net.Dns/DnsOpCode.cs -Mono.Net.Dns/DnsPacket.cs -Mono.Net.Dns/DnsQClass.cs -Mono.Net.Dns/DnsQType.cs -Mono.Net.Dns/DnsQuery.cs -Mono.Net.Dns/DnsQuestion.cs -Mono.Net.Dns/DnsRCode.cs -Mono.Net.Dns/DnsResourceRecordA.cs -Mono.Net.Dns/DnsResourceRecordAAAA.cs -Mono.Net.Dns/DnsResourceRecordCName.cs -Mono.Net.Dns/DnsResourceRecord.cs -Mono.Net.Dns/DnsResourceRecordIPAddress.cs -Mono.Net.Dns/DnsResourceRecordPTR.cs -Mono.Net.Dns/DnsResponse.cs -Mono.Net.Dns/DnsType.cs -Mono.Net.Dns/DnsUtil.cs -Mono.Net.Dns/ResolverAsyncOperation.cs -Mono.Net.Dns/SimpleResolver.cs -Mono.Net.Dns/ResolverError.cs -Mono.Net.Dns/SimpleResolverEventArgs.cs -System.Net/DnsAsyncResult.cs -System.Windows.Input/ICommand.cs - -System/IOSelector.cs - -Mono.Btls/MonoBtlsBio.cs -Mono.Btls/MonoBtlsContext.cs -Mono.Btls/MonoBtlsError.cs -Mono.Btls/MonoBtlsException.cs -Mono.Btls/MonoBtlsKey.cs -Mono.Btls/MonoBtlsObject.cs -Mono.Btls/MonoBtlsPkcs12.cs -Mono.Btls/MonoBtlsProvider.cs -Mono.Btls/MonoBtlsSsl.cs -Mono.Btls/MonoBtlsSslCtx.cs -Mono.Btls/MonoBtlsSslError.cs -Mono.Btls/MonoBtlsStream.cs -Mono.Btls/MonoBtlsUtils.cs -Mono.Btls/MonoBtlsX509.cs -Mono.Btls/MonoBtlsX509Chain.cs -Mono.Btls/MonoBtlsX509Crl.cs -Mono.Btls/MonoBtlsX509Error.cs -Mono.Btls/MonoBtlsX509Exception.cs -Mono.Btls/MonoBtlsX509FileType.cs -Mono.Btls/MonoBtlsX509Format.cs -Mono.Btls/MonoBtlsX509Lookup.cs -Mono.Btls/MonoBtlsX509LookupMonoCollection.cs -Mono.Btls/MonoBtlsX509LookupMono.cs -Mono.Btls/MonoBtlsX509LookupType.cs -Mono.Btls/MonoBtlsX509Name.cs -Mono.Btls/MonoBtlsX509NameEntryType.cs -Mono.Btls/MonoBtlsX509Purpose.cs -Mono.Btls/MonoBtlsX509Revoked.cs -Mono.Btls/MonoBtlsX509Store.cs -Mono.Btls/MonoBtlsX509StoreCtx.cs -Mono.Btls/MonoBtlsX509StoreManager.cs -Mono.Btls/MonoBtlsX509StoreType.cs -Mono.Btls/MonoBtlsX509TrustKind.cs -Mono.Btls/MonoBtlsX509VerifyFlags.cs -Mono.Btls/MonoBtlsX509VerifyParam.cs -Mono.Btls/X509CertificateImplBtls.cs -Mono.Btls/X509ChainImplBtls.cs - -Mono.Net.Security/AsyncProtocolRequest.cs -Mono.Net.Security/CallbackHelpers.cs -Mono.Net.Security/ChainValidationHelper.cs -Mono.Net.Security/IMonoTlsProvider.cs -Mono.Net.Security/IMonoSslStream.cs -Mono.Net.Security/LegacySslStream.cs -Mono.Net.Security/MobileAuthenticatedStream.cs -Mono.Net.Security/MobileTlsContext.cs -Mono.Net.Security/LegacyTlsProvider.cs -Mono.Net.Security/MonoSslStreamImpl.cs -Mono.Net.Security/MonoSslStreamWrapper.cs -Mono.Net.Security/MonoTlsProviderFactory.cs -Mono.Net.Security/MonoTlsProviderWrapper.cs -Mono.Net.Security/MonoTlsStream.cs -Mono.Net.Security/NoReflectionHelper.cs -Mono.Net.Security/SystemCertificateValidator.cs - -ReferenceSources/AutoWebProxyScriptEngine.cs -ReferenceSources/AssertWrapper.cs -ReferenceSources/BinaryCompatibility.cs -ReferenceSources/ConfigurationManagerInternalFactory.cs -ReferenceSources/CAPI.cs -ReferenceSources/EnvironmentHelpers.cs -ReferenceSources/HttpApi.cs -ReferenceSources/HttpSysSettings.cs -ReferenceSources/LocalAppContextSwitches.cs -ReferenceSources/Logging.cs -ReferenceSources/NativeMethods.cs -ReferenceSources/RequestCacheProtocol.cs -ReferenceSources/SettingsSectionInternal.cs -ReferenceSources/SecureStringHelper.cs -ReferenceSources/Socket.cs -ReferenceSources/SR.cs -ReferenceSources/SR2.cs -ReferenceSources/SRCategoryAttribute.cs -ReferenceSources/Win32Exception.cs - -../referencesource/System/misc/PrivilegedConfigurationManager.cs -../referencesource/System/regex/system/text/regularexpressions/Regex.cs -../referencesource/System/regex/system/text/regularexpressions/RegexBoyerMoore.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCapture.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCaptureCollection.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCharClass.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCode.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCompilationInfo.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCompiler.cs -../referencesource/System/regex/system/text/regularexpressions/RegexFCD.cs -../referencesource/System/regex/system/text/regularexpressions/RegexGroup.cs -../referencesource/System/regex/system/text/regularexpressions/RegexGroupCollection.cs -../referencesource/System/regex/system/text/regularexpressions/RegexInterpreter.cs -../referencesource/System/regex/system/text/regularexpressions/RegexMatch.cs -../referencesource/System/regex/system/text/regularexpressions/RegexMatchCollection.cs -../referencesource/System/regex/system/text/regularexpressions/RegexMatchTimeoutException.cs -../referencesource/System/regex/system/text/regularexpressions/RegexNode.cs -../referencesource/System/regex/system/text/regularexpressions/RegexOptions.cs -../referencesource/System/regex/system/text/regularexpressions/RegexParser.cs -../referencesource/System/regex/system/text/regularexpressions/RegexReplacement.cs -../referencesource/System/regex/system/text/regularexpressions/RegexRunner.cs -../referencesource/System/regex/system/text/regularexpressions/RegexRunnerFactory.cs -../referencesource/System/regex/system/text/regularexpressions/RegexTree.cs -../referencesource/System/regex/system/text/regularexpressions/RegexWriter.cs -../referencesource/System/regex/system/text/regularexpressions/compiledregexrunner.cs -../referencesource/System/regex/system/text/regularexpressions/compiledregexrunnerfactory.cs - -../referencesource/System/sys/system/collections/concurrent/BlockingCollection.cs -../referencesource/System/sys/system/collections/concurrent/ConcurrentBag.cs - -../referencesource/System/compmod/system/collections/generic/bithelper.cs -../referencesource/System/compmod/system/collections/generic/debugview.cs -../referencesource/System/compmod/system/collections/generic/iset.cs -../referencesource/System/compmod/system/collections/generic/linkedlist.cs -../referencesource/System/compmod/system/collections/generic/queue.cs -../referencesource/System/compmod/system/collections/generic/sorteddictionary.cs -../referencesource/System/compmod/system/collections/generic/sortedlist.cs -../referencesource/System/compmod/system/collections/generic/sortedset.cs -../referencesource/System/compmod/system/collections/generic/sortedsetdebugview.cs -../referencesource/System/compmod/system/collections/generic/stack.cs -../referencesource/System/compmod/system/collections/generic/throwhelper.cs - -../referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs -../referencesource/System/compmod/system/collections/objectmodel/readonlyobservablecollection.cs - -../referencesource/System/compmod/system/collections/specialized/bitvector32.cs -../referencesource/System/compmod/system/collections/specialized/casesensitivestringdictionary.cs -../referencesource/System/compmod/system/collections/specialized/collectionsutil.cs -../referencesource/System/compmod/system/collections/specialized/fixedstringlookup.cs -../referencesource/System/compmod/system/collections/specialized/hybriddictionary.cs -../referencesource/System/compmod/system/collections/specialized/inotifycollectionchanged.cs -../referencesource/System/compmod/system/collections/specialized/iordereddictionary.cs -../referencesource/System/compmod/system/collections/specialized/listdictionary.cs -../referencesource/System/compmod/system/collections/specialized/nameobjectcollectionbase.cs -../referencesource/System/compmod/system/collections/specialized/namevaluecollection.cs -../referencesource/System/compmod/system/collections/specialized/notifycollectionchangedeventargs.cs -../referencesource/System/compmod/system/collections/specialized/ordereddictionary.cs -../referencesource/System/compmod/system/collections/specialized/stringcollection.cs -../referencesource/System/compmod/system/collections/specialized/stringdictionary.cs -../referencesource/System/compmod/system/collections/specialized/stringdictionarywithcomparer.cs - -../referencesource/System/compmod/system/componentmodel/AddingNewEventArgs.cs -../referencesource/System/compmod/system/componentmodel/AddingNewEventHandler.cs -../referencesource/System/compmod/system/componentmodel/AmbientValueAttribute.cs -../referencesource/System/compmod/system/componentmodel/ArrayConverter.cs -../referencesource/System/compmod/system/componentmodel/ArraySubsetEnumerator.cs -../referencesource/System/compmod/system/componentmodel/AsyncCompletedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/AsyncCompletedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/AsyncOperation.cs -../referencesource/System/compmod/system/componentmodel/AsyncOperationManager.cs -../referencesource/System/compmod/system/componentmodel/AttributeCollection.cs -../referencesource/System/compmod/system/componentmodel/AttributeProviderAttribute.cs -../referencesource/System/compmod/system/componentmodel/BackgroundWorker.cs -../referencesource/System/compmod/system/componentmodel/BaseComponentEditor.cs -../referencesource/System/compmod/system/componentmodel/basenumberconverter.cs -../referencesource/System/compmod/system/componentmodel/BindableAttribute.cs -../referencesource/System/compmod/system/componentmodel/BindableSupport.cs -../referencesource/System/compmod/system/componentmodel/BindingDirection.cs -../referencesource/System/compmod/system/componentmodel/BindingList.cs -../referencesource/System/compmod/system/componentmodel/BooleanConverter.cs -../referencesource/System/compmod/system/componentmodel/BrowsableAttribute.cs -../referencesource/System/compmod/system/componentmodel/ByteConverter.cs -../referencesource/System/compmod/system/componentmodel/CancelEventArgs.cs -../referencesource/System/compmod/system/componentmodel/CancelEventHandler.cs -../referencesource/System/compmod/system/componentmodel/CategoryAttribute.cs -../referencesource/System/compmod/system/componentmodel/CharConverter.cs -../referencesource/System/compmod/system/componentmodel/CollectionChangeAction.cs -../referencesource/System/compmod/system/componentmodel/CollectionChangeEventArgs.cs -../referencesource/System/compmod/system/componentmodel/CollectionChangeEventHandler.cs -../referencesource/System/compmod/system/componentmodel/CollectionConverter.cs -../referencesource/System/compmod/system/componentmodel/ComplexBindingPropertiesAttribute.cs -../referencesource/System/compmod/system/componentmodel/CompModSwitches.cs -../referencesource/System/compmod/system/componentmodel/Component.cs -../referencesource/System/compmod/system/componentmodel/ComponentCollection.cs -../referencesource/System/compmod/system/componentmodel/ComponentConverter.cs -../referencesource/System/compmod/system/componentmodel/ComponentResourceManager.cs -../referencesource/System/compmod/system/componentmodel/Container.cs -../referencesource/System/compmod/system/componentmodel/ContainerFilterService.cs -../referencesource/System/compmod/system/componentmodel/CultureInfoConverter.cs -../referencesource/System/compmod/system/componentmodel/CustomTypeDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DataErrorsChangedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/DataObjectAttribute.cs -../referencesource/System/compmod/system/componentmodel/DataObjectFieldAttribute.cs -../referencesource/System/compmod/system/componentmodel/DataObjectMethodAttribute.cs -../referencesource/System/compmod/system/componentmodel/DataObjectMethodType.cs -../referencesource/System/compmod/system/componentmodel/DateTimeConverter.cs -../referencesource/System/compmod/system/componentmodel/DateTimeOffsetConverter.cs -../referencesource/System/compmod/system/componentmodel/DebugExtendedPropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DebugReflectEventDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DebugReflectPropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DebugTypeDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DecimalConverter.cs -../referencesource/System/compmod/system/componentmodel/DefaultBindingPropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/DefaultEventAttribute.cs -../referencesource/System/compmod/system/componentmodel/DefaultPropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/DefaultValueAttribute.cs -../referencesource/System/compmod/system/componentmodel/DelegatingTypeDescriptionProvider.cs -../referencesource/System/compmod/system/componentmodel/DescriptionAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/ActiveDocumentEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ActiveDocumentEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/CheckoutException.cs -../referencesource/System/compmod/system/componentmodel/design/CommandID.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentChangedEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentChangedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentChangingEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentChangingEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentRenameEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentRenameEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerOptionService.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerTransaction.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerTransactionCloseEvent.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerTransactionCloseEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerVerb.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerVerbCollection.cs -../referencesource/System/compmod/system/componentmodel/design/DesigntimeLicenseContext.cs -../referencesource/System/compmod/system/componentmodel/design/DesigntimeLicenseContextSerializer.cs -../referencesource/System/compmod/system/componentmodel/design/DocumentCollection.cs -../referencesource/System/compmod/system/componentmodel/design/DocumentEventArgs.cs -../referencesource/System/compmod/system/componentmodel/design/DocumentEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/HelpContextType.cs -../referencesource/System/compmod/system/componentmodel/design/HelpKeywordAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/HelpKeywordType.cs -../referencesource/System/compmod/system/componentmodel/design/IComponentChangeService.cs -../referencesource/System/compmod/system/componentmodel/design/IComponentDiscoveryService.cs -../referencesource/System/compmod/system/componentmodel/design/IComponentInitializer.cs -../referencesource/System/compmod/system/componentmodel/design/IDesigner.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerEventService.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerFilter.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerHost.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerHostTransactionState.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerOptionService.cs -../referencesource/System/compmod/system/componentmodel/design/IDictionaryService.cs -../referencesource/System/compmod/system/componentmodel/design/IEventPropertyService.cs -../referencesource/System/compmod/system/componentmodel/design/IExtenderListService.cs -../referencesource/System/compmod/system/componentmodel/design/IExtenderProviderService.cs -../referencesource/System/compmod/system/componentmodel/design/IHelpService.cs -../referencesource/System/compmod/system/componentmodel/design/IInheritanceService.cs -../referencesource/System/compmod/system/componentmodel/design/IMenuCommandService.cs -../referencesource/System/compmod/system/componentmodel/design/InheritanceAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/InheritanceLevel.cs -../referencesource/System/compmod/system/componentmodel/design/IReferenceService.cs -../referencesource/System/compmod/system/componentmodel/design/IResourceService.cs -../referencesource/System/compmod/system/componentmodel/design/IRootDesigner.cs -../referencesource/System/compmod/system/componentmodel/design/ISelectionService.cs -../referencesource/System/compmod/system/componentmodel/design/IServiceObjectContainer.cs -../referencesource/System/compmod/system/componentmodel/design/ITreeDesigner.cs -../referencesource/System/compmod/system/componentmodel/design/ITypeDescriptorFilterService.cs -../referencesource/System/compmod/system/componentmodel/design/ITypeDiscoveryService.cs -../referencesource/System/compmod/system/componentmodel/design/ITypeResolutionService.cs -../referencesource/System/compmod/system/componentmodel/design/MenuCommand.cs -../referencesource/System/compmod/system/componentmodel/design/NotifyParentPropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/ParenthesizePropertyNameAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/PropertyTabAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/PropertyTabScope.cs -../referencesource/System/compmod/system/componentmodel/design/RefreshProperties.cs -../referencesource/System/compmod/system/componentmodel/design/RefreshPropertiesAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/SelectionTypes.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/ComponentSerializationService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/ContextStack.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/DefaultSerializationProviderAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/DesignerLoader.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/DesignerSerializerAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerLoaderHost.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerLoaderService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerSerializationManager.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerSerializationProvider.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerSerializationService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/INameCreationService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/InstanceDescriptor.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/MemberRelationshipService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/ResolveNameEventArgs.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/ResolveNameEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/RootDesignerSerializerAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/SerializationStore.cs -../referencesource/System/compmod/system/componentmodel/design/ServiceCreatorCallback.cs -../referencesource/System/compmod/system/componentmodel/design/ServiceObjectContainer.cs -../referencesource/System/compmod/system/componentmodel/design/StandardCommands.cs -../referencesource/System/compmod/system/componentmodel/design/StandardToolWindows.cs -../referencesource/System/compmod/system/componentmodel/design/ToolboxItemAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/ViewTechnology.cs -../referencesource/System/compmod/system/componentmodel/DesignerAttribute.cs -../referencesource/System/compmod/system/componentmodel/DesignerCategoryAttribute.cs -../referencesource/System/compmod/system/componentmodel/DesignerSerializationVisibility.cs -../referencesource/System/compmod/system/componentmodel/DesignerSerializationVisibilityAttribute.cs -../referencesource/System/compmod/system/componentmodel/DesignOnlyAttribute.cs -../referencesource/System/compmod/system/componentmodel/DesignTimeVisibleAttribute.cs -../referencesource/System/compmod/system/componentmodel/DisplayNameAttribute.cs -../referencesource/System/compmod/system/componentmodel/DoubleConverter.cs -../referencesource/System/compmod/system/componentmodel/DoWorkEventArgs.cs -../referencesource/System/compmod/system/componentmodel/DoWorkEventHandler.cs -../referencesource/System/compmod/system/componentmodel/EditorAttribute.cs -../referencesource/System/compmod/system/componentmodel/EditorBrowsableAttribute.cs -../referencesource/System/compmod/system/componentmodel/EnumConverter.cs -../referencesource/System/compmod/system/componentmodel/EventDescriptor.cs -../referencesource/System/compmod/system/componentmodel/EventDescriptorCollection.cs -../referencesource/System/compmod/system/componentmodel/EventHandlerList.cs -../referencesource/System/compmod/system/componentmodel/ExpandableObjectConverter.cs -../referencesource/System/compmod/system/componentmodel/ExtendedPropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/ExtenderProvidedPropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/FxCopSuppression.cs -../referencesource/System/compmod/system/componentmodel/GuidConverter.cs -../referencesource/System/compmod/system/componentmodel/HandledEventArgs.cs -../referencesource/System/compmod/system/componentmodel/HandledEventHandler.cs -../referencesource/System/compmod/system/componentmodel/IBindingList.cs -../referencesource/System/compmod/system/componentmodel/IBindingListView.cs -../referencesource/System/compmod/system/componentmodel/ICancelAddNew.cs -../referencesource/System/compmod/system/componentmodel/IChangeTracking.cs -../referencesource/System/compmod/system/componentmodel/IComNativeDescriptorHandler.cs -../referencesource/System/compmod/system/componentmodel/IComponent.cs -../referencesource/System/compmod/system/componentmodel/IContainer.cs -../referencesource/System/compmod/system/componentmodel/ICustomTypeDescriptor.cs -../referencesource/System/compmod/system/componentmodel/IDataErrorInfo.cs -../referencesource/System/compmod/system/componentmodel/IEditableObject.cs -../referencesource/System/compmod/system/componentmodel/IExtenderProvider.cs -../referencesource/System/compmod/system/componentmodel/IIntellisenseBuilder.cs -../referencesource/System/compmod/system/componentmodel/IListSource.cs -../referencesource/System/compmod/system/componentmodel/ImmutableObjectAttribute.cs -../referencesource/System/compmod/system/componentmodel/INestedContainer.cs -../referencesource/System/compmod/system/componentmodel/INestedSite.cs -../referencesource/System/compmod/system/componentmodel/InitializationEventAttribute.cs -../referencesource/System/compmod/system/componentmodel/INotifyDataErrorInfo.cs -../referencesource/System/compmod/system/componentmodel/INotifyPropertyChanged.cs -../referencesource/System/compmod/system/componentmodel/INotifyPropertyChanging.cs -../referencesource/System/compmod/system/componentmodel/InstallerTypeAttribute.cs -../referencesource/System/compmod/system/componentmodel/InstanceCreationEditor.cs -../referencesource/System/compmod/system/componentmodel/Int16Converter.cs -../referencesource/System/compmod/system/componentmodel/Int32Converter.cs -../referencesource/System/compmod/system/componentmodel/Int64Converter.cs -../referencesource/System/compmod/system/componentmodel/IntSecurity.cs -../referencesource/System/compmod/system/componentmodel/InvalidAsynchronousStateException.cs -../referencesource/System/compmod/system/componentmodel/InvalidEnumArgumentException.cs -../referencesource/System/compmod/system/componentmodel/IRaiseItemChangedEvents.cs -../referencesource/System/compmod/system/componentmodel/IRevertibleChangeTracking.cs -../referencesource/System/compmod/system/componentmodel/ISite.cs -../referencesource/System/compmod/system/componentmodel/ISupportInitialize.cs -../referencesource/System/compmod/system/componentmodel/ISupportInitializeNotification.cs -../referencesource/System/compmod/system/componentmodel/ISynchronizeInvoke.cs -../referencesource/System/compmod/system/componentmodel/ITypeDescriptorContext.cs -../referencesource/System/compmod/system/componentmodel/ITypedList.cs -../referencesource/System/compmod/system/componentmodel/License.cs -../referencesource/System/compmod/system/componentmodel/LicenseContext.cs -../referencesource/System/compmod/system/componentmodel/LicenseException.cs -../referencesource/System/compmod/system/componentmodel/LicenseManager.cs -../referencesource/System/compmod/system/componentmodel/LicenseProvider.cs -../referencesource/System/compmod/system/componentmodel/LicenseProviderAttribute.cs -../referencesource/System/compmod/system/componentmodel/LicenseUsageMode.cs -../referencesource/System/compmod/system/componentmodel/LicFileLicenseProvider.cs -../referencesource/System/compmod/system/componentmodel/ListBindableAttribute.cs -../referencesource/System/compmod/system/componentmodel/ListChangedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/ListChangedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/ListChangedType.cs -../referencesource/System/compmod/system/componentmodel/ListSortDescription.cs -../referencesource/System/compmod/system/componentmodel/ListSortDescriptionCollection.cs -../referencesource/System/compmod/system/componentmodel/ListSortDirection.cs -../referencesource/System/compmod/system/componentmodel/LocalizableAttribute.cs -../referencesource/System/compmod/system/componentmodel/LookupBindingPropertiesAttribute.cs -../referencesource/System/compmod/system/componentmodel/MarshalByValueComponent.cs -../referencesource/System/compmod/system/componentmodel/MaskedTextProvider.cs -../referencesource/System/compmod/system/componentmodel/MaskedTextResultHint.cs -../referencesource/System/compmod/system/componentmodel/MemberDescriptor.cs -../referencesource/System/compmod/system/componentmodel/MergablePropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/MultilineStringConverter.cs -../referencesource/System/compmod/system/componentmodel/NestedContainer.cs -../referencesource/System/compmod/system/componentmodel/NullableConverter.cs -../referencesource/System/compmod/system/componentmodel/PasswordPropertyTextAttribute.cs -../referencesource/System/compmod/system/componentmodel/ProgressChangedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/ProgressChangedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/PropertyChangedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/PropertyChangedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/PropertyChangingEventArgs.cs -../referencesource/System/compmod/system/componentmodel/PropertyChangingEventHandler.cs -../referencesource/System/compmod/system/componentmodel/PropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/PropertyDescriptorCollection.cs -../referencesource/System/compmod/system/componentmodel/ProvidePropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/ReadOnlyAttribute.cs -../referencesource/System/compmod/system/componentmodel/RecommendedAsConfigurableAttribute.cs -../referencesource/System/compmod/system/componentmodel/ReferenceConverter.cs -../referencesource/System/compmod/system/componentmodel/ReflectEventDescriptor.cs -../referencesource/System/compmod/system/componentmodel/ReflectPropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/ReflectTypeDescriptionProvider.cs -../referencesource/System/compmod/system/componentmodel/RefreshEventArgs.cs -../referencesource/System/compmod/system/componentmodel/RefreshEventHandler.cs -../referencesource/System/compmod/system/componentmodel/RunInstallerAttribute.cs -../referencesource/System/compmod/system/componentmodel/RunWorkerCompletedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/RunWorkerCompletedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/SByteConverter.cs -../referencesource/System/compmod/system/componentmodel/SettingsBindableAttribute.cs -../referencesource/System/compmod/system/componentmodel/SingleConverter.cs -../referencesource/System/compmod/system/componentmodel/StringConverter.cs -../referencesource/System/compmod/system/componentmodel/SyntaxCheck.cs -../referencesource/System/compmod/system/componentmodel/TimeSpanConverter.cs -../referencesource/System/compmod/system/componentmodel/ToolboxItemFilterAttribute.cs -../referencesource/System/compmod/system/componentmodel/ToolboxItemFilterType.cs -../referencesource/System/compmod/system/componentmodel/TypeConverter.cs -../referencesource/System/compmod/system/componentmodel/TypeConverterAttribute.cs -../referencesource/System/compmod/system/componentmodel/TypeDescriptionProvider.cs -../referencesource/System/compmod/system/componentmodel/TypeDescriptionProviderAttribute.cs -../referencesource/System/compmod/system/componentmodel/TypeDescriptionProviderService.cs -../referencesource/System/compmod/system/componentmodel/TypeDescriptor.cs -../referencesource/System/compmod/system/componentmodel/TypeListConverter.cs -../referencesource/System/compmod/system/componentmodel/UInt16Converter.cs -../referencesource/System/compmod/system/componentmodel/UInt32Converter.cs -../referencesource/System/compmod/system/componentmodel/UInt64Converter.cs -../referencesource/System/compmod/system/componentmodel/WarningException.cs -../referencesource/System/compmod/system/componentmodel/Win32Exception.cs - -../referencesource/System/compmod/system/diagnostics/AssertSection.cs -../referencesource/System/compmod/system/diagnostics/BooleanSwitch.cs -../referencesource/System/compmod/system/diagnostics/ConsoleTraceListener.cs -../referencesource/System/compmod/system/diagnostics/CorrelationManager.cs -../referencesource/System/compmod/system/diagnostics/Debug.cs -../referencesource/System/compmod/system/diagnostics/DelimitedListTraceListener.cs -../referencesource/System/compmod/system/diagnostics/DiagnosticsConfiguration.cs -../referencesource/System/compmod/system/diagnostics/FilterElement.cs -../referencesource/System/compmod/system/diagnostics/ListenerElementsCollection.cs -../referencesource/System/compmod/system/diagnostics/PerfCounterSection.cs -../referencesource/System/compmod/system/diagnostics/SeverityFilter.cs -../referencesource/System/compmod/system/diagnostics/SourceElementsCollection.cs -../referencesource/System/compmod/system/diagnostics/SourceFilter.cs -../referencesource/System/compmod/system/diagnostics/SourceLevels.cs -../referencesource/System/compmod/system/diagnostics/SourceSwitch.cs -../referencesource/System/compmod/system/diagnostics/SwitchAttribute.cs -../referencesource/System/compmod/system/diagnostics/Switch.cs -../referencesource/System/compmod/system/diagnostics/SwitchElementsCollection.cs -../referencesource/System/compmod/system/diagnostics/SwitchLevelAttribute.cs -../referencesource/System/compmod/system/diagnostics/SystemDiagnosticsSection.cs -../referencesource/System/compmod/system/diagnostics/TextWriterTraceListener.cs -../referencesource/System/compmod/system/diagnostics/Trace.cs -../referencesource/System/compmod/system/diagnostics/TraceEventCache.cs -../referencesource/System/compmod/system/diagnostics/TraceEventType.cs -../referencesource/System/compmod/system/diagnostics/TraceFilter.cs -../referencesource/System/compmod/system/diagnostics/TraceInternal.cs -../referencesource/System/compmod/system/diagnostics/TraceLevel.cs -../referencesource/System/compmod/system/diagnostics/TraceListener.cs -../referencesource/System/compmod/system/diagnostics/TraceListeners.cs -../referencesource/System/compmod/system/diagnostics/TraceOptions.cs -../referencesource/System/compmod/system/diagnostics/TraceSection.cs -../referencesource/System/compmod/system/diagnostics/TraceSource.cs -../referencesource/System/compmod/system/diagnostics/TraceSwitch.cs -../referencesource/System/compmod/system/diagnostics/traceutils.cs -../referencesource/System/compmod/system/diagnostics/TypedElement.cs -../referencesource/System/compmod/system/diagnostics/XmlWriterTraceListener.cs - -../referencesource/System/net/System/_DomainName.cs -../referencesource/System/net/System/_IPv4Address.cs -../referencesource/System/net/System/_IPv6Address.cs -../referencesource/System/net/System/_UncName.cs -../referencesource/System/net/System/_UriSyntax.cs -../referencesource/System/net/System/GenericUriParser.cs -../referencesource/System/net/System/IriHelper.cs -../referencesource/System/net/System/URI.cs -../referencesource/System/net/System/uribuilder.cs -../referencesource/System/net/System/UriEnumTypes.cs -../referencesource/System/net/System/UriExt.cs -../referencesource/System/net/System/URIFormatException.cs -../referencesource/System/net/System/UriHelper.cs -../referencesource/System/net/System/UriHostNameType.cs -../referencesource/System/net/System/UriParserTemplates.cs -../referencesource/System/net/System/URIPartial.cs -../referencesource/System/net/System/UriScheme.cs - -../referencesource/System/net/System/Net/_BufferOffsetSize.cs -../referencesource/System/net/System/Net/_Connection.cs -../referencesource/System/net/System/Net/_emptywebproxy.cs -../referencesource/System/net/System/Net/_HeaderInfo.cs -../referencesource/System/net/System/Net/_HeaderInfoTable.cs -../referencesource/System/net/System/Net/_HTTPDateParse.cs -../referencesource/System/net/System/Net/_IStreams.cs -../referencesource/System/net/System/Net/_NetRes.cs -../referencesource/System/net/System/Net/_LazyAsyncResult.cs -../referencesource/System/net/System/Net/_LoggingObject.cs -../referencesource/System/net/System/Net/_PooledStream.cs -../referencesource/System/net/System/Net/_ProxyChain.cs -../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs -../referencesource/System/net/System/Net/_Semaphore.cs -../referencesource/System/net/System/Net/_ServiceNameStore.cs -../referencesource/System/net/System/Net/_TimerThread.cs -../referencesource/System/net/System/Net/_WebProxyDataBuilder.cs -../referencesource/System/net/System/Net/AuthenticationScheme.cs -../referencesource/System/net/System/Net/AuthenticationSchemeSelector.cs -../referencesource/System/net/System/Net/Authorization.cs -../referencesource/System/net/System/Net/CredentialCache.cs -../referencesource/System/net/System/Net/cookie.cs -../referencesource/System/net/System/Net/cookiecollection.cs -../referencesource/System/net/System/Net/cookiecontainer.cs -../referencesource/System/net/System/Net/cookieexception.cs -../referencesource/System/net/System/Net/connectionpool.cs -../referencesource/System/net/System/Net/DnsEndPoint.cs -../referencesource/System/net/System/Net/EndPoint.cs -../referencesource/System/net/System/Net/FtpStatusCode.cs -../referencesource/System/net/System/Net/filewebrequest.cs -../referencesource/System/net/System/Net/filewebresponse.cs -../referencesource/System/net/System/Net/GlobalProxySelection.cs -../referencesource/System/net/System/Net/HttpListenerException.cs -../referencesource/System/net/System/Net/HttpListenerRequestUriBuilder.cs -../referencesource/System/net/System/Net/HttpRequestHeader.cs -../referencesource/System/net/System/Net/HttpResponseHeader.cs -../referencesource/System/net/System/Net/HttpStatusCode.cs -../referencesource/System/net/System/Net/HttpVersion.cs -../referencesource/System/net/System/Net/IAuthenticationModule.cs -../referencesource/System/net/System/Net/ICertificatePolicy.cs -../referencesource/System/net/System/Net/ICredentials.cs -../referencesource/System/net/System/Net/ICredentialsByHost.cs -../referencesource/System/net/System/Net/Internal.cs -../referencesource/System/net/System/Net/IPAddress.cs -../referencesource/System/net/System/Net/IPEndPoint.cs -../referencesource/System/net/System/Net/IPHostEntry.cs -../referencesource/System/net/System/Net/iwebproxy.cs -../referencesource/System/net/System/Net/IWebProxyFinder.cs -../referencesource/System/net/System/Net/IWebRequestCreate.cs -../referencesource/System/net/System/Net/NetworkAccess.cs -../referencesource/System/net/System/Net/NetworkCredential.cs -../referencesource/System/net/System/Net/ProtocolViolationException.cs -../referencesource/System/net/System/Net/TransportContext.cs -../referencesource/System/net/System/Net/TransportType.cs -../referencesource/System/net/System/Net/UnicodeDecodingConformance.cs -../referencesource/System/net/System/Net/UnicodeEncodingConformance.cs -../referencesource/System/net/System/Net/ServicePointManager.cs -../referencesource/System/net/System/Net/SocketAddress.cs -../referencesource/System/net/System/Net/SocketException.cs -../referencesource/System/net/System/Net/webclient.cs -../referencesource/System/net/System/Net/WebException.cs -../referencesource/System/net/System/Net/WebExceptionStatus.cs -../referencesource/System/net/System/Net/WebHeaderCollection.cs -../referencesource/System/net/System/Net/WebPermission.cs -../referencesource/System/net/System/Net/webproxy.cs -../referencesource/System/net/System/Net/WebRequestMethods.cs -../referencesource/System/net/System/Net/WebRequest.cs -../referencesource/System/net/System/Net/WebResponse.cs -../referencesource/System/net/System/Net/WebUtility.cs -../referencesource/System/net/System/Net/WriteStreamClosedEventArgs.cs - -../referencesource/System/net/System/Net/Cache/RequestCache.cs -../referencesource/System/net/System/Net/Cache/RequestCacheEntry.cs -../referencesource/System/net/System/Net/Cache/RequestCachePolicy.cs -../referencesource/System/net/System/Net/Cache/RequestCacheManager.cs - -../referencesource/System/net/System/Net/Configuration/DefaultProxySection.cs - -../referencesource/System/net/System/Net/Sockets/_MultipleConnectAsync.cs -../referencesource/System/net/System/Net/Sockets/AddressFamily.cs -../referencesource/System/net/System/Net/Sockets/IOControlCode.cs -../referencesource/System/net/System/Net/Sockets/IPPacketInformation.cs -../referencesource/System/net/System/Net/Sockets/IPProtectionLevel.cs -../referencesource/System/net/System/Net/Sockets/LingerOption.cs -../referencesource/System/net/System/Net/Sockets/MulticastOption.cs -../referencesource/System/net/System/Net/Sockets/NetworkStream.cs -../referencesource/System/net/System/Net/Sockets/ProtocolFamily.cs -../referencesource/System/net/System/Net/Sockets/ProtocolType.cs -../referencesource/System/net/System/Net/Sockets/SelectMode.cs -../referencesource/System/net/System/Net/Sockets/Socket.cs -../referencesource/System/net/System/Net/Sockets/SocketErrors.cs -../referencesource/System/net/System/Net/Sockets/SocketFlags.cs -../referencesource/System/net/System/Net/Sockets/SocketInformation.cs -../referencesource/System/net/System/Net/Sockets/SocketInformationOptions.cs -../referencesource/System/net/System/Net/Sockets/SocketOptionLevel.cs -../referencesource/System/net/System/Net/Sockets/SocketOptionName.cs -../referencesource/System/net/System/Net/Sockets/SocketShutdown.cs -../referencesource/System/net/System/Net/Sockets/SocketType.cs -../referencesource/System/net/System/Net/Sockets/TCPClient.cs -../referencesource/System/net/System/Net/Sockets/TCPListener.cs -../referencesource/System/net/System/Net/Sockets/TransmitFileFlags.cs -../referencesource/System/net/System/Net/Sockets/UdpReceiveResult.cs -../referencesource/System/net/System/Net/Sockets/UDPClient.cs - -../referencesource/System/net/System/Net/NetworkInformation/DuplicateAddressDetectionState.cs -../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformationCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/IPAddressCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformationCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/IPGlobalProperties.cs -../referencesource/System/net/System/Net/NetworkInformation/IPGlobalStatistics.cs -../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceProperties.cs -../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceStatistics.cs -../referencesource/System/net/System/Net/NetworkInformation/IPStatus.cs -../referencesource/System/net/System/Net/NetworkInformation/IPv4InterfaceProperties.cs -../referencesource/System/net/System/Net/NetworkInformation/IPv6InterfaceProperties.cs -../referencesource/System/net/System/Net/NetworkInformation/IcmpV4Statistics.cs -../referencesource/System/net/System/Net/NetworkInformation/IcmpV6Statistics.cs -../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformationCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkAddressChange.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationException.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationPermission.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkInterface.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkInterfaceComponent.cs -../referencesource/System/net/System/Net/NetworkInformation/OperationalStatus.cs -../referencesource/System/net/System/Net/NetworkInformation/PhysicalAddress.cs -../referencesource/System/net/System/Net/NetworkInformation/PingOptions.cs -../referencesource/System/net/System/Net/NetworkInformation/PingReply.cs -../referencesource/System/net/System/Net/NetworkInformation/PrefixOrigin.cs -../referencesource/System/net/System/Net/NetworkInformation/ScopeLevel.cs -../referencesource/System/net/System/Net/NetworkInformation/SuffixOrigin.cs -../referencesource/System/net/System/Net/NetworkInformation/SystemGatewayIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/SystemIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/SystemMulticastIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/SystemTcpConnection.cs -../referencesource/System/net/System/Net/NetworkInformation/TcpConnection.cs -../referencesource/System/net/System/Net/NetworkInformation/TcpState.cs -../referencesource/System/net/System/Net/NetworkInformation/TcpStatistics.cs -../referencesource/System/net/System/Net/NetworkInformation/UdpStatistics.cs -../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformationCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/interfacetype.cs -../referencesource/System/net/System/Net/NetworkInformation/nodetype.cs -../referencesource/System/net/System/Net/NetworkInformation/pingexception.cs - -../referencesource/System/sys/system/IO/ports/InternalResources.cs - -../referencesource/System/sys/system/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs - -../referencesource/System/sys/system/runtime/interopservices/DefaultParameterValueAttribute.cs -../referencesource/System/sys/system/runtime/interopservices/handlecollector.cs - -../referencesource/System/sys/system/runtime/versioning/FrameworkName.cs - -../referencesource/System/sys/system/threading/Barrier.cs -../referencesource/System/sys/system/threading/semaphore.cs - -../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs - -../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs -../referencesource/System/security/system/security/Authentication/ExtendedProtection/ServiceNameCollection.cs - -../referencesource/System/security/system/security/cryptography/oid.cs - -../referencesource/System/security/system/security/cryptography/x509/x509utils.cs - -../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs - -../referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs -../referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs - -../referencesource/System/services/timers/system/timers/ElapsedEventHandler.cs -../referencesource/System/services/timers/system/timers/Timer.cs -../referencesource/System/services/timers/system/timers/TimersDescriptionAttribute.cs - -../referencesource/System/misc/hresults.cs -../referencesource/System/misc/invariantcomparer.cs -../referencesource/System/misc/SecurityUtils.cs -../referencesource/System/misc/WeakHashtable.cs - -../referencesource/System/compmod/system/codedom/CodeArgumentReferenceExpression.cs -../referencesource/System/compmod/system/codedom/CodeArrayCreateExpression.cs -../referencesource/System/compmod/system/codedom/CodeArrayIndexerExpression.cs -../referencesource/System/compmod/system/codedom/CodeAssignStatement.cs -../referencesource/System/compmod/system/codedom/CodeAttachEventStatement.cs -../referencesource/System/compmod/system/codedom/CodeAttributeArgumentCollection.cs -../referencesource/System/compmod/system/codedom/CodeAttributeArgument.cs -../referencesource/System/compmod/system/codedom/CodeAttributeDeclarationCollection.cs -../referencesource/System/compmod/system/codedom/CodeAttributeDeclaration.cs -../referencesource/System/compmod/system/codedom/CodeBaseReferenceExpression.cs -../referencesource/System/compmod/system/codedom/CodeBinaryOperatorExpression.cs -../referencesource/System/compmod/system/codedom/CodeBinaryOperatorType.cs -../referencesource/System/compmod/system/codedom/CodeCastExpression.cs -../referencesource/System/compmod/system/codedom/CodeCatchClauseCollection.cs -../referencesource/System/compmod/system/codedom/CodeCatchClause.cs -../referencesource/System/compmod/system/codedom/CodeChecksumPragma.cs -../referencesource/System/compmod/system/codedom/CodeComment.cs -../referencesource/System/compmod/system/codedom/CodeCommentStatementCollection.cs -../referencesource/System/compmod/system/codedom/CodeCommentStatement.cs -../referencesource/System/compmod/system/codedom/CodeCompileUnit.cs -../referencesource/System/compmod/system/codedom/CodeConditionStatement.cs -../referencesource/System/compmod/system/codedom/CodeConstructor.cs -../referencesource/System/compmod/system/codedom/CodeDefaultValueExpression.cs -../referencesource/System/compmod/system/codedom/CodeDelegateCreateExpression.cs -../referencesource/System/compmod/system/codedom/CodeDelegateInvokeExpression.cs -../referencesource/System/compmod/system/codedom/CodeDirectionExpression.cs -../referencesource/System/compmod/system/codedom/CodeDirectiveCollection.cs -../referencesource/System/compmod/system/codedom/CodeDirective.cs -../referencesource/System/compmod/system/codedom/CodeEntryPointMethod.cs -../referencesource/System/compmod/system/codedom/CodeEventReferenceExpression.cs -../referencesource/System/compmod/system/codedom/CodeExpressionCollection.cs -../referencesource/System/compmod/system/codedom/CodeExpression.cs -../referencesource/System/compmod/system/codedom/CodeExpressionStatement.cs -../referencesource/System/compmod/system/codedom/CodeFieldReferenceExpression.cs -../referencesource/System/compmod/system/codedom/CodeGotoStatement.cs -../referencesource/System/compmod/system/codedom/CodeIndexerExpression.cs -../referencesource/System/compmod/system/codedom/CodeIterationStatement.cs -../referencesource/System/compmod/system/codedom/CodeLabeledStatement.cs -../referencesource/System/compmod/system/codedom/CodeLinePragma.cs -../referencesource/System/compmod/system/codedom/CodeMemberEvent.cs -../referencesource/System/compmod/system/codedom/CodeMemberField.cs -../referencesource/System/compmod/system/codedom/CodeMemberMethod.cs -../referencesource/System/compmod/system/codedom/CodeMemberProperty.cs -../referencesource/System/compmod/system/codedom/CodeMethodInvokeExpression.cs -../referencesource/System/compmod/system/codedom/codemethodreferenceexpression.cs -../referencesource/System/compmod/system/codedom/CodeMethodReturnStatement.cs -../referencesource/System/compmod/system/codedom/CodeNamespaceCollection.cs -../referencesource/System/compmod/system/codedom/CodeNamespace.cs -../referencesource/System/compmod/system/codedom/CodeNamespaceImportCollection.cs -../referencesource/System/compmod/system/codedom/CodeNamespaceImport.cs -../referencesource/System/compmod/system/codedom/CodeObjectCreateExpression.cs -../referencesource/System/compmod/system/codedom/CodeObject.cs -../referencesource/System/compmod/system/codedom/CodeParameterDeclarationExpressionCollection.cs -../referencesource/System/compmod/system/codedom/CodeParameterDeclarationExpression.cs -../referencesource/System/compmod/system/codedom/CodePrimitiveExpression.cs -../referencesource/System/compmod/system/codedom/CodePropertyReferenceExpression.cs -../referencesource/System/compmod/system/codedom/CodePropertySetValueReferenceExpression.cs -../referencesource/System/compmod/system/codedom/CodeRegionDirective.cs -../referencesource/System/compmod/system/codedom/CodeRegionMode.cs -../referencesource/System/compmod/system/codedom/CodeRemoveEventStatement.cs -../referencesource/System/compmod/system/codedom/CodeSnippetCompileUnit.cs -../referencesource/System/compmod/system/codedom/CodeSnippetExpression.cs -../referencesource/System/compmod/system/codedom/CodeSnippetStatement.cs -../referencesource/System/compmod/system/codedom/CodeSnippetTypeMember.cs -../referencesource/System/compmod/system/codedom/CodeStatementCollection.cs -../referencesource/System/compmod/system/codedom/CodeStatement.cs -../referencesource/System/compmod/system/codedom/CodeThisReferenceExpression.cs -../referencesource/System/compmod/system/codedom/CodeThrowExceptionStatement.cs -../referencesource/System/compmod/system/codedom/CodeTryCatchFinallyStatement.cs -../referencesource/System/compmod/system/codedom/CodeTypeConstructor.cs -../referencesource/System/compmod/system/codedom/CodeTypeDeclarationCollection.cs -../referencesource/System/compmod/system/codedom/CodeTypeDeclaration.cs -../referencesource/System/compmod/system/codedom/CodeTypeDelegate.cs -../referencesource/System/compmod/system/codedom/CodeTypeMemberCollection.cs -../referencesource/System/compmod/system/codedom/CodeTypeMember.cs -../referencesource/System/compmod/system/codedom/CodeTypeOfExpression.cs -../referencesource/System/compmod/system/codedom/CodeTypeParameterCollection.cs -../referencesource/System/compmod/system/codedom/CodeTypeParameter.cs -../referencesource/System/compmod/system/codedom/CodeTypeReferenceCollection.cs -../referencesource/System/compmod/system/codedom/CodeTypeReference.cs -../referencesource/System/compmod/system/codedom/CodeTypeReferenceExpression.cs -../referencesource/System/compmod/system/codedom/CodeVariableDeclarationStatement.cs -../referencesource/System/compmod/system/codedom/CodeVariableReferenceExpression.cs -../referencesource/System/compmod/system/codedom/FieldDirection.cs -../referencesource/System/compmod/system/codedom/MemberAttributes.cs - -../referencesource/System/compmod/system/codedom/compiler/CodeGenerator.cs -../referencesource/System/compmod/system/codedom/compiler/CodeGeneratorOptions.cs -../referencesource/System/compmod/system/codedom/compiler/CodeValidator.cs -../referencesource/System/compmod/system/codedom/compiler/CompilerError.cs -../referencesource/System/compmod/system/codedom/compiler/CompilerErrorCollection.cs -../referencesource/System/compmod/system/codedom/compiler/CompilerParameters.cs -../referencesource/System/compmod/system/codedom/compiler/GeneratedCodeAttribute.cs -../referencesource/System/compmod/system/codedom/compiler/GeneratorSupport.cs -../referencesource/System/compmod/system/codedom/compiler/ICodeCompiler.cs -../referencesource/System/compmod/system/codedom/compiler/ICodeGenerator.cs -../referencesource/System/compmod/system/codedom/compiler/ICodeParser.cs -../referencesource/System/compmod/system/codedom/compiler/IndentTextWriter.cs -../referencesource/System/compmod/system/codedom/compiler/LanguageOptions.cs - -../referencesource/System/services/monitoring/system/diagnosticts/AsyncStreamReader.cs -../referencesource/System/services/monitoring/system/diagnosticts/Process.cs -../referencesource/System/services/monitoring/system/diagnosticts/ProcessStartInfo.cs -../referencesource/System/services/monitoring/system/diagnosticts/processwaithandle.cs - -../referencesource/System/compmod/microsoft/win32/safehandles/SafeProcessHandle.cs diff --git a/mcs/class/System/System/Platform.cs b/mcs/class/System/System/Platform.cs index b687c590f58..8afd40370cd 100644 --- a/mcs/class/System/System/Platform.cs +++ b/mcs/class/System/System/Platform.cs @@ -30,14 +30,17 @@ namespace System { internal static class Platform { static bool checkedOS; static bool isMacOS; - static bool isFreeBSD; #if MONOTOUCH || XAMMAC + const bool isFreeBSD = false; + private static void CheckOS() { isMacOS = true; checkedOS = true; } #else + static bool isFreeBSD; + [DllImport ("libc")] static extern int uname (IntPtr buf); diff --git a/mcs/class/System/aot_hybrid_System.dll.sources b/mcs/class/System/aot_hybrid_System.dll.sources deleted file mode 100644 index 70a77a6dbff..00000000000 --- a/mcs/class/System/aot_hybrid_System.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include mobile_System.dll.sources diff --git a/mcs/class/System/aot_hybrid_System_test.dll.exclude.sources b/mcs/class/System/aot_hybrid_System_test.dll.exclude.sources deleted file mode 100644 index 9a453e68f8c..00000000000 --- a/mcs/class/System/aot_hybrid_System_test.dll.exclude.sources +++ /dev/null @@ -1,210 +0,0 @@ - -Microsoft.CSharp/CSharpCodeProviderCas.cs -Microsoft.CSharp/CSharpCodeProviderTest.cs -Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs -Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs -Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs -Microsoft.CSharp/CodeGeneratorFromStatementTest.cs -Microsoft.CSharp/CodeGeneratorFromTypeTest.cs -Microsoft.CSharp/CodeGeneratorIdentifierTest.cs -Microsoft.CSharp/CodeGeneratorTestBase.cs -Microsoft.CSharp/CodeGeneratorTypeOutputTest.cs -Microsoft.VisualBasic/CodeGeneratorFromBinaryOperatorTest.cs -Microsoft.VisualBasic/CodeGeneratorFromCompileUnitTest.cs -Microsoft.VisualBasic/CodeGeneratorFromExpressionTest.cs -Microsoft.VisualBasic/CodeGeneratorFromNamespaceTest.cs -Microsoft.VisualBasic/CodeGeneratorFromStatementTest.cs -Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs -Microsoft.VisualBasic/CodeGeneratorTestBase.cs -Microsoft.VisualBasic/VBCodeProviderCas.cs -Microsoft.VisualBasic/VBCodeProviderTest.cs -Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs -Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs -Microsoft.Win32/PowerModeChangedEventArgsCas.cs -Microsoft.Win32/SessionEndedEventArgsCas.cs -Microsoft.Win32/SessionEndingEventArgsCas.cs -Microsoft.Win32/SessionSwitchEventArgsCas.cs -Microsoft.Win32/SessionSwitchEventArgsTest.cs -Microsoft.Win32/SystemEventsCas.cs -Microsoft.Win32/TimerElapsedEventArgsCas.cs -Microsoft.Win32/UserPreferenceChangedEventArgsCas.cs -Microsoft.Win32/UserPreferenceChangingEventArgsCas.cs -System.CodeDom.Compiler/CodeCompilerCas.cs -System.CodeDom.Compiler/CodeDomProviderCas.cs -System.CodeDom.Compiler/CodeGeneratorCas.cs -System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs -System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs -System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs -System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs -System.CodeDom.Compiler/CodeGeneratorTest.cs -System.CodeDom.Compiler/CodeGeneratorTestBase.cs -System.CodeDom.Compiler/CodeParserCas.cs -System.CodeDom.Compiler/CompilerErrorCas.cs -System.CodeDom.Compiler/CompilerErrorCollectionCas.cs -System.CodeDom.Compiler/CompilerInfoCas.cs -System.CodeDom.Compiler/CompilerParametersCas.cs -System.CodeDom.Compiler/CompilerResultsCas.cs -System.CodeDom.Compiler/ExecutorCas.cs -System.CodeDom.Compiler/ExecutorTest.cs -System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs -System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs -System.CodeDom.Compiler/IndentedTextWriterCas.cs -System.CodeDom.Compiler/IndentedTextWriterTest.cs -System.CodeDom.Compiler/TempFileCollectionCas.cs -System.CodeDom.Compiler/TempFileCollectionTest.cs -System.CodeDom/CodeArgumentReferenceExpressionCas.cs -System.CodeDom/CodeArgumentReferenceExpressionTest.cs -System.CodeDom/CodeArrayCreateExpressionCas.cs -System.CodeDom/CodeArrayCreateExpressionTest.cs -System.CodeDom/CodeArrayIndexerExpressionCas.cs -System.CodeDom/CodeAssignStatementCas.cs -System.CodeDom/CodeAttachEventStatementCas.cs -System.CodeDom/CodeAttachEventStatementTest.cs -System.CodeDom/CodeAttributeArgumentCas.cs -System.CodeDom/CodeAttributeArgumentCollectionCas.cs -System.CodeDom/CodeAttributeArgumentCollectionTest.cs -System.CodeDom/CodeAttributeArgumentTest.cs -System.CodeDom/CodeAttributeDeclarationCas.cs -System.CodeDom/CodeAttributeDeclarationCollectionCas.cs -System.CodeDom/CodeAttributeDeclarationCollectionTest.cs -System.CodeDom/CodeAttributeDeclarationTest.cs -System.CodeDom/CodeBaseReferenceExpressionCas.cs -System.CodeDom/CodeBinaryOperatorExpressionCas.cs -System.CodeDom/CodeCastExpressionCas.cs -System.CodeDom/CodeCastExpressionTest.cs -System.CodeDom/CodeCatchClauseCas.cs -System.CodeDom/CodeCatchClauseCollectionCas.cs -System.CodeDom/CodeCatchClauseCollectionTest.cs -System.CodeDom/CodeCatchClauseTest.cs -System.CodeDom/CodeChecksumPragmaCas.cs -System.CodeDom/CodeChecksumPragmaTest.cs -System.CodeDom/CodeCommentStatementCas.cs -System.CodeDom/CodeCommentStatementCollectionCas.cs -System.CodeDom/CodeCommentStatementCollectionTest.cs -System.CodeDom/CodeCompileUnitCas.cs -System.CodeDom/CodeConditionStatementCas.cs -System.CodeDom/CodeConstructorCas.cs -System.CodeDom/CodeConstructorTest.cs -System.CodeDom/CodeDefaultValueExpressionCas.cs -System.CodeDom/CodeDefaultValueExpressionTest.cs -System.CodeDom/CodeDelegateCreateExpressionCas.cs -System.CodeDom/CodeDelegateCreateExpressionTest.cs -System.CodeDom/CodeDelegateInvokeExpressionCas.cs -System.CodeDom/CodeDirectionExpressionCas.cs -System.CodeDom/CodeDirectiveCas.cs -System.CodeDom/CodeDirectiveCollectionCas.cs -System.CodeDom/CodeDirectiveCollectionTest.cs -System.CodeDom/CodeEntryPointMethodCas.cs -System.CodeDom/CodeEventReferenceExpressionCas.cs -System.CodeDom/CodeEventReferenceExpressionTest.cs -System.CodeDom/CodeExpressionCas.cs -System.CodeDom/CodeExpressionCollectionCas.cs -System.CodeDom/CodeExpressionCollectionTest.cs -System.CodeDom/CodeExpressionStatementCas.cs -System.CodeDom/CodeFieldReferenceExpressionCas.cs -System.CodeDom/CodeGotoStatementCas.cs -System.CodeDom/CodeGotoStatementTest.cs -System.CodeDom/CodeIndexerExpressionCas.cs -System.CodeDom/CodeIterationStatementCas.cs -System.CodeDom/CodeLabeledStatementTest.cs -System.CodeDom/CodeLinePragmaCas.cs -System.CodeDom/CodeLinePragmaTest.cs -System.CodeDom/CodeMemberEventCas.cs -System.CodeDom/CodeMemberFieldCas.cs -System.CodeDom/CodeMemberFieldTest.cs -System.CodeDom/CodeMemberMethodCas.cs -System.CodeDom/CodeMemberMethodTest.cs -System.CodeDom/CodeMemberPropertyCas.cs -System.CodeDom/CodeMemberPropertyTest.cs -System.CodeDom/CodeMethodInvokeExpressionCas.cs -System.CodeDom/CodeMethodInvokeExpressionTest.cs -System.CodeDom/CodeMethodReferenceExpressionCas.cs -System.CodeDom/CodeMethodReferenceExpressionTest.cs -System.CodeDom/CodeMethodReturnStatementCas.cs -System.CodeDom/CodeNamespaceCas.cs -System.CodeDom/CodeNamespaceCollectionCas.cs -System.CodeDom/CodeNamespaceCollectionTest.cs -System.CodeDom/CodeNamespaceImportCas.cs -System.CodeDom/CodeNamespaceImportCollectionCas.cs -System.CodeDom/CodeNamespaceImportCollectionTest.cs -System.CodeDom/CodeNamespaceImportTest.cs -System.CodeDom/CodeNamespaceTest.cs -System.CodeDom/CodeObjectCas.cs -System.CodeDom/CodeObjectCreateExpressionCas.cs -System.CodeDom/CodeObjectCreateExpressionTest.cs -System.CodeDom/CodeParameterDeclarationExpressionCas.cs -System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs -System.CodeDom/CodeParameterDeclarationExpressionCollectionTest.cs -System.CodeDom/CodeParameterDeclarationExpressionTest.cs -System.CodeDom/CodePrimitiveExpressionCas.cs -System.CodeDom/CodePropertyReferenceExpressionCas.cs -System.CodeDom/CodePropertyReferenceExpressionTest.cs -System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs -System.CodeDom/CodeRegionDirectiveCas.cs -System.CodeDom/CodeRegionDirectiveTest.cs -System.CodeDom/CodeRemoveEventStatementCas.cs -System.CodeDom/CodeRemoveEventStatementTest.cs -System.CodeDom/CodeSnippetCompileUnitCas.cs -System.CodeDom/CodeSnippetCompileUnitTest.cs -System.CodeDom/CodeSnippetExpressionCas.cs -System.CodeDom/CodeSnippetExpressionTest.cs -System.CodeDom/CodeSnippetStatementCas.cs -System.CodeDom/CodeSnippetStatementTest.cs -System.CodeDom/CodeSnippetTypeMemberCas.cs -System.CodeDom/CodeSnippetTypeMemberTest.cs -System.CodeDom/CodeStatementCas.cs -System.CodeDom/CodeStatementCollectionCas.cs -System.CodeDom/CodeStatementCollectionTest.cs -System.CodeDom/CodeThisReferenceExpressionCas.cs -System.CodeDom/CodeThrowExceptionStatementCas.cs -System.CodeDom/CodeTryCatchFinallyStatementCas.cs -System.CodeDom/CodeTypeConstructorCas.cs -System.CodeDom/CodeTypeConstructorTest.cs -System.CodeDom/CodeTypeDeclarationCas.cs -System.CodeDom/CodeTypeDeclarationCollectionCas.cs -System.CodeDom/CodeTypeDeclarationCollectionTest.cs -System.CodeDom/CodeTypeDelegateCas.cs -System.CodeDom/CodeTypeDelegateTest.cs -System.CodeDom/CodeTypeMemberCas.cs -System.CodeDom/CodeTypeMemberCollectionCas.cs -System.CodeDom/CodeTypeMemberCollectionTest.cs -System.CodeDom/CodeTypeOfExpressionCas.cs -System.CodeDom/CodeTypeOfExpressionTest.cs -System.CodeDom/CodeTypeParameterCas.cs -System.CodeDom/CodeTypeParameterCollectionTest.cs -System.CodeDom/CodeTypeParameterTest.cs -System.CodeDom/CodeTypeReferenceCas.cs -System.CodeDom/CodeTypeReferenceCollectionCas.cs -System.CodeDom/CodeTypeReferenceCollectionTest.cs -System.CodeDom/CodeTypeReferenceExpressionCas.cs -System.CodeDom/CodeTypeReferenceExpressionTest.cs -System.CodeDom/CodeTypeReferenceTest.cs -System.CodeDom/CodeVariableDeclarationStatementCas.cs -System.CodeDom/CodeVariableDeclarationStatementTest.cs -System.CodeDom/CodeVariableReferenceExpressionCas.cs -System.CodeDom/CodeVariableReferenceExpressionTest.cs -System.Configuration.Provider -System.Configuration.Provider/ProviderBaseTest.cs -System.Configuration/ApplicationSettingsBaseTest.cs -System.Configuration/ConfigXmlDocumentTest.cs -System.Configuration/ConfigurationExceptionTest.cs -System.Configuration/LocalFileSettingsProviderTest.cs -System.Configuration/SettingElementTest.cs -System.Configuration/SettingsBaseTest.cs -System.Configuration/SettingsPropertyCollectionTest.cs -System.Configuration/SettingsPropertyTest.cs -System.Configuration/SettingsPropertyValueCollectionTest.cs -System.Configuration/SettingsPropertyValueTest.cs -System.IO.Ports/SerialPortTest.cs -System.Security.Permissions/ResourcePermissionBaseCas.cs -System.Security.Permissions/ResourcePermissionBaseEntryCas.cs -System.Security.Permissions/ResourcePermissionBaseEntryTest.cs -System.Security.Permissions/ResourcePermissionBaseTest.cs -System.Security.Permissions/StorePermissionAttributeCas.cs -System.Security.Permissions/StorePermissionAttributeTest.cs -System.Security.Permissions/StorePermissionCas.cs -System.Security.Permissions/StorePermissionTest.cs -System.Web/AspNetHostingPermissionAttributeCas.cs -System.Web/AspNetHostingPermissionAttributeTest.cs -System.Web/AspNetHostingPermissionCas.cs -System.Web/AspNetHostingPermissionTest.cs diff --git a/mcs/class/System/aot_only_System.dll.sources b/mcs/class/System/aot_only_System.dll.sources deleted file mode 100644 index e9469d07a62..00000000000 --- a/mcs/class/System/aot_only_System.dll.sources +++ /dev/null @@ -1,2 +0,0 @@ -#include mobile_System.dll.sources -Mono.Util/MonoPInvokeCallbackAttribute.cs diff --git a/mcs/class/System/aot_only_System_test.dll.exclude.sources b/mcs/class/System/aot_only_System_test.dll.exclude.sources deleted file mode 100644 index 9a453e68f8c..00000000000 --- a/mcs/class/System/aot_only_System_test.dll.exclude.sources +++ /dev/null @@ -1,210 +0,0 @@ - -Microsoft.CSharp/CSharpCodeProviderCas.cs -Microsoft.CSharp/CSharpCodeProviderTest.cs -Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs -Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs -Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs -Microsoft.CSharp/CodeGeneratorFromStatementTest.cs -Microsoft.CSharp/CodeGeneratorFromTypeTest.cs -Microsoft.CSharp/CodeGeneratorIdentifierTest.cs -Microsoft.CSharp/CodeGeneratorTestBase.cs -Microsoft.CSharp/CodeGeneratorTypeOutputTest.cs -Microsoft.VisualBasic/CodeGeneratorFromBinaryOperatorTest.cs -Microsoft.VisualBasic/CodeGeneratorFromCompileUnitTest.cs -Microsoft.VisualBasic/CodeGeneratorFromExpressionTest.cs -Microsoft.VisualBasic/CodeGeneratorFromNamespaceTest.cs -Microsoft.VisualBasic/CodeGeneratorFromStatementTest.cs -Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs -Microsoft.VisualBasic/CodeGeneratorTestBase.cs -Microsoft.VisualBasic/VBCodeProviderCas.cs -Microsoft.VisualBasic/VBCodeProviderTest.cs -Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs -Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs -Microsoft.Win32/PowerModeChangedEventArgsCas.cs -Microsoft.Win32/SessionEndedEventArgsCas.cs -Microsoft.Win32/SessionEndingEventArgsCas.cs -Microsoft.Win32/SessionSwitchEventArgsCas.cs -Microsoft.Win32/SessionSwitchEventArgsTest.cs -Microsoft.Win32/SystemEventsCas.cs -Microsoft.Win32/TimerElapsedEventArgsCas.cs -Microsoft.Win32/UserPreferenceChangedEventArgsCas.cs -Microsoft.Win32/UserPreferenceChangingEventArgsCas.cs -System.CodeDom.Compiler/CodeCompilerCas.cs -System.CodeDom.Compiler/CodeDomProviderCas.cs -System.CodeDom.Compiler/CodeGeneratorCas.cs -System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs -System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs -System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs -System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs -System.CodeDom.Compiler/CodeGeneratorTest.cs -System.CodeDom.Compiler/CodeGeneratorTestBase.cs -System.CodeDom.Compiler/CodeParserCas.cs -System.CodeDom.Compiler/CompilerErrorCas.cs -System.CodeDom.Compiler/CompilerErrorCollectionCas.cs -System.CodeDom.Compiler/CompilerInfoCas.cs -System.CodeDom.Compiler/CompilerParametersCas.cs -System.CodeDom.Compiler/CompilerResultsCas.cs -System.CodeDom.Compiler/ExecutorCas.cs -System.CodeDom.Compiler/ExecutorTest.cs -System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs -System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs -System.CodeDom.Compiler/IndentedTextWriterCas.cs -System.CodeDom.Compiler/IndentedTextWriterTest.cs -System.CodeDom.Compiler/TempFileCollectionCas.cs -System.CodeDom.Compiler/TempFileCollectionTest.cs -System.CodeDom/CodeArgumentReferenceExpressionCas.cs -System.CodeDom/CodeArgumentReferenceExpressionTest.cs -System.CodeDom/CodeArrayCreateExpressionCas.cs -System.CodeDom/CodeArrayCreateExpressionTest.cs -System.CodeDom/CodeArrayIndexerExpressionCas.cs -System.CodeDom/CodeAssignStatementCas.cs -System.CodeDom/CodeAttachEventStatementCas.cs -System.CodeDom/CodeAttachEventStatementTest.cs -System.CodeDom/CodeAttributeArgumentCas.cs -System.CodeDom/CodeAttributeArgumentCollectionCas.cs -System.CodeDom/CodeAttributeArgumentCollectionTest.cs -System.CodeDom/CodeAttributeArgumentTest.cs -System.CodeDom/CodeAttributeDeclarationCas.cs -System.CodeDom/CodeAttributeDeclarationCollectionCas.cs -System.CodeDom/CodeAttributeDeclarationCollectionTest.cs -System.CodeDom/CodeAttributeDeclarationTest.cs -System.CodeDom/CodeBaseReferenceExpressionCas.cs -System.CodeDom/CodeBinaryOperatorExpressionCas.cs -System.CodeDom/CodeCastExpressionCas.cs -System.CodeDom/CodeCastExpressionTest.cs -System.CodeDom/CodeCatchClauseCas.cs -System.CodeDom/CodeCatchClauseCollectionCas.cs -System.CodeDom/CodeCatchClauseCollectionTest.cs -System.CodeDom/CodeCatchClauseTest.cs -System.CodeDom/CodeChecksumPragmaCas.cs -System.CodeDom/CodeChecksumPragmaTest.cs -System.CodeDom/CodeCommentStatementCas.cs -System.CodeDom/CodeCommentStatementCollectionCas.cs -System.CodeDom/CodeCommentStatementCollectionTest.cs -System.CodeDom/CodeCompileUnitCas.cs -System.CodeDom/CodeConditionStatementCas.cs -System.CodeDom/CodeConstructorCas.cs -System.CodeDom/CodeConstructorTest.cs -System.CodeDom/CodeDefaultValueExpressionCas.cs -System.CodeDom/CodeDefaultValueExpressionTest.cs -System.CodeDom/CodeDelegateCreateExpressionCas.cs -System.CodeDom/CodeDelegateCreateExpressionTest.cs -System.CodeDom/CodeDelegateInvokeExpressionCas.cs -System.CodeDom/CodeDirectionExpressionCas.cs -System.CodeDom/CodeDirectiveCas.cs -System.CodeDom/CodeDirectiveCollectionCas.cs -System.CodeDom/CodeDirectiveCollectionTest.cs -System.CodeDom/CodeEntryPointMethodCas.cs -System.CodeDom/CodeEventReferenceExpressionCas.cs -System.CodeDom/CodeEventReferenceExpressionTest.cs -System.CodeDom/CodeExpressionCas.cs -System.CodeDom/CodeExpressionCollectionCas.cs -System.CodeDom/CodeExpressionCollectionTest.cs -System.CodeDom/CodeExpressionStatementCas.cs -System.CodeDom/CodeFieldReferenceExpressionCas.cs -System.CodeDom/CodeGotoStatementCas.cs -System.CodeDom/CodeGotoStatementTest.cs -System.CodeDom/CodeIndexerExpressionCas.cs -System.CodeDom/CodeIterationStatementCas.cs -System.CodeDom/CodeLabeledStatementTest.cs -System.CodeDom/CodeLinePragmaCas.cs -System.CodeDom/CodeLinePragmaTest.cs -System.CodeDom/CodeMemberEventCas.cs -System.CodeDom/CodeMemberFieldCas.cs -System.CodeDom/CodeMemberFieldTest.cs -System.CodeDom/CodeMemberMethodCas.cs -System.CodeDom/CodeMemberMethodTest.cs -System.CodeDom/CodeMemberPropertyCas.cs -System.CodeDom/CodeMemberPropertyTest.cs -System.CodeDom/CodeMethodInvokeExpressionCas.cs -System.CodeDom/CodeMethodInvokeExpressionTest.cs -System.CodeDom/CodeMethodReferenceExpressionCas.cs -System.CodeDom/CodeMethodReferenceExpressionTest.cs -System.CodeDom/CodeMethodReturnStatementCas.cs -System.CodeDom/CodeNamespaceCas.cs -System.CodeDom/CodeNamespaceCollectionCas.cs -System.CodeDom/CodeNamespaceCollectionTest.cs -System.CodeDom/CodeNamespaceImportCas.cs -System.CodeDom/CodeNamespaceImportCollectionCas.cs -System.CodeDom/CodeNamespaceImportCollectionTest.cs -System.CodeDom/CodeNamespaceImportTest.cs -System.CodeDom/CodeNamespaceTest.cs -System.CodeDom/CodeObjectCas.cs -System.CodeDom/CodeObjectCreateExpressionCas.cs -System.CodeDom/CodeObjectCreateExpressionTest.cs -System.CodeDom/CodeParameterDeclarationExpressionCas.cs -System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs -System.CodeDom/CodeParameterDeclarationExpressionCollectionTest.cs -System.CodeDom/CodeParameterDeclarationExpressionTest.cs -System.CodeDom/CodePrimitiveExpressionCas.cs -System.CodeDom/CodePropertyReferenceExpressionCas.cs -System.CodeDom/CodePropertyReferenceExpressionTest.cs -System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs -System.CodeDom/CodeRegionDirectiveCas.cs -System.CodeDom/CodeRegionDirectiveTest.cs -System.CodeDom/CodeRemoveEventStatementCas.cs -System.CodeDom/CodeRemoveEventStatementTest.cs -System.CodeDom/CodeSnippetCompileUnitCas.cs -System.CodeDom/CodeSnippetCompileUnitTest.cs -System.CodeDom/CodeSnippetExpressionCas.cs -System.CodeDom/CodeSnippetExpressionTest.cs -System.CodeDom/CodeSnippetStatementCas.cs -System.CodeDom/CodeSnippetStatementTest.cs -System.CodeDom/CodeSnippetTypeMemberCas.cs -System.CodeDom/CodeSnippetTypeMemberTest.cs -System.CodeDom/CodeStatementCas.cs -System.CodeDom/CodeStatementCollectionCas.cs -System.CodeDom/CodeStatementCollectionTest.cs -System.CodeDom/CodeThisReferenceExpressionCas.cs -System.CodeDom/CodeThrowExceptionStatementCas.cs -System.CodeDom/CodeTryCatchFinallyStatementCas.cs -System.CodeDom/CodeTypeConstructorCas.cs -System.CodeDom/CodeTypeConstructorTest.cs -System.CodeDom/CodeTypeDeclarationCas.cs -System.CodeDom/CodeTypeDeclarationCollectionCas.cs -System.CodeDom/CodeTypeDeclarationCollectionTest.cs -System.CodeDom/CodeTypeDelegateCas.cs -System.CodeDom/CodeTypeDelegateTest.cs -System.CodeDom/CodeTypeMemberCas.cs -System.CodeDom/CodeTypeMemberCollectionCas.cs -System.CodeDom/CodeTypeMemberCollectionTest.cs -System.CodeDom/CodeTypeOfExpressionCas.cs -System.CodeDom/CodeTypeOfExpressionTest.cs -System.CodeDom/CodeTypeParameterCas.cs -System.CodeDom/CodeTypeParameterCollectionTest.cs -System.CodeDom/CodeTypeParameterTest.cs -System.CodeDom/CodeTypeReferenceCas.cs -System.CodeDom/CodeTypeReferenceCollectionCas.cs -System.CodeDom/CodeTypeReferenceCollectionTest.cs -System.CodeDom/CodeTypeReferenceExpressionCas.cs -System.CodeDom/CodeTypeReferenceExpressionTest.cs -System.CodeDom/CodeTypeReferenceTest.cs -System.CodeDom/CodeVariableDeclarationStatementCas.cs -System.CodeDom/CodeVariableDeclarationStatementTest.cs -System.CodeDom/CodeVariableReferenceExpressionCas.cs -System.CodeDom/CodeVariableReferenceExpressionTest.cs -System.Configuration.Provider -System.Configuration.Provider/ProviderBaseTest.cs -System.Configuration/ApplicationSettingsBaseTest.cs -System.Configuration/ConfigXmlDocumentTest.cs -System.Configuration/ConfigurationExceptionTest.cs -System.Configuration/LocalFileSettingsProviderTest.cs -System.Configuration/SettingElementTest.cs -System.Configuration/SettingsBaseTest.cs -System.Configuration/SettingsPropertyCollectionTest.cs -System.Configuration/SettingsPropertyTest.cs -System.Configuration/SettingsPropertyValueCollectionTest.cs -System.Configuration/SettingsPropertyValueTest.cs -System.IO.Ports/SerialPortTest.cs -System.Security.Permissions/ResourcePermissionBaseCas.cs -System.Security.Permissions/ResourcePermissionBaseEntryCas.cs -System.Security.Permissions/ResourcePermissionBaseEntryTest.cs -System.Security.Permissions/ResourcePermissionBaseTest.cs -System.Security.Permissions/StorePermissionAttributeCas.cs -System.Security.Permissions/StorePermissionAttributeTest.cs -System.Security.Permissions/StorePermissionCas.cs -System.Security.Permissions/StorePermissionTest.cs -System.Web/AspNetHostingPermissionAttributeCas.cs -System.Web/AspNetHostingPermissionAttributeTest.cs -System.Web/AspNetHostingPermissionCas.cs -System.Web/AspNetHostingPermissionTest.cs diff --git a/mcs/class/System/aot_only_System_test.dll.sources b/mcs/class/System/aot_only_System_test.dll.sources deleted file mode 100644 index 3944a95be6a..00000000000 --- a/mcs/class/System/aot_only_System_test.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include System_test.dll.sources diff --git a/mcs/class/System/basic_System.dll.sources b/mcs/class/System/basic_System.dll.sources new file mode 100644 index 00000000000..ee2d1a0d962 --- /dev/null +++ b/mcs/class/System/basic_System.dll.sources @@ -0,0 +1,2 @@ +#include net_4_x_System.dll.sources + diff --git a/mcs/class/System/build_System.dll.sources b/mcs/class/System/build_System.dll.sources new file mode 100644 index 00000000000..ee2d1a0d962 --- /dev/null +++ b/mcs/class/System/build_System.dll.sources @@ -0,0 +1,2 @@ +#include net_4_x_System.dll.sources + diff --git a/mcs/class/System/common.sources b/mcs/class/System/common.sources new file mode 100644 index 00000000000..a6bef85dedd --- /dev/null +++ b/mcs/class/System/common.sources @@ -0,0 +1,928 @@ +Assembly/AssemblyInfo.cs +../../build/common/SR.cs + +Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs + +System/IOSelector.cs +System/Platform.cs +System/SRDescriptionAttribute.cs +System/UriTypeConverter.cs + +System.Diagnostics/DataReceivedEventArgs.cs +System.Diagnostics/DataReceivedEventHandler.cs +System.Diagnostics/DefaultTraceListener.cs +System.Diagnostics/FileVersionInfo.cs +System.Diagnostics/MonitoringDescriptionAttribute.cs +System.Diagnostics/Process.cs +System.Diagnostics/ProcessModule.cs +System.Diagnostics/ProcessPriorityClass.cs +System.Diagnostics/ProcessStartInfo.cs +System.Diagnostics/ProcessThread.cs +System.Diagnostics/ProcessWindowStyle.cs +System.Diagnostics/Stopwatch.cs +System.Diagnostics/ThreadPriorityLevel.cs +System.Diagnostics/ThreadState.cs +System.Diagnostics/ThreadWaitReason.cs +System.Diagnostics/TraceImpl.cs + +System.IO.Compression/CompressionLevel.cs +System.IO.Compression/CompressionMode.cs +System.IO.Compression/DeflateStream.cs +System.IO.Compression/GZipStream.cs + +System.IO/ErrorEventArgs.cs +System.IO/ErrorEventHandler.cs +System.IO/FileSystemEventArgs.cs +System.IO/FileSystemEventHandler.cs +System.IO/InternalBufferOverflowException.cs +System.IO/InvalidDataException.cs +System.IO/IODescriptionAttribute.cs +System.IO/NotifyFilters.cs +System.IO/RenamedEventArgs.cs +System.IO/RenamedEventHandler.cs +System.IO/WaitForChangedResult.cs +System.IO/WatcherChangeTypes.cs + +System.Net/AuthenticationManager.cs +System.Net/BasicClient.cs +System.Net/BindIPEndPoint.cs +System.Net/ChunkedInputStream.cs +System.Net/ChunkStream.cs +System.Net/DecompressionMethods.cs +System.Net/DefaultCertificatePolicy.cs +System.Net/DigestClient.cs +System.Net/Dns.cs +System.Net/EndPointListener.cs +System.Net/EndPointManager.cs +System.Net/EndpointPermission.cs +System.Net/FtpAsyncResult.cs +System.Net/FtpDataStream.cs +System.Net/FtpRequestCreator.cs +System.Net/FtpStatus.cs +System.Net/FtpWebRequest.cs +System.Net/FtpWebResponse.cs +System.Net/HttpConnection.cs +System.Net/HttpListener.cs +System.Net/HttpListenerBasicIdentity.cs +System.Net/HttpListenerContext.cs +System.Net/HttpListenerPrefixCollection.cs +System.Net/HttpListenerRequest.cs +System.Net/HttpListenerResponse.cs +System.Net/HttpListenerResponseHelper.cs +System.Net/HttpListenerTimeoutManager.cs +System.Net/HttpRequestCreator.cs +System.Net/HttpStreamAsyncResult.cs +System.Net/HttpWebRequest.cs +System.Net/HttpWebResponse.cs +System.Net/ICredentialPolicy.cs +System.Net/IPv6Address.cs +System.Net/IWebConnectionState.cs +System.Net/IWebProxyScript.cs +System.Net/ListenerAsyncResult.cs +System.Net/ListenerPrefix.cs +System.Net/MacProxy.cs +System.Net/MonoHttpDate.cs +System.Net/NetConfig.cs +System.Net/NtlmClient.cs +System.Net/RequestStream.cs +System.Net/ResponseStream.cs +System.Net/ServicePoint.cs +System.Net/ServicePointManager.cs +System.Net/ServicePointManager.extra.cs +System.Net/SimpleAsyncResult.cs +System.Net/SocketPermissionAttribute.cs +System.Net/SocketPermission.cs +System.Net/WebAsyncResult.cs +System.Net/WebConnection.cs +System.Net/WebConnectionData.cs +System.Net/WebConnectionGroup.cs +System.Net/WebConnectionStream.cs + +System.Net.Mail/AlternateView.cs +System.Net.Mail/AlternateViewCollection.cs +System.Net.Mail/Attachment.cs +System.Net.Mail/AttachmentBase.cs +System.Net.Mail/AttachmentCollection.cs +System.Net.Mail/DeliveryNotificationOptions.cs +System.Net.Mail/LinkedResource.cs +System.Net.Mail/LinkedResourceCollection.cs +System.Net.Mail/MailAddress.cs +System.Net.Mail/MailAddressCollection.cs +System.Net.Mail/MailMessage.cs +System.Net.Mail/MailPriority.cs +System.Net.Mail/SendCompletedEventHandler.cs +System.Net.Mail/SmtpAccess.cs +System.Net.Mail/SmtpClient.cs +System.Net.Mail/SmtpDeliveryFormat.cs +System.Net.Mail/SmtpDeliveryMethod.cs +System.Net.Mail/SmtpException.cs +System.Net.Mail/SmtpFailedRecipientException.cs +System.Net.Mail/SmtpFailedRecipientsException.cs +System.Net.Mail/SmtpStatusCode.cs + +System.Net.NetworkInformation/IcmpV4Statistics.cs +System.Net.NetworkInformation/IcmpV6Statistics.cs +System.Net.NetworkInformation/IPAddressCollection.cs +System.Net.NetworkInformation/IPGlobalProperties.cs +System.Net.NetworkInformation/IPGlobalStatistics.cs +System.Net.NetworkInformation/IPInterfaceProperties.cs +System.Net.NetworkInformation/IPv4InterfaceProperties.cs +System.Net.NetworkInformation/IPv4InterfaceStatistics.cs +System.Net.NetworkInformation/IPv6InterfaceProperties.cs +System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs +System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs +System.Net.NetworkInformation/NetworkChange.cs +System.Net.NetworkInformation/NetworkInterface.cs +System.Net.NetworkInformation/Ping.cs +System.Net.NetworkInformation/PingCompletedEventArgs.cs +System.Net.NetworkInformation/PingCompletedEventHandler.cs +System.Net.NetworkInformation/TcpStatistics.cs +System.Net.NetworkInformation/UdpStatistics.cs +System.Net.NetworkInformation/UnicastIPAddressInformation.cs +System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs +System.Net.Security/EncryptionPolicy.cs +System.Net.Security/LocalCertificateSelectionCallback.cs +System.Net.Security/NegotiateStream.cs +System.Net.Security/RemoteCertificateValidationCallback.cs +System.Net.Security/SslPolicyErrors.cs +System.Net.Security/SslStream.cs + +System.Net.Sockets/SafeSocketHandle.cs +System.Net.Sockets/Socket.cs +System.Net.Sockets/SocketAsyncEventArgs.cs +System.Net.Sockets/SocketAsyncResult.cs +System.Net.Sockets/SocketOperation.cs +System.Net.Sockets/SocketReceiveFromResult.cs +System.Net.Sockets/SocketReceiveMessageFromResult.cs +System.Net.Sockets/SocketTaskExtensions.cs + +System.Net.WebSockets/ClientWebSocket.cs +System.Net.WebSockets/ClientWebSocketOptions.cs +System.Net.WebSockets/HttpListenerWebSocketContext.cs +System.Net.WebSockets/WebSocket.cs +System.Net.WebSockets/WebSocketCloseStatus.cs +System.Net.WebSockets/WebSocketContext.cs +System.Net.WebSockets/WebSocketError.cs +System.Net.WebSockets/WebSocketException.cs +System.Net.WebSockets/WebSocketMessageType.cs +System.Net.WebSockets/WebSocketReceiveResult.cs +System.Net.WebSockets/WebSocketState.cs + +System.Runtime.InteropServices.ComTypes/ADVF.cs +System.Runtime.InteropServices.ComTypes/DATADIR.cs +System.Runtime.InteropServices.ComTypes/DVASPECT.cs +System.Runtime.InteropServices.ComTypes/FORMATETC.cs +System.Runtime.InteropServices.ComTypes/IAdviseSink.cs +System.Runtime.InteropServices.ComTypes/IDataObject.cs +System.Runtime.InteropServices.ComTypes/IEnumFORMATETC.cs +System.Runtime.InteropServices.ComTypes/IEnumSTATDATA.cs +System.Runtime.InteropServices.ComTypes/STATDATA.cs +System.Runtime.InteropServices.ComTypes/STGMEDIUM.cs +System.Runtime.InteropServices.ComTypes/TYMED.cs + +System.Security.AccessControl/SemaphoreAccessRule.cs +System.Security.AccessControl/SemaphoreAuditRule.cs +System.Security.AccessControl/SemaphoreRights.cs +System.Security.AccessControl/SemaphoreSecurity.cs +System.Security.Authentication/AuthenticationException.cs +System.Security.Authentication/CipherAlgorithmType.cs +System.Security.Authentication/ExchangeAlgorithmType.cs +System.Security.Authentication/HashAlgorithmType.cs +System.Security.Authentication/SslProtocols.cs +System.Security.Authentication/InvalidCredentialException.cs +System.Security.Authentication.ExtendedProtection/ChannelBinding.cs +System.Security.Authentication.ExtendedProtection/ChannelBindingKind.cs +System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicy.cs +System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs +System.Security.Authentication.ExtendedProtection/PolicyEnforcement.cs +System.Security.Authentication.ExtendedProtection/ProtectionScenario.cs +System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs +System.Security.Authentication.ExtendedProtection.Configuration/ExtendedProtectionPolicyElement.cs +System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElement.cs +System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElementCollection.cs + +System.Security.Cryptography/AsnEncodedData.cs +System.Security.Cryptography/AsnEncodedDataCollection.cs +System.Security.Cryptography/AsnEncodedDataEnumerator.cs + +System.Security.Cryptography.X509Certificates/OpenFlags.cs +System.Security.Cryptography.X509Certificates/OSX509Certificates.cs +System.Security.Cryptography.X509Certificates/PublicKey.cs +System.Security.Cryptography.X509Certificates/StoreLocation.cs +System.Security.Cryptography.X509Certificates/StoreName.cs +System.Security.Cryptography.X509Certificates/X500DistinguishedName.cs +System.Security.Cryptography.X509Certificates/X500DistinguishedNameFlags.cs +System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs +System.Security.Cryptography.X509Certificates/X509Certificate2.cs +System.Security.Cryptography.X509Certificates/X509Certificate2Collection.cs +System.Security.Cryptography.X509Certificates/X509Certificate2Enumerator.cs +System.Security.Cryptography.X509Certificates/X509Certificate2Impl.cs +System.Security.Cryptography.X509Certificates/X509Certificate2ImplMono.cs +System.Security.Cryptography.X509Certificates/X509CertificateCollection.cs +System.Security.Cryptography.X509Certificates/X509CertificateImplCollection.cs +System.Security.Cryptography.X509Certificates/X509Chain.cs +System.Security.Cryptography.X509Certificates/X509ChainElement.cs +System.Security.Cryptography.X509Certificates/X509ChainElementCollection.cs +System.Security.Cryptography.X509Certificates/X509ChainElementEnumerator.cs +System.Security.Cryptography.X509Certificates/X509ChainImpl.cs +System.Security.Cryptography.X509Certificates/X509ChainImplMono.cs +System.Security.Cryptography.X509Certificates/X509ChainPolicy.cs +System.Security.Cryptography.X509Certificates/X509ChainStatus.cs +System.Security.Cryptography.X509Certificates/X509ChainStatusFlags.cs +System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs +System.Security.Cryptography.X509Certificates/X509Extension.cs +System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs +System.Security.Cryptography.X509Certificates/X509ExtensionEnumerator.cs +System.Security.Cryptography.X509Certificates/X509FindType.cs +System.Security.Cryptography.X509Certificates/X509IncludeOption.cs +System.Security.Cryptography.X509Certificates/X509Helper2.cs +System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs +System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs +System.Security.Cryptography.X509Certificates/X509NameType.cs +System.Security.Cryptography.X509Certificates/X509RevocationFlag.cs +System.Security.Cryptography.X509Certificates/X509RevocationMode.cs +System.Security.Cryptography.X509Certificates/X509Store.cs +System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs +System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierHashAlgorithm.cs +System.Security.Cryptography.X509Certificates/X509VerificationFlags.cs + +System.Threading/ThreadExceptionEventArgs.cs +System.Threading/ThreadExceptionEventHandler.cs + +System.Timers/ElapsedEventArgs.cs + +System.Windows.Input/ICommand.cs + +Mono.Btls/MonoBtlsBio.cs +Mono.Btls/MonoBtlsContext.cs +Mono.Btls/MonoBtlsError.cs +Mono.Btls/MonoBtlsException.cs +Mono.Btls/MonoBtlsKey.cs +Mono.Btls/MonoBtlsObject.cs +Mono.Btls/MonoBtlsPkcs12.cs +Mono.Btls/MonoBtlsProvider.cs +Mono.Btls/MonoBtlsSsl.cs +Mono.Btls/MonoBtlsSslCtx.cs +Mono.Btls/MonoBtlsSslError.cs +Mono.Btls/MonoBtlsStream.cs +Mono.Btls/MonoBtlsUtils.cs +Mono.Btls/MonoBtlsX509.cs +Mono.Btls/MonoBtlsX509Chain.cs +Mono.Btls/MonoBtlsX509Crl.cs +Mono.Btls/MonoBtlsX509Error.cs +Mono.Btls/MonoBtlsX509Exception.cs +Mono.Btls/MonoBtlsX509FileType.cs +Mono.Btls/MonoBtlsX509Format.cs +Mono.Btls/MonoBtlsX509Lookup.cs +Mono.Btls/MonoBtlsX509LookupMonoCollection.cs +Mono.Btls/MonoBtlsX509LookupMono.cs +Mono.Btls/MonoBtlsX509LookupType.cs +Mono.Btls/MonoBtlsX509Name.cs +Mono.Btls/MonoBtlsX509NameEntryType.cs +Mono.Btls/MonoBtlsX509Purpose.cs +Mono.Btls/MonoBtlsX509Revoked.cs +Mono.Btls/MonoBtlsX509Store.cs +Mono.Btls/MonoBtlsX509StoreCtx.cs +Mono.Btls/MonoBtlsX509StoreManager.cs +Mono.Btls/MonoBtlsX509StoreType.cs +Mono.Btls/MonoBtlsX509TrustKind.cs +Mono.Btls/MonoBtlsX509VerifyFlags.cs +Mono.Btls/MonoBtlsX509VerifyParam.cs +Mono.Btls/X509CertificateImplBtls.cs +Mono.Btls/X509ChainImplBtls.cs + +Mono.Http/NtlmClient.cs + +Mono.Net.Security/AsyncProtocolRequest.cs +Mono.Net.Security/CallbackHelpers.cs +Mono.Net.Security/ChainValidationHelper.cs +Mono.Net.Security/IMonoTlsProvider.cs +Mono.Net.Security/IMonoSslStream.cs +Mono.Net.Security/LegacySslStream.cs +Mono.Net.Security/MobileAuthenticatedStream.cs +Mono.Net.Security/MobileTlsContext.cs +Mono.Net.Security/LegacyTlsProvider.cs +Mono.Net.Security/MonoSslStreamImpl.cs +Mono.Net.Security/MonoSslStreamWrapper.cs +Mono.Net.Security/MonoTlsProviderFactory.cs +Mono.Net.Security/MonoTlsProviderWrapper.cs +Mono.Net.Security/MonoTlsStream.cs +Mono.Net.Security/NoReflectionHelper.cs +Mono.Net.Security/SystemCertificateValidator.cs + +Mono.Util/MonoPInvokeCallbackAttribute.cs + +ReferenceSources/AutoWebProxyScriptEngine.cs +ReferenceSources/AssertWrapper.cs +ReferenceSources/CAPI.cs +ReferenceSources/EnvironmentHelpers.cs +ReferenceSources/HttpApi.cs +ReferenceSources/LocalAppContextSwitches.cs +ReferenceSources/HttpSysSettings.cs +ReferenceSources/Logging.cs +ReferenceSources/NativeMethods.cs +ReferenceSources/RequestCacheProtocol.cs +ReferenceSources/SettingsSectionInternal.cs +ReferenceSources/SecureStringHelper.cs +ReferenceSources/Socket.cs +ReferenceSources/SR.cs +ReferenceSources/SRCategoryAttribute.cs +ReferenceSources/Win32Exception.cs + +../referencesource/System/regex/system/text/regularexpressions/Regex.cs +../referencesource/System/regex/system/text/regularexpressions/RegexBoyerMoore.cs +../referencesource/System/regex/system/text/regularexpressions/RegexCapture.cs +../referencesource/System/regex/system/text/regularexpressions/RegexCaptureCollection.cs +../referencesource/System/regex/system/text/regularexpressions/RegexCharClass.cs +../referencesource/System/regex/system/text/regularexpressions/RegexCode.cs +../referencesource/System/regex/system/text/regularexpressions/RegexCompilationInfo.cs +../referencesource/System/regex/system/text/regularexpressions/RegexCompiler.cs +../referencesource/System/regex/system/text/regularexpressions/RegexFCD.cs +../referencesource/System/regex/system/text/regularexpressions/RegexGroup.cs +../referencesource/System/regex/system/text/regularexpressions/RegexGroupCollection.cs +../referencesource/System/regex/system/text/regularexpressions/RegexInterpreter.cs +../referencesource/System/regex/system/text/regularexpressions/RegexMatch.cs +../referencesource/System/regex/system/text/regularexpressions/RegexMatchCollection.cs +../referencesource/System/regex/system/text/regularexpressions/RegexMatchTimeoutException.cs +../referencesource/System/regex/system/text/regularexpressions/RegexNode.cs +../referencesource/System/regex/system/text/regularexpressions/RegexOptions.cs +../referencesource/System/regex/system/text/regularexpressions/RegexParser.cs +../referencesource/System/regex/system/text/regularexpressions/RegexReplacement.cs +../referencesource/System/regex/system/text/regularexpressions/RegexRunner.cs +../referencesource/System/regex/system/text/regularexpressions/RegexRunnerFactory.cs +../referencesource/System/regex/system/text/regularexpressions/RegexTree.cs +../referencesource/System/regex/system/text/regularexpressions/RegexWriter.cs +../referencesource/System/regex/system/text/regularexpressions/compiledregexrunner.cs +../referencesource/System/regex/system/text/regularexpressions/compiledregexrunnerfactory.cs + +../referencesource/System/sys/system/collections/concurrent/BlockingCollection.cs +../referencesource/System/sys/system/collections/concurrent/ConcurrentBag.cs + +../referencesource/System/compmod/system/collections/generic/bithelper.cs +../referencesource/System/compmod/system/collections/generic/debugview.cs +../referencesource/System/compmod/system/collections/generic/iset.cs +../referencesource/System/compmod/system/collections/generic/linkedlist.cs +../referencesource/System/compmod/system/collections/generic/queue.cs +../referencesource/System/compmod/system/collections/generic/sorteddictionary.cs +../referencesource/System/compmod/system/collections/generic/sortedlist.cs +../referencesource/System/compmod/system/collections/generic/sortedset.cs +../referencesource/System/compmod/system/collections/generic/sortedsetdebugview.cs +../referencesource/System/compmod/system/collections/generic/stack.cs +../referencesource/System/compmod/system/collections/generic/throwhelper.cs + +../referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs +../referencesource/System/compmod/system/collections/objectmodel/readonlyobservablecollection.cs + +../referencesource/System/compmod/system/collections/specialized/bitvector32.cs +../referencesource/System/compmod/system/collections/specialized/casesensitivestringdictionary.cs +../referencesource/System/compmod/system/collections/specialized/collectionsutil.cs +../referencesource/System/compmod/system/collections/specialized/fixedstringlookup.cs +../referencesource/System/compmod/system/collections/specialized/hybriddictionary.cs +../referencesource/System/compmod/system/collections/specialized/inotifycollectionchanged.cs +../referencesource/System/compmod/system/collections/specialized/iordereddictionary.cs +../referencesource/System/compmod/system/collections/specialized/listdictionary.cs +../referencesource/System/compmod/system/collections/specialized/nameobjectcollectionbase.cs +../referencesource/System/compmod/system/collections/specialized/namevaluecollection.cs +../referencesource/System/compmod/system/collections/specialized/notifycollectionchangedeventargs.cs +../referencesource/System/compmod/system/collections/specialized/ordereddictionary.cs +../referencesource/System/compmod/system/collections/specialized/stringcollection.cs +../referencesource/System/compmod/system/collections/specialized/stringdictionary.cs +../referencesource/System/compmod/system/collections/specialized/stringdictionarywithcomparer.cs + +../referencesource/System/compmod/system/componentmodel/AddingNewEventArgs.cs +../referencesource/System/compmod/system/componentmodel/AddingNewEventHandler.cs +../referencesource/System/compmod/system/componentmodel/AmbientValueAttribute.cs +../referencesource/System/compmod/system/componentmodel/ArrayConverter.cs +../referencesource/System/compmod/system/componentmodel/ArraySubsetEnumerator.cs +../referencesource/System/compmod/system/componentmodel/AsyncCompletedEventArgs.cs +../referencesource/System/compmod/system/componentmodel/AsyncCompletedEventHandler.cs +../referencesource/System/compmod/system/componentmodel/AsyncOperation.cs +../referencesource/System/compmod/system/componentmodel/AsyncOperationManager.cs +../referencesource/System/compmod/system/componentmodel/AttributeCollection.cs +../referencesource/System/compmod/system/componentmodel/AttributeProviderAttribute.cs +../referencesource/System/compmod/system/componentmodel/BackgroundWorker.cs +../referencesource/System/compmod/system/componentmodel/BaseComponentEditor.cs +../referencesource/System/compmod/system/componentmodel/basenumberconverter.cs +../referencesource/System/compmod/system/componentmodel/BindableAttribute.cs +../referencesource/System/compmod/system/componentmodel/BindableSupport.cs +../referencesource/System/compmod/system/componentmodel/BindingDirection.cs +../referencesource/System/compmod/system/componentmodel/BindingList.cs +../referencesource/System/compmod/system/componentmodel/BooleanConverter.cs +../referencesource/System/compmod/system/componentmodel/BrowsableAttribute.cs +../referencesource/System/compmod/system/componentmodel/ByteConverter.cs +../referencesource/System/compmod/system/componentmodel/CancelEventArgs.cs +../referencesource/System/compmod/system/componentmodel/CancelEventHandler.cs +../referencesource/System/compmod/system/componentmodel/CategoryAttribute.cs +../referencesource/System/compmod/system/componentmodel/CharConverter.cs +../referencesource/System/compmod/system/componentmodel/CollectionChangeAction.cs +../referencesource/System/compmod/system/componentmodel/CollectionChangeEventArgs.cs +../referencesource/System/compmod/system/componentmodel/CollectionChangeEventHandler.cs +../referencesource/System/compmod/system/componentmodel/CollectionConverter.cs +../referencesource/System/compmod/system/componentmodel/ComplexBindingPropertiesAttribute.cs +../referencesource/System/compmod/system/componentmodel/CompModSwitches.cs +../referencesource/System/compmod/system/componentmodel/Component.cs +../referencesource/System/compmod/system/componentmodel/ComponentCollection.cs +../referencesource/System/compmod/system/componentmodel/ComponentConverter.cs +../referencesource/System/compmod/system/componentmodel/ComponentResourceManager.cs +../referencesource/System/compmod/system/componentmodel/Container.cs +../referencesource/System/compmod/system/componentmodel/ContainerFilterService.cs +../referencesource/System/compmod/system/componentmodel/CultureInfoConverter.cs +../referencesource/System/compmod/system/componentmodel/CustomTypeDescriptor.cs +../referencesource/System/compmod/system/componentmodel/DataErrorsChangedEventArgs.cs +../referencesource/System/compmod/system/componentmodel/DataObjectAttribute.cs +../referencesource/System/compmod/system/componentmodel/DataObjectFieldAttribute.cs +../referencesource/System/compmod/system/componentmodel/DataObjectMethodAttribute.cs +../referencesource/System/compmod/system/componentmodel/DataObjectMethodType.cs +../referencesource/System/compmod/system/componentmodel/DateTimeConverter.cs +../referencesource/System/compmod/system/componentmodel/DateTimeOffsetConverter.cs +../referencesource/System/compmod/system/componentmodel/DebugExtendedPropertyDescriptor.cs +../referencesource/System/compmod/system/componentmodel/DebugReflectEventDescriptor.cs +../referencesource/System/compmod/system/componentmodel/DebugReflectPropertyDescriptor.cs +../referencesource/System/compmod/system/componentmodel/DebugTypeDescriptor.cs +../referencesource/System/compmod/system/componentmodel/DecimalConverter.cs +../referencesource/System/compmod/system/componentmodel/DefaultBindingPropertyAttribute.cs +../referencesource/System/compmod/system/componentmodel/DefaultEventAttribute.cs +../referencesource/System/compmod/system/componentmodel/DefaultPropertyAttribute.cs +../referencesource/System/compmod/system/componentmodel/DefaultValueAttribute.cs +../referencesource/System/compmod/system/componentmodel/DelegatingTypeDescriptionProvider.cs +../referencesource/System/compmod/system/componentmodel/DescriptionAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/ActiveDocumentEvent.cs +../referencesource/System/compmod/system/componentmodel/design/ActiveDocumentEventHandler.cs +../referencesource/System/compmod/system/componentmodel/design/CheckoutException.cs +../referencesource/System/compmod/system/componentmodel/design/CommandID.cs +../referencesource/System/compmod/system/componentmodel/design/ComponentChangedEvent.cs +../referencesource/System/compmod/system/componentmodel/design/ComponentChangedEventHandler.cs +../referencesource/System/compmod/system/componentmodel/design/ComponentChangingEvent.cs +../referencesource/System/compmod/system/componentmodel/design/ComponentChangingEventHandler.cs +../referencesource/System/compmod/system/componentmodel/design/ComponentEvent.cs +../referencesource/System/compmod/system/componentmodel/design/ComponentEventHandler.cs +../referencesource/System/compmod/system/componentmodel/design/ComponentRenameEvent.cs +../referencesource/System/compmod/system/componentmodel/design/ComponentRenameEventHandler.cs +../referencesource/System/compmod/system/componentmodel/design/DesignerOptionService.cs +../referencesource/System/compmod/system/componentmodel/design/DesignerTransaction.cs +../referencesource/System/compmod/system/componentmodel/design/DesignerTransactionCloseEvent.cs +../referencesource/System/compmod/system/componentmodel/design/DesignerTransactionCloseEventHandler.cs +../referencesource/System/compmod/system/componentmodel/design/DesignerVerb.cs +../referencesource/System/compmod/system/componentmodel/design/DesignerVerbCollection.cs +../referencesource/System/compmod/system/componentmodel/design/DesigntimeLicenseContext.cs +../referencesource/System/compmod/system/componentmodel/design/DesigntimeLicenseContextSerializer.cs +../referencesource/System/compmod/system/componentmodel/design/DocumentCollection.cs +../referencesource/System/compmod/system/componentmodel/design/DocumentEventArgs.cs +../referencesource/System/compmod/system/componentmodel/design/DocumentEventHandler.cs +../referencesource/System/compmod/system/componentmodel/design/HelpContextType.cs +../referencesource/System/compmod/system/componentmodel/design/HelpKeywordAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/HelpKeywordType.cs +../referencesource/System/compmod/system/componentmodel/design/IComponentChangeService.cs +../referencesource/System/compmod/system/componentmodel/design/IComponentDiscoveryService.cs +../referencesource/System/compmod/system/componentmodel/design/IComponentInitializer.cs +../referencesource/System/compmod/system/componentmodel/design/IDesigner.cs +../referencesource/System/compmod/system/componentmodel/design/IDesignerEventService.cs +../referencesource/System/compmod/system/componentmodel/design/IDesignerFilter.cs +../referencesource/System/compmod/system/componentmodel/design/IDesignerHost.cs +../referencesource/System/compmod/system/componentmodel/design/IDesignerHostTransactionState.cs +../referencesource/System/compmod/system/componentmodel/design/IDesignerOptionService.cs +../referencesource/System/compmod/system/componentmodel/design/IDictionaryService.cs +../referencesource/System/compmod/system/componentmodel/design/IEventPropertyService.cs +../referencesource/System/compmod/system/componentmodel/design/IExtenderListService.cs +../referencesource/System/compmod/system/componentmodel/design/IExtenderProviderService.cs +../referencesource/System/compmod/system/componentmodel/design/IHelpService.cs +../referencesource/System/compmod/system/componentmodel/design/IInheritanceService.cs +../referencesource/System/compmod/system/componentmodel/design/IMenuCommandService.cs +../referencesource/System/compmod/system/componentmodel/design/InheritanceAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/InheritanceLevel.cs +../referencesource/System/compmod/system/componentmodel/design/IReferenceService.cs +../referencesource/System/compmod/system/componentmodel/design/IResourceService.cs +../referencesource/System/compmod/system/componentmodel/design/IRootDesigner.cs +../referencesource/System/compmod/system/componentmodel/design/ISelectionService.cs +../referencesource/System/compmod/system/componentmodel/design/IServiceObjectContainer.cs +../referencesource/System/compmod/system/componentmodel/design/ITreeDesigner.cs +../referencesource/System/compmod/system/componentmodel/design/ITypeDescriptorFilterService.cs +../referencesource/System/compmod/system/componentmodel/design/ITypeDiscoveryService.cs +../referencesource/System/compmod/system/componentmodel/design/ITypeResolutionService.cs +../referencesource/System/compmod/system/componentmodel/design/MenuCommand.cs +../referencesource/System/compmod/system/componentmodel/design/NotifyParentPropertyAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/ParenthesizePropertyNameAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/PropertyTabAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/PropertyTabScope.cs +../referencesource/System/compmod/system/componentmodel/design/RefreshProperties.cs +../referencesource/System/compmod/system/componentmodel/design/RefreshPropertiesAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/SelectionTypes.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/ComponentSerializationService.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/ContextStack.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/DefaultSerializationProviderAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/DesignerLoader.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/DesignerSerializerAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerLoaderHost.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerLoaderService.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerSerializationManager.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerSerializationProvider.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerSerializationService.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/INameCreationService.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/InstanceDescriptor.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/MemberRelationshipService.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/ResolveNameEventArgs.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/ResolveNameEventHandler.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/RootDesignerSerializerAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/serialization/SerializationStore.cs +../referencesource/System/compmod/system/componentmodel/design/ServiceCreatorCallback.cs +../referencesource/System/compmod/system/componentmodel/design/ServiceObjectContainer.cs +../referencesource/System/compmod/system/componentmodel/design/StandardCommands.cs +../referencesource/System/compmod/system/componentmodel/design/StandardToolWindows.cs +../referencesource/System/compmod/system/componentmodel/design/ToolboxItemAttribute.cs +../referencesource/System/compmod/system/componentmodel/design/ViewTechnology.cs +../referencesource/System/compmod/system/componentmodel/DesignerAttribute.cs +../referencesource/System/compmod/system/componentmodel/DesignerCategoryAttribute.cs +../referencesource/System/compmod/system/componentmodel/DesignerSerializationVisibility.cs +../referencesource/System/compmod/system/componentmodel/DesignerSerializationVisibilityAttribute.cs +../referencesource/System/compmod/system/componentmodel/DesignOnlyAttribute.cs +../referencesource/System/compmod/system/componentmodel/DesignTimeVisibleAttribute.cs +../referencesource/System/compmod/system/componentmodel/DisplayNameAttribute.cs +../referencesource/System/compmod/system/componentmodel/DoubleConverter.cs +../referencesource/System/compmod/system/componentmodel/DoWorkEventArgs.cs +../referencesource/System/compmod/system/componentmodel/DoWorkEventHandler.cs +../referencesource/System/compmod/system/componentmodel/EditorAttribute.cs +../referencesource/System/compmod/system/componentmodel/EditorBrowsableAttribute.cs +../referencesource/System/compmod/system/componentmodel/EnumConverter.cs +../referencesource/System/compmod/system/componentmodel/EventDescriptor.cs +../referencesource/System/compmod/system/componentmodel/EventDescriptorCollection.cs +../referencesource/System/compmod/system/componentmodel/EventHandlerList.cs +../referencesource/System/compmod/system/componentmodel/ExpandableObjectConverter.cs +../referencesource/System/compmod/system/componentmodel/ExtendedPropertyDescriptor.cs +../referencesource/System/compmod/system/componentmodel/ExtenderProvidedPropertyAttribute.cs +../referencesource/System/compmod/system/componentmodel/FxCopSuppression.cs +../referencesource/System/compmod/system/componentmodel/GuidConverter.cs +../referencesource/System/compmod/system/componentmodel/HandledEventArgs.cs +../referencesource/System/compmod/system/componentmodel/HandledEventHandler.cs +../referencesource/System/compmod/system/componentmodel/IBindingList.cs +../referencesource/System/compmod/system/componentmodel/IBindingListView.cs +../referencesource/System/compmod/system/componentmodel/ICancelAddNew.cs +../referencesource/System/compmod/system/componentmodel/IChangeTracking.cs +../referencesource/System/compmod/system/componentmodel/IComNativeDescriptorHandler.cs +../referencesource/System/compmod/system/componentmodel/IComponent.cs +../referencesource/System/compmod/system/componentmodel/IContainer.cs +../referencesource/System/compmod/system/componentmodel/ICustomTypeDescriptor.cs +../referencesource/System/compmod/system/componentmodel/IDataErrorInfo.cs +../referencesource/System/compmod/system/componentmodel/IEditableObject.cs +../referencesource/System/compmod/system/componentmodel/IExtenderProvider.cs +../referencesource/System/compmod/system/componentmodel/IIntellisenseBuilder.cs +../referencesource/System/compmod/system/componentmodel/IListSource.cs +../referencesource/System/compmod/system/componentmodel/ImmutableObjectAttribute.cs +../referencesource/System/compmod/system/componentmodel/INestedContainer.cs +../referencesource/System/compmod/system/componentmodel/INestedSite.cs +../referencesource/System/compmod/system/componentmodel/InitializationEventAttribute.cs +../referencesource/System/compmod/system/componentmodel/INotifyDataErrorInfo.cs +../referencesource/System/compmod/system/componentmodel/INotifyPropertyChanged.cs +../referencesource/System/compmod/system/componentmodel/INotifyPropertyChanging.cs +../referencesource/System/compmod/system/componentmodel/InstallerTypeAttribute.cs +../referencesource/System/compmod/system/componentmodel/InstanceCreationEditor.cs +../referencesource/System/compmod/system/componentmodel/Int16Converter.cs +../referencesource/System/compmod/system/componentmodel/Int32Converter.cs +../referencesource/System/compmod/system/componentmodel/Int64Converter.cs +../referencesource/System/compmod/system/componentmodel/IntSecurity.cs +../referencesource/System/compmod/system/componentmodel/InvalidAsynchronousStateException.cs +../referencesource/System/compmod/system/componentmodel/InvalidEnumArgumentException.cs +../referencesource/System/compmod/system/componentmodel/IRaiseItemChangedEvents.cs +../referencesource/System/compmod/system/componentmodel/IRevertibleChangeTracking.cs +../referencesource/System/compmod/system/componentmodel/ISite.cs +../referencesource/System/compmod/system/componentmodel/ISupportInitialize.cs +../referencesource/System/compmod/system/componentmodel/ISupportInitializeNotification.cs +../referencesource/System/compmod/system/componentmodel/ISynchronizeInvoke.cs +../referencesource/System/compmod/system/componentmodel/ITypeDescriptorContext.cs +../referencesource/System/compmod/system/componentmodel/ITypedList.cs +../referencesource/System/compmod/system/componentmodel/License.cs +../referencesource/System/compmod/system/componentmodel/LicenseContext.cs +../referencesource/System/compmod/system/componentmodel/LicenseException.cs +../referencesource/System/compmod/system/componentmodel/LicenseManager.cs +../referencesource/System/compmod/system/componentmodel/LicenseProvider.cs +../referencesource/System/compmod/system/componentmodel/LicenseProviderAttribute.cs +../referencesource/System/compmod/system/componentmodel/LicenseUsageMode.cs +../referencesource/System/compmod/system/componentmodel/LicFileLicenseProvider.cs +../referencesource/System/compmod/system/componentmodel/ListBindableAttribute.cs +../referencesource/System/compmod/system/componentmodel/ListChangedEventArgs.cs +../referencesource/System/compmod/system/componentmodel/ListChangedEventHandler.cs +../referencesource/System/compmod/system/componentmodel/ListChangedType.cs +../referencesource/System/compmod/system/componentmodel/ListSortDescription.cs +../referencesource/System/compmod/system/componentmodel/ListSortDescriptionCollection.cs +../referencesource/System/compmod/system/componentmodel/ListSortDirection.cs +../referencesource/System/compmod/system/componentmodel/LocalizableAttribute.cs +../referencesource/System/compmod/system/componentmodel/LookupBindingPropertiesAttribute.cs +../referencesource/System/compmod/system/componentmodel/MarshalByValueComponent.cs +../referencesource/System/compmod/system/componentmodel/MaskedTextProvider.cs +../referencesource/System/compmod/system/componentmodel/MaskedTextResultHint.cs +../referencesource/System/compmod/system/componentmodel/MemberDescriptor.cs +../referencesource/System/compmod/system/componentmodel/MergablePropertyAttribute.cs +../referencesource/System/compmod/system/componentmodel/MultilineStringConverter.cs +../referencesource/System/compmod/system/componentmodel/NestedContainer.cs +../referencesource/System/compmod/system/componentmodel/NullableConverter.cs +../referencesource/System/compmod/system/componentmodel/PasswordPropertyTextAttribute.cs +../referencesource/System/compmod/system/componentmodel/ProgressChangedEventArgs.cs +../referencesource/System/compmod/system/componentmodel/ProgressChangedEventHandler.cs +../referencesource/System/compmod/system/componentmodel/PropertyChangedEventArgs.cs +../referencesource/System/compmod/system/componentmodel/PropertyChangedEventHandler.cs +../referencesource/System/compmod/system/componentmodel/PropertyChangingEventArgs.cs +../referencesource/System/compmod/system/componentmodel/PropertyChangingEventHandler.cs +../referencesource/System/compmod/system/componentmodel/PropertyDescriptor.cs +../referencesource/System/compmod/system/componentmodel/PropertyDescriptorCollection.cs +../referencesource/System/compmod/system/componentmodel/ProvidePropertyAttribute.cs +../referencesource/System/compmod/system/componentmodel/ReadOnlyAttribute.cs +../referencesource/System/compmod/system/componentmodel/RecommendedAsConfigurableAttribute.cs +../referencesource/System/compmod/system/componentmodel/ReferenceConverter.cs +../referencesource/System/compmod/system/componentmodel/ReflectEventDescriptor.cs +../referencesource/System/compmod/system/componentmodel/ReflectPropertyDescriptor.cs +../referencesource/System/compmod/system/componentmodel/ReflectTypeDescriptionProvider.cs +../referencesource/System/compmod/system/componentmodel/RefreshEventArgs.cs +../referencesource/System/compmod/system/componentmodel/RefreshEventHandler.cs +../referencesource/System/compmod/system/componentmodel/RunInstallerAttribute.cs +../referencesource/System/compmod/system/componentmodel/RunWorkerCompletedEventArgs.cs +../referencesource/System/compmod/system/componentmodel/RunWorkerCompletedEventHandler.cs +../referencesource/System/compmod/system/componentmodel/SByteConverter.cs +../referencesource/System/compmod/system/componentmodel/SettingsBindableAttribute.cs +../referencesource/System/compmod/system/componentmodel/SingleConverter.cs +../referencesource/System/compmod/system/componentmodel/StringConverter.cs +../referencesource/System/compmod/system/componentmodel/SyntaxCheck.cs +../referencesource/System/compmod/system/componentmodel/TimeSpanConverter.cs +../referencesource/System/compmod/system/componentmodel/ToolboxItemFilterAttribute.cs +../referencesource/System/compmod/system/componentmodel/ToolboxItemFilterType.cs +../referencesource/System/compmod/system/componentmodel/TypeConverter.cs +../referencesource/System/compmod/system/componentmodel/TypeConverterAttribute.cs +../referencesource/System/compmod/system/componentmodel/TypeDescriptionProvider.cs +../referencesource/System/compmod/system/componentmodel/TypeDescriptionProviderAttribute.cs +../referencesource/System/compmod/system/componentmodel/TypeDescriptionProviderService.cs +../referencesource/System/compmod/system/componentmodel/TypeDescriptor.cs +../referencesource/System/compmod/system/componentmodel/TypeListConverter.cs +../referencesource/System/compmod/system/componentmodel/UInt16Converter.cs +../referencesource/System/compmod/system/componentmodel/UInt32Converter.cs +../referencesource/System/compmod/system/componentmodel/UInt64Converter.cs +../referencesource/System/compmod/system/componentmodel/WarningException.cs +../referencesource/System/compmod/system/componentmodel/Win32Exception.cs + +../referencesource/System/compmod/system/diagnostics/AssertSection.cs +../referencesource/System/compmod/system/diagnostics/BooleanSwitch.cs +../referencesource/System/compmod/system/diagnostics/CorrelationManager.cs +../referencesource/System/compmod/system/diagnostics/Debug.cs +../referencesource/System/compmod/system/diagnostics/DelimitedListTraceListener.cs +../referencesource/System/compmod/system/diagnostics/DiagnosticsConfiguration.cs +../referencesource/System/compmod/system/diagnostics/ListenerElementsCollection.cs +../referencesource/System/compmod/system/diagnostics/SeverityFilter.cs +../referencesource/System/compmod/system/diagnostics/SourceFilter.cs +../referencesource/System/compmod/system/diagnostics/SourceLevels.cs +../referencesource/System/compmod/system/diagnostics/SourceSwitch.cs +../referencesource/System/compmod/system/diagnostics/SwitchAttribute.cs +../referencesource/System/compmod/system/diagnostics/Switch.cs +../referencesource/System/compmod/system/diagnostics/SwitchLevelAttribute.cs +../referencesource/System/compmod/system/diagnostics/TextWriterTraceListener.cs +../referencesource/System/compmod/system/diagnostics/Trace.cs +../referencesource/System/compmod/system/diagnostics/TraceEventCache.cs +../referencesource/System/compmod/system/diagnostics/TraceEventType.cs +../referencesource/System/compmod/system/diagnostics/TraceFilter.cs +../referencesource/System/compmod/system/diagnostics/TraceInternal.cs +../referencesource/System/compmod/system/diagnostics/TraceLevel.cs +../referencesource/System/compmod/system/diagnostics/TraceListener.cs +../referencesource/System/compmod/system/diagnostics/TraceListeners.cs +../referencesource/System/compmod/system/diagnostics/TraceOptions.cs +../referencesource/System/compmod/system/diagnostics/TraceSource.cs +../referencesource/System/compmod/system/diagnostics/TraceSwitch.cs +../referencesource/System/compmod/system/diagnostics/traceutils.cs + +../referencesource/System/net/System/_DomainName.cs +../referencesource/System/net/System/_IPv4Address.cs +../referencesource/System/net/System/_IPv6Address.cs +../referencesource/System/net/System/_UncName.cs +../referencesource/System/net/System/_UriSyntax.cs +../referencesource/System/net/System/GenericUriParser.cs +../referencesource/System/net/System/IriHelper.cs +../referencesource/System/net/System/URI.cs +../referencesource/System/net/System/uribuilder.cs +../referencesource/System/net/System/UriEnumTypes.cs +../referencesource/System/net/System/UriExt.cs +../referencesource/System/net/System/URIFormatException.cs +../referencesource/System/net/System/UriHelper.cs +../referencesource/System/net/System/UriHostNameType.cs +../referencesource/System/net/System/UriParserTemplates.cs +../referencesource/System/net/System/URIPartial.cs +../referencesource/System/net/System/UriScheme.cs + +../referencesource/System/net/System/Net/_BufferOffsetSize.cs +../referencesource/System/net/System/Net/_Connection.cs +../referencesource/System/net/System/Net/_emptywebproxy.cs +../referencesource/System/net/System/Net/_HeaderInfo.cs +../referencesource/System/net/System/Net/_HeaderInfoTable.cs +../referencesource/System/net/System/Net/_HTTPDateParse.cs +../referencesource/System/net/System/Net/_IStreams.cs +../referencesource/System/net/System/Net/_NetRes.cs +../referencesource/System/net/System/Net/_LazyAsyncResult.cs +../referencesource/System/net/System/Net/_LoggingObject.cs +../referencesource/System/net/System/Net/_PooledStream.cs +../referencesource/System/net/System/Net/_ProxyChain.cs +../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs +../referencesource/System/net/System/Net/_Semaphore.cs +../referencesource/System/net/System/Net/_ServiceNameStore.cs +../referencesource/System/net/System/Net/_TimerThread.cs +../referencesource/System/net/System/Net/_WebProxyDataBuilder.cs +../referencesource/System/net/System/Net/AuthenticationScheme.cs +../referencesource/System/net/System/Net/AuthenticationSchemeSelector.cs +../referencesource/System/net/System/Net/Authorization.cs +../referencesource/System/net/System/Net/CredentialCache.cs +../referencesource/System/net/System/Net/cookie.cs +../referencesource/System/net/System/Net/cookiecollection.cs +../referencesource/System/net/System/Net/cookiecontainer.cs +../referencesource/System/net/System/Net/cookieexception.cs +../referencesource/System/net/System/Net/connectionpool.cs +../referencesource/System/net/System/Net/DnsEndPoint.cs +../referencesource/System/net/System/Net/EndPoint.cs +../referencesource/System/net/System/Net/FtpStatusCode.cs +../referencesource/System/net/System/Net/filewebrequest.cs +../referencesource/System/net/System/Net/filewebresponse.cs +../referencesource/System/net/System/Net/GlobalProxySelection.cs +../referencesource/System/net/System/Net/HttpListenerException.cs +../referencesource/System/net/System/Net/HttpListenerRequestUriBuilder.cs +../referencesource/System/net/System/Net/HttpRequestHeader.cs +../referencesource/System/net/System/Net/HttpResponseHeader.cs +../referencesource/System/net/System/Net/HttpStatusCode.cs +../referencesource/System/net/System/Net/HttpVersion.cs +../referencesource/System/net/System/Net/IAuthenticationModule.cs +../referencesource/System/net/System/Net/ICertificatePolicy.cs +../referencesource/System/net/System/Net/ICredentials.cs +../referencesource/System/net/System/Net/ICredentialsByHost.cs +../referencesource/System/net/System/Net/Internal.cs +../referencesource/System/net/System/Net/IPAddress.cs +../referencesource/System/net/System/Net/IPEndPoint.cs +../referencesource/System/net/System/Net/IPHostEntry.cs +../referencesource/System/net/System/Net/iwebproxy.cs +../referencesource/System/net/System/Net/IWebProxyFinder.cs +../referencesource/System/net/System/Net/IWebRequestCreate.cs +../referencesource/System/net/System/Net/NetworkAccess.cs +../referencesource/System/net/System/Net/NetworkCredential.cs +../referencesource/System/net/System/Net/ProtocolViolationException.cs +../referencesource/System/net/System/Net/TransportContext.cs +../referencesource/System/net/System/Net/TransportType.cs +../referencesource/System/net/System/Net/UnicodeDecodingConformance.cs +../referencesource/System/net/System/Net/UnicodeEncodingConformance.cs +../referencesource/System/net/System/Net/ServicePointManager.cs +../referencesource/System/net/System/Net/SocketAddress.cs +../referencesource/System/net/System/Net/SocketException.cs +../referencesource/System/net/System/Net/webclient.cs +../referencesource/System/net/System/Net/WebException.cs +../referencesource/System/net/System/Net/WebExceptionStatus.cs +../referencesource/System/net/System/Net/WebHeaderCollection.cs +../referencesource/System/net/System/Net/WebPermission.cs +../referencesource/System/net/System/Net/webproxy.cs +../referencesource/System/net/System/Net/WebRequestMethods.cs +../referencesource/System/net/System/Net/WebRequest.cs +../referencesource/System/net/System/Net/WebResponse.cs +../referencesource/System/net/System/Net/WebUtility.cs +../referencesource/System/net/System/Net/WriteStreamClosedEventArgs.cs + +../referencesource/System/net/System/Net/Cache/RequestCache.cs +../referencesource/System/net/System/Net/Cache/RequestCacheEntry.cs +../referencesource/System/net/System/Net/Cache/RequestCachePolicy.cs +../referencesource/System/net/System/Net/Cache/RequestCacheManager.cs + +../referencesource/System/net/System/Net/Configuration/DefaultProxySection.cs + +../referencesource/System/net/System/Net/SecureProtocols/AuthenticatedStream.cs +../referencesource/System/net/System/Net/SecureProtocols/NegotiateEnumTypes.cs + +../referencesource/System/net/System/Net/Sockets/_MultipleConnectAsync.cs +../referencesource/System/net/System/Net/Sockets/AddressFamily.cs +../referencesource/System/net/System/Net/Sockets/IOControlCode.cs +../referencesource/System/net/System/Net/Sockets/IPPacketInformation.cs +../referencesource/System/net/System/Net/Sockets/IPProtectionLevel.cs +../referencesource/System/net/System/Net/Sockets/LingerOption.cs +../referencesource/System/net/System/Net/Sockets/MulticastOption.cs +../referencesource/System/net/System/Net/Sockets/NetworkStream.cs +../referencesource/System/net/System/Net/Sockets/ProtocolFamily.cs +../referencesource/System/net/System/Net/Sockets/ProtocolType.cs +../referencesource/System/net/System/Net/Sockets/SelectMode.cs +../referencesource/System/net/System/Net/Sockets/Socket.cs +../referencesource/System/net/System/Net/Sockets/SocketErrors.cs +../referencesource/System/net/System/Net/Sockets/SocketFlags.cs +../referencesource/System/net/System/Net/Sockets/SocketInformation.cs +../referencesource/System/net/System/Net/Sockets/SocketInformationOptions.cs +../referencesource/System/net/System/Net/Sockets/SocketOptionLevel.cs +../referencesource/System/net/System/Net/Sockets/SocketOptionName.cs +../referencesource/System/net/System/Net/Sockets/SocketShutdown.cs +../referencesource/System/net/System/Net/Sockets/SocketType.cs +../referencesource/System/net/System/Net/Sockets/TCPClient.cs +../referencesource/System/net/System/Net/Sockets/TCPListener.cs +../referencesource/System/net/System/Net/Sockets/TransmitFileFlags.cs +../referencesource/System/net/System/Net/Sockets/UdpReceiveResult.cs +../referencesource/System/net/System/Net/Sockets/UDPClient.cs + +../referencesource/System/net/System/Net/NetworkInformation/DuplicateAddressDetectionState.cs +../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformation.cs +../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformationCollection.cs +../referencesource/System/net/System/Net/NetworkInformation/IPAddressCollection.cs +../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformation.cs +../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformationCollection.cs +../referencesource/System/net/System/Net/NetworkInformation/IPGlobalProperties.cs +../referencesource/System/net/System/Net/NetworkInformation/IPGlobalStatistics.cs +../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceProperties.cs +../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceStatistics.cs +../referencesource/System/net/System/Net/NetworkInformation/IPStatus.cs +../referencesource/System/net/System/Net/NetworkInformation/IPv4InterfaceProperties.cs +../referencesource/System/net/System/Net/NetworkInformation/IPv6InterfaceProperties.cs +../referencesource/System/net/System/Net/NetworkInformation/IcmpV4Statistics.cs +../referencesource/System/net/System/Net/NetworkInformation/IcmpV6Statistics.cs +../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformation.cs +../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformationCollection.cs +../referencesource/System/net/System/Net/NetworkInformation/NetworkAddressChange.cs +../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationException.cs +../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationPermission.cs +../referencesource/System/net/System/Net/NetworkInformation/NetworkInterface.cs +../referencesource/System/net/System/Net/NetworkInformation/NetworkInterfaceComponent.cs +../referencesource/System/net/System/Net/NetworkInformation/OperationalStatus.cs +../referencesource/System/net/System/Net/NetworkInformation/PhysicalAddress.cs +../referencesource/System/net/System/Net/NetworkInformation/PingOptions.cs +../referencesource/System/net/System/Net/NetworkInformation/PingReply.cs +../referencesource/System/net/System/Net/NetworkInformation/PrefixOrigin.cs +../referencesource/System/net/System/Net/NetworkInformation/ScopeLevel.cs +../referencesource/System/net/System/Net/NetworkInformation/SuffixOrigin.cs +../referencesource/System/net/System/Net/NetworkInformation/SystemGatewayIPAddressInformation.cs +../referencesource/System/net/System/Net/NetworkInformation/SystemIPAddressInformation.cs +../referencesource/System/net/System/Net/NetworkInformation/SystemMulticastIPAddressInformation.cs +../referencesource/System/net/System/Net/NetworkInformation/SystemTcpConnection.cs +../referencesource/System/net/System/Net/NetworkInformation/TcpConnection.cs +../referencesource/System/net/System/Net/NetworkInformation/TcpState.cs +../referencesource/System/net/System/Net/NetworkInformation/TcpStatistics.cs +../referencesource/System/net/System/Net/NetworkInformation/UdpStatistics.cs +../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformation.cs +../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformationCollection.cs +../referencesource/System/net/System/Net/NetworkInformation/interfacetype.cs +../referencesource/System/net/System/Net/NetworkInformation/nodetype.cs +../referencesource/System/net/System/Net/NetworkInformation/pingexception.cs + +../referencesource/System/net/System/Net/mail/Base64Stream.cs +../referencesource/System/net/System/Net/mail/Base64WriteStateInfo.cs +../referencesource/System/net/System/Net/mail/BaseWriter.cs +../referencesource/System/net/System/Net/mail/BufferBuilder.cs +../referencesource/System/net/System/Net/mail/ClosableStream.cs +../referencesource/System/net/System/Net/mail/ContentDisposition.cs +../referencesource/System/net/System/Net/mail/ContentType.cs +../referencesource/System/net/System/Net/mail/DelegatedStream.cs +../referencesource/System/net/System/Net/mail/DispositionTypeNames.cs +../referencesource/System/net/System/Net/mail/EightBitStream.cs +../referencesource/System/net/System/Net/mail/EncodedStreamFactory.cs +../referencesource/System/net/System/Net/mail/HeaderCollection.cs +../referencesource/System/net/System/Net/mail/IEncodableStream.cs +../referencesource/System/net/System/Net/mail/MailBnfHelper.cs +../referencesource/System/net/System/Net/mail/MailHeaderInfo.cs +../referencesource/System/net/System/Net/mail/MimeBasePart.cs +../referencesource/System/net/System/Net/mail/MimeEmbeddedMessagePart.cs +../referencesource/System/net/System/Net/mail/MimeMultiPart.cs +../referencesource/System/net/System/Net/mail/MimeMultiPartType.cs +../referencesource/System/net/System/Net/mail/MimePart.cs +../referencesource/System/net/System/Net/mail/MimeWriter.cs +../referencesource/System/net/System/Net/mail/MultiAsyncResult.cs +../referencesource/System/net/System/Net/mail/QEncodedStream.cs +../referencesource/System/net/System/Net/mail/QuotedPrintableStream.cs +../referencesource/System/net/System/Net/mail/SmtpDateTime.cs +../referencesource/System/net/System/Net/mail/TrackingStringDictionary.cs +../referencesource/System/net/System/Net/mail/TrackingValidationObjectDictionary.cs +../referencesource/System/net/System/Net/mail/TransferEncoding.cs +../referencesource/System/net/System/Net/mail/WriteStateInfoBase.cs +../referencesource/System/net/System/Net/mail/mediatypenames.cs + +../referencesource/System/sys/system/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs + +../referencesource/System/sys/system/IO/ports/InternalResources.cs + +../referencesource/System/sys/system/runtime/interopservices/DefaultParameterValueAttribute.cs +../referencesource/System/sys/system/runtime/interopservices/handlecollector.cs + +../referencesource/System/sys/system/runtime/versioning/FrameworkName.cs + +../referencesource/System/sys/system/threading/Barrier.cs +../referencesource/System/sys/system/threading/semaphore.cs + +../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs + +../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs +../referencesource/System/security/system/security/Authentication/ExtendedProtection/ServiceNameCollection.cs + +../referencesource/System/security/system/security/cryptography/oid.cs + +../referencesource/System/security/system/security/cryptography/x509/x509utils.cs + +../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs + +../referencesource/System/services/monitoring/system/diagnosticts/AsyncStreamReader.cs +../referencesource/System/services/monitoring/system/diagnosticts/Process.cs +../referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs +../referencesource/System/services/monitoring/system/diagnosticts/ProcessStartInfo.cs +../referencesource/System/services/monitoring/system/diagnosticts/processwaithandle.cs +../referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs + +../referencesource/System/services/timers/system/timers/ElapsedEventHandler.cs +../referencesource/System/services/timers/system/timers/Timer.cs +../referencesource/System/services/timers/system/timers/TimersDescriptionAttribute.cs + +../referencesource/System/misc/hresults.cs +../referencesource/System/misc/invariantcomparer.cs +../referencesource/System/misc/SecurityUtils.cs +../referencesource/System/misc/WeakHashtable.cs + +../referencesource/System/compmod/system/codedom/compiler/GeneratedCodeAttribute.cs +../referencesource/System/compmod/system/codedom/compiler/IndentTextWriter.cs + +../referencesource/System/compmod/microsoft/win32/safehandles/SafeProcessHandle.cs diff --git a/mcs/class/System/machine.config b/mcs/class/System/machine.config deleted file mode 100644 index d1ebe8ae9dc..00000000000 --- a/mcs/class/System/machine.config +++ /dev/null @@ -1,445 +0,0 @@ - - - - - -
-
-
-
-
-
-
-
-
-
- -
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
-
- - - -
-
-
-
-
- - -
-
-
- - -
- - -
-
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - add verb="*" path="*.master" type="System.Web.HttpForbiddenHandler, System.Web" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - //PixelsPerMeter/X - //PixelsPerMeter/Y - - .0254 - - - //JPEGvariety/app0JFIF/@Xdensity - //JPEGvariety/app0JFIF/@Ydensity - //JPEGvariety/app0JFIF/@resUnits - 1.0 - 1.0 - 25.4 - - - //pHYs/@pixelsPerUnitXAxis - //pHYs/@pixelsPerUnitYAxis - //pHYs/@unitSpecifier - .0254 - 1.0 - 1.0 - - - //TIFFField[@name='XResolution']/TIFFRationals/TIFFRational/@value - //TIFFField[@name='YResolution']/TIFFRationals/TIFFRational/@value - //TIFFField[@name='ResolutionUnit']/TIFFShorts/TIFFShort/@value - 1.0 - 1.0 - 25.4 - - - - - - diff --git a/mcs/class/System/makefile.build b/mcs/class/System/makefile.build deleted file mode 100755 index 0625511ab7b..00000000000 --- a/mcs/class/System/makefile.build +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/System/mobile_System.dll.sources b/mcs/class/System/mobile_System.dll.sources index 1351778bb86..aaa9ab17047 100644 --- a/mcs/class/System/mobile_System.dll.sources +++ b/mcs/class/System/mobile_System.dll.sources @@ -1,1003 +1,2 @@ -Assembly/AssemblyInfo.cs -ReferenceSources/SR.cs -../../build/common/SR.cs -Mono.Http/NtlmClient.cs -../referencesource/System/compmod/system/codedom/compiler/GeneratedCodeAttribute.cs -../referencesource/System/compmod/system/codedom/compiler/IndentTextWriter.cs -System.Diagnostics/DataReceivedEventArgs.cs -System.Diagnostics/DataReceivedEventHandler.cs -System.Diagnostics/DefaultTraceListener.cs -System.Diagnostics/FileVersionInfo.cs -System.Diagnostics/MonitoringDescriptionAttribute.cs -System.Diagnostics/Process.cs -System.Diagnostics/ProcessModule.cs -System.Diagnostics/ProcessPriorityClass.cs -System.Diagnostics/ProcessStartInfo.cs -System.Diagnostics/ProcessThread.cs -System.Diagnostics/ProcessWindowStyle.cs -System.Diagnostics/Stopwatch.cs -System.Diagnostics/ThreadPriorityLevel.cs -System.Diagnostics/ThreadState.cs -System.Diagnostics/ThreadWaitReason.cs -System.Diagnostics/TraceImpl.cs -System.IO.Compression/CompressionLevel.cs -System.IO.Compression/CompressionMode.cs -System.IO.Compression/DeflateStream.cs -System.IO.Compression/GZipStream.cs -System.IO/InternalBufferOverflowException.cs -System.IO/InvalidDataException.cs -System.IO/IODescriptionAttribute.cs -System.IO/ErrorEventArgs.cs -System.IO/ErrorEventHandler.cs -System.IO/FileSystemEventArgs.cs -System.IO/FileSystemEventHandler.cs +#include common.sources System.IO/FileSystemWatcher_mobile.cs -System.IO/NotifyFilters.cs -System.IO/RenamedEventArgs.cs -System.IO/RenamedEventHandler.cs -System.IO/WaitForChangedResult.cs -System.IO/WatcherChangeTypes.cs -System.Net.Mail/AlternateView.cs -System.Net.Mail/AlternateViewCollection.cs -System.Net.Mail/Attachment.cs -System.Net.Mail/AttachmentBase.cs -System.Net.Mail/AttachmentCollection.cs -System.Net.Mail/DeliveryNotificationOptions.cs -System.Net.Mail/LinkedResource.cs -System.Net.Mail/LinkedResourceCollection.cs -System.Net.Mail/MailAddress.cs -System.Net.Mail/MailAddressCollection.cs -System.Net.Mail/MailMessage.cs -System.Net.Mail/MailPriority.cs -System.Net.Mail/SendCompletedEventHandler.cs -System.Net.Mail/SmtpAccess.cs -System.Net.Mail/SmtpClient.cs -System.Net.Mail/SmtpDeliveryFormat.cs -System.Net.Mail/SmtpDeliveryMethod.cs -System.Net.Mail/SmtpException.cs -System.Net.Mail/SmtpFailedRecipientException.cs -System.Net.Mail/SmtpFailedRecipientsException.cs -System.Net.Mail/SmtpStatusCode.cs -../referencesource/System/net/System/Net/mail/Base64Stream.cs -../referencesource/System/net/System/Net/mail/Base64WriteStateInfo.cs -../referencesource/System/net/System/Net/mail/BaseWriter.cs -../referencesource/System/net/System/Net/mail/BufferBuilder.cs -../referencesource/System/net/System/Net/mail/ClosableStream.cs -../referencesource/System/net/System/Net/mail/ContentDisposition.cs -../referencesource/System/net/System/Net/mail/ContentType.cs -../referencesource/System/net/System/Net/mail/DelegatedStream.cs -../referencesource/System/net/System/Net/mail/DispositionTypeNames.cs -../referencesource/System/net/System/Net/mail/EightBitStream.cs -../referencesource/System/net/System/Net/mail/EncodedStreamFactory.cs -../referencesource/System/net/System/Net/mail/HeaderCollection.cs -../referencesource/System/net/System/Net/mail/IEncodableStream.cs -../referencesource/System/net/System/Net/mail/MailBnfHelper.cs -../referencesource/System/net/System/Net/mail/MailHeaderInfo.cs -../referencesource/System/net/System/Net/mail/MimeBasePart.cs -../referencesource/System/net/System/Net/mail/MimeEmbeddedMessagePart.cs -../referencesource/System/net/System/Net/mail/MimeMultiPart.cs -../referencesource/System/net/System/Net/mail/MimeMultiPartType.cs -../referencesource/System/net/System/Net/mail/MimePart.cs -../referencesource/System/net/System/Net/mail/MimeWriter.cs -../referencesource/System/net/System/Net/mail/MultiAsyncResult.cs -../referencesource/System/net/System/Net/mail/QEncodedStream.cs -../referencesource/System/net/System/Net/mail/QuotedPrintableStream.cs -../referencesource/System/net/System/Net/mail/SmtpDateTime.cs -../referencesource/System/net/System/Net/mail/TrackingStringDictionary.cs -../referencesource/System/net/System/Net/mail/TrackingValidationObjectDictionary.cs -../referencesource/System/net/System/Net/mail/TransferEncoding.cs -../referencesource/System/net/System/Net/mail/WriteStateInfoBase.cs -../referencesource/System/net/System/Net/mail/mediatypenames.cs -System.Net.NetworkInformation/IcmpV4Statistics.cs -System.Net.NetworkInformation/IcmpV6Statistics.cs -System.Net.NetworkInformation/IPAddressCollection.cs -System.Net.NetworkInformation/IPGlobalProperties.cs -System.Net.NetworkInformation/IPGlobalStatistics.cs -System.Net.NetworkInformation/IPInterfaceProperties.cs -System.Net.NetworkInformation/IPv4InterfaceProperties.cs -System.Net.NetworkInformation/IPv4InterfaceStatistics.cs -System.Net.NetworkInformation/IPv6InterfaceProperties.cs -System.Net.NetworkInformation/LinuxNetworkInterfaceMarshal.cs -System.Net.NetworkInformation/MacOsNetworkInterfaceMarshal.cs -System.Net.NetworkInformation/NetworkChange.cs -System.Net.NetworkInformation/NetworkInterface.cs -System.Net.NetworkInformation/Ping.cs -System.Net.NetworkInformation/PingCompletedEventArgs.cs -System.Net.NetworkInformation/PingCompletedEventHandler.cs -System.Net.NetworkInformation/TcpStatistics.cs -System.Net.NetworkInformation/UdpStatistics.cs -System.Net.NetworkInformation/UnicastIPAddressInformation.cs -System.Net.NetworkInformation/Win32NetworkInterfaceMarshal.cs -../referencesource/System/net/System/Net/SecureProtocols/AuthenticatedStream.cs -../referencesource/System/net/System/Net/SecureProtocols/NegotiateEnumTypes.cs -System.Net.Security/EncryptionPolicy.cs -System.Net.Security/LocalCertificateSelectionCallback.cs -System.Net.Security/NegotiateStream.cs -System.Net.Security/RemoteCertificateValidationCallback.cs -System.Net.Security/SslPolicyErrors.cs -System.Net.Security/SslStream.cs -System.Net/SocketPermissionAttribute.cs -System.Net/SocketPermission.cs -System.Net.Sockets/SafeSocketHandle.cs -System.Net.Sockets/Socket.cs -System.Net.Sockets/SocketAsyncEventArgs.cs -System.Net.Sockets/SocketAsyncResult.cs -System.Net.Sockets/SocketOperation.cs -System.Net.Sockets/SocketReceiveFromResult.cs -System.Net.Sockets/SocketReceiveMessageFromResult.cs -System.Net.Sockets/SocketTaskExtensions.cs -System.Net/AuthenticationManager.cs -System.Net/BasicClient.cs -System.Net/BindIPEndPoint.cs -System.Net/ChunkStream.cs -System.Net/ChunkedInputStream.cs -System.Net/DecompressionMethods.cs -System.Net/DefaultCertificatePolicy.cs -System.Net/DigestClient.cs -System.Net/Dns.cs -System.Net/EndPointListener.cs -System.Net/EndPointManager.cs -System.Net/EndpointPermission.cs -System.Net/FtpAsyncResult.cs -System.Net/FtpDataStream.cs -System.Net/FtpRequestCreator.cs -System.Net/FtpStatus.cs -System.Net/FtpWebRequest.cs -System.Net/FtpWebResponse.cs -System.Net/HttpConnection.cs -System.Net/HttpListener.cs -System.Net/HttpListenerBasicIdentity.cs -System.Net/HttpListenerContext.cs -System.Net/HttpListenerPrefixCollection.cs -System.Net/HttpListenerRequest.cs -System.Net/HttpListenerResponse.cs -System.Net/HttpListenerResponseHelper.cs -System.Net/HttpListenerTimeoutManager.cs -System.Net/HttpRequestCreator.cs -System.Net/HttpStreamAsyncResult.cs -System.Net/HttpWebRequest.cs -System.Net/HttpWebResponse.cs -System.Net/ICredentialPolicy.cs -System.Net/IPv6Address.cs -System.Net/IWebConnectionState.cs -System.Net/IWebProxyScript.cs -System.Net/ListenerAsyncResult.cs -System.Net/ListenerPrefix.cs -System.Net/MacProxy.cs -System.Net/MonoHttpDate.cs -System.Net/NetConfig.cs -System.Net/NtlmClient.cs -System.Net/RequestStream.cs -System.Net/ResponseStream.cs -System.Net/ServicePoint.cs -System.Net/ServicePointManager.cs -System.Net/ServicePointManager.extra.cs -System.Net/SimpleAsyncResult.cs -System.Net/WebAsyncResult.cs -System.Net/WebConnection.cs -System.Net/WebConnectionData.cs -System.Net/WebConnectionGroup.cs -System.Net/WebConnectionStream.cs -System.Net.WebSockets/ClientWebSocket.cs -System.Net.WebSockets/ClientWebSocketOptions.cs -System.Net.WebSockets/HttpListenerWebSocketContext.cs -System.Net.WebSockets/WebSocket.cs -System.Net.WebSockets/WebSocketCloseStatus.cs -System.Net.WebSockets/WebSocketContext.cs -System.Net.WebSockets/WebSocketError.cs -System.Net.WebSockets/WebSocketException.cs -System.Net.WebSockets/WebSocketMessageType.cs -System.Net.WebSockets/WebSocketReceiveResult.cs -System.Net.WebSockets/WebSocketState.cs -System.Security.AccessControl/SemaphoreAccessRule.cs -System.Security.AccessControl/SemaphoreAuditRule.cs -System.Security.AccessControl/SemaphoreRights.cs -System.Security.AccessControl/SemaphoreSecurity.cs -System.Security.Authentication/AuthenticationException.cs -System.Security.Authentication/CipherAlgorithmType.cs -System.Security.Authentication/ExchangeAlgorithmType.cs -System.Security.Authentication/HashAlgorithmType.cs -System.Security.Authentication/SslProtocols.cs -System.Security.Authentication/InvalidCredentialException.cs -System.Security.Authentication.ExtendedProtection/ChannelBinding.cs -System.Security.Authentication.ExtendedProtection/ChannelBindingKind.cs -System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicy.cs -System.Security.Authentication.ExtendedProtection/ExtendedProtectionPolicyTypeConverter.cs -System.Security.Authentication.ExtendedProtection/PolicyEnforcement.cs -System.Security.Authentication.ExtendedProtection/ProtectionScenario.cs -System.Security.Authentication.ExtendedProtection.Configuration/ConfigUtil.cs -System.Security.Authentication.ExtendedProtection.Configuration/ExtendedProtectionPolicyElement.cs -System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElement.cs -System.Security.Authentication.ExtendedProtection.Configuration/ServiceNameElementCollection.cs -System.Security.Cryptography.X509Certificates/OSX509Certificates.cs -System.Security.Cryptography.X509Certificates/OpenFlags.cs -System.Security.Cryptography.X509Certificates/PublicKey.cs -System.Security.Cryptography.X509Certificates/StoreLocation.cs -System.Security.Cryptography.X509Certificates/StoreName.cs -System.Security.Cryptography.X509Certificates/X500DistinguishedName.cs -System.Security.Cryptography.X509Certificates/X500DistinguishedNameFlags.cs -System.Security.Cryptography.X509Certificates/X509BasicConstraintsExtension.cs -System.Security.Cryptography.X509Certificates/X509Certificate2.cs -System.Security.Cryptography.X509Certificates/X509Certificate2Collection.cs -System.Security.Cryptography.X509Certificates/X509Certificate2Enumerator.cs -System.Security.Cryptography.X509Certificates/X509Certificate2Impl.cs -System.Security.Cryptography.X509Certificates/X509Certificate2ImplMono.cs -System.Security.Cryptography.X509Certificates/X509CertificateCollection.cs -System.Security.Cryptography.X509Certificates/X509CertificateImplCollection.cs -System.Security.Cryptography.X509Certificates/X509Chain.cs -System.Security.Cryptography.X509Certificates/X509ChainElement.cs -System.Security.Cryptography.X509Certificates/X509ChainElementCollection.cs -System.Security.Cryptography.X509Certificates/X509ChainElementEnumerator.cs -System.Security.Cryptography.X509Certificates/X509ChainImpl.cs -System.Security.Cryptography.X509Certificates/X509ChainImplMono.cs -System.Security.Cryptography.X509Certificates/X509ChainPolicy.cs -System.Security.Cryptography.X509Certificates/X509ChainStatus.cs -System.Security.Cryptography.X509Certificates/X509ChainStatusFlags.cs -System.Security.Cryptography.X509Certificates/X509EnhancedKeyUsageExtension.cs -System.Security.Cryptography.X509Certificates/X509Extension.cs -System.Security.Cryptography.X509Certificates/X509ExtensionCollection.cs -System.Security.Cryptography.X509Certificates/X509ExtensionEnumerator.cs -System.Security.Cryptography.X509Certificates/X509FindType.cs -System.Security.Cryptography.X509Certificates/X509IncludeOption.cs -System.Security.Cryptography.X509Certificates/X509Helper2.cs -System.Security.Cryptography.X509Certificates/X509KeyUsageExtension.cs -System.Security.Cryptography.X509Certificates/X509KeyUsageFlags.cs -System.Security.Cryptography.X509Certificates/X509NameType.cs -System.Security.Cryptography.X509Certificates/X509RevocationFlag.cs -System.Security.Cryptography.X509Certificates/X509RevocationMode.cs -System.Security.Cryptography.X509Certificates/X509Store.cs -System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierExtension.cs -System.Security.Cryptography.X509Certificates/X509SubjectKeyIdentifierHashAlgorithm.cs -System.Security.Cryptography.X509Certificates/X509VerificationFlags.cs -System.Security.Cryptography/AsnEncodedData.cs -System.Security.Cryptography/AsnEncodedDataCollection.cs -System.Security.Cryptography/AsnEncodedDataEnumerator.cs -System.Threading/ThreadExceptionEventArgs.cs -System.Threading/ThreadExceptionEventHandler.cs -System.Timers/ElapsedEventArgs.cs -System/IOSelector.cs -System/Platform.cs -System/SRDescriptionAttribute.cs -System/UriTypeConverter.cs -System.Windows.Input/ICommand.cs -Microsoft.Win32.SafeHandles/SafeX509ChainHandle.cs - -Mono.Net.Security/AsyncProtocolRequest.cs -Mono.Net.Security/CallbackHelpers.cs -Mono.Net.Security/ChainValidationHelper.cs -Mono.Net.Security/IMonoTlsProvider.cs -Mono.Net.Security/IMonoSslStream.cs -Mono.Net.Security/LegacySslStream.cs -Mono.Net.Security/MobileAuthenticatedStream.cs -Mono.Net.Security/MobileTlsContext.cs -Mono.Net.Security/LegacyTlsProvider.cs -Mono.Net.Security/MonoSslStreamImpl.cs -Mono.Net.Security/MonoSslStreamWrapper.cs -Mono.Net.Security/MonoTlsProviderFactory.cs -Mono.Net.Security/MonoTlsProviderWrapper.cs -Mono.Net.Security/MonoTlsStream.cs -Mono.Net.Security/NoReflectionHelper.cs -Mono.Net.Security/SystemCertificateValidator.cs - -Mono.Btls/MonoBtlsBio.cs -Mono.Btls/MonoBtlsContext.cs -Mono.Btls/MonoBtlsError.cs -Mono.Btls/MonoBtlsException.cs -Mono.Btls/MonoBtlsKey.cs -Mono.Btls/MonoBtlsObject.cs -Mono.Btls/MonoBtlsPkcs12.cs -Mono.Btls/MonoBtlsProvider.cs -Mono.Btls/MonoBtlsSsl.cs -Mono.Btls/MonoBtlsSslCtx.cs -Mono.Btls/MonoBtlsSslError.cs -Mono.Btls/MonoBtlsStream.cs -Mono.Btls/MonoBtlsUtils.cs -Mono.Btls/MonoBtlsX509.cs -Mono.Btls/MonoBtlsX509Chain.cs -Mono.Btls/MonoBtlsX509Crl.cs -Mono.Btls/MonoBtlsX509Error.cs -Mono.Btls/MonoBtlsX509Exception.cs -Mono.Btls/MonoBtlsX509FileType.cs -Mono.Btls/MonoBtlsX509Format.cs -Mono.Btls/MonoBtlsX509Lookup.cs -Mono.Btls/MonoBtlsX509LookupMonoCollection.cs -Mono.Btls/MonoBtlsX509LookupMono.cs -Mono.Btls/MonoBtlsX509LookupType.cs -Mono.Btls/MonoBtlsX509Name.cs -Mono.Btls/MonoBtlsX509NameEntryType.cs -Mono.Btls/MonoBtlsX509Purpose.cs -Mono.Btls/MonoBtlsX509Revoked.cs -Mono.Btls/MonoBtlsX509Store.cs -Mono.Btls/MonoBtlsX509StoreCtx.cs -Mono.Btls/MonoBtlsX509StoreManager.cs -Mono.Btls/MonoBtlsX509StoreType.cs -Mono.Btls/MonoBtlsX509TrustKind.cs -Mono.Btls/MonoBtlsX509VerifyFlags.cs -Mono.Btls/MonoBtlsX509VerifyParam.cs -Mono.Btls/X509CertificateImplBtls.cs -Mono.Btls/X509ChainImplBtls.cs - -ReferenceSources/AutoWebProxyScriptEngine.cs -ReferenceSources/AssertWrapper.cs -ReferenceSources/CAPI.cs -ReferenceSources/EnvironmentHelpers.cs -ReferenceSources/HttpApi.cs -ReferenceSources/LocalAppContextSwitches.cs -ReferenceSources/HttpSysSettings.cs -ReferenceSources/Logging.cs -ReferenceSources/NativeMethods.cs -ReferenceSources/RequestCacheProtocol.cs -ReferenceSources/SettingsSectionInternal.cs -ReferenceSources/SecureStringHelper.cs -ReferenceSources/Socket.cs -ReferenceSources/SR.cs -ReferenceSources/SRCategoryAttribute.cs -ReferenceSources/Win32Exception.cs - -../referencesource/System/regex/system/text/regularexpressions/Regex.cs -../referencesource/System/regex/system/text/regularexpressions/RegexBoyerMoore.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCapture.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCaptureCollection.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCharClass.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCode.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCompilationInfo.cs -../referencesource/System/regex/system/text/regularexpressions/RegexCompiler.cs -../referencesource/System/regex/system/text/regularexpressions/RegexFCD.cs -../referencesource/System/regex/system/text/regularexpressions/RegexGroup.cs -../referencesource/System/regex/system/text/regularexpressions/RegexGroupCollection.cs -../referencesource/System/regex/system/text/regularexpressions/RegexInterpreter.cs -../referencesource/System/regex/system/text/regularexpressions/RegexMatch.cs -../referencesource/System/regex/system/text/regularexpressions/RegexMatchCollection.cs -../referencesource/System/regex/system/text/regularexpressions/RegexMatchTimeoutException.cs -../referencesource/System/regex/system/text/regularexpressions/RegexNode.cs -../referencesource/System/regex/system/text/regularexpressions/RegexOptions.cs -../referencesource/System/regex/system/text/regularexpressions/RegexParser.cs -../referencesource/System/regex/system/text/regularexpressions/RegexReplacement.cs -../referencesource/System/regex/system/text/regularexpressions/RegexRunner.cs -../referencesource/System/regex/system/text/regularexpressions/RegexRunnerFactory.cs -../referencesource/System/regex/system/text/regularexpressions/RegexTree.cs -../referencesource/System/regex/system/text/regularexpressions/RegexWriter.cs -../referencesource/System/regex/system/text/regularexpressions/compiledregexrunner.cs -../referencesource/System/regex/system/text/regularexpressions/compiledregexrunnerfactory.cs - -../referencesource/System/sys/system/collections/concurrent/BlockingCollection.cs -../referencesource/System/sys/system/collections/concurrent/ConcurrentBag.cs - -../referencesource/System/compmod/system/collections/generic/bithelper.cs -../referencesource/System/compmod/system/collections/generic/debugview.cs -../referencesource/System/compmod/system/collections/generic/iset.cs -../referencesource/System/compmod/system/collections/generic/linkedlist.cs -../referencesource/System/compmod/system/collections/generic/queue.cs -../referencesource/System/compmod/system/collections/generic/sorteddictionary.cs -../referencesource/System/compmod/system/collections/generic/sortedlist.cs -../referencesource/System/compmod/system/collections/generic/sortedset.cs -../referencesource/System/compmod/system/collections/generic/sortedsetdebugview.cs -../referencesource/System/compmod/system/collections/generic/stack.cs -../referencesource/System/compmod/system/collections/generic/throwhelper.cs - -../referencesource/System/compmod/system/collections/objectmodel/observablecollection.cs -../referencesource/System/compmod/system/collections/objectmodel/readonlyobservablecollection.cs - -../referencesource/System/compmod/system/collections/specialized/bitvector32.cs -../referencesource/System/compmod/system/collections/specialized/casesensitivestringdictionary.cs -../referencesource/System/compmod/system/collections/specialized/collectionsutil.cs -../referencesource/System/compmod/system/collections/specialized/fixedstringlookup.cs -../referencesource/System/compmod/system/collections/specialized/hybriddictionary.cs -../referencesource/System/compmod/system/collections/specialized/inotifycollectionchanged.cs -../referencesource/System/compmod/system/collections/specialized/iordereddictionary.cs -../referencesource/System/compmod/system/collections/specialized/listdictionary.cs -../referencesource/System/compmod/system/collections/specialized/nameobjectcollectionbase.cs -../referencesource/System/compmod/system/collections/specialized/namevaluecollection.cs -../referencesource/System/compmod/system/collections/specialized/notifycollectionchangedeventargs.cs -../referencesource/System/compmod/system/collections/specialized/ordereddictionary.cs -../referencesource/System/compmod/system/collections/specialized/stringcollection.cs -../referencesource/System/compmod/system/collections/specialized/stringdictionary.cs -../referencesource/System/compmod/system/collections/specialized/stringdictionarywithcomparer.cs - -../referencesource/System/compmod/system/componentmodel/AddingNewEventArgs.cs -../referencesource/System/compmod/system/componentmodel/AddingNewEventHandler.cs -../referencesource/System/compmod/system/componentmodel/AmbientValueAttribute.cs -../referencesource/System/compmod/system/componentmodel/ArrayConverter.cs -../referencesource/System/compmod/system/componentmodel/ArraySubsetEnumerator.cs -../referencesource/System/compmod/system/componentmodel/AsyncCompletedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/AsyncCompletedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/AsyncOperation.cs -../referencesource/System/compmod/system/componentmodel/AsyncOperationManager.cs -../referencesource/System/compmod/system/componentmodel/AttributeCollection.cs -../referencesource/System/compmod/system/componentmodel/AttributeProviderAttribute.cs -../referencesource/System/compmod/system/componentmodel/BackgroundWorker.cs -../referencesource/System/compmod/system/componentmodel/BaseComponentEditor.cs -../referencesource/System/compmod/system/componentmodel/basenumberconverter.cs -../referencesource/System/compmod/system/componentmodel/BindableAttribute.cs -../referencesource/System/compmod/system/componentmodel/BindableSupport.cs -../referencesource/System/compmod/system/componentmodel/BindingDirection.cs -../referencesource/System/compmod/system/componentmodel/BindingList.cs -../referencesource/System/compmod/system/componentmodel/BooleanConverter.cs -../referencesource/System/compmod/system/componentmodel/BrowsableAttribute.cs -../referencesource/System/compmod/system/componentmodel/ByteConverter.cs -../referencesource/System/compmod/system/componentmodel/CancelEventArgs.cs -../referencesource/System/compmod/system/componentmodel/CancelEventHandler.cs -../referencesource/System/compmod/system/componentmodel/CategoryAttribute.cs -../referencesource/System/compmod/system/componentmodel/CharConverter.cs -../referencesource/System/compmod/system/componentmodel/CollectionChangeAction.cs -../referencesource/System/compmod/system/componentmodel/CollectionChangeEventArgs.cs -../referencesource/System/compmod/system/componentmodel/CollectionChangeEventHandler.cs -../referencesource/System/compmod/system/componentmodel/CollectionConverter.cs -../referencesource/System/compmod/system/componentmodel/ComplexBindingPropertiesAttribute.cs -../referencesource/System/compmod/system/componentmodel/CompModSwitches.cs -../referencesource/System/compmod/system/componentmodel/Component.cs -../referencesource/System/compmod/system/componentmodel/ComponentCollection.cs -../referencesource/System/compmod/system/componentmodel/ComponentConverter.cs -../referencesource/System/compmod/system/componentmodel/ComponentResourceManager.cs -../referencesource/System/compmod/system/componentmodel/Container.cs -../referencesource/System/compmod/system/componentmodel/ContainerFilterService.cs -../referencesource/System/compmod/system/componentmodel/CultureInfoConverter.cs -../referencesource/System/compmod/system/componentmodel/CustomTypeDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DataErrorsChangedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/DataObjectAttribute.cs -../referencesource/System/compmod/system/componentmodel/DataObjectFieldAttribute.cs -../referencesource/System/compmod/system/componentmodel/DataObjectMethodAttribute.cs -../referencesource/System/compmod/system/componentmodel/DataObjectMethodType.cs -../referencesource/System/compmod/system/componentmodel/DateTimeConverter.cs -../referencesource/System/compmod/system/componentmodel/DateTimeOffsetConverter.cs -../referencesource/System/compmod/system/componentmodel/DebugExtendedPropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DebugReflectEventDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DebugReflectPropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DebugTypeDescriptor.cs -../referencesource/System/compmod/system/componentmodel/DecimalConverter.cs -../referencesource/System/compmod/system/componentmodel/DefaultBindingPropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/DefaultEventAttribute.cs -../referencesource/System/compmod/system/componentmodel/DefaultPropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/DefaultValueAttribute.cs -../referencesource/System/compmod/system/componentmodel/DelegatingTypeDescriptionProvider.cs -../referencesource/System/compmod/system/componentmodel/DescriptionAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/ActiveDocumentEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ActiveDocumentEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/CheckoutException.cs -../referencesource/System/compmod/system/componentmodel/design/CommandID.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentChangedEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentChangedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentChangingEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentChangingEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentRenameEvent.cs -../referencesource/System/compmod/system/componentmodel/design/ComponentRenameEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerOptionService.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerTransaction.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerTransactionCloseEvent.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerTransactionCloseEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerVerb.cs -../referencesource/System/compmod/system/componentmodel/design/DesignerVerbCollection.cs -../referencesource/System/compmod/system/componentmodel/design/DesigntimeLicenseContext.cs -../referencesource/System/compmod/system/componentmodel/design/DesigntimeLicenseContextSerializer.cs -../referencesource/System/compmod/system/componentmodel/design/DocumentCollection.cs -../referencesource/System/compmod/system/componentmodel/design/DocumentEventArgs.cs -../referencesource/System/compmod/system/componentmodel/design/DocumentEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/HelpContextType.cs -../referencesource/System/compmod/system/componentmodel/design/HelpKeywordAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/HelpKeywordType.cs -../referencesource/System/compmod/system/componentmodel/design/IComponentChangeService.cs -../referencesource/System/compmod/system/componentmodel/design/IComponentDiscoveryService.cs -../referencesource/System/compmod/system/componentmodel/design/IComponentInitializer.cs -../referencesource/System/compmod/system/componentmodel/design/IDesigner.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerEventService.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerFilter.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerHost.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerHostTransactionState.cs -../referencesource/System/compmod/system/componentmodel/design/IDesignerOptionService.cs -../referencesource/System/compmod/system/componentmodel/design/IDictionaryService.cs -../referencesource/System/compmod/system/componentmodel/design/IEventPropertyService.cs -../referencesource/System/compmod/system/componentmodel/design/IExtenderListService.cs -../referencesource/System/compmod/system/componentmodel/design/IExtenderProviderService.cs -../referencesource/System/compmod/system/componentmodel/design/IHelpService.cs -../referencesource/System/compmod/system/componentmodel/design/IInheritanceService.cs -../referencesource/System/compmod/system/componentmodel/design/IMenuCommandService.cs -../referencesource/System/compmod/system/componentmodel/design/InheritanceAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/InheritanceLevel.cs -../referencesource/System/compmod/system/componentmodel/design/IReferenceService.cs -../referencesource/System/compmod/system/componentmodel/design/IResourceService.cs -../referencesource/System/compmod/system/componentmodel/design/IRootDesigner.cs -../referencesource/System/compmod/system/componentmodel/design/ISelectionService.cs -../referencesource/System/compmod/system/componentmodel/design/IServiceObjectContainer.cs -../referencesource/System/compmod/system/componentmodel/design/ITreeDesigner.cs -../referencesource/System/compmod/system/componentmodel/design/ITypeDescriptorFilterService.cs -../referencesource/System/compmod/system/componentmodel/design/ITypeDiscoveryService.cs -../referencesource/System/compmod/system/componentmodel/design/ITypeResolutionService.cs -../referencesource/System/compmod/system/componentmodel/design/MenuCommand.cs -../referencesource/System/compmod/system/componentmodel/design/NotifyParentPropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/ParenthesizePropertyNameAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/PropertyTabAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/PropertyTabScope.cs -../referencesource/System/compmod/system/componentmodel/design/RefreshProperties.cs -../referencesource/System/compmod/system/componentmodel/design/RefreshPropertiesAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/SelectionTypes.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/ComponentSerializationService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/ContextStack.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/DefaultSerializationProviderAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/DesignerLoader.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/DesignerSerializerAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerLoaderHost.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerLoaderService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerSerializationManager.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerSerializationProvider.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/IDesignerSerializationService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/INameCreationService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/InstanceDescriptor.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/MemberRelationshipService.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/ResolveNameEventArgs.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/ResolveNameEventHandler.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/RootDesignerSerializerAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/serialization/SerializationStore.cs -../referencesource/System/compmod/system/componentmodel/design/ServiceCreatorCallback.cs -../referencesource/System/compmod/system/componentmodel/design/ServiceObjectContainer.cs -../referencesource/System/compmod/system/componentmodel/design/StandardCommands.cs -../referencesource/System/compmod/system/componentmodel/design/StandardToolWindows.cs -../referencesource/System/compmod/system/componentmodel/design/ToolboxItemAttribute.cs -../referencesource/System/compmod/system/componentmodel/design/ViewTechnology.cs -../referencesource/System/compmod/system/componentmodel/DesignerAttribute.cs -../referencesource/System/compmod/system/componentmodel/DesignerCategoryAttribute.cs -../referencesource/System/compmod/system/componentmodel/DesignerSerializationVisibility.cs -../referencesource/System/compmod/system/componentmodel/DesignerSerializationVisibilityAttribute.cs -../referencesource/System/compmod/system/componentmodel/DesignOnlyAttribute.cs -../referencesource/System/compmod/system/componentmodel/DesignTimeVisibleAttribute.cs -../referencesource/System/compmod/system/componentmodel/DisplayNameAttribute.cs -../referencesource/System/compmod/system/componentmodel/DoubleConverter.cs -../referencesource/System/compmod/system/componentmodel/DoWorkEventArgs.cs -../referencesource/System/compmod/system/componentmodel/DoWorkEventHandler.cs -../referencesource/System/compmod/system/componentmodel/EditorAttribute.cs -../referencesource/System/compmod/system/componentmodel/EditorBrowsableAttribute.cs -../referencesource/System/compmod/system/componentmodel/EnumConverter.cs -../referencesource/System/compmod/system/componentmodel/EventDescriptor.cs -../referencesource/System/compmod/system/componentmodel/EventDescriptorCollection.cs -../referencesource/System/compmod/system/componentmodel/EventHandlerList.cs -../referencesource/System/compmod/system/componentmodel/ExpandableObjectConverter.cs -../referencesource/System/compmod/system/componentmodel/ExtendedPropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/ExtenderProvidedPropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/FxCopSuppression.cs -../referencesource/System/compmod/system/componentmodel/GuidConverter.cs -../referencesource/System/compmod/system/componentmodel/HandledEventArgs.cs -../referencesource/System/compmod/system/componentmodel/HandledEventHandler.cs -../referencesource/System/compmod/system/componentmodel/IBindingList.cs -../referencesource/System/compmod/system/componentmodel/IBindingListView.cs -../referencesource/System/compmod/system/componentmodel/ICancelAddNew.cs -../referencesource/System/compmod/system/componentmodel/IChangeTracking.cs -../referencesource/System/compmod/system/componentmodel/IComNativeDescriptorHandler.cs -../referencesource/System/compmod/system/componentmodel/IComponent.cs -../referencesource/System/compmod/system/componentmodel/IContainer.cs -../referencesource/System/compmod/system/componentmodel/ICustomTypeDescriptor.cs -../referencesource/System/compmod/system/componentmodel/IDataErrorInfo.cs -../referencesource/System/compmod/system/componentmodel/IEditableObject.cs -../referencesource/System/compmod/system/componentmodel/IExtenderProvider.cs -../referencesource/System/compmod/system/componentmodel/IIntellisenseBuilder.cs -../referencesource/System/compmod/system/componentmodel/IListSource.cs -../referencesource/System/compmod/system/componentmodel/ImmutableObjectAttribute.cs -../referencesource/System/compmod/system/componentmodel/INestedContainer.cs -../referencesource/System/compmod/system/componentmodel/INestedSite.cs -../referencesource/System/compmod/system/componentmodel/InitializationEventAttribute.cs -../referencesource/System/compmod/system/componentmodel/INotifyDataErrorInfo.cs -../referencesource/System/compmod/system/componentmodel/INotifyPropertyChanged.cs -../referencesource/System/compmod/system/componentmodel/INotifyPropertyChanging.cs -../referencesource/System/compmod/system/componentmodel/InstallerTypeAttribute.cs -../referencesource/System/compmod/system/componentmodel/InstanceCreationEditor.cs -../referencesource/System/compmod/system/componentmodel/Int16Converter.cs -../referencesource/System/compmod/system/componentmodel/Int32Converter.cs -../referencesource/System/compmod/system/componentmodel/Int64Converter.cs -../referencesource/System/compmod/system/componentmodel/IntSecurity.cs -../referencesource/System/compmod/system/componentmodel/InvalidAsynchronousStateException.cs -../referencesource/System/compmod/system/componentmodel/InvalidEnumArgumentException.cs -../referencesource/System/compmod/system/componentmodel/IRaiseItemChangedEvents.cs -../referencesource/System/compmod/system/componentmodel/IRevertibleChangeTracking.cs -../referencesource/System/compmod/system/componentmodel/ISite.cs -../referencesource/System/compmod/system/componentmodel/ISupportInitialize.cs -../referencesource/System/compmod/system/componentmodel/ISupportInitializeNotification.cs -../referencesource/System/compmod/system/componentmodel/ISynchronizeInvoke.cs -../referencesource/System/compmod/system/componentmodel/ITypeDescriptorContext.cs -../referencesource/System/compmod/system/componentmodel/ITypedList.cs -../referencesource/System/compmod/system/componentmodel/License.cs -../referencesource/System/compmod/system/componentmodel/LicenseContext.cs -../referencesource/System/compmod/system/componentmodel/LicenseException.cs -../referencesource/System/compmod/system/componentmodel/LicenseManager.cs -../referencesource/System/compmod/system/componentmodel/LicenseProvider.cs -../referencesource/System/compmod/system/componentmodel/LicenseProviderAttribute.cs -../referencesource/System/compmod/system/componentmodel/LicenseUsageMode.cs -../referencesource/System/compmod/system/componentmodel/LicFileLicenseProvider.cs -../referencesource/System/compmod/system/componentmodel/ListBindableAttribute.cs -../referencesource/System/compmod/system/componentmodel/ListChangedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/ListChangedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/ListChangedType.cs -../referencesource/System/compmod/system/componentmodel/ListSortDescription.cs -../referencesource/System/compmod/system/componentmodel/ListSortDescriptionCollection.cs -../referencesource/System/compmod/system/componentmodel/ListSortDirection.cs -../referencesource/System/compmod/system/componentmodel/LocalizableAttribute.cs -../referencesource/System/compmod/system/componentmodel/LookupBindingPropertiesAttribute.cs -../referencesource/System/compmod/system/componentmodel/MarshalByValueComponent.cs -../referencesource/System/compmod/system/componentmodel/MaskedTextProvider.cs -../referencesource/System/compmod/system/componentmodel/MaskedTextResultHint.cs -../referencesource/System/compmod/system/componentmodel/MemberDescriptor.cs -../referencesource/System/compmod/system/componentmodel/MergablePropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/MultilineStringConverter.cs -../referencesource/System/compmod/system/componentmodel/NestedContainer.cs -../referencesource/System/compmod/system/componentmodel/NullableConverter.cs -../referencesource/System/compmod/system/componentmodel/PasswordPropertyTextAttribute.cs -../referencesource/System/compmod/system/componentmodel/ProgressChangedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/ProgressChangedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/PropertyChangedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/PropertyChangedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/PropertyChangingEventArgs.cs -../referencesource/System/compmod/system/componentmodel/PropertyChangingEventHandler.cs -../referencesource/System/compmod/system/componentmodel/PropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/PropertyDescriptorCollection.cs -../referencesource/System/compmod/system/componentmodel/ProvidePropertyAttribute.cs -../referencesource/System/compmod/system/componentmodel/ReadOnlyAttribute.cs -../referencesource/System/compmod/system/componentmodel/RecommendedAsConfigurableAttribute.cs -../referencesource/System/compmod/system/componentmodel/ReferenceConverter.cs -../referencesource/System/compmod/system/componentmodel/ReflectEventDescriptor.cs -../referencesource/System/compmod/system/componentmodel/ReflectPropertyDescriptor.cs -../referencesource/System/compmod/system/componentmodel/ReflectTypeDescriptionProvider.cs -../referencesource/System/compmod/system/componentmodel/RefreshEventArgs.cs -../referencesource/System/compmod/system/componentmodel/RefreshEventHandler.cs -../referencesource/System/compmod/system/componentmodel/RunInstallerAttribute.cs -../referencesource/System/compmod/system/componentmodel/RunWorkerCompletedEventArgs.cs -../referencesource/System/compmod/system/componentmodel/RunWorkerCompletedEventHandler.cs -../referencesource/System/compmod/system/componentmodel/SByteConverter.cs -../referencesource/System/compmod/system/componentmodel/SettingsBindableAttribute.cs -../referencesource/System/compmod/system/componentmodel/SingleConverter.cs -../referencesource/System/compmod/system/componentmodel/StringConverter.cs -../referencesource/System/compmod/system/componentmodel/SyntaxCheck.cs -../referencesource/System/compmod/system/componentmodel/TimeSpanConverter.cs -../referencesource/System/compmod/system/componentmodel/ToolboxItemFilterAttribute.cs -../referencesource/System/compmod/system/componentmodel/ToolboxItemFilterType.cs -../referencesource/System/compmod/system/componentmodel/TypeConverter.cs -../referencesource/System/compmod/system/componentmodel/TypeConverterAttribute.cs -../referencesource/System/compmod/system/componentmodel/TypeDescriptionProvider.cs -../referencesource/System/compmod/system/componentmodel/TypeDescriptionProviderAttribute.cs -../referencesource/System/compmod/system/componentmodel/TypeDescriptionProviderService.cs -../referencesource/System/compmod/system/componentmodel/TypeDescriptor.cs -../referencesource/System/compmod/system/componentmodel/TypeListConverter.cs -../referencesource/System/compmod/system/componentmodel/UInt16Converter.cs -../referencesource/System/compmod/system/componentmodel/UInt32Converter.cs -../referencesource/System/compmod/system/componentmodel/UInt64Converter.cs -../referencesource/System/compmod/system/componentmodel/WarningException.cs -../referencesource/System/compmod/system/componentmodel/Win32Exception.cs - -../referencesource/System/compmod/system/diagnostics/AssertSection.cs -../referencesource/System/compmod/system/diagnostics/BooleanSwitch.cs -../referencesource/System/compmod/system/diagnostics/CorrelationManager.cs -../referencesource/System/compmod/system/diagnostics/Debug.cs -../referencesource/System/compmod/system/diagnostics/DelimitedListTraceListener.cs -../referencesource/System/compmod/system/diagnostics/DiagnosticsConfiguration.cs -../referencesource/System/compmod/system/diagnostics/ListenerElementsCollection.cs -../referencesource/System/compmod/system/diagnostics/SeverityFilter.cs -../referencesource/System/compmod/system/diagnostics/SourceFilter.cs -../referencesource/System/compmod/system/diagnostics/SourceLevels.cs -../referencesource/System/compmod/system/diagnostics/SourceSwitch.cs -../referencesource/System/compmod/system/diagnostics/SwitchAttribute.cs -../referencesource/System/compmod/system/diagnostics/Switch.cs -../referencesource/System/compmod/system/diagnostics/SwitchLevelAttribute.cs -../referencesource/System/compmod/system/diagnostics/Trace.cs -../referencesource/System/compmod/system/diagnostics/TraceEventCache.cs -../referencesource/System/compmod/system/diagnostics/TraceEventType.cs -../referencesource/System/compmod/system/diagnostics/TraceFilter.cs -../referencesource/System/compmod/system/diagnostics/TraceInternal.cs -../referencesource/System/compmod/system/diagnostics/TraceLevel.cs -../referencesource/System/compmod/system/diagnostics/TraceListener.cs -../referencesource/System/compmod/system/diagnostics/TraceListeners.cs -../referencesource/System/compmod/system/diagnostics/TraceOptions.cs -../referencesource/System/compmod/system/diagnostics/TraceSource.cs -../referencesource/System/compmod/system/diagnostics/TraceSwitch.cs -../referencesource/System/compmod/system/diagnostics/traceutils.cs - -../referencesource/System/net/System/_DomainName.cs -../referencesource/System/net/System/_IPv4Address.cs -../referencesource/System/net/System/_IPv6Address.cs -../referencesource/System/net/System/_UncName.cs -../referencesource/System/net/System/_UriSyntax.cs -../referencesource/System/net/System/GenericUriParser.cs -../referencesource/System/net/System/IriHelper.cs -../referencesource/System/net/System/URI.cs -../referencesource/System/net/System/uribuilder.cs -../referencesource/System/net/System/UriEnumTypes.cs -../referencesource/System/net/System/UriExt.cs -../referencesource/System/net/System/URIFormatException.cs -../referencesource/System/net/System/UriHelper.cs -../referencesource/System/net/System/UriHostNameType.cs -../referencesource/System/net/System/UriParserTemplates.cs -../referencesource/System/net/System/URIPartial.cs -../referencesource/System/net/System/UriScheme.cs - -../referencesource/System/net/System/Net/_BufferOffsetSize.cs -../referencesource/System/net/System/Net/_Connection.cs -../referencesource/System/net/System/Net/_emptywebproxy.cs -../referencesource/System/net/System/Net/_HeaderInfo.cs -../referencesource/System/net/System/Net/_HeaderInfoTable.cs -../referencesource/System/net/System/Net/_HTTPDateParse.cs -../referencesource/System/net/System/Net/_IStreams.cs -../referencesource/System/net/System/Net/_NetRes.cs -../referencesource/System/net/System/Net/_LazyAsyncResult.cs -../referencesource/System/net/System/Net/_LoggingObject.cs -../referencesource/System/net/System/Net/_PooledStream.cs -../referencesource/System/net/System/Net/_ProxyChain.cs -../referencesource/System/net/System/Net/_ScatterGatherBuffers.cs -../referencesource/System/net/System/Net/_Semaphore.cs -../referencesource/System/net/System/Net/_ServiceNameStore.cs -../referencesource/System/net/System/Net/_TimerThread.cs -../referencesource/System/net/System/Net/_WebProxyDataBuilder.cs -../referencesource/System/net/System/Net/AuthenticationScheme.cs -../referencesource/System/net/System/Net/AuthenticationSchemeSelector.cs -../referencesource/System/net/System/Net/Authorization.cs -../referencesource/System/net/System/Net/CredentialCache.cs -../referencesource/System/net/System/Net/cookie.cs -../referencesource/System/net/System/Net/cookiecollection.cs -../referencesource/System/net/System/Net/cookiecontainer.cs -../referencesource/System/net/System/Net/cookieexception.cs -../referencesource/System/net/System/Net/connectionpool.cs -../referencesource/System/net/System/Net/DnsEndPoint.cs -../referencesource/System/net/System/Net/EndPoint.cs -../referencesource/System/net/System/Net/FtpStatusCode.cs -../referencesource/System/net/System/Net/filewebrequest.cs -../referencesource/System/net/System/Net/filewebresponse.cs -../referencesource/System/net/System/Net/GlobalProxySelection.cs -../referencesource/System/net/System/Net/HttpListenerException.cs -../referencesource/System/net/System/Net/HttpListenerRequestUriBuilder.cs -../referencesource/System/net/System/Net/HttpRequestHeader.cs -../referencesource/System/net/System/Net/HttpResponseHeader.cs -../referencesource/System/net/System/Net/HttpStatusCode.cs -../referencesource/System/net/System/Net/HttpVersion.cs -../referencesource/System/net/System/Net/IAuthenticationModule.cs -../referencesource/System/net/System/Net/ICertificatePolicy.cs -../referencesource/System/net/System/Net/ICredentials.cs -../referencesource/System/net/System/Net/ICredentialsByHost.cs -../referencesource/System/net/System/Net/Internal.cs -../referencesource/System/net/System/Net/IPAddress.cs -../referencesource/System/net/System/Net/IPEndPoint.cs -../referencesource/System/net/System/Net/IPHostEntry.cs -../referencesource/System/net/System/Net/iwebproxy.cs -../referencesource/System/net/System/Net/IWebProxyFinder.cs -../referencesource/System/net/System/Net/IWebRequestCreate.cs -../referencesource/System/net/System/Net/NetworkAccess.cs -../referencesource/System/net/System/Net/NetworkCredential.cs -../referencesource/System/net/System/Net/ProtocolViolationException.cs -../referencesource/System/net/System/Net/TransportContext.cs -../referencesource/System/net/System/Net/TransportType.cs -../referencesource/System/net/System/Net/UnicodeDecodingConformance.cs -../referencesource/System/net/System/Net/UnicodeEncodingConformance.cs -../referencesource/System/net/System/Net/ServicePointManager.cs -../referencesource/System/net/System/Net/SocketAddress.cs -../referencesource/System/net/System/Net/SocketException.cs -../referencesource/System/net/System/Net/webclient.cs -../referencesource/System/net/System/Net/WebException.cs -../referencesource/System/net/System/Net/WebExceptionStatus.cs -../referencesource/System/net/System/Net/WebHeaderCollection.cs -../referencesource/System/net/System/Net/WebPermission.cs -../referencesource/System/net/System/Net/webproxy.cs -../referencesource/System/net/System/Net/WebRequestMethods.cs -../referencesource/System/net/System/Net/WebRequest.cs -../referencesource/System/net/System/Net/WebResponse.cs -../referencesource/System/net/System/Net/WebUtility.cs -../referencesource/System/net/System/Net/WriteStreamClosedEventArgs.cs - -../referencesource/System/net/System/Net/Cache/RequestCache.cs -../referencesource/System/net/System/Net/Cache/RequestCacheEntry.cs -../referencesource/System/net/System/Net/Cache/RequestCachePolicy.cs -../referencesource/System/net/System/Net/Cache/RequestCacheManager.cs - -../referencesource/System/net/System/Net/Configuration/DefaultProxySection.cs - -../referencesource/System/net/System/Net/Sockets/_MultipleConnectAsync.cs -../referencesource/System/net/System/Net/Sockets/AddressFamily.cs -../referencesource/System/net/System/Net/Sockets/IOControlCode.cs -../referencesource/System/net/System/Net/Sockets/IPPacketInformation.cs -../referencesource/System/net/System/Net/Sockets/IPProtectionLevel.cs -../referencesource/System/net/System/Net/Sockets/LingerOption.cs -../referencesource/System/net/System/Net/Sockets/MulticastOption.cs -../referencesource/System/net/System/Net/Sockets/NetworkStream.cs -../referencesource/System/net/System/Net/Sockets/ProtocolFamily.cs -../referencesource/System/net/System/Net/Sockets/ProtocolType.cs -../referencesource/System/net/System/Net/Sockets/SelectMode.cs -../referencesource/System/net/System/Net/Sockets/Socket.cs -../referencesource/System/net/System/Net/Sockets/SocketErrors.cs -../referencesource/System/net/System/Net/Sockets/SocketFlags.cs -../referencesource/System/net/System/Net/Sockets/SocketInformation.cs -../referencesource/System/net/System/Net/Sockets/SocketInformationOptions.cs -../referencesource/System/net/System/Net/Sockets/SocketOptionLevel.cs -../referencesource/System/net/System/Net/Sockets/SocketOptionName.cs -../referencesource/System/net/System/Net/Sockets/SocketShutdown.cs -../referencesource/System/net/System/Net/Sockets/SocketType.cs -../referencesource/System/net/System/Net/Sockets/TCPClient.cs -../referencesource/System/net/System/Net/Sockets/TCPListener.cs -../referencesource/System/net/System/Net/Sockets/TransmitFileFlags.cs -../referencesource/System/net/System/Net/Sockets/UdpReceiveResult.cs -../referencesource/System/net/System/Net/Sockets/UDPClient.cs - -../referencesource/System/net/System/Net/NetworkInformation/DuplicateAddressDetectionState.cs -../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/GatewayIPAddressInformationCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/IPAddressCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/IPAddressInformationCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/IPGlobalProperties.cs -../referencesource/System/net/System/Net/NetworkInformation/IPGlobalStatistics.cs -../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceProperties.cs -../referencesource/System/net/System/Net/NetworkInformation/IPInterfaceStatistics.cs -../referencesource/System/net/System/Net/NetworkInformation/IPStatus.cs -../referencesource/System/net/System/Net/NetworkInformation/IPv4InterfaceProperties.cs -../referencesource/System/net/System/Net/NetworkInformation/IPv6InterfaceProperties.cs -../referencesource/System/net/System/Net/NetworkInformation/IcmpV4Statistics.cs -../referencesource/System/net/System/Net/NetworkInformation/IcmpV6Statistics.cs -../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/MulticastIPAddressInformationCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkAddressChange.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationException.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkInformationPermission.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkInterface.cs -../referencesource/System/net/System/Net/NetworkInformation/NetworkInterfaceComponent.cs -../referencesource/System/net/System/Net/NetworkInformation/OperationalStatus.cs -../referencesource/System/net/System/Net/NetworkInformation/PhysicalAddress.cs -../referencesource/System/net/System/Net/NetworkInformation/PingOptions.cs -../referencesource/System/net/System/Net/NetworkInformation/PingReply.cs -../referencesource/System/net/System/Net/NetworkInformation/PrefixOrigin.cs -../referencesource/System/net/System/Net/NetworkInformation/ScopeLevel.cs -../referencesource/System/net/System/Net/NetworkInformation/SuffixOrigin.cs -../referencesource/System/net/System/Net/NetworkInformation/SystemGatewayIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/SystemIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/SystemMulticastIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/SystemTcpConnection.cs -../referencesource/System/net/System/Net/NetworkInformation/TcpConnection.cs -../referencesource/System/net/System/Net/NetworkInformation/TcpState.cs -../referencesource/System/net/System/Net/NetworkInformation/TcpStatistics.cs -../referencesource/System/net/System/Net/NetworkInformation/UdpStatistics.cs -../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformation.cs -../referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformationCollection.cs -../referencesource/System/net/System/Net/NetworkInformation/interfacetype.cs -../referencesource/System/net/System/Net/NetworkInformation/nodetype.cs -../referencesource/System/net/System/Net/NetworkInformation/pingexception.cs - -../referencesource/System/sys/system/Diagnostics/CodeAnalysis/ExcludeFromCodeCoverageAttribute.cs - -../referencesource/System/sys/system/IO/ports/InternalResources.cs - -../referencesource/System/sys/system/runtime/interopservices/DefaultParameterValueAttribute.cs -../referencesource/System/sys/system/runtime/interopservices/handlecollector.cs - -../referencesource/System/sys/system/runtime/versioning/FrameworkName.cs - -../referencesource/System/sys/system/threading/Barrier.cs -../referencesource/System/sys/system/threading/semaphore.cs - -../referencesource/System/sys/system/windows/markup/ValueSerializerAttribute.cs - -../referencesource/System/security/system/security/Authentication/ExtendedProtection/TokenBinding.cs -../referencesource/System/security/system/security/Authentication/ExtendedProtection/ServiceNameCollection.cs - -../referencesource/System/security/system/security/cryptography/oid.cs - -../referencesource/System/security/system/security/cryptography/x509/x509utils.cs - -../referencesource/System/security/system/security/permissions/typedescriptorpermission.cs - -../referencesource/System/services/monitoring/system/diagnosticts/ProcessModuleCollection.cs -../referencesource/System/services/monitoring/system/diagnosticts/ProcessThreadCollection.cs - -../referencesource/System/services/timers/system/timers/ElapsedEventHandler.cs -../referencesource/System/services/timers/system/timers/Timer.cs -../referencesource/System/services/timers/system/timers/TimersDescriptionAttribute.cs - -../referencesource/System/misc/hresults.cs -../referencesource/System/misc/invariantcomparer.cs -../referencesource/System/misc/SecurityUtils.cs -../referencesource/System/misc/WeakHashtable.cs - -../referencesource/System/compmod/system/diagnostics/TextWriterTraceListener.cs - -../referencesource/System/services/monitoring/system/diagnosticts/AsyncStreamReader.cs -../referencesource/System/services/monitoring/system/diagnosticts/Process.cs -../referencesource/System/services/monitoring/system/diagnosticts/ProcessStartInfo.cs -../referencesource/System/services/monitoring/system/diagnosticts/processwaithandle.cs - -../referencesource/System/compmod/microsoft/win32/safehandles/SafeProcessHandle.cs - -../Mono.Security/Mono.Security.Authenticode/PrivateKey.cs -../Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs -../Mono.Security/Mono.Security.Cryptography/TlsHMAC.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/MessageBase.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/NtlmFlags.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/NtlmSettings.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/Type1Message.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/Type2Message.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/Type3Message.cs -../Mono.Security/Mono.Security.Protocol.Tls/Alert.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs -../Mono.Security/Mono.Security.Protocol.Tls/ClientContext.cs -../Mono.Security/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs -../Mono.Security/Mono.Security.Protocol.Tls/ClientSessionCache.cs -../Mono.Security/Mono.Security.Protocol.Tls/ContentType.cs -../Mono.Security/Mono.Security.Protocol.Tls/Context.cs -../Mono.Security/Mono.Security.Protocol.Tls/DebugHelper.cs -../Mono.Security/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs -../Mono.Security/Mono.Security.Protocol.Tls/HandshakeState.cs -../Mono.Security/Mono.Security.Protocol.Tls/HashAlgorithmType.cs -../Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs -../Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs -../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs -../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs -../Mono.Security/Mono.Security.Protocol.Tls/SecurityCompressionType.cs -../Mono.Security/Mono.Security.Protocol.Tls/SecurityParameters.cs -../Mono.Security/Mono.Security.Protocol.Tls/SecurityProtocolType.cs -../Mono.Security/Mono.Security.Protocol.Tls/ServerContext.cs -../Mono.Security/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslCipherSuite.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslHandshakeHash.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuite.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsClientSettings.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsException.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsServerSettings.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs -../Mono.Security/Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs -../Mono.Security/Mono.Security.X509.Extensions/ExtendedKeyUsageExtension.cs -../Mono.Security/Mono.Security.X509.Extensions/GeneralNames.cs -../Mono.Security/Mono.Security.X509.Extensions/NetscapeCertTypeExtension.cs -../Mono.Security/Mono.Security.X509.Extensions/SubjectAltNameExtension.cs - -../Mono.Security/Mono.Security.Interface/Alert.cs -../Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs -../Mono.Security/Mono.Security.Interface/CipherAlgorithmType.cs -../Mono.Security/Mono.Security.Interface/CipherSuiteCode.cs -../Mono.Security/Mono.Security.Interface/ExchangeAlgorithmType.cs -../Mono.Security/Mono.Security.Interface/HashAlgorithmType.cs -../Mono.Security/Mono.Security.Interface/IBufferOffsetSize.cs -../Mono.Security/Mono.Security.Interface/IMonoTlsEventSink.cs -../Mono.Security/Mono.Security.Interface/IMonoSslStream.cs -../Mono.Security/Mono.Security.Interface/MonoTlsConnectionInfo.cs -../Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs -../Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.cs -../Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs -../Mono.Security/Mono.Security.Interface/TlsException.cs -../Mono.Security/Mono.Security.Interface/TlsProtocolCode.cs -../Mono.Security/Mono.Security.Interface/TlsProtocols.cs - -System.Runtime.InteropServices.ComTypes/ADVF.cs -System.Runtime.InteropServices.ComTypes/DATADIR.cs -System.Runtime.InteropServices.ComTypes/DVASPECT.cs -System.Runtime.InteropServices.ComTypes/FORMATETC.cs -System.Runtime.InteropServices.ComTypes/IAdviseSink.cs -System.Runtime.InteropServices.ComTypes/IDataObject.cs -System.Runtime.InteropServices.ComTypes/IEnumFORMATETC.cs -System.Runtime.InteropServices.ComTypes/IEnumSTATDATA.cs -System.Runtime.InteropServices.ComTypes/STATDATA.cs -System.Runtime.InteropServices.ComTypes/STGMEDIUM.cs -System.Runtime.InteropServices.ComTypes/TYMED.cs diff --git a/mcs/class/System/monodroid_System_test.dll.exclude.sources b/mcs/class/System/monodroid_System_test.dll.exclude.sources index 799115c396c..8b8f4861a48 100644 --- a/mcs/class/System/monodroid_System_test.dll.exclude.sources +++ b/mcs/class/System/monodroid_System_test.dll.exclude.sources @@ -1,4 +1,4 @@ -#include aot_only_System_test.dll.exclude.sources +#include testing_aot_full_System_test.dll.exclude.sources #include monodroid_System_test.dll.new-exclude.sources Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs diff --git a/mcs/class/System/monotouch_System.dll.sources b/mcs/class/System/monotouch_System.dll.sources index 5068573588b..8d2f2fdbbc4 100644 --- a/mcs/class/System/monotouch_System.dll.sources +++ b/mcs/class/System/monotouch_System.dll.sources @@ -1,5 +1,5 @@ #include mobile_System.dll.sources -Mono.Util/MonoPInvokeCallbackAttribute.cs -Assembly/AssemblyInfoEx.cs + +System.Net/MacProxy.cs + Mono.Net.Security/MonoTlsProviderFactory.Apple.cs -../Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs diff --git a/mcs/class/System/monotouch_watch_System.dll.exclude.sources b/mcs/class/System/monotouch_watch_System.dll.exclude.sources index 8d7969bf906..d5e3ca4f944 100644 --- a/mcs/class/System/monotouch_watch_System.dll.exclude.sources +++ b/mcs/class/System/monotouch_watch_System.dll.exclude.sources @@ -1,91 +1,3 @@ -../Mono.Security/Mono.Security.Authenticode/PrivateKey.cs -../Mono.Security/Mono.Security.Cryptography/MD5SHA1.cs -../Mono.Security/Mono.Security.Cryptography/TlsHMAC.cs -../Mono.Security/Mono.Security.Interface/Alert.cs -../Mono.Security/Mono.Security.Interface/CertificateValidationHelper.cs -../Mono.Security/Mono.Security.Interface/CipherAlgorithmType.cs -../Mono.Security/Mono.Security.Interface/CipherSuiteCode.cs -../Mono.Security/Mono.Security.Interface/ExchangeAlgorithmType.cs -../Mono.Security/Mono.Security.Interface/HashAlgorithmType.cs -../Mono.Security/Mono.Security.Interface/IBufferOffsetSize.cs -../Mono.Security/Mono.Security.Interface/IMonoSslStream.cs -../Mono.Security/Mono.Security.Interface/IMonoTlsContext.cs -../Mono.Security/Mono.Security.Interface/IMonoTlsEventSink.cs -../Mono.Security/Mono.Security.Interface/MonoTlsConnectionInfo.cs -../Mono.Security/Mono.Security.Interface/MonoTlsProvider.cs -../Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs -../Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.cs -../Mono.Security/Mono.Security.Interface/MonoTlsSettings.cs -../Mono.Security/Mono.Security.Interface/TlsException.cs -../Mono.Security/Mono.Security.Interface/TlsProtocolCode.cs -../Mono.Security/Mono.Security.Interface/TlsProtocols.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/MessageBase.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/NtlmFlags.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/NtlmSettings.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/Type1Message.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/Type2Message.cs -../Mono.Security/Mono.Security.Protocol.Ntlm/Type3Message.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientCertificateVerify.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsClientKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerCertificateRequest.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerHelloDone.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Client/TlsServerKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientCertificateVerify.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificate.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerCertificateRequest.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerFinished.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHello.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerHelloDone.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsServerKeyExchange.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake/ClientCertificateType.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs -../Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeType.cs -../Mono.Security/Mono.Security.Protocol.Tls/Alert.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherAlgorithmType.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherSuite.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteCollection.cs -../Mono.Security/Mono.Security.Protocol.Tls/CipherSuiteFactory.cs -../Mono.Security/Mono.Security.Protocol.Tls/ClientContext.cs -../Mono.Security/Mono.Security.Protocol.Tls/ClientRecordProtocol.cs -../Mono.Security/Mono.Security.Protocol.Tls/ClientSessionCache.cs -../Mono.Security/Mono.Security.Protocol.Tls/ContentType.cs -../Mono.Security/Mono.Security.Protocol.Tls/Context.cs -../Mono.Security/Mono.Security.Protocol.Tls/DebugHelper.cs -../Mono.Security/Mono.Security.Protocol.Tls/ExchangeAlgorithmType.cs -../Mono.Security/Mono.Security.Protocol.Tls/HandshakeState.cs -../Mono.Security/Mono.Security.Protocol.Tls/HashAlgorithmType.cs -../Mono.Security/Mono.Security.Protocol.Tls/HttpsClientStream.cs -../Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs -../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureDeformatter.cs -../Mono.Security/Mono.Security.Protocol.Tls/RSASslSignatureFormatter.cs -../Mono.Security/Mono.Security.Protocol.Tls/SecurityCompressionType.cs -../Mono.Security/Mono.Security.Protocol.Tls/SecurityParameters.cs -../Mono.Security/Mono.Security.Protocol.Tls/SecurityProtocolType.cs -../Mono.Security/Mono.Security.Protocol.Tls/ServerContext.cs -../Mono.Security/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslCipherSuite.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslClientStream.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslHandshakeHash.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslServerStream.cs -../Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsCipherSuite.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsClientSettings.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsException.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsServerSettings.cs -../Mono.Security/Mono.Security.Protocol.Tls/TlsStream.cs Mono.Http/NtlmClient.cs Mono.Net.Security/AsyncProtocolRequest.cs Mono.Net.Security/CallbackHelpers.cs diff --git a/mcs/class/System/monotouch_watch_System.dll.sources b/mcs/class/System/monotouch_watch_System.dll.sources index f7e73d81e36..60e5cae4053 100644 --- a/mcs/class/System/monotouch_watch_System.dll.sources +++ b/mcs/class/System/monotouch_watch_System.dll.sources @@ -18,3 +18,4 @@ System.Net/HttpWebRequest.platformnotsupported.cs System.Net/HttpWebResponse.platformnotsupported.cs System.Net/ServicePoint.platformnotsupported.cs System.Net/ServicePointManager.platformnotsupported.cs +../Mono.Security/Mono.Security.X509.Extensions/AuthorityKeyIdentifierExtension.cs diff --git a/mcs/class/System/net_4_x_System.dll.sources b/mcs/class/System/net_4_x_System.dll.sources new file mode 100644 index 00000000000..a84f4b08af0 --- /dev/null +++ b/mcs/class/System/net_4_x_System.dll.sources @@ -0,0 +1,370 @@ +#include common.sources + +Microsoft.CSharp/CSharpCodeCompiler.cs +Microsoft.CSharp/CSharpCodeGenerator.cs +Microsoft.CSharp/CSharpCodeProvider.cs +Microsoft.VisualBasic/VBCodeCompiler.cs +Microsoft.VisualBasic/VBCodeGenerator.cs +Microsoft.VisualBasic/VBCodeProvider.cs +Microsoft.Win32/IntranetZoneCredentialPolicy.cs +Microsoft.Win32/PowerModeChangedEventArgs.cs +Microsoft.Win32/PowerModeChangedEventHandler.cs +Microsoft.Win32/PowerModes.cs +Microsoft.Win32/SessionEndedEventArgs.cs +Microsoft.Win32/SessionEndedEventHandler.cs +Microsoft.Win32/SessionEndingEventArgs.cs +Microsoft.Win32/SessionEndingEventHandler.cs +Microsoft.Win32/SessionEndReasons.cs +Microsoft.Win32/SessionSwitchEventArgs.cs +Microsoft.Win32/SessionSwitchEventHandler.cs +Microsoft.Win32/SessionSwitchReason.cs +Microsoft.Win32/SystemEvents.cs +Microsoft.Win32/TimerElapsedEventArgs.cs +Microsoft.Win32/TimerElapsedEventHandler.cs +Microsoft.Win32/UserPreferenceCategory.cs +Microsoft.Win32/UserPreferenceChangedEventArgs.cs +Microsoft.Win32/UserPreferenceChangedEventHandler.cs +Microsoft.Win32/UserPreferenceChangingEventArgs.cs +Microsoft.Win32/UserPreferenceChangingEventHandler.cs + +System/MonoToolsLocator.cs + +System.CodeDom.Compiler/CodeCompiler.cs +System.CodeDom.Compiler/CodeDomConfigurationHandler.cs +System.CodeDom.Compiler/CodeDomProvider.cs +System.CodeDom.Compiler/CodeParser.cs +System.CodeDom.Compiler/Compiler.cs +System.CodeDom.Compiler/CompilerCollection.cs +System.CodeDom.Compiler/CompilerInfo.cs +System.CodeDom.Compiler/CompilerProviderOption.cs +System.CodeDom.Compiler/CompilerProviderOptionsCollection.cs +System.CodeDom.Compiler/CompilerResults.cs +System.CodeDom.Compiler/Executor.cs +System.CodeDom.Compiler/TempFileCollection.cs +System.Configuration/ApplicationScopedSettingAttribute.cs +System.Configuration/ApplicationSettingsBase.cs +System.Configuration/ApplicationSettingsGroup.cs +System.Configuration/AppSettingsReader.cs +System.Configuration/ClientSettingsSection.cs +System.Configuration/ConfigHelper.cs +System.Configuration/ConfigurationException.cs +System.Configuration/ConfigurationSettings.cs +System.Configuration/ConfigXmlDocument.cs +System.Configuration/CustomizableFileSettingsProvider.cs +System.Configuration/DefaultSettingValueAttribute.cs +System.Configuration/DictionarySectionHandler.cs +System.Configuration/IApplicationSettingsProvider.cs +System.Configuration/IConfigurationSectionHandler.cs +System.Configuration/IConfigurationSystem.cs +System.Configuration/IConfigXmlNode.cs +System.Configuration/IdnElement.cs +System.Configuration/IgnoreSectionHandler.cs +System.Configuration/IriParsingElement.cs +System.Configuration/IPersistComponentSettings.cs +System.Configuration/ISettingsProviderService.cs +System.Configuration/LocalFileSettingsProvider.cs +System.Configuration/NameValueFileSectionHandler.cs +System.Configuration/NameValueSectionHandler.cs +System.Configuration/NoSettingsVersionUpgradeAttribute.cs +System.Configuration/SettingAttribute.cs +System.Configuration/SettingChangingEventArgs.cs +System.Configuration/SettingChangingEventHandler.cs +System.Configuration/SettingElementCollection.cs +System.Configuration/SettingElement.cs +System.Configuration/SettingsAttributeDictionary.cs +System.Configuration/SettingsBase.cs +System.Configuration/SettingsContext.cs +System.Configuration/SettingsLoadedEventArgs.cs +System.Configuration/SettingsLoadedEventHandler.cs +System.Configuration/SettingsPropertyCollection.cs +System.Configuration/SettingsProperty.cs +System.Configuration/SettingsPropertyIsReadOnlyException.cs +System.Configuration/SettingsPropertyNotFoundException.cs +System.Configuration/SettingsPropertyValueCollection.cs +System.Configuration/SettingsPropertyValue.cs +System.Configuration/SettingsPropertyWrongTypeException.cs +System.Configuration/SettingsProviderAttribute.cs +System.Configuration/SettingsProviderCollection.cs +System.Configuration/SettingsProvider.cs +System.Configuration/SettingsSavingEventHandler.cs +System.Configuration/SettingsSerializeAsAttribute.cs +System.Configuration/SettingsSerializeAs.cs +System.Configuration/SettingValueElement.cs +System.Configuration/SettingsManageability.cs +System.Configuration/SettingsManageabilityAttribute.cs +System.Configuration/SettingsGroupDescriptionAttribute.cs +System.Configuration/SettingsDescriptionAttribute.cs +System.Configuration/SettingsGroupNameAttribute.cs +System.Configuration/SingleTagSectionHandler.cs +System.Configuration/SpecialSetting.cs +System.Configuration/SpecialSettingAttribute.cs +System.Configuration/UriSection.cs +System.Configuration/UserSettingsGroup.cs +System.Configuration/UserScopedSettingAttribute.cs + +System.Diagnostics/AlphabeticalEnumConverter.cs +System.Diagnostics/CounterCreationDataCollection.cs +System.Diagnostics/CounterCreationData.cs +System.Diagnostics/CounterSampleCalculator.cs +System.Diagnostics/CounterSample.cs +System.Diagnostics/DiagnosticsConfigurationHandler.cs +System.Diagnostics/EntryWrittenEventArgs.cs +System.Diagnostics/EntryWrittenEventHandler.cs +System.Diagnostics/EventInstance.cs +System.Diagnostics/EventLog.cs +System.Diagnostics/EventLogEntryCollection.cs +System.Diagnostics/EventLogEntry.cs +System.Diagnostics/EventLogEntryType.cs +System.Diagnostics/EventLogImpl.cs +System.Diagnostics/EventLogInstaller.cs +System.Diagnostics/EventLogPermissionAccess.cs +System.Diagnostics/EventLogPermissionAttribute.cs +System.Diagnostics/EventLogPermission.cs +System.Diagnostics/EventLogPermissionEntryCollection.cs +System.Diagnostics/EventLogPermissionEntry.cs +System.Diagnostics/EventLogTraceListener.cs +System.Diagnostics/EventSourceCreationData.cs +System.Diagnostics/ICollectData.cs +System.Diagnostics/InstanceDataCollectionCollection.cs +System.Diagnostics/InstanceDataCollection.cs +System.Diagnostics/InstanceData.cs +System.Diagnostics/LocalFileEventLog.cs +System.Diagnostics/NullEventLog.cs +System.Diagnostics/OverflowAction.cs +System.Diagnostics/PerformanceCounterCategory.cs +System.Diagnostics/PerformanceCounterCategoryType.cs +System.Diagnostics/PerformanceCounter.cs +System.Diagnostics/PerformanceCounterInstaller.cs +System.Diagnostics/PerformanceCounterInstanceLifetime.cs +System.Diagnostics/PerformanceCounterManager.cs +System.Diagnostics/PerformanceCounterPermissionAccess.cs +System.Diagnostics/PerformanceCounterPermissionAttribute.cs +System.Diagnostics/PerformanceCounterPermission.cs +System.Diagnostics/PerformanceCounterPermissionEntryCollection.cs +System.Diagnostics/PerformanceCounterPermissionEntry.cs +System.Diagnostics/PerformanceCounterType.cs +System.Diagnostics/TraceSourceInfo.cs +System.Diagnostics/Win32EventLog.cs + +System.IO/DefaultWatcher.cs +System.IO/FAMWatcher.cs +System.IO/NullFileWatcher.cs +System.IO/FileAction.cs +System.IO/FileSystemWatcher.cs +System.IO/IFileWatcher.cs +System.IO/InotifyWatcher.cs +System.IO/KeventWatcher.cs +System.IO/SearchPattern.cs +System.IO/WindowsWatcher.cs + +System.IO.Ports/Handshake.cs +System.IO.Ports/ISerialStream.cs +System.IO.Ports/Parity.cs +System.IO.Ports/SerialData.cs +System.IO.Ports/SerialError.cs +System.IO.Ports/SerialErrorEventArgs.cs +System.IO.Ports/SerialPinChange.cs +System.IO.Ports/SerialPinChangedEventArgs.cs +System.IO.Ports/SerialPort.cs +System.IO.Ports/SerialPortStream.cs +System.IO.Ports/SerialReceivedEventArgs.cs +System.IO.Ports/SerialSignal.cs +System.IO.Ports/StopBits.cs +System.IO.Ports/WinSerialStream.cs + +System.Media/AudioData.cs +System.Media/AudioDevice.cs +System.Media/SoundPlayer.cs +System.Media/SystemSound.cs +System.Media/SystemSounds.cs +System.Media/Win32SoundPlayer.cs + +System.Net/DnsAsyncResult.cs +System.Net/DnsPermissionAttribute.cs +System.Net/DnsPermission.cs + +System.Net.Configuration/AuthenticationModuleElementCollection.cs +System.Net.Configuration/AuthenticationModuleElement.cs +System.Net.Configuration/AuthenticationModulesSection.cs +System.Net.Configuration/BypassElementCollection.cs +System.Net.Configuration/BypassElement.cs +System.Net.Configuration/ConnectionManagementElementCollection.cs +System.Net.Configuration/ConnectionManagementElement.cs +System.Net.Configuration/ConnectionManagementHandler.cs +System.Net.Configuration/ConnectionManagementSection.cs +System.Net.Configuration/DefaultProxyHandler.cs +System.Net.Configuration/DefaultProxySection.cs +System.Net.Configuration/FtpCachePolicyElement.cs +System.Net.Configuration/HttpCachePolicyElement.cs +System.Net.Configuration/HttpWebRequestElement.cs +System.Net.Configuration/Ipv6Element.cs +System.Net.Configuration/MailSettingsSectionGroup.cs +System.Net.Configuration/ModuleElement.cs +System.Net.Configuration/NetAuthenticationModuleHandler.cs +System.Net.Configuration/NetConfigurationHandler.cs +System.Net.Configuration/NetSectionGroup.cs +System.Net.Configuration/PerformanceCountersElement.cs +System.Net.Configuration/ProxyElement.cs +System.Net.Configuration/RequestCachingSection.cs +System.Net.Configuration/ServicePointManagerElement.cs +System.Net.Configuration/SettingsSection.cs +System.Net.Configuration/SmtpNetworkElement.cs +System.Net.Configuration/SmtpSection.cs +System.Net.Configuration/SmtpSpecifiedPickupDirectoryElement.cs +System.Net.Configuration/SocketElement.cs +System.Net.Configuration/WebProxyScriptElement.cs +System.Net.Configuration/WebRequestModuleElementCollection.cs +System.Net.Configuration/WebRequestModuleElement.cs +System.Net.Configuration/WebRequestModuleHandler.cs +System.Net.Configuration/WebRequestModulesSection.cs + +System.Net.Mail/SmtpPermission.cs +System.Net.Mail/SmtpPermissionAttribute.cs + +System.Runtime.InteropServices/StandardOleMarshalObject.cs + +System.Security.Permissions/PermissionHelper.cs +System.Security.Permissions/ResourcePermissionBase.cs +System.Security.Permissions/ResourcePermissionBaseEntry.cs +System.Security.Permissions/StorePermissionAttribute.cs +System.Security.Permissions/StorePermission.cs +System.Security.Permissions/StorePermissionFlags.cs + +System.Web/AspNetHostingPermissionAttribute.cs +System.Web/AspNetHostingPermission.cs +System.Web/AspNetHostingPermissionLevel.cs + +Mono.Net.Dns/DnsClass.cs +Mono.Net.Dns/DnsHeader.cs +Mono.Net.Dns/DnsOpCode.cs +Mono.Net.Dns/DnsPacket.cs +Mono.Net.Dns/DnsQClass.cs +Mono.Net.Dns/DnsQType.cs +Mono.Net.Dns/DnsQuery.cs +Mono.Net.Dns/DnsQuestion.cs +Mono.Net.Dns/DnsRCode.cs +Mono.Net.Dns/DnsResourceRecordA.cs +Mono.Net.Dns/DnsResourceRecordAAAA.cs +Mono.Net.Dns/DnsResourceRecordCName.cs +Mono.Net.Dns/DnsResourceRecord.cs +Mono.Net.Dns/DnsResourceRecordIPAddress.cs +Mono.Net.Dns/DnsResourceRecordPTR.cs +Mono.Net.Dns/DnsResponse.cs +Mono.Net.Dns/DnsType.cs +Mono.Net.Dns/DnsUtil.cs +Mono.Net.Dns/ResolverAsyncOperation.cs +Mono.Net.Dns/SimpleResolver.cs +Mono.Net.Dns/ResolverError.cs +Mono.Net.Dns/SimpleResolverEventArgs.cs +ReferenceSources/BinaryCompatibility.cs +ReferenceSources/ConfigurationManagerInternalFactory.cs +ReferenceSources/SR2.cs +../referencesource/System/compmod/system/diagnostics/ConsoleTraceListener.cs +../referencesource/System/compmod/system/diagnostics/FilterElement.cs +../referencesource/System/compmod/system/diagnostics/PerfCounterSection.cs +../referencesource/System/compmod/system/diagnostics/SourceElementsCollection.cs +../referencesource/System/compmod/system/diagnostics/SwitchElementsCollection.cs +../referencesource/System/compmod/system/diagnostics/SystemDiagnosticsSection.cs +../referencesource/System/compmod/system/diagnostics/TraceSection.cs +../referencesource/System/compmod/system/diagnostics/TypedElement.cs +../referencesource/System/compmod/system/diagnostics/XmlWriterTraceListener.cs +../referencesource/System/misc/PrivilegedConfigurationManager.cs + +../referencesource/System/compmod/system/codedom/CodeArgumentReferenceExpression.cs +../referencesource/System/compmod/system/codedom/CodeArrayCreateExpression.cs +../referencesource/System/compmod/system/codedom/CodeArrayIndexerExpression.cs +../referencesource/System/compmod/system/codedom/CodeAssignStatement.cs +../referencesource/System/compmod/system/codedom/CodeAttachEventStatement.cs +../referencesource/System/compmod/system/codedom/CodeAttributeArgumentCollection.cs +../referencesource/System/compmod/system/codedom/CodeAttributeArgument.cs +../referencesource/System/compmod/system/codedom/CodeAttributeDeclarationCollection.cs +../referencesource/System/compmod/system/codedom/CodeAttributeDeclaration.cs +../referencesource/System/compmod/system/codedom/CodeBaseReferenceExpression.cs +../referencesource/System/compmod/system/codedom/CodeBinaryOperatorExpression.cs +../referencesource/System/compmod/system/codedom/CodeBinaryOperatorType.cs +../referencesource/System/compmod/system/codedom/CodeCastExpression.cs +../referencesource/System/compmod/system/codedom/CodeCatchClauseCollection.cs +../referencesource/System/compmod/system/codedom/CodeCatchClause.cs +../referencesource/System/compmod/system/codedom/CodeChecksumPragma.cs +../referencesource/System/compmod/system/codedom/CodeComment.cs +../referencesource/System/compmod/system/codedom/CodeCommentStatementCollection.cs +../referencesource/System/compmod/system/codedom/CodeCommentStatement.cs +../referencesource/System/compmod/system/codedom/CodeCompileUnit.cs +../referencesource/System/compmod/system/codedom/CodeConditionStatement.cs +../referencesource/System/compmod/system/codedom/CodeConstructor.cs +../referencesource/System/compmod/system/codedom/CodeDefaultValueExpression.cs +../referencesource/System/compmod/system/codedom/CodeDelegateCreateExpression.cs +../referencesource/System/compmod/system/codedom/CodeDelegateInvokeExpression.cs +../referencesource/System/compmod/system/codedom/CodeDirectionExpression.cs +../referencesource/System/compmod/system/codedom/CodeDirectiveCollection.cs +../referencesource/System/compmod/system/codedom/CodeDirective.cs +../referencesource/System/compmod/system/codedom/CodeEntryPointMethod.cs +../referencesource/System/compmod/system/codedom/CodeEventReferenceExpression.cs +../referencesource/System/compmod/system/codedom/CodeExpressionCollection.cs +../referencesource/System/compmod/system/codedom/CodeExpression.cs +../referencesource/System/compmod/system/codedom/CodeExpressionStatement.cs +../referencesource/System/compmod/system/codedom/CodeFieldReferenceExpression.cs +../referencesource/System/compmod/system/codedom/CodeGotoStatement.cs +../referencesource/System/compmod/system/codedom/CodeIndexerExpression.cs +../referencesource/System/compmod/system/codedom/CodeIterationStatement.cs +../referencesource/System/compmod/system/codedom/CodeLabeledStatement.cs +../referencesource/System/compmod/system/codedom/CodeLinePragma.cs +../referencesource/System/compmod/system/codedom/CodeMemberEvent.cs +../referencesource/System/compmod/system/codedom/CodeMemberField.cs +../referencesource/System/compmod/system/codedom/CodeMemberMethod.cs +../referencesource/System/compmod/system/codedom/CodeMemberProperty.cs +../referencesource/System/compmod/system/codedom/CodeMethodInvokeExpression.cs +../referencesource/System/compmod/system/codedom/codemethodreferenceexpression.cs +../referencesource/System/compmod/system/codedom/CodeMethodReturnStatement.cs +../referencesource/System/compmod/system/codedom/CodeNamespaceCollection.cs +../referencesource/System/compmod/system/codedom/CodeNamespace.cs +../referencesource/System/compmod/system/codedom/CodeNamespaceImportCollection.cs +../referencesource/System/compmod/system/codedom/CodeNamespaceImport.cs +../referencesource/System/compmod/system/codedom/CodeObjectCreateExpression.cs +../referencesource/System/compmod/system/codedom/CodeObject.cs +../referencesource/System/compmod/system/codedom/CodeParameterDeclarationExpressionCollection.cs +../referencesource/System/compmod/system/codedom/CodeParameterDeclarationExpression.cs +../referencesource/System/compmod/system/codedom/CodePrimitiveExpression.cs +../referencesource/System/compmod/system/codedom/CodePropertyReferenceExpression.cs +../referencesource/System/compmod/system/codedom/CodePropertySetValueReferenceExpression.cs +../referencesource/System/compmod/system/codedom/CodeRegionDirective.cs +../referencesource/System/compmod/system/codedom/CodeRegionMode.cs +../referencesource/System/compmod/system/codedom/CodeRemoveEventStatement.cs +../referencesource/System/compmod/system/codedom/CodeSnippetCompileUnit.cs +../referencesource/System/compmod/system/codedom/CodeSnippetExpression.cs +../referencesource/System/compmod/system/codedom/CodeSnippetStatement.cs +../referencesource/System/compmod/system/codedom/CodeSnippetTypeMember.cs +../referencesource/System/compmod/system/codedom/CodeStatementCollection.cs +../referencesource/System/compmod/system/codedom/CodeStatement.cs +../referencesource/System/compmod/system/codedom/CodeThisReferenceExpression.cs +../referencesource/System/compmod/system/codedom/CodeThrowExceptionStatement.cs +../referencesource/System/compmod/system/codedom/CodeTryCatchFinallyStatement.cs +../referencesource/System/compmod/system/codedom/CodeTypeConstructor.cs +../referencesource/System/compmod/system/codedom/CodeTypeDeclarationCollection.cs +../referencesource/System/compmod/system/codedom/CodeTypeDeclaration.cs +../referencesource/System/compmod/system/codedom/CodeTypeDelegate.cs +../referencesource/System/compmod/system/codedom/CodeTypeMemberCollection.cs +../referencesource/System/compmod/system/codedom/CodeTypeMember.cs +../referencesource/System/compmod/system/codedom/CodeTypeOfExpression.cs +../referencesource/System/compmod/system/codedom/CodeTypeParameterCollection.cs +../referencesource/System/compmod/system/codedom/CodeTypeParameter.cs +../referencesource/System/compmod/system/codedom/CodeTypeReferenceCollection.cs +../referencesource/System/compmod/system/codedom/CodeTypeReference.cs +../referencesource/System/compmod/system/codedom/CodeTypeReferenceExpression.cs +../referencesource/System/compmod/system/codedom/CodeVariableDeclarationStatement.cs +../referencesource/System/compmod/system/codedom/CodeVariableReferenceExpression.cs +../referencesource/System/compmod/system/codedom/FieldDirection.cs +../referencesource/System/compmod/system/codedom/MemberAttributes.cs + +../referencesource/System/compmod/system/codedom/compiler/CodeGenerator.cs +../referencesource/System/compmod/system/codedom/compiler/CodeGeneratorOptions.cs +../referencesource/System/compmod/system/codedom/compiler/CodeValidator.cs +../referencesource/System/compmod/system/codedom/compiler/CompilerError.cs +../referencesource/System/compmod/system/codedom/compiler/CompilerErrorCollection.cs +../referencesource/System/compmod/system/codedom/compiler/CompilerParameters.cs +../referencesource/System/compmod/system/codedom/compiler/GeneratorSupport.cs +../referencesource/System/compmod/system/codedom/compiler/ICodeCompiler.cs +../referencesource/System/compmod/system/codedom/compiler/ICodeGenerator.cs +../referencesource/System/compmod/system/codedom/compiler/ICodeParser.cs +../referencesource/System/compmod/system/codedom/compiler/LanguageOptions.cs + diff --git a/mcs/class/System/run-tests.bat b/mcs/class/System/run-tests.bat deleted file mode 100644 index 1aedacecfc7..00000000000 --- a/mcs/class/System/run-tests.bat +++ /dev/null @@ -1,188 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set OUTPUT_FILE_PREFIX=System -set RUNNING_FIXTURE=MonoTests.System -set TEST_SOLUTION=Test\System.Test20.sln -set TEST_ASSEMBLY=System.Test.jar -set PROJECT_CONFIGURATION=Debug_Java20 -set APP_CONFIG_FILE=app_test_2.0.config - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - -set NUNIT_OPTIONS=/exclude:NotWorking,ValueAdd,CAS,InetAccess - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\java_refs\framework\ -set JAVA_HOME=%VMW_HOME%\jre - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Drawing.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Configuration.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set NUNIT_OPTIONS=/exclude=NotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%framework\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%util\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%core\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -rem devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . -copy %APP_CONFIG_FILE% nunit-console.exe.config - -set TMPDIR=%TMP% - -REM @echo on -echo "%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% -"%JAVA_HOME%\bin\java" -Xmx1024M -cp %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM @echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild]" -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/System/testing_aot_full_System.dll.sources b/mcs/class/System/testing_aot_full_System.dll.sources new file mode 100644 index 00000000000..70a77a6dbff --- /dev/null +++ b/mcs/class/System/testing_aot_full_System.dll.sources @@ -0,0 +1 @@ +#include mobile_System.dll.sources diff --git a/mcs/class/System/testing_aot_full_System_test.dll.exclude.sources b/mcs/class/System/testing_aot_full_System_test.dll.exclude.sources new file mode 100644 index 00000000000..9a453e68f8c --- /dev/null +++ b/mcs/class/System/testing_aot_full_System_test.dll.exclude.sources @@ -0,0 +1,210 @@ + +Microsoft.CSharp/CSharpCodeProviderCas.cs +Microsoft.CSharp/CSharpCodeProviderTest.cs +Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs +Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs +Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs +Microsoft.CSharp/CodeGeneratorFromStatementTest.cs +Microsoft.CSharp/CodeGeneratorFromTypeTest.cs +Microsoft.CSharp/CodeGeneratorIdentifierTest.cs +Microsoft.CSharp/CodeGeneratorTestBase.cs +Microsoft.CSharp/CodeGeneratorTypeOutputTest.cs +Microsoft.VisualBasic/CodeGeneratorFromBinaryOperatorTest.cs +Microsoft.VisualBasic/CodeGeneratorFromCompileUnitTest.cs +Microsoft.VisualBasic/CodeGeneratorFromExpressionTest.cs +Microsoft.VisualBasic/CodeGeneratorFromNamespaceTest.cs +Microsoft.VisualBasic/CodeGeneratorFromStatementTest.cs +Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs +Microsoft.VisualBasic/CodeGeneratorTestBase.cs +Microsoft.VisualBasic/VBCodeProviderCas.cs +Microsoft.VisualBasic/VBCodeProviderTest.cs +Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs +Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs +Microsoft.Win32/PowerModeChangedEventArgsCas.cs +Microsoft.Win32/SessionEndedEventArgsCas.cs +Microsoft.Win32/SessionEndingEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsTest.cs +Microsoft.Win32/SystemEventsCas.cs +Microsoft.Win32/TimerElapsedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangingEventArgsCas.cs +System.CodeDom.Compiler/CodeCompilerCas.cs +System.CodeDom.Compiler/CodeDomProviderCas.cs +System.CodeDom.Compiler/CodeGeneratorCas.cs +System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs +System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs +System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs +System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs +System.CodeDom.Compiler/CodeGeneratorTest.cs +System.CodeDom.Compiler/CodeGeneratorTestBase.cs +System.CodeDom.Compiler/CodeParserCas.cs +System.CodeDom.Compiler/CompilerErrorCas.cs +System.CodeDom.Compiler/CompilerErrorCollectionCas.cs +System.CodeDom.Compiler/CompilerInfoCas.cs +System.CodeDom.Compiler/CompilerParametersCas.cs +System.CodeDom.Compiler/CompilerResultsCas.cs +System.CodeDom.Compiler/ExecutorCas.cs +System.CodeDom.Compiler/ExecutorTest.cs +System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs +System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs +System.CodeDom.Compiler/IndentedTextWriterCas.cs +System.CodeDom.Compiler/IndentedTextWriterTest.cs +System.CodeDom.Compiler/TempFileCollectionCas.cs +System.CodeDom.Compiler/TempFileCollectionTest.cs +System.CodeDom/CodeArgumentReferenceExpressionCas.cs +System.CodeDom/CodeArgumentReferenceExpressionTest.cs +System.CodeDom/CodeArrayCreateExpressionCas.cs +System.CodeDom/CodeArrayCreateExpressionTest.cs +System.CodeDom/CodeArrayIndexerExpressionCas.cs +System.CodeDom/CodeAssignStatementCas.cs +System.CodeDom/CodeAttachEventStatementCas.cs +System.CodeDom/CodeAttachEventStatementTest.cs +System.CodeDom/CodeAttributeArgumentCas.cs +System.CodeDom/CodeAttributeArgumentCollectionCas.cs +System.CodeDom/CodeAttributeArgumentCollectionTest.cs +System.CodeDom/CodeAttributeArgumentTest.cs +System.CodeDom/CodeAttributeDeclarationCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionTest.cs +System.CodeDom/CodeAttributeDeclarationTest.cs +System.CodeDom/CodeBaseReferenceExpressionCas.cs +System.CodeDom/CodeBinaryOperatorExpressionCas.cs +System.CodeDom/CodeCastExpressionCas.cs +System.CodeDom/CodeCastExpressionTest.cs +System.CodeDom/CodeCatchClauseCas.cs +System.CodeDom/CodeCatchClauseCollectionCas.cs +System.CodeDom/CodeCatchClauseCollectionTest.cs +System.CodeDom/CodeCatchClauseTest.cs +System.CodeDom/CodeChecksumPragmaCas.cs +System.CodeDom/CodeChecksumPragmaTest.cs +System.CodeDom/CodeCommentStatementCas.cs +System.CodeDom/CodeCommentStatementCollectionCas.cs +System.CodeDom/CodeCommentStatementCollectionTest.cs +System.CodeDom/CodeCompileUnitCas.cs +System.CodeDom/CodeConditionStatementCas.cs +System.CodeDom/CodeConstructorCas.cs +System.CodeDom/CodeConstructorTest.cs +System.CodeDom/CodeDefaultValueExpressionCas.cs +System.CodeDom/CodeDefaultValueExpressionTest.cs +System.CodeDom/CodeDelegateCreateExpressionCas.cs +System.CodeDom/CodeDelegateCreateExpressionTest.cs +System.CodeDom/CodeDelegateInvokeExpressionCas.cs +System.CodeDom/CodeDirectionExpressionCas.cs +System.CodeDom/CodeDirectiveCas.cs +System.CodeDom/CodeDirectiveCollectionCas.cs +System.CodeDom/CodeDirectiveCollectionTest.cs +System.CodeDom/CodeEntryPointMethodCas.cs +System.CodeDom/CodeEventReferenceExpressionCas.cs +System.CodeDom/CodeEventReferenceExpressionTest.cs +System.CodeDom/CodeExpressionCas.cs +System.CodeDom/CodeExpressionCollectionCas.cs +System.CodeDom/CodeExpressionCollectionTest.cs +System.CodeDom/CodeExpressionStatementCas.cs +System.CodeDom/CodeFieldReferenceExpressionCas.cs +System.CodeDom/CodeGotoStatementCas.cs +System.CodeDom/CodeGotoStatementTest.cs +System.CodeDom/CodeIndexerExpressionCas.cs +System.CodeDom/CodeIterationStatementCas.cs +System.CodeDom/CodeLabeledStatementTest.cs +System.CodeDom/CodeLinePragmaCas.cs +System.CodeDom/CodeLinePragmaTest.cs +System.CodeDom/CodeMemberEventCas.cs +System.CodeDom/CodeMemberFieldCas.cs +System.CodeDom/CodeMemberFieldTest.cs +System.CodeDom/CodeMemberMethodCas.cs +System.CodeDom/CodeMemberMethodTest.cs +System.CodeDom/CodeMemberPropertyCas.cs +System.CodeDom/CodeMemberPropertyTest.cs +System.CodeDom/CodeMethodInvokeExpressionCas.cs +System.CodeDom/CodeMethodInvokeExpressionTest.cs +System.CodeDom/CodeMethodReferenceExpressionCas.cs +System.CodeDom/CodeMethodReferenceExpressionTest.cs +System.CodeDom/CodeMethodReturnStatementCas.cs +System.CodeDom/CodeNamespaceCas.cs +System.CodeDom/CodeNamespaceCollectionCas.cs +System.CodeDom/CodeNamespaceCollectionTest.cs +System.CodeDom/CodeNamespaceImportCas.cs +System.CodeDom/CodeNamespaceImportCollectionCas.cs +System.CodeDom/CodeNamespaceImportCollectionTest.cs +System.CodeDom/CodeNamespaceImportTest.cs +System.CodeDom/CodeNamespaceTest.cs +System.CodeDom/CodeObjectCas.cs +System.CodeDom/CodeObjectCreateExpressionCas.cs +System.CodeDom/CodeObjectCreateExpressionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionTest.cs +System.CodeDom/CodePrimitiveExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionTest.cs +System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs +System.CodeDom/CodeRegionDirectiveCas.cs +System.CodeDom/CodeRegionDirectiveTest.cs +System.CodeDom/CodeRemoveEventStatementCas.cs +System.CodeDom/CodeRemoveEventStatementTest.cs +System.CodeDom/CodeSnippetCompileUnitCas.cs +System.CodeDom/CodeSnippetCompileUnitTest.cs +System.CodeDom/CodeSnippetExpressionCas.cs +System.CodeDom/CodeSnippetExpressionTest.cs +System.CodeDom/CodeSnippetStatementCas.cs +System.CodeDom/CodeSnippetStatementTest.cs +System.CodeDom/CodeSnippetTypeMemberCas.cs +System.CodeDom/CodeSnippetTypeMemberTest.cs +System.CodeDom/CodeStatementCas.cs +System.CodeDom/CodeStatementCollectionCas.cs +System.CodeDom/CodeStatementCollectionTest.cs +System.CodeDom/CodeThisReferenceExpressionCas.cs +System.CodeDom/CodeThrowExceptionStatementCas.cs +System.CodeDom/CodeTryCatchFinallyStatementCas.cs +System.CodeDom/CodeTypeConstructorCas.cs +System.CodeDom/CodeTypeConstructorTest.cs +System.CodeDom/CodeTypeDeclarationCas.cs +System.CodeDom/CodeTypeDeclarationCollectionCas.cs +System.CodeDom/CodeTypeDeclarationCollectionTest.cs +System.CodeDom/CodeTypeDelegateCas.cs +System.CodeDom/CodeTypeDelegateTest.cs +System.CodeDom/CodeTypeMemberCas.cs +System.CodeDom/CodeTypeMemberCollectionCas.cs +System.CodeDom/CodeTypeMemberCollectionTest.cs +System.CodeDom/CodeTypeOfExpressionCas.cs +System.CodeDom/CodeTypeOfExpressionTest.cs +System.CodeDom/CodeTypeParameterCas.cs +System.CodeDom/CodeTypeParameterCollectionTest.cs +System.CodeDom/CodeTypeParameterTest.cs +System.CodeDom/CodeTypeReferenceCas.cs +System.CodeDom/CodeTypeReferenceCollectionCas.cs +System.CodeDom/CodeTypeReferenceCollectionTest.cs +System.CodeDom/CodeTypeReferenceExpressionCas.cs +System.CodeDom/CodeTypeReferenceExpressionTest.cs +System.CodeDom/CodeTypeReferenceTest.cs +System.CodeDom/CodeVariableDeclarationStatementCas.cs +System.CodeDom/CodeVariableDeclarationStatementTest.cs +System.CodeDom/CodeVariableReferenceExpressionCas.cs +System.CodeDom/CodeVariableReferenceExpressionTest.cs +System.Configuration.Provider +System.Configuration.Provider/ProviderBaseTest.cs +System.Configuration/ApplicationSettingsBaseTest.cs +System.Configuration/ConfigXmlDocumentTest.cs +System.Configuration/ConfigurationExceptionTest.cs +System.Configuration/LocalFileSettingsProviderTest.cs +System.Configuration/SettingElementTest.cs +System.Configuration/SettingsBaseTest.cs +System.Configuration/SettingsPropertyCollectionTest.cs +System.Configuration/SettingsPropertyTest.cs +System.Configuration/SettingsPropertyValueCollectionTest.cs +System.Configuration/SettingsPropertyValueTest.cs +System.IO.Ports/SerialPortTest.cs +System.Security.Permissions/ResourcePermissionBaseCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryTest.cs +System.Security.Permissions/ResourcePermissionBaseTest.cs +System.Security.Permissions/StorePermissionAttributeCas.cs +System.Security.Permissions/StorePermissionAttributeTest.cs +System.Security.Permissions/StorePermissionCas.cs +System.Security.Permissions/StorePermissionTest.cs +System.Web/AspNetHostingPermissionAttributeCas.cs +System.Web/AspNetHostingPermissionAttributeTest.cs +System.Web/AspNetHostingPermissionCas.cs +System.Web/AspNetHostingPermissionTest.cs diff --git a/mcs/class/System/testing_aot_full_System_test.dll.sources b/mcs/class/System/testing_aot_full_System_test.dll.sources new file mode 100644 index 00000000000..3944a95be6a --- /dev/null +++ b/mcs/class/System/testing_aot_full_System_test.dll.sources @@ -0,0 +1 @@ +#include System_test.dll.sources diff --git a/mcs/class/System/testing_aot_hybrid_System.dll.sources b/mcs/class/System/testing_aot_hybrid_System.dll.sources new file mode 100644 index 00000000000..70a77a6dbff --- /dev/null +++ b/mcs/class/System/testing_aot_hybrid_System.dll.sources @@ -0,0 +1 @@ +#include mobile_System.dll.sources diff --git a/mcs/class/System/testing_aot_hybrid_System_test.dll.exclude.sources b/mcs/class/System/testing_aot_hybrid_System_test.dll.exclude.sources new file mode 100644 index 00000000000..9a453e68f8c --- /dev/null +++ b/mcs/class/System/testing_aot_hybrid_System_test.dll.exclude.sources @@ -0,0 +1,210 @@ + +Microsoft.CSharp/CSharpCodeProviderCas.cs +Microsoft.CSharp/CSharpCodeProviderTest.cs +Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs +Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs +Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs +Microsoft.CSharp/CodeGeneratorFromStatementTest.cs +Microsoft.CSharp/CodeGeneratorFromTypeTest.cs +Microsoft.CSharp/CodeGeneratorIdentifierTest.cs +Microsoft.CSharp/CodeGeneratorTestBase.cs +Microsoft.CSharp/CodeGeneratorTypeOutputTest.cs +Microsoft.VisualBasic/CodeGeneratorFromBinaryOperatorTest.cs +Microsoft.VisualBasic/CodeGeneratorFromCompileUnitTest.cs +Microsoft.VisualBasic/CodeGeneratorFromExpressionTest.cs +Microsoft.VisualBasic/CodeGeneratorFromNamespaceTest.cs +Microsoft.VisualBasic/CodeGeneratorFromStatementTest.cs +Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs +Microsoft.VisualBasic/CodeGeneratorTestBase.cs +Microsoft.VisualBasic/VBCodeProviderCas.cs +Microsoft.VisualBasic/VBCodeProviderTest.cs +Microsoft.Win32/IntranetZoneCredentialPolicyCas.cs +Microsoft.Win32/IntranetZoneCredentialPolicyTest.cs +Microsoft.Win32/PowerModeChangedEventArgsCas.cs +Microsoft.Win32/SessionEndedEventArgsCas.cs +Microsoft.Win32/SessionEndingEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsCas.cs +Microsoft.Win32/SessionSwitchEventArgsTest.cs +Microsoft.Win32/SystemEventsCas.cs +Microsoft.Win32/TimerElapsedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangedEventArgsCas.cs +Microsoft.Win32/UserPreferenceChangingEventArgsCas.cs +System.CodeDom.Compiler/CodeCompilerCas.cs +System.CodeDom.Compiler/CodeDomProviderCas.cs +System.CodeDom.Compiler/CodeGeneratorCas.cs +System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs +System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs +System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs +System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs +System.CodeDom.Compiler/CodeGeneratorTest.cs +System.CodeDom.Compiler/CodeGeneratorTestBase.cs +System.CodeDom.Compiler/CodeParserCas.cs +System.CodeDom.Compiler/CompilerErrorCas.cs +System.CodeDom.Compiler/CompilerErrorCollectionCas.cs +System.CodeDom.Compiler/CompilerInfoCas.cs +System.CodeDom.Compiler/CompilerParametersCas.cs +System.CodeDom.Compiler/CompilerResultsCas.cs +System.CodeDom.Compiler/ExecutorCas.cs +System.CodeDom.Compiler/ExecutorTest.cs +System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs +System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs +System.CodeDom.Compiler/IndentedTextWriterCas.cs +System.CodeDom.Compiler/IndentedTextWriterTest.cs +System.CodeDom.Compiler/TempFileCollectionCas.cs +System.CodeDom.Compiler/TempFileCollectionTest.cs +System.CodeDom/CodeArgumentReferenceExpressionCas.cs +System.CodeDom/CodeArgumentReferenceExpressionTest.cs +System.CodeDom/CodeArrayCreateExpressionCas.cs +System.CodeDom/CodeArrayCreateExpressionTest.cs +System.CodeDom/CodeArrayIndexerExpressionCas.cs +System.CodeDom/CodeAssignStatementCas.cs +System.CodeDom/CodeAttachEventStatementCas.cs +System.CodeDom/CodeAttachEventStatementTest.cs +System.CodeDom/CodeAttributeArgumentCas.cs +System.CodeDom/CodeAttributeArgumentCollectionCas.cs +System.CodeDom/CodeAttributeArgumentCollectionTest.cs +System.CodeDom/CodeAttributeArgumentTest.cs +System.CodeDom/CodeAttributeDeclarationCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionCas.cs +System.CodeDom/CodeAttributeDeclarationCollectionTest.cs +System.CodeDom/CodeAttributeDeclarationTest.cs +System.CodeDom/CodeBaseReferenceExpressionCas.cs +System.CodeDom/CodeBinaryOperatorExpressionCas.cs +System.CodeDom/CodeCastExpressionCas.cs +System.CodeDom/CodeCastExpressionTest.cs +System.CodeDom/CodeCatchClauseCas.cs +System.CodeDom/CodeCatchClauseCollectionCas.cs +System.CodeDom/CodeCatchClauseCollectionTest.cs +System.CodeDom/CodeCatchClauseTest.cs +System.CodeDom/CodeChecksumPragmaCas.cs +System.CodeDom/CodeChecksumPragmaTest.cs +System.CodeDom/CodeCommentStatementCas.cs +System.CodeDom/CodeCommentStatementCollectionCas.cs +System.CodeDom/CodeCommentStatementCollectionTest.cs +System.CodeDom/CodeCompileUnitCas.cs +System.CodeDom/CodeConditionStatementCas.cs +System.CodeDom/CodeConstructorCas.cs +System.CodeDom/CodeConstructorTest.cs +System.CodeDom/CodeDefaultValueExpressionCas.cs +System.CodeDom/CodeDefaultValueExpressionTest.cs +System.CodeDom/CodeDelegateCreateExpressionCas.cs +System.CodeDom/CodeDelegateCreateExpressionTest.cs +System.CodeDom/CodeDelegateInvokeExpressionCas.cs +System.CodeDom/CodeDirectionExpressionCas.cs +System.CodeDom/CodeDirectiveCas.cs +System.CodeDom/CodeDirectiveCollectionCas.cs +System.CodeDom/CodeDirectiveCollectionTest.cs +System.CodeDom/CodeEntryPointMethodCas.cs +System.CodeDom/CodeEventReferenceExpressionCas.cs +System.CodeDom/CodeEventReferenceExpressionTest.cs +System.CodeDom/CodeExpressionCas.cs +System.CodeDom/CodeExpressionCollectionCas.cs +System.CodeDom/CodeExpressionCollectionTest.cs +System.CodeDom/CodeExpressionStatementCas.cs +System.CodeDom/CodeFieldReferenceExpressionCas.cs +System.CodeDom/CodeGotoStatementCas.cs +System.CodeDom/CodeGotoStatementTest.cs +System.CodeDom/CodeIndexerExpressionCas.cs +System.CodeDom/CodeIterationStatementCas.cs +System.CodeDom/CodeLabeledStatementTest.cs +System.CodeDom/CodeLinePragmaCas.cs +System.CodeDom/CodeLinePragmaTest.cs +System.CodeDom/CodeMemberEventCas.cs +System.CodeDom/CodeMemberFieldCas.cs +System.CodeDom/CodeMemberFieldTest.cs +System.CodeDom/CodeMemberMethodCas.cs +System.CodeDom/CodeMemberMethodTest.cs +System.CodeDom/CodeMemberPropertyCas.cs +System.CodeDom/CodeMemberPropertyTest.cs +System.CodeDom/CodeMethodInvokeExpressionCas.cs +System.CodeDom/CodeMethodInvokeExpressionTest.cs +System.CodeDom/CodeMethodReferenceExpressionCas.cs +System.CodeDom/CodeMethodReferenceExpressionTest.cs +System.CodeDom/CodeMethodReturnStatementCas.cs +System.CodeDom/CodeNamespaceCas.cs +System.CodeDom/CodeNamespaceCollectionCas.cs +System.CodeDom/CodeNamespaceCollectionTest.cs +System.CodeDom/CodeNamespaceImportCas.cs +System.CodeDom/CodeNamespaceImportCollectionCas.cs +System.CodeDom/CodeNamespaceImportCollectionTest.cs +System.CodeDom/CodeNamespaceImportTest.cs +System.CodeDom/CodeNamespaceTest.cs +System.CodeDom/CodeObjectCas.cs +System.CodeDom/CodeObjectCreateExpressionCas.cs +System.CodeDom/CodeObjectCreateExpressionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs +System.CodeDom/CodeParameterDeclarationExpressionCollectionTest.cs +System.CodeDom/CodeParameterDeclarationExpressionTest.cs +System.CodeDom/CodePrimitiveExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionCas.cs +System.CodeDom/CodePropertyReferenceExpressionTest.cs +System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs +System.CodeDom/CodeRegionDirectiveCas.cs +System.CodeDom/CodeRegionDirectiveTest.cs +System.CodeDom/CodeRemoveEventStatementCas.cs +System.CodeDom/CodeRemoveEventStatementTest.cs +System.CodeDom/CodeSnippetCompileUnitCas.cs +System.CodeDom/CodeSnippetCompileUnitTest.cs +System.CodeDom/CodeSnippetExpressionCas.cs +System.CodeDom/CodeSnippetExpressionTest.cs +System.CodeDom/CodeSnippetStatementCas.cs +System.CodeDom/CodeSnippetStatementTest.cs +System.CodeDom/CodeSnippetTypeMemberCas.cs +System.CodeDom/CodeSnippetTypeMemberTest.cs +System.CodeDom/CodeStatementCas.cs +System.CodeDom/CodeStatementCollectionCas.cs +System.CodeDom/CodeStatementCollectionTest.cs +System.CodeDom/CodeThisReferenceExpressionCas.cs +System.CodeDom/CodeThrowExceptionStatementCas.cs +System.CodeDom/CodeTryCatchFinallyStatementCas.cs +System.CodeDom/CodeTypeConstructorCas.cs +System.CodeDom/CodeTypeConstructorTest.cs +System.CodeDom/CodeTypeDeclarationCas.cs +System.CodeDom/CodeTypeDeclarationCollectionCas.cs +System.CodeDom/CodeTypeDeclarationCollectionTest.cs +System.CodeDom/CodeTypeDelegateCas.cs +System.CodeDom/CodeTypeDelegateTest.cs +System.CodeDom/CodeTypeMemberCas.cs +System.CodeDom/CodeTypeMemberCollectionCas.cs +System.CodeDom/CodeTypeMemberCollectionTest.cs +System.CodeDom/CodeTypeOfExpressionCas.cs +System.CodeDom/CodeTypeOfExpressionTest.cs +System.CodeDom/CodeTypeParameterCas.cs +System.CodeDom/CodeTypeParameterCollectionTest.cs +System.CodeDom/CodeTypeParameterTest.cs +System.CodeDom/CodeTypeReferenceCas.cs +System.CodeDom/CodeTypeReferenceCollectionCas.cs +System.CodeDom/CodeTypeReferenceCollectionTest.cs +System.CodeDom/CodeTypeReferenceExpressionCas.cs +System.CodeDom/CodeTypeReferenceExpressionTest.cs +System.CodeDom/CodeTypeReferenceTest.cs +System.CodeDom/CodeVariableDeclarationStatementCas.cs +System.CodeDom/CodeVariableDeclarationStatementTest.cs +System.CodeDom/CodeVariableReferenceExpressionCas.cs +System.CodeDom/CodeVariableReferenceExpressionTest.cs +System.Configuration.Provider +System.Configuration.Provider/ProviderBaseTest.cs +System.Configuration/ApplicationSettingsBaseTest.cs +System.Configuration/ConfigXmlDocumentTest.cs +System.Configuration/ConfigurationExceptionTest.cs +System.Configuration/LocalFileSettingsProviderTest.cs +System.Configuration/SettingElementTest.cs +System.Configuration/SettingsBaseTest.cs +System.Configuration/SettingsPropertyCollectionTest.cs +System.Configuration/SettingsPropertyTest.cs +System.Configuration/SettingsPropertyValueCollectionTest.cs +System.Configuration/SettingsPropertyValueTest.cs +System.IO.Ports/SerialPortTest.cs +System.Security.Permissions/ResourcePermissionBaseCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryCas.cs +System.Security.Permissions/ResourcePermissionBaseEntryTest.cs +System.Security.Permissions/ResourcePermissionBaseTest.cs +System.Security.Permissions/StorePermissionAttributeCas.cs +System.Security.Permissions/StorePermissionAttributeTest.cs +System.Security.Permissions/StorePermissionCas.cs +System.Security.Permissions/StorePermissionTest.cs +System.Web/AspNetHostingPermissionAttributeCas.cs +System.Web/AspNetHostingPermissionAttributeTest.cs +System.Web/AspNetHostingPermissionCas.cs +System.Web/AspNetHostingPermissionTest.cs diff --git a/mcs/class/System/winaot_System.dll.sources b/mcs/class/System/winaot_System.dll.sources new file mode 100644 index 00000000000..4cc254c5022 --- /dev/null +++ b/mcs/class/System/winaot_System.dll.sources @@ -0,0 +1 @@ +#include common.sources diff --git a/mcs/class/System/xammac_System.dll.sources b/mcs/class/System/xammac_System.dll.sources index 7c857b015bf..73405e10266 100644 --- a/mcs/class/System/xammac_System.dll.sources +++ b/mcs/class/System/xammac_System.dll.sources @@ -1,4 +1,2 @@ #include mobile_System.dll.sources -Assembly/AssemblyInfoEx.cs Mono.Net.Security/MonoTlsProviderFactory.Apple.cs -../Mono.Security/Mono.Security.Interface/MonoTlsProviderFactory.Apple.cs diff --git a/mcs/class/System/xammac_net_4_5_System.dll.sources b/mcs/class/System/xammac_net_4_5_System.dll.sources index 7e48f7ecc9d..beb6f2415cf 100644 --- a/mcs/class/System/xammac_net_4_5_System.dll.sources +++ b/mcs/class/System/xammac_net_4_5_System.dll.sources @@ -1,2 +1 @@ -#include System.dll.sources -Assembly/AssemblyInfoEx.cs +#include net_4_x_System.dll.sources diff --git a/mcs/class/aot-compiler/Makefile b/mcs/class/aot-compiler/Makefile index be6d85f087c..505f91591ec 100644 --- a/mcs/class/aot-compiler/Makefile +++ b/mcs/class/aot-compiler/Makefile @@ -10,21 +10,23 @@ include ../../build/rules.make the_libdir = $(topdir)/class/lib/$(PROFILE)/ CSC_DIR = $(dir $(CSC_LOCATION)) +# The directory where the AOT images are stored +images_dir = $(the_libdir) # mcs.exe is only in the build profile, but the aot image should be compiled against the current # profile mcs_exe = $(the_libdir)/mcs.exe mcs_aot_image = $(the_libdir)/mcs.exe$(PLATFORM_AOT_SUFFIX) csc_exe = $(CSC_LOCATION) -csc_aot_image = $(csc_exe)$(PLATFORM_AOT_SUFFIX) +csc_aot_image = $(images_dir)/csc.exe$(PLATFORM_AOT_SUFFIX) csc_MCS_dll = $(CSC_DIR)/Microsoft.CodeAnalysis.CSharp.dll -csc_MCS_image = $(csc_MCS_dll)$(PLATFORM_AOT_SUFFIX) +csc_MCS_image = $(images_dir)/Microsoft.CodeAnalysis.CSharp.dll$(PLATFORM_AOT_SUFFIX) csc_MC_dll = $(CSC_DIR)/Microsoft.CodeAnalysis.dll -csc_MC_image = $(csc_MC_dll)$(PLATFORM_AOT_SUFFIX) +csc_MC_image = $(images_dir)/Microsoft.CodeAnalysis.dll$(PLATFORM_AOT_SUFFIX) csc_SRM_dll = $(CSC_DIR)/System.Reflection.Metadata.dll -csc_SRM_image = $(csc_SRM_dll)$(PLATFORM_AOT_SUFFIX) +csc_SRM_image = $(images_dir)/System.Reflection.Metadata.dll$(PLATFORM_AOT_SUFFIX) csc_SCI_dll = $(CSC_DIR)/System.Collections.Immutable.dll -csc_SCI_image = $(csc_SCI_dll)$(PLATFORM_AOT_SUFFIX) +csc_SCI_image = $(images_dir)/System.Collections.Immutable.dll$(PLATFORM_AOT_SUFFIX) mscorlib_dll = $(the_libdir)/mscorlib.dll mscorlib_aot_image = $(mscorlib_dll)$(PLATFORM_AOT_SUFFIX) @@ -64,21 +66,44 @@ $(csc_SCI_image): $(csc_SCI_dll) $(runtime_dep) ifdef ENABLE_AOT +CSC_IMAGES = $(csc_aot_image) $(csc_SRM_image) $(csc_SCI_image) + clean-local: - -rm -f $(mscorlib_aot_image) $(mcs_aot_image) $(csc_aot_image) $(csc_SRM_image) $(csc_SCI_image) $(PROFILE)_aot.log + -rm -f $(mscorlib_aot_image) $(mcs_aot_image) $(CSC_IMAGES) $(PROFILE)_aot.log -# AOT build profile mcs to speed up build +# AOT build profile to speed up build ifeq ($(PROFILE),build) + +# $(mscorlib_aot_image) is disabled due to runtime bug #50434 +IMAGES = + ifdef MCS_MODE -all-local: $(mscorlib_aot_image) $(mcs_aot_image) +IMAGES += $(mcs_aot_image) + +install-local: + else -all-local: $(mscorlib_aot_image) $(csc_aot_image) $(csc_SRM_image) $(csc_SCI_image) -endif +IMAGES += $(CSC_IMAGES) + install-local: + $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR) + $(INSTALL_LIB) $(CSC_IMAGES) $(DESTDIR)$(LIBRARY_INSTALL_DIR) + +endif + +all-local: $(IMAGES) + endif ifeq ($(PROFILE), $(DEFAULT_PROFILE)) -all-local: $(mscorlib_aot_image) $(mcs_aot_image) + +IMAGES = $(mscorlib_aot_image) $(mcs_aot_image) + +ifdef MCS_MODE +IMAGES += $(CSC_IMAGES) +endif + +all-local: $(IMAGES) install-local: $(MKINSTALLDIRS) $(DESTDIR)$(LIBRARY_INSTALL_DIR) $(INSTALL_LIB) $(mscorlib_aot_image) $(DESTDIR)$(LIBRARY_INSTALL_DIR) diff --git a/mcs/class/corlib/Assembly/AssemblyInfo.cs b/mcs/class/corlib/Assembly/AssemblyInfo.cs index 6dc94160d19..59ef32f147f 100644 --- a/mcs/class/corlib/Assembly/AssemblyInfo.cs +++ b/mcs/class/corlib/Assembly/AssemblyInfo.cs @@ -78,6 +78,9 @@ using System.Runtime.InteropServices; [assembly: InternalsVisibleTo ("System.Numerics, PublicKey=00000000000000000400000000000000")] +[assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")] +[assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000")] + #if MONOTOUCH #if MONOTOUCH_TV [assembly: InternalsVisibleTo ("Xamarin.TVOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")] diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile index ab29d69da51..4d40d337125 100644 --- a/mcs/class/corlib/Makefile +++ b/mcs/class/corlib/Makefile @@ -21,6 +21,7 @@ endif endif RESOURCE_STRINGS = ../referencesource/mscorlib/mscorlib.txt +RESX_RESOURCE_STRING = ../../../external/corefx/src/System.ValueTuple/src/Resources/Strings.resx LIBRARY_COMPILE = $(BOOT_COMPILE) LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION) @@ -67,7 +68,7 @@ DEFAULT_REFERENCES = TEST_LIB_REFS = System.Core System ifndef AOT_FRIENDLY_PROFILE -ifneq ($(PROFILE),aot_hybrid) +ifneq ($(PROFILE),testing_aot_hybrid) TEST_LIB_REFS += Mono.Posix endif endif diff --git a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs index ed524bb7c18..9312f1da9fe 100644 --- a/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs +++ b/mcs/class/corlib/System.Reflection.Emit/AssemblyBuilder.cs @@ -468,7 +468,12 @@ namespace System.Reflection.Emit public static AssemblyBuilder DefineDynamicAssembly (AssemblyName name, AssemblyBuilderAccess access, IEnumerable assemblyAttributes) { - throw new NotImplementedException (); + var ab = DefineDynamicAssembly (name, access); + foreach (var attr in assemblyAttributes) { + ab.SetCustomAttribute (attr); + } + + return ab; } public ModuleBuilder DefineDynamicModule (string name) diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs index a54c6b97d9c..5cef04313c4 100755 --- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs +++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs @@ -196,7 +196,7 @@ namespace System.Security.Cryptography { name = "System.Security.Cryptography.X509Certificates.X509Chain, System"; break; case "aes": -#if AOT_ONLY_DESKTOP +#if FULL_AOT_DESKTOP // TODO: why is this special cased? we could use AesManaged like other full AOT profiles name = "System.Security.Cryptography.AesCryptoServiceProvider, System.Core"; #else name = "System.Security.Cryptography.AesManaged, System.Core"; diff --git a/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs b/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs index 3d72d23a7bd..ceef9625fe5 100644 --- a/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs +++ b/mcs/class/corlib/System.Security.Cryptography/DSACryptoServiceProvider.cs @@ -231,6 +231,28 @@ namespace System.Security.Cryptography { return dsa.VerifySignature (rgbHash, rgbSignature); } + protected override byte[] HashData (byte[] data, int offset, int count, HashAlgorithmName hashAlgorithm) + { + if (hashAlgorithm != HashAlgorithmName.SHA1) + { + throw new CryptographicException(Environment.GetResourceString("Cryptography_UnknownHashAlgorithm", hashAlgorithm.Name)); + } + + var hash = HashAlgorithm.Create (hashAlgorithm.Name); + return hash.ComputeHash (data, offset, count); + } + + protected override byte[] HashData (System.IO.Stream data, HashAlgorithmName hashAlgorithm) + { + if (hashAlgorithm != HashAlgorithmName.SHA1) + { + throw new CryptographicException(Environment.GetResourceString("Cryptography_UnknownHashAlgorithm", hashAlgorithm.Name)); + } + + var hash = HashAlgorithm.Create (hashAlgorithm.Name); + return hash.ComputeHash (data); + } + protected override void Dispose (bool disposing) { if (!m_disposed) { diff --git a/mcs/class/corlib/System.Security.Cryptography/IncrementalHash.cs b/mcs/class/corlib/System.Security.Cryptography/IncrementalHash.cs deleted file mode 100644 index a1248fee72f..00000000000 --- a/mcs/class/corlib/System.Security.Cryptography/IncrementalHash.cs +++ /dev/null @@ -1,42 +0,0 @@ -// -// IncrementalHash.cs -// -// Authors: -// Marek Safar -// -// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.com) -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// - -namespace System.Security.Cryptography -{ - public sealed class IncrementalHash : IDisposable - { - private IncrementalHash () { } - public HashAlgorithmName AlgorithmName { get { throw new NotImplementedException (); } } - public void AppendData (byte[] data) { } - public void AppendData (byte[] data, int offset, int count) { } - public static IncrementalHash CreateHash (HashAlgorithmName hashAlgorithm) { throw new NotImplementedException (); } - public static IncrementalHash CreateHMAC (HashAlgorithmName hashAlgorithm, byte[] key) { throw new NotImplementedException (); } - public void Dispose () { } - public byte[] GetHashAndReset () { throw new NotImplementedException (); } - } -} diff --git a/mcs/class/corlib/System/TimeZoneInfo.cs b/mcs/class/corlib/System/TimeZoneInfo.cs index 89de2ee7462..6e29a65dadc 100644 --- a/mcs/class/corlib/System/TimeZoneInfo.cs +++ b/mcs/class/corlib/System/TimeZoneInfo.cs @@ -152,7 +152,7 @@ namespace System #if !MONODROID && !MONOTOUCH && !XAMMAC static TimeZoneInfo CreateLocal () { -#if !AOT_ONLY_DESKTOP +#if !FULL_AOT_DESKTOP if (IsWindows && LocalZoneKey != null) { string name = (string)LocalZoneKey.GetValue ("TimeZoneKeyName"); if (name == null) @@ -204,7 +204,7 @@ namespace System static void GetSystemTimeZonesCore (List systemTimeZones) { -#if !AOT_ONLY_DESKTOP +#if !FULL_AOT_DESKTOP if (TimeZoneKey != null) { foreach (string id in TimeZoneKey.GetSubKeyNames ()) { try { @@ -273,7 +273,7 @@ namespace System #endif private AdjustmentRule [] adjustmentRules; -#if !MOBILE || !AOT_ONLY_DESKTOP +#if !MOBILE || !FULL_AOT_DESKTOP /// /// Determine whether windows of not (taken Stephane Delcroix's code) /// @@ -301,7 +301,7 @@ namespace System return str.Substring (Istart, Iend-Istart+1); } -#if !AOT_ONLY_DESKTOP +#if !FULL_AOT_DESKTOP static RegistryKey timeZoneKey; static RegistryKey TimeZoneKey { get { @@ -330,7 +330,7 @@ namespace System } } #endif -#endif // !MOBILE || !AOT_ONLY_DESKTOP +#endif // !MOBILE || !FULL_AOT_DESKTOP private static bool TryAddTicks (DateTime date, long ticks, out DateTime result, DateTimeKind kind = DateTimeKind.Unspecified) { diff --git a/mcs/class/corlib/System/__ComObject.cs b/mcs/class/corlib/System/__ComObject.cs index af6c4d8cae7..38f14ade221 100644 --- a/mcs/class/corlib/System/__ComObject.cs +++ b/mcs/class/corlib/System/__ComObject.cs @@ -255,7 +255,7 @@ namespace System #else namespace System { - // this is a shim class so we can AOT during aot_only build without --enable-minimal=com + // this is a shim class so we can AOT during full AOT builds without --enable-minimal=com internal class __ComObject { __ComObject () diff --git a/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs b/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs index be26d45553b..2ec2af50394 100644 --- a/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs +++ b/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs @@ -265,7 +265,7 @@ namespace MonoTests.System.Reflection public void Corlib_test () { Assembly corlib_test = Assembly.GetExecutingAssembly (); -#if MONODROID || AOT_ONLY_DESKTOP || __WATCHOS__ +#if MONODROID || FULL_AOT_DESKTOP || __WATCHOS__ Assert.IsNull (corlib_test.EntryPoint, "EntryPoint"); Assert.IsNull (corlib_test.Evidence, "Evidence"); #elif MOBILE @@ -474,8 +474,8 @@ namespace MonoTests.System.Reflection // with the semantics of aot'ed assembly loading, as // aot may assert when loading. This assumes that it's // safe to greedly load everything. -#if AOT_ONLY_DESKTOP - string [] names = { "aot_only_corlib_test" }; +#if FULL_AOT_DESKTOP + string [] names = { "testing_aot_full_corlib_test" }; #else string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "net_4_x_corlib_test", "corlib_plattest", "mscorlibtests", "BclTests" }; #endif diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs index 148cad2367a..282a5a3f905 100644 --- a/mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs +++ b/mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs @@ -44,7 +44,7 @@ namespace MonoTests.System.Security.Cryptography { [Test] [Category ("AndroidNotWorking")] // Exception is thrown: CryptographicException : Bad PKCS7 padding. Invalid length 236. - [Category ("MobileNotWorking")] // On aot_only, above exception is thrown as well + [Category ("MobileNotWorking")] // On testing_aot_full, above exception is thrown as well public void Roundtrip () { // that will return a AesCryptoServiceProvider diff --git a/mcs/class/corlib/aot_hybrid_corlib_test.dll.exclude.sources b/mcs/class/corlib/aot_hybrid_corlib_test.dll.exclude.sources deleted file mode 100644 index 9b651e6fc9e..00000000000 --- a/mcs/class/corlib/aot_hybrid_corlib_test.dll.exclude.sources +++ /dev/null @@ -1,22 +0,0 @@ -Microsoft.Win32/RegistryKeyTest.cs -System.Reflection/VisibilityTest.cs -System.Security.AccessControl/AuthorizationRuleTest.cs -System.Security.AccessControl/CommonAceTest.cs -System.Security.AccessControl/CommonAclTest.cs -System.Security.AccessControl/CommonObjectSecurityTest.cs -System.Security.AccessControl/CommonSecurityDescriptorTest.cs -System.Security.AccessControl/CryptoKeyAccessRuleTest.cs -System.Security.AccessControl/DirectoryObjectSecurityTest.cs -System.Security.AccessControl/DirectorySecurityTest.cs -System.Security.AccessControl/DiscretionaryAclTest.cs -System.Security.AccessControl/EventWaitHandleSecurityTest.cs -System.Security.AccessControl/FileSecurityTest.cs -System.Security.AccessControl/MutexAccessRuleTest.cs -System.Security.AccessControl/MutexSecurityTest.cs -System.Security.AccessControl/ObjectAceTest.cs -System.Security.AccessControl/ObjectSecurity_TTest.cs -System.Security.AccessControl/ObjectSecurityTest.cs -System.Security.AccessControl/RawAclTest.cs -System.Security.AccessControl/RawSecurityDescriptorTest.cs -System.Security.AccessControl/RegistrySecurityTest.cs -System.Security.AccessControl/SystemAclTest.cs diff --git a/mcs/class/corlib/aot_only_corlib_test.dll.exclude.sources b/mcs/class/corlib/aot_only_corlib_test.dll.exclude.sources deleted file mode 100644 index eb17a105b75..00000000000 --- a/mcs/class/corlib/aot_only_corlib_test.dll.exclude.sources +++ /dev/null @@ -1,131 +0,0 @@ -Microsoft.Win32/RegistryKeyTest.cs -System.Diagnostics.Contracts/ContractAssertTest.cs -System.Diagnostics.Contracts/ContractAssumeTest.cs -System.Diagnostics.Contracts/ContractCollectionMethodsTest.cs -System.Diagnostics.Contracts/ContractHelperTest.cs -System.Diagnostics.Contracts/ContractMarkerMethodsTest.cs -System.Diagnostics.Contracts/ContractMustUseRewriterTest.cs -System.Diagnostics.Contracts/Helpers/RunAgainstReferenceAttribute.cs -System.Diagnostics.Contracts/Helpers/TestContractBase.cs -System.Reflection.Emit/AssemblyBuilderAccessTest.cs -System.Reflection.Emit/AssemblyBuilderTest.cs -System.Reflection.Emit/ConstructorBuilderTest.cs -System.Reflection.Emit/ConstructorOnTypeBuilderInstTest.cs -System.Reflection.Emit/CustomAttributeBuilderTest.cs -System.Reflection.Emit/DerivedTypesTest.cs -System.Reflection.Emit/DynamicILInfoTest.cs -System.Reflection.Emit/DynamicMethodTest.cs -System.Reflection.Emit/EnumBuilderTest.cs -System.Reflection.Emit/EventBuilderTest.cs -System.Reflection.Emit/FieldBuilderTest.cs -System.Reflection.Emit/GenericTypeParameterBuilderTest.cs -System.Reflection.Emit/ILGeneratorTest.cs -System.Reflection.Emit/MethodBuilderTest.cs -System.Reflection.Emit/MethodBuilderTestIL.cs -System.Reflection.Emit/MethodOnTypeBuilderInstTest.cs -System.Reflection.Emit/MethodRentalCas.cs -System.Reflection.Emit/MethodRentalTest.cs -System.Reflection.Emit/ModuleBuilderTest.cs -System.Reflection.Emit/ParameterBuilderTest.cs -System.Reflection.Emit/PropertyBuilderTest.cs -System.Reflection.Emit/SignatureHelperTest.cs -System.Reflection.Emit/TypeBuilderTest.cs -System.Runtime.Remoting/ContextTest.cs -System.Runtime.Remoting/RemotingConfigurationTest.cs -System.Runtime.Remoting/RemotingServicesTest.cs -System.Runtime.Remoting/SoapServicesTest.cs -System.Runtime.Remoting/SynchronizationAttributeTest.cs -System.Runtime.Remoting.Channels/ChannelServicesTest.cs -System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs -System.Runtime.Remoting.Messaging/CallContextTest.cs -System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs -System.Security.AccessControl/AuthorizationRuleTest.cs -System.Security.AccessControl/CommonAceTest.cs -System.Security.AccessControl/CommonAclTest.cs -System.Security.AccessControl/CommonObjectSecurityTest.cs -System.Security.AccessControl/CommonSecurityDescriptorTest.cs -System.Security.AccessControl/CryptoKeyAccessRuleTest.cs -System.Security.AccessControl/DirectoryObjectSecurityTest.cs -System.Security.AccessControl/DirectorySecurityTest.cs -System.Security.AccessControl/DiscretionaryAclTest.cs -System.Security.AccessControl/EventWaitHandleSecurityTest.cs -System.Security.AccessControl/FileSecurityTest.cs -System.Security.AccessControl/MutexAccessRuleTest.cs -System.Security.AccessControl/MutexSecurityTest.cs -System.Security.AccessControl/ObjectAceTest.cs -System.Security.AccessControl/ObjectSecurity_TTest.cs -System.Security.AccessControl/ObjectSecurityTest.cs -System.Security.AccessControl/RawAclTest.cs -System.Security.AccessControl/RawSecurityDescriptorTest.cs -System.Security.AccessControl/RegistrySecurityTest.cs -System.Security.AccessControl/SystemAclTest.cs -System.Security.Permissions/CodeAccessSecurityAttributeTest.cs -System.Security.Permissions/EnvironmentPermissionAttributeTest.cs -System.Security.Permissions/EnvironmentPermissionTest.cs -System.Security.Permissions/FileDialogPermissionAttributeTest.cs -System.Security.Permissions/FileDialogPermissionTest.cs -System.Security.Permissions/FileIOPermissionAttributeTest.cs -System.Security.Permissions/FileIOPermissionTest.cs -System.Security.Permissions/GacIdentityPermissionAttributeTest.cs -System.Security.Permissions/GacIdentityPermissionTest.cs -System.Security.Permissions/HostProtectionAttributeTest.cs -System.Security.Permissions/IBuiltInPermissionTest.cs -System.Security.Permissions/IsolatedStorageFilePermissionAttributeTest.cs -System.Security.Permissions/IsolatedStorageFilePermissionTest.cs -System.Security.Permissions/IsolatedStoragePermissionAttributeTest.cs -System.Security.Permissions/KeyContainerPermissionAttributeTest.cs -System.Security.Permissions/PermissionSetAttributeTest.cs -System.Security.Permissions/PrincipalPermissionAttributeTest.cs -System.Security.Permissions/PrincipalPermissionTest.cs -System.Security.Permissions/PublisherIdentityPermissionAttributeTest.cs -System.Security.Permissions/PublisherIdentityPermissionTest.cs -System.Security.Permissions/ReflectionPermissionAttributeTest.cs -System.Security.Permissions/ReflectionPermissionTest.cs -System.Security.Permissions/RegistryPermissionAttributeTest.cs -System.Security.Permissions/RegistryPermissionTest.cs -System.Security.Permissions/SecurityAttributeTest.cs -System.Security.Permissions/SecurityPermissionAttributeTest.cs -System.Security.Permissions/SecurityPermissionTest.cs -System.Security.Permissions/SiteIdentityPermissionAttributeTest.cs -System.Security.Permissions/SiteIdentityPermissionTest.cs -System.Security.Permissions/StrongNameIdentityPermissionAttributeTest.cs -System.Security.Permissions/StrongNameIdentityPermissionTest.cs -System.Security.Permissions/StrongNamePublicKeyBlobTest.cs -System.Security.Permissions/UIPermissionAttributeTest.cs -System.Security.Permissions/UIPermissionTest.cs -System.Security.Permissions/UrlIdentityPermissionAttributeTest.cs -System.Security.Permissions/UrlIdentityPermissionTest.cs -System.Security.Permissions/ZoneIdentityPermissionAttributeTest.cs -System.Security.Permissions/ZoneIdentityPermissionTest.cs -System.Security.Policy/AllMembershipConditionTest.cs -System.Security.Policy/ApplicationDirectoryMembershipConditionTest.cs -System.Security.Policy/ApplicationDirectoryTest.cs -System.Security.Policy/ApplicationMembershipConditionTest.cs -System.Security.Policy/ApplicationSecurityManagerCas.cs -System.Security.Policy/ApplicationSecurityManagerTest.cs -System.Security.Policy/ApplicationTrustTest.cs -System.Security.Policy/CodeGroupTest.cs -System.Security.Policy/DomainApplicationMembershipConditionTest.cs -System.Security.Policy/EvidenceTest.cs -System.Security.Policy/FileCodeGroupTest.cs -System.Security.Policy/FirstMatchCodeGroupTest.cs -System.Security.Policy/GacMembershipConditionTest.cs -System.Security.Policy/GacTest.cs -System.Security.Policy/HashMembershipConditionTest.cs -System.Security.Policy/HashTest.cs -System.Security.Policy/IBuiltInEvidenceTest.cs -System.Security.Policy/NetCodeGroupTest.cs -System.Security.Policy/PermissionRequestEvidenceTest.cs -System.Security.Policy/PolicyLevelTest.cs -System.Security.Policy/PolicyStatementTest.cs -System.Security.Policy/PublisherMembershipConditionTest.cs -System.Security.Policy/PublisherTest.cs -System.Security.Policy/SiteMembershipConditionTest.cs -System.Security.Policy/SiteTest.cs -System.Security.Policy/StrongNameMembershipConditionTest.cs -System.Security.Policy/StrongNameTest.cs -System.Security.Policy/UnionCodeGroupTest.cs -System.Security.Policy/UrlMembershipConditionTest.cs -System.Security.Policy/UrlTest.cs -System.Security.Policy/ZoneMembershipConditionTest.cs -System.Security.Policy/ZoneTest.cs diff --git a/mcs/class/corlib/aot_only_corlib_test.dll.sources b/mcs/class/corlib/aot_only_corlib_test.dll.sources deleted file mode 100644 index 011effe162c..00000000000 --- a/mcs/class/corlib/aot_only_corlib_test.dll.sources +++ /dev/null @@ -1 +0,0 @@ -#include corlib_test.dll.sources diff --git a/mcs/class/corlib/corefx/SR.cs b/mcs/class/corlib/corefx/SR.cs index 7330ff645cf..ebd0387b1f4 100644 --- a/mcs/class/corlib/corefx/SR.cs +++ b/mcs/class/corlib/corefx/SR.cs @@ -1,7 +1,9 @@ -// TODO: Should be auto-generated from resources.resx +// +// This file was generated by resx2sr tool +// -static class SR +partial class SR { public const string ArgumentException_ValueTupleIncorrectType = "The parameter should be a ValueTuple type of appropriate arity."; public const string ArgumentException_ValueTupleLastArgumentNotAValueTuple = "The TRest type argument of ValueTuple`8 must be a ValueTuple."; -} \ No newline at end of file +} diff --git a/mcs/class/corlib/corlib-net_4_x.csproj b/mcs/class/corlib/corlib-net_4_x.csproj index 1a14d253c8c..4fda0148d07 100644 --- a/mcs/class/corlib/corlib-net_4_x.csproj +++ b/mcs/class/corlib/corlib-net_4_x.csproj @@ -1411,7 +1411,6 @@ - diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources index 58f0233ab81..fed8cbf7522 100644 --- a/mcs/class/corlib/corlib.dll.sources +++ b/mcs/class/corlib/corlib.dll.sources @@ -704,7 +704,6 @@ System.Security.Cryptography/CspKeyContainerInfo.cs System.Security.Cryptography/DESCryptoServiceProvider.cs System.Security.Cryptography/DSACryptoServiceProvider.cs System.Security.Cryptography/ICspAsymmetricAlgorithm.cs -System.Security.Cryptography/IncrementalHash.cs System.Security.Cryptography/KeyNumber.cs System.Security.Cryptography/MD5CryptoServiceProvider.cs System.Security.Cryptography/RC2CryptoServiceProvider.cs diff --git a/mcs/class/corlib/run-tests.bat b/mcs/class/corlib/run-tests.bat deleted file mode 100644 index eb6f2b8543e..00000000000 --- a/mcs/class/corlib/run-tests.bat +++ /dev/null @@ -1,20 +0,0 @@ -@echo off -REM ******************************************************** -REM This batch call all the test batches with default parameters -REM ******************************************************** -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM ******************************************************** - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -set OUTPUT_FILE_PREFIX=MonoTests.Corlib -set RUNNING_FIXTURE=MonoTests.System - -call run-tests.test.bat %BUILD_OPTION% %SECURE_MODE% %OUTPUT_FILE_PREFIX% %RUNNING_FIXTURE% diff --git a/mcs/class/corlib/run-tests.test.bat b/mcs/class/corlib/run-tests.test.bat deleted file mode 100644 index f78342d8125..00000000000 --- a/mcs/class/corlib/run-tests.test.bat +++ /dev/null @@ -1,183 +0,0 @@ -REM @echo off -REM ******************************************************** -REM This batch file receives the follwing parameters: -REM build/rebuild (optional): should the solution file be rebuilded -REM or just builded before test run (default is rebuild) -REM output files name prefix (mandratory) : prefix for naming output xml files -REM test fixture name (optional) : if you want to run some particular test fixture -REM directory to run tests (optional) -REM path back to root directory (opposite to previous param) -REM example run-tests build GhTests Test.Sys.Drawing Test\DrawingTest\Test ..\..\..\ -REM will cause to build (and not rebuild) test solutions, -REM running Test.Sys.Drawing fixture in directory Test\DrawingTest\Test -REM with output files named GhTests.Net.xml and GhTests.GH.xml -REM ******************************************************** - -IF "%1"=="" GOTO USAGE - -IF "%VMW_HOME%"=="" GOTO ENVIRONMENT_EXCEPTION - - - -IF "%1"=="" ( - set BUILD_OPTION=rebuild -) ELSE ( - set BUILD_OPTION=%1 -) - -REM ******************************************************** -REM Set parameters -REM ******************************************************** - -set BUILD_OPTION=%1 -set OUTPUT_FILE_PREFIX=Corlib_MonoTests -set RUNNING_FIXTURE=MonoTests.System -set TEST_SOLUTION=Test\Mscorlib.Test20.sln -set TEST_ASSEMBLY=Mscorlib.Test20.jar -set PROJECT_CONFIGURATION=Debug_Java20 - - -set startDate=%date% -set startTime=%time% -set sdy=%startDate:~10% -set /a sdm=1%startDate:~4,2% - 100 -set /a sdd=1%startDate:~7,2% - 100 -set /a sth=%startTime:~0,2% -set /a stm=1%startTime:~3,2% - 100 -set /a sts=1%startTime:~6,2% - 100 -set TIMESTAMP=%sdy%_%sdm%_%sdd%_%sth%_%stm% - - -REM ******************************************************** -REM @echo Set environment -REM ******************************************************** - -set JGAC_PATH=%VMW_HOME%\jgac\vmw4j2ee_110\ -set JAVA_HOME=%VMW_HOME%\jre6 - -set RUNTIME_CLASSPATH=%JGAC_PATH%mscorlib.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Xml.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%System.Configuration.jar -set RUNTIME_CLASSPATH=%RUNTIME_CLASSPATH%;%JGAC_PATH%J2SE.Helpers.jar -set NUNIT_OPTIONS=/exclude=NotWorking,NotDotNet,TargetJvmNotSupported,TargetJvmNotWorking - -if "%GH_VERSION%"=="" ( - set GH_VERSION=0_0_0_0 -) - -set COMMON_PREFIX=%TIMESTAMP%_%OUTPUT_FILE_PREFIX%.GH_%GH_VERSION%.1.%USERNAME% -set GH_OUTPUT_XML=%COMMON_PREFIX%.xml -set BUILD_LOG=%COMMON_PREFIX%.build.log -set RUN_LOG=%COMMON_PREFIX%.run.log - -set NUNIT_PATH=..\..\nunit20\ -set NUNIT_CLASSPATH=%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.framework.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.util.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit.core.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%NUNIT_PATH%nunit-console\bin\%PROJECT_CONFIGURATION%\nunit-console.jar -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;. -set NUNIT_CLASSPATH=%NUNIT_CLASSPATH%;%TEST_ASSEMBLY% - -set CLASSPATH="%RUNTIME_CLASSPATH%;%NUNIT_CLASSPATH%" - -REM ******************************************************** -@echo Building GH solution... -REM ******************************************************** - -rem devenv %TEST_SOLUTION% /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %TEST_SOLUTION% /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Building NUnit solution... -REM ******************************************************** - -if "%NUNIT_BUILD%" == "DONE" goto NUNITSKIP - -REM devenv ..\..\nunit20\nunit.java.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild ..\..\nunit20\nunit20.java.sln /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -goto NUNITREADY - -:NUNITSKIP -echo Skipping NUnit Build... - -:NUNITREADY -set NUNIT_BUILD=DONE - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -REM ******************************************************** -@echo Running GH tests... -REM ******************************************************** - -REM ******************************************************** -@echo Running fixture "%RUNNING_FIXTURE%" -REM ******************************************************** - -copy %BACK_TO_ROOT_DIR%Test\bin\%PROJECT_CONFIGURATION%\%TEST_ASSEMBLY% . - -REM @echo on -"%JAVA_HOME%\bin\java" -server -Xmx1024M -Djava.io.tmpdir="C:\Temp" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% >>%RUN_LOG% 2<&1 -REM jdb -server -Xmx1024M -Djava.io.tmpdir="C:\Temp" -classpath %CLASSPATH% NUnit.Console.ConsoleUi %TEST_ASSEMBLY% /fixture=%RUNNING_FIXTURE% %NUNIT_OPTIONS% /xml=%GH_OUTPUT_XML% -REM @echo off - -REM ******************************************************** -@echo Build XmlTool -REM ******************************************************** -set XML_TOOL_PATH=..\..\tools\mono-xmltool - -if "%XMLTOOL_BUILD%" == "DONE" goto XMLTOOLSKIP - -REM devenv %XML_TOOL_PATH%\XmlTool.sln /%BUILD_OPTION% %PROJECT_CONFIGURATION% >>%RUNNING_FIXTURE%_build.log.txt 2<&1 -msbuild %XML_TOOL_PATH%\XmlTool20.csproj /t:%BUILD_OPTION% /p:Configuration=%PROJECT_CONFIGURATION% >>%BUILD_LOG% 2<&1 - -IF %ERRORLEVEL% NEQ 0 GOTO BUILD_EXCEPTION - -goto XMLTOOLREADY - -:XMLTOOLSKIP -echo Skipping XmlToll build... - -:XMLTOOLREADY -set XMLTOOL_BUILD=DONE - -copy %XML_TOOL_PATH%\bin\%PROJECT_CONFIGURATION%\xmltool.exe . -copy %XML_TOOL_PATH%\nunit_transform.xslt . - -REM ******************************************************** -@echo Analyze and print results -REM ******************************************************** -@echo on -xmltool.exe --transform nunit_transform.xslt %GH_OUTPUT_XML% -@echo off - -:FINALLY -GOTO END - -:ENVIRONMENT_EXCEPTION -@echo This test requires environment variable VMW_HOME to be defined -GOTO END - -:BUILD_EXCEPTION -@echo Error in building solutions. See %BUILD_LOG% for details... -REM EXIT 1 -GOTO END - -:RUN_EXCEPTION -@echo Error in running fixture %RUNNING_FIXTURE%. See %RUN_LOG% for details... -REM EXIT 1 -GOTO END - -:USAGE -@echo Parameters: "[build|rebuild] " -GOTO END - -:END -copy %RUN_LOG% ..\ -copy %BUILD_LOG% ..\ -copy %GH_OUTPUT_XML% ..\ - -REM EXIT 0 diff --git a/mcs/class/corlib/testing_aot_full_corlib_test.dll.exclude.sources b/mcs/class/corlib/testing_aot_full_corlib_test.dll.exclude.sources new file mode 100644 index 00000000000..eb17a105b75 --- /dev/null +++ b/mcs/class/corlib/testing_aot_full_corlib_test.dll.exclude.sources @@ -0,0 +1,131 @@ +Microsoft.Win32/RegistryKeyTest.cs +System.Diagnostics.Contracts/ContractAssertTest.cs +System.Diagnostics.Contracts/ContractAssumeTest.cs +System.Diagnostics.Contracts/ContractCollectionMethodsTest.cs +System.Diagnostics.Contracts/ContractHelperTest.cs +System.Diagnostics.Contracts/ContractMarkerMethodsTest.cs +System.Diagnostics.Contracts/ContractMustUseRewriterTest.cs +System.Diagnostics.Contracts/Helpers/RunAgainstReferenceAttribute.cs +System.Diagnostics.Contracts/Helpers/TestContractBase.cs +System.Reflection.Emit/AssemblyBuilderAccessTest.cs +System.Reflection.Emit/AssemblyBuilderTest.cs +System.Reflection.Emit/ConstructorBuilderTest.cs +System.Reflection.Emit/ConstructorOnTypeBuilderInstTest.cs +System.Reflection.Emit/CustomAttributeBuilderTest.cs +System.Reflection.Emit/DerivedTypesTest.cs +System.Reflection.Emit/DynamicILInfoTest.cs +System.Reflection.Emit/DynamicMethodTest.cs +System.Reflection.Emit/EnumBuilderTest.cs +System.Reflection.Emit/EventBuilderTest.cs +System.Reflection.Emit/FieldBuilderTest.cs +System.Reflection.Emit/GenericTypeParameterBuilderTest.cs +System.Reflection.Emit/ILGeneratorTest.cs +System.Reflection.Emit/MethodBuilderTest.cs +System.Reflection.Emit/MethodBuilderTestIL.cs +System.Reflection.Emit/MethodOnTypeBuilderInstTest.cs +System.Reflection.Emit/MethodRentalCas.cs +System.Reflection.Emit/MethodRentalTest.cs +System.Reflection.Emit/ModuleBuilderTest.cs +System.Reflection.Emit/ParameterBuilderTest.cs +System.Reflection.Emit/PropertyBuilderTest.cs +System.Reflection.Emit/SignatureHelperTest.cs +System.Reflection.Emit/TypeBuilderTest.cs +System.Runtime.Remoting/ContextTest.cs +System.Runtime.Remoting/RemotingConfigurationTest.cs +System.Runtime.Remoting/RemotingServicesTest.cs +System.Runtime.Remoting/SoapServicesTest.cs +System.Runtime.Remoting/SynchronizationAttributeTest.cs +System.Runtime.Remoting.Channels/ChannelServicesTest.cs +System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs +System.Runtime.Remoting.Messaging/CallContextTest.cs +System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs +System.Security.AccessControl/AuthorizationRuleTest.cs +System.Security.AccessControl/CommonAceTest.cs +System.Security.AccessControl/CommonAclTest.cs +System.Security.AccessControl/CommonObjectSecurityTest.cs +System.Security.AccessControl/CommonSecurityDescriptorTest.cs +System.Security.AccessControl/CryptoKeyAccessRuleTest.cs +System.Security.AccessControl/DirectoryObjectSecurityTest.cs +System.Security.AccessControl/DirectorySecurityTest.cs +System.Security.AccessControl/DiscretionaryAclTest.cs +System.Security.AccessControl/EventWaitHandleSecurityTest.cs +System.Security.AccessControl/FileSecurityTest.cs +System.Security.AccessControl/MutexAccessRuleTest.cs +System.Security.AccessControl/MutexSecurityTest.cs +System.Security.AccessControl/ObjectAceTest.cs +System.Security.AccessControl/ObjectSecurity_TTest.cs +System.Security.AccessControl/ObjectSecurityTest.cs +System.Security.AccessControl/RawAclTest.cs +System.Security.AccessControl/RawSecurityDescriptorTest.cs +System.Security.AccessControl/RegistrySecurityTest.cs +System.Security.AccessControl/SystemAclTest.cs +System.Security.Permissions/CodeAccessSecurityAttributeTest.cs +System.Security.Permissions/EnvironmentPermissionAttributeTest.cs +System.Security.Permissions/EnvironmentPermissionTest.cs +System.Security.Permissions/FileDialogPermissionAttributeTest.cs +System.Security.Permissions/FileDialogPermissionTest.cs +System.Security.Permissions/FileIOPermissionAttributeTest.cs +System.Security.Permissions/FileIOPermissionTest.cs +System.Security.Permissions/GacIdentityPermissionAttributeTest.cs +System.Security.Permissions/GacIdentityPermissionTest.cs +System.Security.Permissions/HostProtectionAttributeTest.cs +System.Security.Permissions/IBuiltInPermissionTest.cs +System.Security.Permissions/IsolatedStorageFilePermissionAttributeTest.cs +System.Security.Permissions/IsolatedStorageFilePermissionTest.cs +System.Security.Permissions/IsolatedStoragePermissionAttributeTest.cs +System.Security.Permissions/KeyContainerPermissionAttributeTest.cs +System.Security.Permissions/PermissionSetAttributeTest.cs +System.Security.Permissions/PrincipalPermissionAttributeTest.cs +System.Security.Permissions/PrincipalPermissionTest.cs +System.Security.Permissions/PublisherIdentityPermissionAttributeTest.cs +System.Security.Permissions/PublisherIdentityPermissionTest.cs +System.Security.Permissions/ReflectionPermissionAttributeTest.cs +System.Security.Permissions/ReflectionPermissionTest.cs +System.Security.Permissions/RegistryPermissionAttributeTest.cs +System.Security.Permissions/RegistryPermissionTest.cs +System.Security.Permissions/SecurityAttributeTest.cs +System.Security.Permissions/SecurityPermissionAttributeTest.cs +System.Security.Permissions/SecurityPermissionTest.cs +System.Security.Permissions/SiteIdentityPermissionAttributeTest.cs +System.Security.Permissions/SiteIdentityPermissionTest.cs +System.Security.Permissions/StrongNameIdentityPermissionAttributeTest.cs +System.Security.Permissions/StrongNameIdentityPermissionTest.cs +System.Security.Permissions/StrongNamePublicKeyBlobTest.cs +System.Security.Permissions/UIPermissionAttributeTest.cs +System.Security.Permissions/UIPermissionTest.cs +System.Security.Permissions/UrlIdentityPermissionAttributeTest.cs +System.Security.Permissions/UrlIdentityPermissionTest.cs +System.Security.Permissions/ZoneIdentityPermissionAttributeTest.cs +System.Security.Permissions/ZoneIdentityPermissionTest.cs +System.Security.Policy/AllMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryMembershipConditionTest.cs +System.Security.Policy/ApplicationDirectoryTest.cs +System.Security.Policy/ApplicationMembershipConditionTest.cs +System.Security.Policy/ApplicationSecurityManagerCas.cs +System.Security.Policy/ApplicationSecurityManagerTest.cs +System.Security.Policy/ApplicationTrustTest.cs +System.Security.Policy/CodeGroupTest.cs +System.Security.Policy/DomainApplicationMembershipConditionTest.cs +System.Security.Policy/EvidenceTest.cs +System.Security.Policy/FileCodeGroupTest.cs +System.Security.Policy/FirstMatchCodeGroupTest.cs +System.Security.Policy/GacMembershipConditionTest.cs +System.Security.Policy/GacTest.cs +System.Security.Policy/HashMembershipConditionTest.cs +System.Security.Policy/HashTest.cs +System.Security.Policy/IBuiltInEvidenceTest.cs +System.Security.Policy/NetCodeGroupTest.cs +System.Security.Policy/PermissionRequestEvidenceTest.cs +System.Security.Policy/PolicyLevelTest.cs +System.Security.Policy/PolicyStatementTest.cs +System.Security.Policy/PublisherMembershipConditionTest.cs +System.Security.Policy/PublisherTest.cs +System.Security.Policy/SiteMembershipConditionTest.cs +System.Security.Policy/SiteTest.cs +System.Security.Policy/StrongNameMembershipConditionTest.cs +System.Security.Policy/StrongNameTest.cs +System.Security.Policy/UnionCodeGroupTest.cs +System.Security.Policy/UrlMembershipConditionTest.cs +System.Security.Policy/UrlTest.cs +System.Security.Policy/ZoneMembershipConditionTest.cs +System.Security.Policy/ZoneTest.cs diff --git a/mcs/class/corlib/testing_aot_full_corlib_test.dll.sources b/mcs/class/corlib/testing_aot_full_corlib_test.dll.sources new file mode 100644 index 00000000000..011effe162c --- /dev/null +++ b/mcs/class/corlib/testing_aot_full_corlib_test.dll.sources @@ -0,0 +1 @@ +#include corlib_test.dll.sources diff --git a/mcs/class/corlib/testing_aot_hybrid_corlib_test.dll.exclude.sources b/mcs/class/corlib/testing_aot_hybrid_corlib_test.dll.exclude.sources new file mode 100644 index 00000000000..9b651e6fc9e --- /dev/null +++ b/mcs/class/corlib/testing_aot_hybrid_corlib_test.dll.exclude.sources @@ -0,0 +1,22 @@ +Microsoft.Win32/RegistryKeyTest.cs +System.Reflection/VisibilityTest.cs +System.Security.AccessControl/AuthorizationRuleTest.cs +System.Security.AccessControl/CommonAceTest.cs +System.Security.AccessControl/CommonAclTest.cs +System.Security.AccessControl/CommonObjectSecurityTest.cs +System.Security.AccessControl/CommonSecurityDescriptorTest.cs +System.Security.AccessControl/CryptoKeyAccessRuleTest.cs +System.Security.AccessControl/DirectoryObjectSecurityTest.cs +System.Security.AccessControl/DirectorySecurityTest.cs +System.Security.AccessControl/DiscretionaryAclTest.cs +System.Security.AccessControl/EventWaitHandleSecurityTest.cs +System.Security.AccessControl/FileSecurityTest.cs +System.Security.AccessControl/MutexAccessRuleTest.cs +System.Security.AccessControl/MutexSecurityTest.cs +System.Security.AccessControl/ObjectAceTest.cs +System.Security.AccessControl/ObjectSecurity_TTest.cs +System.Security.AccessControl/ObjectSecurityTest.cs +System.Security.AccessControl/RawAclTest.cs +System.Security.AccessControl/RawSecurityDescriptorTest.cs +System.Security.AccessControl/RegistrySecurityTest.cs +System.Security.AccessControl/SystemAclTest.cs diff --git a/mcs/class/dlr/Makefile b/mcs/class/dlr/Makefile index 2a701832e6d..bb352b71fb4 100644 --- a/mcs/class/dlr/Makefile +++ b/mcs/class/dlr/Makefile @@ -4,11 +4,7 @@ SUBDIRS = include ../../build/rules.make DISTFILES = \ - Runtime/Microsoft.Dynamic/*.cs \ - Runtime/Microsoft.Scripting.Core/Actions/*.cs \ - Runtime/Microsoft.Scripting.Core/Ast/*.cs \ - Runtime/Microsoft.Scripting.Core/Compiler/*.cs \ - Runtime/Microsoft.Scripting.Core/Utils/*.cs + Runtime/Microsoft.Dynamic/*.cs all-local install-local clean-local test-local run-test-local run-test-ondotnet-local uninstall-local doc-update-local csproj-local: diff --git a/mcs/class/dlr/README b/mcs/class/dlr/README deleted file mode 100644 index 7ec5bea3410..00000000000 --- a/mcs/class/dlr/README +++ /dev/null @@ -1,8 +0,0 @@ -This is fork of Microsoft DLR source code. The original code was published at -http://dlr.codeplex.com/ which had the code used for .NET 4.0 -System.Linq.Expression public API. Since them the code was migrated to -https://github.com/IronLanguages/main but it no longer has the goal to offer -compatible System.Linq.Expression API and we cannot use some part of it. - -We want to have minimum local changes. Importatant changes need to be marked -using easily recognizable marker (like MONO_INTERPRETER) for easier merging. \ No newline at end of file diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Actions/Dummy.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Actions/Dummy.cs deleted file mode 100644 index 880a99a8e2a..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Actions/Dummy.cs +++ /dev/null @@ -1,5 +0,0 @@ -namespace Microsoft.Scripting.Actions { - class Dummy - { - } -} \ No newline at end of file diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/BinaryExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/BinaryExpression.cs deleted file mode 100644 index 10f8a9658c9..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/BinaryExpression.cs +++ /dev/null @@ -1,133 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Reflection; -using System.Dynamic; -using Microsoft.Scripting.Utils; -using AstUtils = Microsoft.Scripting.Ast.Utils; - -namespace Microsoft.Scripting.Ast { - public static partial class Utils { -#if !MONO_INTERPRETER - /// - /// Null coalescing expression - /// {result} ::= ((tmp = {_left}) == null) ? {right} : tmp - /// '??' operator in C#. - /// - public static Expression Coalesce(Expression left, Expression right, out ParameterExpression temp) { - return CoalesceInternal(left, right, null, false, out temp); - } - - /// - /// True coalescing expression. - /// {result} ::= IsTrue(tmp = {left}) ? {right} : tmp - /// Generalized AND semantics. - /// - public static Expression CoalesceTrue(Expression left, Expression right, MethodInfo isTrue, out ParameterExpression temp) { - ContractUtils.RequiresNotNull(isTrue, "isTrue"); - return CoalesceInternal(left, right, isTrue, false, out temp); - } - - /// - /// False coalescing expression. - /// {result} ::= IsTrue(tmp = {left}) ? tmp : {right} - /// Generalized OR semantics. - /// - public static Expression CoalesceFalse(Expression left, Expression right, MethodInfo isTrue, out ParameterExpression temp) { - ContractUtils.RequiresNotNull(isTrue, "isTrue"); - return CoalesceInternal(left, right, isTrue, true, out temp); - } - - private static Expression CoalesceInternal(Expression left, Expression right, MethodInfo isTrue, bool isReverse, out ParameterExpression temp) { - ContractUtils.RequiresNotNull(left, "left"); - ContractUtils.RequiresNotNull(right, "right"); - - // A bit too strict, but on a safe side. - ContractUtils.Requires(left.Type == right.Type, "Expression types must match"); - - temp = Expression.Variable(left.Type, "tmp_left"); - - Expression condition; - if (isTrue != null) { - ContractUtils.Requires(isTrue.ReturnType == typeof(bool), "isTrue", "Predicate must return bool."); - ParameterInfo[] parameters = isTrue.GetParameters(); - ContractUtils.Requires(parameters.Length == 1, "isTrue", "Predicate must take one parameter."); - ContractUtils.Requires(isTrue.IsStatic && isTrue.IsPublic, "isTrue", "Predicate must be public and static."); - - Type pt = parameters[0].ParameterType; - ContractUtils.Requires(TypeUtils.CanAssign(pt, left.Type), "left", "Incorrect left expression type"); - condition = Expression.Call(isTrue, Expression.Assign(temp, left)); - } else { - ContractUtils.Requires(TypeUtils.CanCompareToNull(left.Type), "left", "Incorrect left expression type"); - condition = Expression.Equal(Expression.Assign(temp, left), AstUtils.Constant(null, left.Type)); - } - - Expression t, f; - if (isReverse) { - t = temp; - f = right; - } else { - t = right; - f = temp; - } - - return Expression.Condition(condition, t, f); - } - - public static Expression Coalesce(LambdaBuilder builder, Expression left, Expression right) { - ParameterExpression temp; - Expression result = Coalesce(left, right, out temp); - builder.AddHiddenVariable(temp); - return result; - } - - /// - /// True coalescing expression. - /// {result} ::= IsTrue(tmp = {left}) ? {right} : tmp - /// Generalized AND semantics. - /// - public static Expression CoalesceTrue(LambdaBuilder builder, Expression left, Expression right, MethodInfo isTrue) { - ContractUtils.RequiresNotNull(isTrue, "isTrue"); - ParameterExpression temp; - Expression result = CoalesceTrue(left, right, isTrue, out temp); - builder.AddHiddenVariable(temp); - return result; - } - - /// - /// False coalescing expression. - /// {result} ::= IsTrue(tmp = {left}) ? tmp : {right} - /// Generalized OR semantics. - /// - public static Expression CoalesceFalse(LambdaBuilder builder, Expression left, Expression right, MethodInfo isTrue) { - ContractUtils.RequiresNotNull(isTrue, "isTrue"); - ParameterExpression temp; - Expression result = CoalesceFalse(left, right, isTrue, out temp); - builder.AddHiddenVariable(temp); - return result; - } -#endif - public static BinaryExpression Update(this BinaryExpression expression, Expression left, Expression right) { - return expression.Update(left, expression.Conversion, right); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/ConstantExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/ConstantExpression.cs deleted file mode 100644 index 881f0a3351c..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/ConstantExpression.cs +++ /dev/null @@ -1,235 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -#if FEATURE_NUMERICS -using BigInt = System.Numerics.BigInteger; -using Complex = System.Numerics.Complex; -#endif - -using System; -using System.Reflection; -using Microsoft.Scripting.Generation; -using Microsoft.Scripting.Math; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Ast { - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1724:TypeNamesShouldNotMatchNamespaces")] - public static partial class Utils { - private static readonly ConstantExpression TrueLiteral = Expression.Constant(true, typeof(bool)); - private static readonly ConstantExpression FalseLiteral = Expression.Constant(false, typeof(bool)); - private static readonly ConstantExpression NullLiteral = Expression.Constant(null, typeof(object)); - private static readonly ConstantExpression EmptyStringLiteral = Expression.Constant(String.Empty, typeof(string)); - private static readonly ConstantExpression[] IntCache = new ConstantExpression[100]; - - /// - /// Wraps the given value in a WeakReference and returns a tree that will retrieve - /// the value from the WeakReference. - /// - public static MemberExpression WeakConstant(object value) { - System.Diagnostics.Debug.Assert(!(value is Expression)); - return Expression.Property( - Constant(new WeakReference(value)), - typeof(WeakReference).GetDeclaredProperty("Target") - ); - } - - public static ConstantExpression Constant(object value, Type type) { - return Expression.Constant(value, type); - } - - // The helper API should return ConstantExpression after SymbolConstantExpression goes away - public static Expression Constant(object value) { - if (value == null) { - return NullLiteral; - } - -#if !MONO_INTERPRETER - BigInteger bi = value as BigInteger; - if ((object)bi != null) { - return BigIntegerConstant(bi); -#endif - -#if FEATURE_NUMERICS - if (value is BigInt) - return BigIntConstant((BigInt)value); - if (value is Complex) - return ComplexConstant((Complex)value); -#endif - -#if !MONO_INTERPRETER - if (value is Complex64) - return Complex64Constant((Complex64)value); -#endif - if (value is Type) { - return Expression.Constant(value, typeof(Type)); - } else if (value is ConstructorInfo) { - return Expression.Constant(value, typeof(ConstructorInfo)); - } else if (value is EventInfo) { - return Expression.Constant(value, typeof(EventInfo)); - } else if (value is FieldInfo) { - return Expression.Constant(value, typeof(FieldInfo)); - } else if (value is MethodInfo) { - return Expression.Constant(value, typeof(MethodInfo)); - } else if (value is PropertyInfo) { - return Expression.Constant(value, typeof(PropertyInfo)); - } else { - Type t = value.GetType(); - if (!t.GetTypeInfo().IsEnum) { - switch (t.GetTypeCode()) { - case TypeCode.Boolean: - return (bool)value ? TrueLiteral : FalseLiteral; - case TypeCode.Int32: - int x = (int)value; - int cacheIndex = x + 2; - if (cacheIndex >= 0 && cacheIndex < IntCache.Length) { - ConstantExpression res; - if ((res = IntCache[cacheIndex]) == null) { - IntCache[cacheIndex] = res = Constant(x, typeof(int)); - } - return res; - } - break; - case TypeCode.String: - if (String.IsNullOrEmpty((string)value)) { - return EmptyStringLiteral; - } - break; - } - } - return Expression.Constant(value); - } - } - -#if !MONO_INTERPRETER - private static Expression BigIntegerConstant(BigInteger value) { - int ival; - if (value.AsInt32(out ival)) { - return Expression.Call( - new Func(BigInteger.Create).GetMethodInfo(), - Constant(ival) - ); - } - - long lval; - if (value.AsInt64(out lval)) { - return Expression.Call( - new Func(BigInteger.Create).GetMethodInfo(), - Constant(lval) - ); - } - -#if !FEATURE_NUMERICS - return Expression.Call( - new Func(CompilerHelpers.CreateBigInteger).Method, - Constant((int)value.Sign), - CreateArray(value.GetWords()) - ); -#else - return Expression.Call( - new Func(CompilerHelpers.CreateBigInteger).GetMethodInfo(), - Constant(value.Sign < 0), - CreateArray(value.Abs().ToByteArray()) - ); - } - - private static Expression BigIntConstant(BigInt value) { - int ival; - if (value.AsInt32(out ival)) { - return Expression.Call( - new Func(CompilerHelpers.CreateBigInt).GetMethodInfo(), - Constant(ival) - ); - } - - long lval; - if (value.AsInt64(out lval)) { - return Expression.Call( - new Func(CompilerHelpers.CreateBigInt).GetMethodInfo(), - Constant(lval) - ); - } - - return Expression.Call( - new Func(CompilerHelpers.CreateBigInt).GetMethodInfo(), - Constant(value.Sign < 0), - CreateArray(value.Abs().ToByteArray()) - ); -#endif - } -#endif - private static Expression CreateArray(T[] array) { - // TODO: could we use blobs? - Expression[] init = new Expression[array.Length]; - for (int i = 0; i < init.Length; i++) { - init[i] = Constant(array[i]); - } - return Expression.NewArrayInit(typeof(T), init); - } - -#if FEATURE_NUMERICS - private static Expression ComplexConstant(Complex value) { - if (value.Real != 0.0) { - if (value.Imaginary() != 0.0) { - return Expression.Call( - new Func(MathUtils.MakeComplex).GetMethodInfo(), - Constant(value.Real), - Constant(value.Imaginary()) - ); - } else { - return Expression.Call( - new Func(MathUtils.MakeReal).GetMethodInfo(), - Constant(value.Real) - ); - } - } else { - return Expression.Call( - new Func(MathUtils.MakeImaginary).GetMethodInfo(), - Constant(value.Imaginary()) - ); - } - } -#endif - -#if !MONO_INTERPRETER - private static Expression Complex64Constant(Complex64 value) { - if (value.Real != 0.0) { - if (value.Imag != 0.0) { - return Expression.Call( - new Func(Complex64.Make).GetMethodInfo(), - Constant(value.Real), - Constant(value.Imag) - ); - } else { - return Expression.Call( - new Func(Complex64.MakeReal).GetMethodInfo(), - Constant(value.Real) - ); - } - } else { - return Expression.Call( - new Func(Complex64.MakeImaginary).GetMethodInfo(), - Constant(value.Imag) - ); - } - } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/EmptyStatements.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/EmptyStatements.cs deleted file mode 100644 index 0968a2ca616..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/EmptyStatements.cs +++ /dev/null @@ -1,45 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Dynamic; - -namespace Microsoft.Scripting.Ast { - public static partial class Utils { - private static readonly DefaultExpression VoidInstance = Expression.Empty(); - - public static DefaultExpression Empty() { - return VoidInstance; - } - - public static DefaultExpression Default(Type type) { - if (type == typeof(void)) { - return Empty(); - } - return Expression.Default(type); - } - } -} - - - - - diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/LightLambdaExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/LightLambdaExpression.cs deleted file mode 100644 index 6b2a08e3443..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/LightLambdaExpression.cs +++ /dev/null @@ -1,149 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.Generic; -using System.Text; -using Microsoft.Scripting.Interpreter; -using Microsoft.Scripting.Generation; - -namespace Microsoft.Scripting.Ast { - public class LightLambdaExpression : Expression { - private readonly Expression _body; - private readonly Type _retType; - private readonly string _name; - private readonly IList _args; - - internal LightLambdaExpression(Type retType, Expression body, string name, IList args) { - _body = body; - _name = name; - _args = args; - _retType = retType; - } - - public Expression Body { - get { - return _body; - } - } - - public string Name { - get { - return _name; - } - } - - public IList Parameters { - get { - return _args; - } - } - - internal virtual LambdaExpression ReduceToLambdaWorker() { - throw new InvalidOperationException(); - } - - public Delegate Compile() { - return Compile(-1); - } - - public Delegate Compile(int compilationThreshold) { - return new LightCompiler(compilationThreshold).CompileTop(this).CreateDelegate(); - } - - public override ExpressionType NodeType { - get { return ExpressionType.Extension; } - } - - public override bool CanReduce { - get { return true; } - } - - public override Expression Reduce() { - return ReduceToLambdaWorker(); - } - - public Type ReturnType { - get { - return _retType; - } - } - } - - internal class TypedLightLambdaExpression : LightLambdaExpression { - private readonly Type _delegateType; - - internal TypedLightLambdaExpression(Type retType, Type delegateType, Expression body, string name, IList args) - : base(retType, body, name, args) { - _delegateType = delegateType; - } - - internal override LambdaExpression ReduceToLambdaWorker() { - return Expression.Lambda( - _delegateType, - Body, - Name, - Parameters - ); - } - - public override Type Type { - get { return _delegateType; } - } - } - - public class LightExpression : LightLambdaExpression { - internal LightExpression(Type retType, Expression body, string name, IList args) - : base(retType, body, name, args) { - } - - public Expression ReduceToLambda() { - return Expression.Lambda(Body, Name, Parameters); - } - - public override Type Type { - get { return typeof(T); } - } - - public new T Compile() { - return Compile(-1); - } - - public new T Compile(int compilationThreshold) { - return (T)(object)new LightCompiler(compilationThreshold).CompileTop(this).CreateDelegate(); - } - - internal override LambdaExpression ReduceToLambdaWorker() { - return ReduceToLambda(); - } - } - - public static partial class Utils { - public static LightExpression LightLambda(Type retType, Expression body, string name, IList args) { - return new LightExpression(retType, body, name, args); - } - - public static LightLambdaExpression LightLambda(Type retType, Type delegateType, Expression body, string name, IList args) { - return new TypedLightLambdaExpression(retType, delegateType, body, name, args); - } - } - -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/UnaryExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/UnaryExpression.cs deleted file mode 100644 index 19477b2320e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/UnaryExpression.cs +++ /dev/null @@ -1,82 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; -using System.Reflection; - -namespace Microsoft.Scripting.Ast { - public static partial class Utils { - /// - /// Converts an expression to a void type. - /// - /// An to convert to void. - /// An that has the property equal to and the and property set to void. - public static Expression Void(Expression expression) { - ContractUtils.RequiresNotNull(expression, "expression"); - if (expression.Type == typeof(void)) { - return expression; - } - return Expression.Block(expression, Utils.Empty()); - } - - public static Expression Convert(Expression expression, Type type) { - ContractUtils.RequiresNotNull(expression, "expression"); - - if (expression.Type == type) { - return expression; - } - - if (expression.Type == typeof(void)) { - return Expression.Block(expression, Utils.Default(type)); - } - - if (type == typeof(void)) { - return Void(expression); - } - - // TODO: this is not the right level for this to be at. It should - // be pushed into languages if they really want this behavior. - if (type == typeof(object)) { - return Box(expression); - } - - return Expression.Convert(expression, type); - } - - /// - /// Returns an expression that boxes a given value. Uses boxed objects cache for Int32 and Boolean types. - /// - public static Expression Box(Expression expression) { - MethodInfo m; - if (expression.Type == typeof(int)) { - m = ScriptingRuntimeHelpers.Int32ToObjectMethod; - } else if (expression.Type == typeof(bool)) { - m = ScriptingRuntimeHelpers.BooleanToObjectMethod; - } else { - m = null; - } - - return Expression.Convert(expression, typeof(object), m); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/Utils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/Utils.cs deleted file mode 100644 index 165a42458e8..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Ast/Utils.cs +++ /dev/null @@ -1,111 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Reflection; -using System.Dynamic; -using Microsoft.Scripting.Utils; -using AstUtils = Microsoft.Scripting.Ast.Utils; - -namespace Microsoft.Scripting.Ast { - [Flags] - public enum ExpressionAccess { - None = 0, - Read = 1, - Write = 2, - ReadWrite = Read | Write, - } - - public static partial class Utils { - /// - /// Determines whether specified expression type represents an assignment. - /// - /// - /// True if the expression type represents an assignment. - /// - /// - /// Note that some other nodes can also assign to variables, members or array items: - /// MemberInit, NewArrayInit, Call with ref params, New with ref params, Dynamic with ref params. - /// - public static bool IsAssignment(this ExpressionType type) { - return IsWriteOnlyAssignment(type) || IsReadWriteAssignment(type); - } - - public static bool IsWriteOnlyAssignment(this ExpressionType type) { - return type == ExpressionType.Assign; - } - - public static bool IsReadWriteAssignment(this ExpressionType type) { - switch (type) { - // unary: - case ExpressionType.PostDecrementAssign: - case ExpressionType.PostIncrementAssign: - case ExpressionType.PreDecrementAssign: - case ExpressionType.PreIncrementAssign: - - // binary - compound: - case ExpressionType.AddAssign: - case ExpressionType.AddAssignChecked: - case ExpressionType.AndAssign: - case ExpressionType.DivideAssign: - case ExpressionType.ExclusiveOrAssign: - case ExpressionType.LeftShiftAssign: - case ExpressionType.ModuloAssign: - case ExpressionType.MultiplyAssign: - case ExpressionType.MultiplyAssignChecked: - case ExpressionType.OrAssign: - case ExpressionType.PowerAssign: - case ExpressionType.RightShiftAssign: - case ExpressionType.SubtractAssign: - case ExpressionType.SubtractAssignChecked: - return true; - } - return false; - } - - /// - /// Determines if the left child of the given expression is read or written to or both. - /// - public static ExpressionAccess GetLValueAccess(this ExpressionType type) { - if (type.IsReadWriteAssignment()) { - return ExpressionAccess.ReadWrite; - } - - if (type.IsWriteOnlyAssignment()) { - return ExpressionAccess.Write; - } - - return ExpressionAccess.Read; - } - - public static bool IsLValue(this ExpressionType type) { - // see Expression.RequiresCanWrite - switch (type) { - case ExpressionType.Index: - case ExpressionType.MemberAccess: - case ExpressionType.Parameter: - return true; - } - - return false; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/CompilerHelpers.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/CompilerHelpers.cs deleted file mode 100644 index 5f3cba2ff6e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/CompilerHelpers.cs +++ /dev/null @@ -1,911 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_NUMERICS -using BigInt = System.Numerics.BigInteger; -#endif - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#endif - -using System; -using System.Collections; -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Dynamic; -using System.Linq; -using System.Reflection; -using System.Threading; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Actions; -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Interpreter; -using Microsoft.Scripting.Math; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; -using AstUtils = Microsoft.Scripting.Ast.Utils; - -namespace Microsoft.Scripting.Generation { - // TODO: keep this? - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1045:DoNotPassTypesByReference")] - public delegate void ActionRef(ref T0 arg0, ref T1 arg1); - - public static class CompilerHelpers { - public const MethodAttributes PublicStatic = MethodAttributes.Public | MethodAttributes.Static; - private static MethodInfo _CreateInstanceMethod; - - private static int _Counter; // for generating unique names for lambda methods - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - public static object GetMissingValue(Type type) { - ContractUtils.RequiresNotNull(type, "type"); - - if (type.IsByRef) type = type.GetElementType(); - if (type.IsEnum()) return Activator.CreateInstance(type); - - switch (type.GetTypeCode()) { - default: - case TypeCode.Object: - // struct - if (type.IsSealed() && type.IsValueType()) { - return Activator.CreateInstance(type); - } else if (type == typeof(object)) { - // parameter of type object receives the actual Missing value - return Missing.Value; - } else if (!type.IsValueType()) { - return null; - } else { - throw Error.CantCreateDefaultTypeFor(type); - } - case TypeCode.Empty: - case TypeCode.DBNull: - case TypeCode.String: - return null; - - case TypeCode.Boolean: return false; - case TypeCode.Char: return '\0'; - case TypeCode.SByte: return (sbyte)0; - case TypeCode.Byte: return (byte)0; - case TypeCode.Int16: return (short)0; - case TypeCode.UInt16: return (ushort)0; - case TypeCode.Int32: return (int)0; - case TypeCode.UInt32: return (uint)0; - case TypeCode.Int64: return 0L; - case TypeCode.UInt64: return 0UL; - case TypeCode.Single: return 0.0f; - case TypeCode.Double: return 0.0D; - case TypeCode.Decimal: return (decimal)0; - case TypeCode.DateTime: return DateTime.MinValue; - } - } - - public static bool IsStatic(MethodBase mi) { - return mi.IsConstructor || mi.IsStatic; - } - - /// - /// True if the MethodBase is method which is going to construct an object - /// - public static bool IsConstructor(MethodBase mb) { - if (mb.IsConstructor) { - return true; - } - - if (mb.IsGenericMethod) { - MethodInfo mi = mb as MethodInfo; - - if (_CreateInstanceMethod == null) - Interlocked.CompareExchange (ref _CreateInstanceMethod, typeof(ScriptingRuntimeHelpers).GetMethod ("CreateInstance"), null); - - if (mi.GetGenericMethodDefinition() == _CreateInstanceMethod) { - return true; - } - } - - return false; - } - - public static T[] MakeRepeatedArray(T item, int count) { - T[] ret = new T[count]; - for (int i = 0; i < count; i++) ret[i] = item; - return ret; - } - - public static bool IsComparisonOperator(ExpressionType op) { - switch (op) { - case ExpressionType.LessThan: return true; - case ExpressionType.LessThanOrEqual: return true; - case ExpressionType.GreaterThan: return true; - case ExpressionType.GreaterThanOrEqual: return true; - case ExpressionType.Equal: return true; - case ExpressionType.NotEqual: return true; - } - return false; - } - - /// - /// Returns the System.Type for any object, including null. The type of null - /// is represented by None.Type and all other objects just return the - /// result of Object.GetType - /// - public static Type GetType(object obj) { - if (obj == null) { - return typeof(DynamicNull); - } - - return obj.GetType(); - } - - /// - /// Simply returns a Type[] from calling GetType on each element of args. - /// - public static Type[] GetTypes(object[] args) { - Type[] types = new Type[args.Length]; - for (int i = 0; i < args.Length; i++) { - types[i] = GetType(args[i]); - } - return types; - } - - /// - /// EMITTED - /// Used by default method binder to check types of splatted arguments. - /// - public static bool TypesEqual(IList args, int start, Type[] types) { - for (int i = 0; i < types.Length; i++) { - object arg = args[start + i]; - if (types[i] != (arg != null ? arg.GetType() : null)) { - return false; - } - } - return true; - } - - public static bool CanOptimizeMethod(MethodBase method) { - if (method.ContainsGenericParameters || - method.IsProtected() || - method.IsPrivate || - !method.DeclaringType.IsVisible()) { - return false; - } - return true; - } - - /// - /// Given a MethodInfo which may be declared on a non-public type this attempts to - /// return a MethodInfo which will dispatch to the original MethodInfo but is declared - /// on a public type. - /// - /// Returns the original method if the method if a public version cannot be found. - /// - public static MethodInfo TryGetCallableMethod(Type targetType, MethodInfo method) { - if (method.DeclaringType == null || method.DeclaringType.IsVisible()) { - return method; - } - - // first try and get it from the base type we're overriding... - MethodInfo baseMethod = method.GetRuntimeBaseDefinition(); - - if (baseMethod.DeclaringType.IsVisible() || baseMethod.DeclaringType.IsInterface()) { - // We need to instantiate the method as GetBaseDefinition might return a generic definition of the base method: - if (baseMethod.IsGenericMethodDefinition) { - baseMethod = baseMethod.MakeGenericMethod(method.GetGenericArguments()); - } - return baseMethod; - } - -#if WIN8 // TODO: interface map, method handle - foreach (Type iface in targetType.GetImplementedInterfaces()) { - dynamic mapping = ((dynamic)targetType).GetInterfaceMap(iface); - for (int i = 0; i < mapping.TargetMethods.Length; i++) { - MethodInfo targetMethod = mapping.TargetMethods[i]; - if (targetMethod != null && ((dynamic)targetMethod).MethodHandle == ((dynamic)method).MethodHandle) { - return mapping.InterfaceMethods[i]; - } - } - } -#else - // maybe we can get it from an interface on the type this - // method came from... - foreach (Type iface in targetType.GetImplementedInterfaces()) { - if (iface.IsPublic()) { - InterfaceMapping mapping = targetType.GetInterfaceMap(iface); - for (int i = 0; i < mapping.TargetMethods.Length; i++) { - MethodInfo targetMethod = mapping.TargetMethods[i]; - if (targetMethod != null && targetMethod.MethodHandle == method.MethodHandle) { - return mapping.InterfaceMethods[i]; - } - } - } - } -#endif - return method; - } - - /// - /// Non-public types can have public members that we find when calling type.GetMember(...). This - /// filters out the non-visible members by attempting to resolve them to the correct visible type. - /// - /// If no correct visible type can be found then the member is not visible and we won't call it. - /// - public static IEnumerable FilterNonVisibleMembers(Type targetType, IEnumerable members) { - if (targetType.IsVisible()) { - return members; - } else { - return FilterNonVisibleMembersIterator(targetType, members); - } - } - - public static IEnumerable FilterNonVisibleMembersIterator(Type targetType, IEnumerable members) { - foreach (var member in members) { - MemberInfo visible = TryGetVisibleMember(targetType, member); - if (visible != null) { - yield return visible; - } - } - } - - public static MemberInfo TryGetVisibleMember(Type targetType, MemberInfo member) { - MethodInfo method; - PropertyInfo property; - EventInfo evnt; - - MethodInfo mi; - MemberInfo visible = null; - - if ((method = member as MethodInfo) != null) { - mi = TryGetCallableMethod(targetType, method); - if (CompilerHelpers.IsVisible(mi)) { - visible = mi; - } - } else if ((property = member as PropertyInfo) != null) { - mi = TryGetCallableMethod(targetType, property.GetGetMethod() ?? property.GetSetMethod()); - if (CompilerHelpers.IsVisible(mi)) { - visible = mi.DeclaringType.GetDeclaredProperty(property.Name); - } - } else if ((evnt = member as EventInfo) != null) { - mi = TryGetCallableMethod(targetType, evnt.GetAddMethod() ?? evnt.GetRemoveMethod() ?? evnt.GetRaiseMethod()); - if (CompilerHelpers.IsVisible(mi)) { - visible = mi.DeclaringType.GetDeclaredEvent(evnt.Name); - } - } - - // all others can't be exposed out this way - return visible; - } - -#if !WIN8 - /// - /// Sees if two MemberInfos point to the same underlying construct in IL. This - /// ignores the ReflectedType property which exists on MemberInfos which - /// causes direct comparisons to be false even if they are the same member. - /// - public static bool MemberEquals(this MemberInfo self, MemberInfo other) { - if ((self == null) != (other == null)) { - // one null, the other isn't. - return false; - } else if (self == null) { - // both null - return true; - } - - if (self.MemberType != other.MemberType) { - return false; - } - - switch (self.MemberType) { - case MemberTypes.Field: - return ((FieldInfo)self).FieldHandle.Equals(((FieldInfo)other).FieldHandle); - case MemberTypes.Method: - return ((MethodInfo)self).MethodHandle.Equals(((MethodInfo)other).MethodHandle); - case MemberTypes.Constructor: - return ((ConstructorInfo)self).MethodHandle.Equals(((ConstructorInfo)other).MethodHandle); - case MemberTypes.NestedType: - case MemberTypes.TypeInfo: - return ((Type)self).TypeHandle.Equals(((Type)other).TypeHandle); - case MemberTypes.Event: - case MemberTypes.Property: - default: - return - ((MemberInfo)self).Module == ((MemberInfo)other).Module && - ((MemberInfo)self).MetadataToken == ((MemberInfo)other).MetadataToken; - } - } -#endif - - public static bool IsVisible(MethodBase info) { - return info.IsPublic && (info.DeclaringType == null || info.DeclaringType.IsVisible()); - } - - public static bool IsVisible(FieldInfo info) { - return info.IsPublic && (info.DeclaringType == null || info.DeclaringType.IsVisible()); - } - - public static bool IsProtected(this MethodBase info) { - return info.IsFamily || info.IsFamilyOrAssembly; - } - - public static bool IsProtected(this FieldInfo info) { - return info.IsFamily || info.IsFamilyOrAssembly; - } - - public static bool IsProtected(this Type type) { - return type.GetTypeInfo().IsNestedFamily || type.GetTypeInfo().IsNestedFamORAssem; - } - - public static Type GetVisibleType(object value) { - return GetVisibleType(GetType(value)); - } - - public static Type GetVisibleType(Type t) { - while (!t.IsVisible()) { - t = t.GetBaseType(); - } - return t; - } - - public static MethodBase[] GetConstructors(Type t, bool privateBinding) { - return GetConstructors(t, privateBinding, false); - } - - public static MethodBase[] GetConstructors(Type t, bool privateBinding, bool includeProtected) { - if (t.IsArray) { - // The JIT verifier doesn't like new int[](3) even though it appears as a ctor. - // We could do better and return newarr in the future. - return new MethodBase[] { GetArrayCtor(t) }; - } - - BindingFlags bf = BindingFlags.Instance | BindingFlags.Public; - if (privateBinding || includeProtected) { - bf |= BindingFlags.NonPublic; - } - - IEnumerable ctors = t.GetDeclaredConstructors().WithBindingFlags(bf); - - // leave in protected ctors, even if we're not in private binding mode. - if (!privateBinding && includeProtected) { - ctors = FilterConstructorsToPublicAndProtected(ctors); - } - - if (t.IsValueType() -#if !SILVERLIGHT && !WIN8 && !WP75 - && t != typeof(ArgIterator) -#endif -) { - // structs don't define a parameterless ctor, add a generic method for that. - List result = new List(); - result.Add(GetStructDefaultCtor(t)); - result.AddRange(ctors.Cast()); - return result.ToArray(); - } else { - return ctors.ToArray(); - } - } - - public static IEnumerable FilterConstructorsToPublicAndProtected(IEnumerable ctors) { - foreach (var ctor in ctors) { - if (ctor.IsPublic || ctor.IsProtected()) { - yield return ctor; - } - } - } - - private static MethodBase GetStructDefaultCtor(Type t) { - return typeof(ScriptingRuntimeHelpers).GetDeclaredMethods("CreateInstance").Single().MakeGenericMethod(t); - } - - private static MethodBase GetArrayCtor(Type t) { - return typeof(ScriptingRuntimeHelpers).GetDeclaredMethods("CreateArray").Single().MakeGenericMethod(t.GetElementType()); - } - - #region Type Conversions - - public static MethodInfo GetImplicitConverter(Type fromType, Type toType) { - return GetConverter(fromType, fromType, toType, "op_Implicit") ?? GetConverter(toType, fromType, toType, "op_Implicit"); - } - - public static MethodInfo GetExplicitConverter(Type fromType, Type toType) { - return GetConverter(fromType, fromType, toType, "op_Explicit") ?? GetConverter(toType, fromType, toType, "op_Explicit"); - } - - private static MethodInfo GetConverter(Type type, Type fromType, Type toType, string opMethodName) { - foreach (MethodInfo mi in type.GetInheritedMembers(opMethodName).WithBindingFlags(BindingFlags.Public | BindingFlags.Static)) { - if ((mi.DeclaringType == null || mi.DeclaringType.IsVisible()) && mi.IsPublic && - mi.ReturnType == toType && mi.GetParameters()[0].ParameterType.IsAssignableFrom(fromType)) { - return mi; - } - } - return null; - } - - public static bool TryImplicitConversion(Object value, Type to, out object result) { - if (CompilerHelpers.TryImplicitConvert(value, to, to.GetInheritedMethods("op_Implicit").WithBindingFlags(BindingFlags.Public | BindingFlags.Static), out result)) { - return true; - } - - Type curType = CompilerHelpers.GetType(value); - do { - if (CompilerHelpers.TryImplicitConvert(value, to, curType.GetInheritedMethods("op_Implicit").WithBindingFlags(BindingFlags.Public | BindingFlags.Static), out result)) { - return true; - } - curType = curType.GetBaseType(); - } while (curType != null); - - return false; - } - - private static bool TryImplicitConvert(Object value, Type to, IEnumerable implicitConv, out object result) { - foreach (MethodInfo mi in implicitConv) { - if (to.IsValueType() == mi.ReturnType.IsValueType() && to.IsAssignableFrom(mi.ReturnType)) { - if (mi.IsStatic) { - result = mi.Invoke(null, new object[] { value }); - } else { - result = mi.Invoke(value, ArrayUtils.EmptyObjects); - } - return true; - } - } - - result = null; - return false; - } - - public static bool IsStrongBox(object target) { - Type t = CompilerHelpers.GetType(target); - - return IsStrongBox(t); - } - - public static bool IsStrongBox(Type t) { - return t.IsGenericType() && t.GetGenericTypeDefinition() == typeof(StrongBox<>); - } - - /// - /// Returns a value which indicates failure when a OldConvertToAction of ImplicitTry or - /// ExplicitTry. - /// - public static Expression GetTryConvertReturnValue(Type type) { - Expression res; - var info = type.GetTypeInfo(); - if (info.IsInterface || info.IsClass || (info.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>))) { - res = AstUtils.Constant(null, type); - } else { - res = AstUtils.Constant(Activator.CreateInstance(type)); - } - - return res; - } - - public static bool HasTypeConverter(Type fromType, Type toType) { -#if FEATURE_TYPECONVERTER - TypeConverter _; - return TryGetTypeConverter(fromType, toType, out _); -#else - return false; -#endif - } - - public static bool TryApplyTypeConverter(object value, Type toType, out object result) { -#if FEATURE_TYPECONVERTER - TypeConverter converter; - if (value != null && CompilerHelpers.TryGetTypeConverter(value.GetType(), toType, out converter)) { - result = converter.ConvertFrom(value); - return true; - } else { - result = value; - return false; - } -#else - result = value; - return false; -#endif - } - -#if FEATURE_TYPECONVERTER - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - public static bool TryGetTypeConverter(Type fromType, Type toType, out TypeConverter converter) { - ContractUtils.RequiresNotNull(fromType, "fromType"); - ContractUtils.RequiresNotNull(toType, "toType"); - - // try available type conversions... - foreach (TypeConverterAttribute tca in toType.GetCustomAttributes(typeof(TypeConverterAttribute), true)) { - try { - converter = Activator.CreateInstance(Type.GetType(tca.ConverterTypeName)) as TypeConverter; - } catch (Exception) { - converter = null; - } - - if (converter != null && converter.CanConvertFrom(fromType)) { - return true; - } - } - - converter = null; - return false; - } -#endif - - #endregion - -#if !MONO_INTERPRETER - public static MethodBase[] GetMethodTargets(object obj) { - Type t = CompilerHelpers.GetType(obj); - - if (typeof(Delegate).IsAssignableFrom(t)) { - MethodInfo mi = t.GetMethod("Invoke"); - return new MethodBase[] { mi }; - } else if (typeof(BoundMemberTracker).IsAssignableFrom(t)) { - BoundMemberTracker bmt = obj as BoundMemberTracker; - if (bmt.BoundTo.MemberType == TrackerTypes.Method) { - } - } else if (typeof(MethodGroup).IsAssignableFrom(t)) { - } else if (typeof(MemberGroup).IsAssignableFrom(t)) { - } else { - return MakeCallSignatureForCallableObject(t); - } - - return null; - } -#endif - - private static MethodBase[] MakeCallSignatureForCallableObject(Type t) { - List res = new List(); - foreach (MethodInfo method in t.GetInheritedMethods("Call")) { - if (method.IsSpecialName) { - res.Add(method); - } - } - return res.ToArray(); - } - - public static Type[] GetSiteTypes(IList arguments, Type returnType) { - int count = arguments.Count; - - Type[] ret = new Type[count + 1]; - - for (int i = 0; i < count; i++) { - ret[i] = arguments[i].Type; - } - - ret[count] = returnType; - return ret; - } - - public static Type[] GetExpressionTypes(Expression[] expressions) { - ContractUtils.RequiresNotNull(expressions, "expressions"); - - Type[] res = new Type[expressions.Length]; - for (int i = 0; i < res.Length; i++) { - ContractUtils.RequiresNotNull(expressions[i], "expressions[i]"); - - res[i] = expressions[i].Type; - } - - return res; - } - - public static Type MakeCallSiteType(params Type[] types) { - return typeof(CallSite<>).MakeGenericType(DelegateHelpers.MakeDelegate(types)); - } - - public static Type MakeCallSiteDelegateType(Type[] types) { - return DelegateHelpers.MakeDelegate(types); - } - - /// - /// Creates an interpreted delegate for the lambda. - /// - /// The lambda to compile. - /// A delegate which can interpret the lambda. - public static Delegate LightCompile(this LambdaExpression lambda) { - return new LightCompiler(-1).CompileTop(lambda).CreateDelegate(); - } - - /// - /// Creates an interpreted delegate for the lambda. - /// - /// The lambda to compile. - /// The number of iterations before the interpreter starts compiling - /// A delegate which can interpret the lambda. - public static Delegate LightCompile(this LambdaExpression lambda, int compilationThreshold) { - return new LightCompiler(compilationThreshold).CompileTop(lambda).CreateDelegate(); - } - - /// - /// Creates an interpreted delegate for the lambda. - /// - /// The lambda's delegate type. - /// The lambda to compile. - /// A delegate which can interpret the lambda. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - public static T LightCompile(this Expression lambda) { - return (T)(object)LightCompile((LambdaExpression)lambda); - } - - /// - /// Creates an interpreted delegate for the lambda. - /// - /// The lambda to compile. - /// The number of iterations before the interpreter starts compiling - /// A delegate which can interpret the lambda. - public static T LightCompile(this Expression lambda, int compilationThreshold) { - return (T)(object)LightCompile((LambdaExpression)lambda, compilationThreshold); - } - -#if FEATURE_REFEMIT - /// - /// Compiles the lambda into a method definition. - /// - /// the lambda to compile - /// A which will be used to hold the lambda's IL. - /// A parameter that indicates if debugging information should be emitted to a PDB symbol store. - public static void CompileToMethod(this LambdaExpression lambda, MethodBuilder method, bool emitDebugSymbols) { -#if FEATURE_PDBEMIT - if (emitDebugSymbols) { - var module = method.Module as ModuleBuilder; - ContractUtils.Requires(module != null, "method", "MethodBuilder does not have a valid ModuleBuilder"); - lambda.CompileToMethod(method, DebugInfoGenerator.CreatePdbGenerator()); - return; - } -#endif - -#if WIN8 // TODO - ((dynamic)lambda).CompileToMethod(method); -#else - lambda.CompileToMethod(method); -#endif - } -#endif - - /// - /// Compiles the LambdaExpression. - /// - /// If the lambda is compiled with emitDebugSymbols, it will be - /// generated into a TypeBuilder. Otherwise, this method is the same as - /// calling LambdaExpression.Compile() - /// - /// This is a workaround for a CLR limitiation: DynamicMethods cannot - /// have debugging information. - /// - /// the lambda to compile - /// true to generate a debuggable method, false otherwise - /// the compiled delegate - public static T Compile(this Expression lambda, bool emitDebugSymbols) { -#if FEATURE_PDBEMIT && FEATURE_REFEMIT - if (emitDebugSymbols) { - return CompileToMethod(lambda, DebugInfoGenerator.CreatePdbGenerator(), true); - } -#endif - return lambda.Compile(); - } - -#if FEATURE_REFEMIT - /// - /// Compiles the LambdaExpression, emitting it into a new type, and - /// optionally making it debuggable. - /// - /// This is a workaround for a CLR limitiation: DynamicMethods cannot - /// have debugging information. - /// - /// the lambda to compile - /// Debugging information generator used by the compiler to mark sequence points and annotate local variables. - /// True if debug symbols (PDBs) are emitted by the . - /// the compiled delegate - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - public static T CompileToMethod(Expression lambda, DebugInfoGenerator debugInfoGenerator, bool emitDebugSymbols) { - return (T)(object)CompileToMethod((LambdaExpression)lambda, debugInfoGenerator, emitDebugSymbols); - } - - public static Delegate CompileToMethod(LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator, bool emitDebugSymbols) { - string methodName = String.IsNullOrEmpty(lambda.Name) ? GetUniqueMethodName() : lambda.Name; - - var type = Snippets.Shared.DefineType(methodName, typeof(object), false, emitDebugSymbols).TypeBuilder; - var rewriter = new DebuggableCodeRewriter(type); - lambda = (LambdaExpression)rewriter.Visit(lambda); - - //Create a unique method name when the lambda doesn't have a name or the name is empty. - var method = type.DefineMethod(methodName, CompilerHelpers.PublicStatic); - - lambda.CompileToMethod(method, debugInfoGenerator); - var finished = type.CreateType(); - - rewriter.InitializeFields(finished); - - return finished.GetMethod(method.Name).CreateDelegate(lambda.Type); - } - - /// - /// Removes all live objects and places them in static fields of a type. - /// - private sealed class DebuggableCodeRewriter : DynamicExpressionVisitor { - private readonly Dictionary _fields = new Dictionary(ReferenceEqualityComparer.Instance); - private readonly TypeBuilder _type; - private readonly HashSet _methodNames = new HashSet(); - - internal DebuggableCodeRewriter(TypeBuilder type) { - _type = type; - } - - internal void InitializeFields(Type type) { - foreach (var pair in _fields) { - type.GetInheritedFields(pair.Value.Name).First().SetValue(null, pair.Key); - } - } - - protected override Expression VisitLambda(Expression node) { - if (_methodNames.Contains(node.Name)) { - int count = _methodNames.Count; - - string newName; - do { - newName = node.Name + "$" + count++; - } while (_methodNames.Contains(newName)); - - _methodNames.Add(newName); - return Expression.Lambda( - base.Visit(node.Body), - newName, - node.TailCall, - node.Parameters - ); - } else { - _methodNames.Add(node.Name); - return base.VisitLambda(node); - } - } - - protected override Expression VisitExtension(Expression node) { - // LightDynamicExpressions override Visit but we want to really reduce them - // because they reduce to DynamicExpressions. - LightDynamicExpression lightDyn = node as LightDynamicExpression; - if (lightDyn != null) { - return Visit(lightDyn.Reduce()); - } - - return Visit(node.Reduce()); - } - - protected override Expression VisitConstant(ConstantExpression node) { - if (CanEmitConstant(node.Value, node.Type)) { - return node; - } - - FieldBuilder field; - if (!_fields.TryGetValue(node.Value, out field)) { - field = _type.DefineField( - "$constant" + _fields.Count, - GetVisibleType(node.Value.GetType()), - FieldAttributes.Public | FieldAttributes.Static - ); - _fields.Add(node.Value, field); - } - - Expression result = Expression.Field(null, field); - if (result.Type != node.Type) { - result = Expression.Convert(result, node.Type); - } - return result; - } - - protected override Expression VisitDynamic(DynamicExpression node) { - return Visit(Reduce(node)); - } - } -#endif - - public static string GetUniqueMethodName() { - return "lambda_method" + "$" + System.Threading.Interlocked.Increment(ref _Counter); - } - -#if FEATURE_LCG - // Matches ILGen.TryEmitConstant - public static bool CanEmitConstant(object value, Type type) { - if (value == null || CanEmitILConstant(type)) { - return true; - } - - Type t = value as Type; - if (t != null && ILGen.ShouldLdtoken(t)) { - return true; - } - - MethodBase mb = value as MethodBase; - if (mb != null && ILGen.ShouldLdtoken(mb)) { - return true; - } - - return false; - } - - // Matches ILGen.TryEmitILConstant - internal static bool CanEmitILConstant(Type type) { - switch (type.GetTypeCode()) { - case TypeCode.Boolean: - case TypeCode.SByte: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Char: - case TypeCode.Byte: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - case TypeCode.Decimal: - case TypeCode.String: - return true; - } - return false; - } -#endif - - /// - /// Reduces the provided DynamicExpression into site.Target(site, *args). - /// - public static Expression Reduce(DynamicExpression node) { - // Store the callsite as a constant - var siteConstant = AstUtils.Constant(CallSite.Create(node.DelegateType, node.Binder)); - - // ($site = siteExpr).Target.Invoke($site, *args) - var site = Expression.Variable(siteConstant.Type, "$site"); - return Expression.Block( - new[] { site }, - Expression.Call( - Expression.Field( - Expression.Assign(site, siteConstant), - siteConstant.Type.GetDeclaredField("Target") - ), - node.DelegateType.GetMethod("Invoke"), - ArrayUtils.Insert(site, node.Arguments) - ) - ); - } -#if !MONO_INTERPRETER - #region Factories -#if !FEATURE_NUMERICS - [CLSCompliant(false)] - public static BigInteger CreateBigInteger(int sign, uint[] data) { - return new BigInteger(sign, data); - } -#else - public static BigInteger CreateBigInteger(bool isNegative, byte[] data) { - return new BigInteger(CreateBigInt(isNegative, data)); - } - - public static BigInt CreateBigInt(int value) { - return (BigInt)value; - } - - public static BigInt CreateBigInt(long value) { - return (BigInt)value; - } - - public static BigInt CreateBigInt(bool isNegative, byte[] data) { - BigInt res = new BigInt(data); - return isNegative ? -res : res; - } - -#endif - #endregion -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/ConstantCheck.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/ConstantCheck.cs deleted file mode 100644 index 89cbbfe91cc..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/ConstantCheck.cs +++ /dev/null @@ -1,128 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System.Diagnostics; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Generation { - - public static class ConstantCheck { - - /// - /// Tests to see if the expression is a constant with the given value. - /// - /// The expression to examine - /// The constant value to check for. - /// true/false - public static bool Check(Expression expression, object value) { - ContractUtils.RequiresNotNull(expression, "expression"); - return IsConstant(expression, value); - } - - - /// - /// Tests to see if the expression is a constant with the given value. - /// - /// The expression to examine - /// The constant value to check for. - /// true/false - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] - internal static bool IsConstant(Expression e, object value) { - switch (e.NodeType) { - case ExpressionType.AndAlso: - return CheckAndAlso((BinaryExpression)e, value); - - case ExpressionType.OrElse: - return CheckOrElse((BinaryExpression)e, value); - - case ExpressionType.Constant: - return CheckConstant((ConstantExpression)e, value); - - case ExpressionType.TypeIs: - return Check((TypeBinaryExpression)e, value); - - default: - return false; - } - } - - //CONFORMING - internal static bool IsNull(Expression e) { - return IsConstant(e, null); - } - - - private static bool CheckAndAlso(BinaryExpression node, object value) { - Debug.Assert(node.NodeType == ExpressionType.AndAlso); - - if (node.Method != null) { - return false; - } - //TODO: we can propagate through conversion, but it may not worth it. - if (node.Conversion != null) { - return false; - } - - if (value is bool) { - if ((bool)value) { - return IsConstant(node.Left, true) && IsConstant(node.Right, true); - } else { - // if left isn't a constant it has to be evaluated - return IsConstant(node.Left, false); - } - } - return false; - } - - private static bool CheckOrElse(BinaryExpression node, object value) { - Debug.Assert(node.NodeType == ExpressionType.OrElse); - - if (node.Method != null) { - return false; - } - - if (value is bool) { - if ((bool)value) { - return IsConstant(node.Left, true); - } else { - return IsConstant(node.Left, false) && IsConstant(node.Right, false); - } - } - return false; - } - - private static bool CheckConstant(ConstantExpression node, object value) { - if (value == null) { - return node.Value == null; - } else { - return value.Equals(node.Value); - } - } - - private static bool Check(TypeBinaryExpression node, object value) { - // allow constant TypeIs expressions to be optimized away - if (value is bool && ((bool)value) == true) { - return node.TypeOperand.IsAssignableFrom(node.Expression.Type); - } - return false; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/DelegateHelpers.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/DelegateHelpers.Generated.cs deleted file mode 100644 index 2b5bd93d0fa..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/DelegateHelpers.Generated.cs +++ /dev/null @@ -1,110 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Linq; -using System.Diagnostics; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Generation { - internal static partial class DelegateHelpers { - - #region Generated Maximum Delegate Arity - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_max_delegate_arity from: generate_dynsites.py - - private const int MaximumArity = 17; - - // *** END GENERATED CODE *** - - #endregion - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] - internal static Type MakeDelegate(Type[] types) { - Debug.Assert(types != null && types.Length > 0); - - // Can only used predefined delegates if we have no byref types and - // the arity is small enough to fit in Func<...> or Action<...> - if (types.Length > MaximumArity || types.Any(t => t.IsByRef)) { - return MakeCustomDelegate(types); - } - - Type returnType = types[types.Length - 1]; - if (returnType == typeof(void)) { - types = types.RemoveLast(); - switch (types.Length) { - case 0: return typeof(Action); - #region Generated Delegate Action Types - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_delegate_action from: generate_dynsites.py - - case 1: return typeof(Action<>).MakeGenericType(types); - case 2: return typeof(Action<,>).MakeGenericType(types); - case 3: return typeof(Action<,,>).MakeGenericType(types); - case 4: return typeof(Action<,,,>).MakeGenericType(types); - case 5: return typeof(Action<,,,,>).MakeGenericType(types); - case 6: return typeof(Action<,,,,,>).MakeGenericType(types); - case 7: return typeof(Action<,,,,,,>).MakeGenericType(types); - case 8: return typeof(Action<,,,,,,,>).MakeGenericType(types); - case 9: return typeof(Action<,,,,,,,,>).MakeGenericType(types); - case 10: return typeof(Action<,,,,,,,,,>).MakeGenericType(types); - case 11: return typeof(Action<,,,,,,,,,,>).MakeGenericType(types); - case 12: return typeof(Action<,,,,,,,,,,,>).MakeGenericType(types); - case 13: return typeof(Action<,,,,,,,,,,,,>).MakeGenericType(types); - case 14: return typeof(Action<,,,,,,,,,,,,,>).MakeGenericType(types); - case 15: return typeof(Action<,,,,,,,,,,,,,,>).MakeGenericType(types); - case 16: return typeof(Action<,,,,,,,,,,,,,,,>).MakeGenericType(types); - - // *** END GENERATED CODE *** - - #endregion - } - } else { - switch (types.Length) { - #region Generated Delegate Func Types - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_delegate_func from: generate_dynsites.py - - case 1: return typeof(Func<>).MakeGenericType(types); - case 2: return typeof(Func<,>).MakeGenericType(types); - case 3: return typeof(Func<,,>).MakeGenericType(types); - case 4: return typeof(Func<,,,>).MakeGenericType(types); - case 5: return typeof(Func<,,,,>).MakeGenericType(types); - case 6: return typeof(Func<,,,,,>).MakeGenericType(types); - case 7: return typeof(Func<,,,,,,>).MakeGenericType(types); - case 8: return typeof(Func<,,,,,,,>).MakeGenericType(types); - case 9: return typeof(Func<,,,,,,,,>).MakeGenericType(types); - case 10: return typeof(Func<,,,,,,,,,>).MakeGenericType(types); - case 11: return typeof(Func<,,,,,,,,,,>).MakeGenericType(types); - case 12: return typeof(Func<,,,,,,,,,,,>).MakeGenericType(types); - case 13: return typeof(Func<,,,,,,,,,,,,>).MakeGenericType(types); - case 14: return typeof(Func<,,,,,,,,,,,,,>).MakeGenericType(types); - case 15: return typeof(Func<,,,,,,,,,,,,,,>).MakeGenericType(types); - case 16: return typeof(Func<,,,,,,,,,,,,,,,>).MakeGenericType(types); - case 17: return typeof(Func<,,,,,,,,,,,,,,,,>).MakeGenericType(types); - - // *** END GENERATED CODE *** - - #endregion - } - } - throw Assert.Unreachable; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/DelegateHelpers.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/DelegateHelpers.cs deleted file mode 100644 index b2ef101c769..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Generation/DelegateHelpers.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Reflection; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif -using System.Threading; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Generation { - internal static partial class DelegateHelpers { - - private static Dictionary, Type> _DelegateTypes; - - private static Type MakeCustomDelegate(Type[] types) { - if (_DelegateTypes == null) { - Interlocked.CompareExchange( - ref _DelegateTypes, - new Dictionary, Type>(ListEqualityComparer.Instance), - null - ); - } - - bool found; - Type type; - - // - // LOCK to retrieve the delegate type, if any - // - - lock (_DelegateTypes) { - found = _DelegateTypes.TryGetValue(types, out type); - } - - if (!found && type != null) { - return type; - } - - // - // Create new delegate type - // - - type = MakeNewCustomDelegate(types); - - // - // LOCK to insert new delegate into the cache. If we already have one (racing threads), use the one from the cache - // - - lock (_DelegateTypes) { - Type conflict; - if (_DelegateTypes.TryGetValue(types, out conflict) && conflict != null) { - type = conflict; - } else { - _DelegateTypes[types] = type; - } - } - - return type; - } - - private static Type MakeNewCustomDelegate(Type[] types) { -#if FEATURE_REFEMIT - Type returnType = types[types.Length - 1]; - Type[] parameters = types.RemoveLast(); - - return Snippets.Shared.DefineDelegate("Delegate" + types.Length, returnType, parameters); -#else - throw new NotSupportedException("Signature not supported on this platform"); -#endif - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/BranchLabel.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/BranchLabel.cs deleted file mode 100644 index de0b6db37c4..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/BranchLabel.cs +++ /dev/null @@ -1,108 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Collections.Generic; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal struct RuntimeLabel { - public readonly int Index; - public readonly int StackDepth; - public readonly int ContinuationStackDepth; - - public RuntimeLabel(int index, int continuationStackDepth, int stackDepth) { - Index = index; - ContinuationStackDepth = continuationStackDepth; - StackDepth = stackDepth; - } - - public override string ToString() { - return String.Format("->{0} C({1}) S({2})", Index, ContinuationStackDepth, StackDepth); - } - } - - public sealed class BranchLabel { - internal const int UnknownIndex = Int32.MinValue; - internal const int UnknownDepth = Int32.MinValue; - - internal int _labelIndex = UnknownIndex; - internal int _targetIndex = UnknownIndex; - internal int _stackDepth = UnknownDepth; - internal int _continuationStackDepth = UnknownDepth; - - // Offsets of forward branching instructions targetting this label - // that need to be updated after we emit the label. - private List _forwardBranchFixups; - - public BranchLabel() { - } - - internal int LabelIndex { - get { return _labelIndex; } - set { _labelIndex = value; } - } - - internal bool HasRuntimeLabel { - get { return _labelIndex != UnknownIndex; } - } - - internal int TargetIndex { - get { return _targetIndex; } - } - - internal RuntimeLabel ToRuntimeLabel() { - Debug.Assert(_targetIndex != UnknownIndex && _stackDepth != UnknownDepth && _continuationStackDepth != UnknownDepth); - return new RuntimeLabel(_targetIndex, _continuationStackDepth, _stackDepth); - } - - internal void Mark(InstructionList instructions) { - ContractUtils.Requires(_targetIndex == UnknownIndex && _stackDepth == UnknownDepth && _continuationStackDepth == UnknownDepth); - - _stackDepth = instructions.CurrentStackDepth; - _continuationStackDepth = instructions.CurrentContinuationsDepth; - _targetIndex = instructions.Count; - - if (_forwardBranchFixups != null) { - foreach (var branchIndex in _forwardBranchFixups) { - FixupBranch(instructions, branchIndex); - } - _forwardBranchFixups = null; - } - } - - internal void AddBranch(InstructionList instructions, int branchIndex) { - Debug.Assert(((_targetIndex == UnknownIndex) == (_stackDepth == UnknownDepth))); - Debug.Assert(((_targetIndex == UnknownIndex) == (_continuationStackDepth == UnknownDepth))); - - if (_targetIndex == UnknownIndex) { - if (_forwardBranchFixups == null) { - _forwardBranchFixups = new List(); - } - _forwardBranchFixups.Add(branchIndex); - } else { - FixupBranch(instructions, branchIndex); - } - } - - internal void FixupBranch(InstructionList instructions, int branchIndex) { - Debug.Assert(_targetIndex != UnknownIndex); - instructions.FixupBranch(branchIndex, _targetIndex - branchIndex); - } - } - - -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/ILightCallSiteBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/ILightCallSiteBinder.cs deleted file mode 100644 index 8535961f86b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/ILightCallSiteBinder.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; -using System.Reflection; -using Microsoft.Scripting.Interpreter; -using System.Runtime.CompilerServices; -using System.Collections.Generic; - -namespace Microsoft.Scripting.Interpreter { - public interface ILightCallSiteBinder { - bool AcceptsArgumentArray { get; } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/AddInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/AddInstruction.cs deleted file mode 100644 index ee176510ec0..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/AddInstruction.cs +++ /dev/null @@ -1,191 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class AddInstruction : ArithmeticInstruction { - - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Single, _Double; - - private AddInstruction() { - } - - internal sealed class AddInt32 : AddInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject(unchecked((Int32)l + (Int32)r)); - } - } - - internal sealed class AddInt16 : AddInstruction { - protected override object Calculate (object l, object r) - { - return (Int16)unchecked((Int16)l + (Int16)r); - } - } - - internal sealed class AddInt64 : AddInstruction { - protected override object Calculate (object l, object r) - { - return (Int64)unchecked((Int64)l + (Int64)r); - } - } - - internal sealed class AddUInt16 : AddInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16)unchecked((UInt16)l + (UInt16)r); - } - } - - internal sealed class AddUInt32 : AddInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32)unchecked((UInt32)l + (UInt32)r); - } - } - - internal sealed class AddUInt64 : AddInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64)unchecked((UInt64)l + (UInt64)r); - } - } - - internal sealed class AddSingle : AddInstruction { - protected override object Calculate (object l, object r) - { - return (Single)((Single)l + (Single)r); - } - } - - internal sealed class AddDouble : AddInstruction { - protected override object Calculate (object l, object r) - { - return (Double)l + (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new AddInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new AddInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new AddInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new AddUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new AddUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new AddUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new AddSingle()); - case TypeCode.Double: return _Double ?? (_Double = new AddDouble()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Add()"; - } - } - - internal abstract class AddOvfInstruction : ArithmeticInstruction { - - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Single, _Double; - - private AddOvfInstruction() { - } - - internal sealed class AddOvfInt32 : AddOvfInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject(checked((Int32)l + (Int32)r)); - } - } - - internal sealed class AddOvfInt16 : AddOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((Int16)((Int16)l + (Int16)r)); - } - } - - internal sealed class AddOvfInt64 : AddOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((Int64)((Int64)l + (Int64)r)); - } - } - - internal sealed class AddOvfUInt16 : AddOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((UInt16)((UInt16)l + (UInt16)r)); - } - } - - internal sealed class AddOvfUInt32 : AddOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((UInt32)((UInt32)l + (UInt32)r)); - } - } - - internal sealed class AddOvfUInt64 : AddOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((UInt64)((UInt64)l + (UInt64)r)); - } - } - - internal sealed class AddOvfSingle : AddOvfInstruction { - protected override object Calculate (object l, object r) - { - return (Single)((Single)l + (Single)r); - } - } - - internal sealed class AddOvfDouble : AddOvfInstruction { - protected override object Calculate (object l, object r) - { - return (Double)l + (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new AddOvfInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new AddOvfInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new AddOvfInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new AddOvfUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new AddOvfUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new AddOvfUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new AddOvfSingle()); - case TypeCode.Double: return _Double ?? (_Double = new AddOvfDouble()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "AddOvf()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/AndInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/AndInstruction.cs deleted file mode 100644 index 8f33dc3357f..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/AndInstruction.cs +++ /dev/null @@ -1,176 +0,0 @@ -// -// AndInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class AndInstruction : ArithmeticInstruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Boolean; - private static Instruction _Int16Lifted, _Int32Lifted, _Int64Lifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _BooleanLifted; - - private AndInstruction() { - } - - internal sealed class AndInt32 : AndInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject((Int32)l & (Int32)r); - } - } - - internal sealed class AndInt16 : AndInstruction { - protected override object Calculate (object l, object r) - { - return (Int16)((Int16)l & (Int16)r); - } - } - - internal sealed class AndInt64 : AndInstruction { - protected override object Calculate (object l, object r) - { - return (Int64)((Int64)l & (Int64)r); - } - } - - internal sealed class AndUInt16 : AndInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16)((UInt16)l & (UInt16)r); - } - } - - internal sealed class AndUInt32 : AndInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32)((UInt32)l & (UInt32)r); - } - } - - internal sealed class AndUInt64 : AndInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64)((UInt64)l & (UInt64)r); - } - } - - internal sealed class AndBoolean : AndInstruction { - protected override object Calculate (object l, object r) - { - return (Boolean)((Boolean)l & (Boolean)r); - } - } - - internal sealed class AndInt32Lifted : AndInstruction { - protected override object Calculate (object l, object r) - { - return (Int32?)((Int32?)l & (Int32?)r); - } - } - - internal sealed class AndInt16Lifted : AndInstruction { - protected override object Calculate (object l, object r) - { - return (Int16?)((Int16?)l & (Int16?)r); - } - } - - internal sealed class AndInt64Lifted : AndInstruction { - protected override object Calculate (object l, object r) - { - return (Int64?)((Int64?)l & (Int64?)r); - } - } - - internal sealed class AndUInt16Lifted : AndInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16?)((UInt16?)l & (UInt16?)r); - } - } - - internal sealed class AndUInt32Lifted : AndInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32?)((UInt32?)l & (UInt32?)r); - } - } - - internal sealed class AndUInt64Lifted : AndInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64?)((UInt64?)l & (UInt64?)r); - } - } - - internal sealed class AndBooleanLifted : AndInstruction { - protected override object Calculate (object l, object r) - { - return ((Boolean?)l & (Boolean?)r); - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new AndInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new AndInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new AndInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new AndUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new AndUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new AndUInt64()); - case TypeCode.Boolean: return _Boolean ?? (_Boolean = new AndBoolean()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new AndInt16Lifted()); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new AndInt32Lifted()); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new AndInt64Lifted()); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new AndUInt16Lifted()); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new AndUInt32Lifted()); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new AndUInt64Lifted()); - case TypeCode.Boolean: return _BooleanLifted ?? (_BooleanLifted = new AndBooleanLifted()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "And()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ArithmeticInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ArithmeticInstruction.cs deleted file mode 100644 index eb71f03e4f0..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ArithmeticInstruction.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// ArithmeticInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class ArithmeticInstruction : Instruction { - - public override int ConsumedStack { get { return 2; } } - public override int ProducedStack { get { return 1; } } - - protected abstract object Calculate (object l, object r); - - public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 2] = Calculate (l, r); - frame.StackIndex--; - return +1; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ArrayOperations.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ArrayOperations.cs deleted file mode 100644 index d8e0bc6c831..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ArrayOperations.cs +++ /dev/null @@ -1,134 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; - -namespace Microsoft.Scripting.Interpreter { - public sealed class NewArrayInitInstruction : Instruction { - private readonly int _elementCount; - - internal NewArrayInitInstruction(int elementCount) { - _elementCount = elementCount; - } - - public override int ConsumedStack { get { return _elementCount; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - TElement[] array = new TElement[_elementCount]; - for (int i = _elementCount - 1; i >= 0; i--) { - array[i] = (TElement)frame.Pop(); - } - frame.Push(array); - return +1; - } - } - - public sealed class NewArrayInstruction : Instruction { - internal NewArrayInstruction() { } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - int length = (int)frame.Pop(); - frame.Push(new TElement[length]); - return +1; - } - } - - public sealed class NewArrayBoundsInstruction : Instruction { - private readonly Type _elementType; - private readonly int _rank; - - internal NewArrayBoundsInstruction(Type elementType, int rank) { - _elementType = elementType; - _rank = rank; - } - - public override int ConsumedStack { get { return _rank; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - var lengths = new int[_rank]; - for (int i = _rank - 1; i >= 0; i--) { - lengths[i] = (int)frame.Pop(); - } - var array = Array.CreateInstance(_elementType, lengths); - frame.Push(array); - return +1; - } - } - - public sealed class GetArrayItemInstruction : Instruction { - internal GetArrayItemInstruction() { } - - public override int ConsumedStack { get { return 2; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - int index = (int)frame.Pop(); - TElement[] array = (TElement[])frame.Pop(); - frame.Push(array[index]); - return +1; - } - - public override string InstructionName { - get { return "GetArrayItem"; } - } - } - - public sealed class GetArrayLengthInstruction : Instruction { - private static Instruction instance; - - private GetArrayLengthInstruction() { } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - var array = (Array)frame.Pop(); - frame.Push(array.Length); - return +1; - } - - public static Instruction Create() { - return instance ?? (instance = new GetArrayLengthInstruction()); - } - - public override string InstructionName { - get { return "GetArrayLength"; } - } - } - - public sealed class SetArrayItemInstruction : Instruction { - internal SetArrayItemInstruction() { } - - public override int ConsumedStack { get { return 3; } } - public override int ProducedStack { get { return 0; } } - - public override int Run(InterpretedFrame frame) { - TElement value = (TElement)frame.Pop(); - int index = (int)frame.Pop(); - TElement[] array = (TElement[])frame.Pop(); - array[index] = value; - return +1; - } - - public override string InstructionName { - get { return "SetArrayItem"; } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.Generated.cs deleted file mode 100644 index 19163eedc6e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.Generated.cs +++ /dev/null @@ -1,905 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Threading; -using Microsoft.Scripting.Utils; -using Microsoft.Scripting.Generation; -using Microsoft.Scripting.Runtime; - -using System.Dynamic; - -namespace Microsoft.Scripting.Interpreter { - #region Generated Reflected Caller - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_all from: generate_reflected_calls.py - - public partial class CallInstruction { - private const int MaxHelpers = 10; - private const int MaxArgs = 3; - - public virtual object InvokeInstance(object instance, params object[] args) { - switch(args.Length) { - case 0: return Invoke(instance); - case 1: return Invoke(instance, args[0]); - case 2: return Invoke(instance, args[0], args[1]); - case 3: return Invoke(instance, args[0], args[1], args[2]); - case 4: return Invoke(instance, args[0], args[1], args[2], args[3]); - case 5: return Invoke(instance, args[0], args[1], args[2], args[3], args[4]); - case 6: return Invoke(instance, args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: return Invoke(instance, args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - case 8: return Invoke(instance, args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); - default: throw new InvalidOperationException(); - } - } - - public virtual object Invoke(params object[] args) { - switch(args.Length) { - case 0: return Invoke(); - case 1: return Invoke(args[0]); - case 2: return Invoke(args[0], args[1]); - case 3: return Invoke(args[0], args[1], args[2]); - case 4: return Invoke(args[0], args[1], args[2], args[3]); - case 5: return Invoke(args[0], args[1], args[2], args[3], args[4]); - case 6: return Invoke(args[0], args[1], args[2], args[3], args[4], args[5]); - case 7: return Invoke(args[0], args[1], args[2], args[3], args[4], args[5], args[6]); - case 8: return Invoke(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]); - case 9: return Invoke(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8]); - default: throw new InvalidOperationException(); - } - } - - public virtual object Invoke() { throw new InvalidOperationException(); } - public virtual object Invoke(object arg0) { throw new InvalidOperationException(); } - public virtual object Invoke(object arg0, object arg1) { throw new InvalidOperationException(); } - public virtual object Invoke(object arg0, object arg1, object arg2) { throw new InvalidOperationException(); } - public virtual object Invoke(object arg0, object arg1, object arg2, object arg3) { throw new InvalidOperationException(); } - public virtual object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4) { throw new InvalidOperationException(); } - public virtual object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5) { throw new InvalidOperationException(); } - public virtual object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6) { throw new InvalidOperationException(); } - public virtual object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7) { throw new InvalidOperationException(); } - public virtual object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8) { throw new InvalidOperationException(); } - - /// - /// Fast creation works if we have a known primitive types for the entire - /// method siganture. If we have any non-primitive types then FastCreate - /// falls back to SlowCreate which works for all types. - /// - /// Fast creation is fast because it avoids using reflection (MakeGenericType - /// and Activator.CreateInstance) to create the types. It does this through - /// calling a series of generic methods picking up each strong type of the - /// signature along the way. When it runs out of types it news up the - /// appropriate CallInstruction with the strong-types that have been built up. - /// - /// One relaxation is that for return types which are non-primitive types - /// we can fallback to object due to relaxed delegates. - /// - private static CallInstruction FastCreate(MethodInfo target, ParameterInfo[] pi) { - Type t = TryGetParameterOrReturnType(target, pi, 0); - if (t == null) { - return new ActionCallInstruction(target); - } - - if (t.IsEnum()) return SlowCreate(target, pi); - switch (t.GetTypeCode()) { - case TypeCode.Object: { - if (t != typeof(object) && (IndexIsNotReturnType(0, target, pi) || t.IsValueType())) { - // if we're on the return type relaxed delegates makes it ok to use object - goto default; - } - return FastCreate(target, pi); - } - case TypeCode.Int16: return FastCreate(target, pi); - case TypeCode.Int32: return FastCreate(target, pi); - case TypeCode.Int64: return FastCreate(target, pi); - case TypeCode.Boolean: return FastCreate(target, pi); - case TypeCode.Char: return FastCreate(target, pi); - case TypeCode.Byte: return FastCreate(target, pi); - case TypeCode.Decimal: return FastCreate(target, pi); - case TypeCode.DateTime: return FastCreate(target, pi); - case TypeCode.Double: return FastCreate(target, pi); - case TypeCode.Single: return FastCreate(target, pi); - case TypeCode.UInt16: return FastCreate(target, pi); - case TypeCode.UInt32: return FastCreate(target, pi); - case TypeCode.UInt64: return FastCreate(target, pi); - case TypeCode.String: return FastCreate(target, pi); - case TypeCode.SByte: return FastCreate(target, pi); - default: return SlowCreate(target, pi); - } - } - - private static CallInstruction FastCreate(MethodInfo target, ParameterInfo[] pi) { - Type t = TryGetParameterOrReturnType(target, pi, 1); - if (t == null) { - if (target.ReturnType == typeof(void)) { - return new ActionCallInstruction(target); - } - return new FuncCallInstruction(target); - } - - if (t.IsEnum()) return SlowCreate(target, pi); - switch (t.GetTypeCode()) { - case TypeCode.Object: { - if (t != typeof(object) && (IndexIsNotReturnType(1, target, pi) || t.IsValueType())) { - // if we're on the return type relaxed delegates makes it ok to use object - goto default; - } - return FastCreate(target, pi); - } - case TypeCode.Int16: return FastCreate(target, pi); - case TypeCode.Int32: return FastCreate(target, pi); - case TypeCode.Int64: return FastCreate(target, pi); - case TypeCode.Boolean: return FastCreate(target, pi); - case TypeCode.Char: return FastCreate(target, pi); - case TypeCode.Byte: return FastCreate(target, pi); - case TypeCode.Decimal: return FastCreate(target, pi); - case TypeCode.DateTime: return FastCreate(target, pi); - case TypeCode.Double: return FastCreate(target, pi); - case TypeCode.Single: return FastCreate(target, pi); - case TypeCode.UInt16: return FastCreate(target, pi); - case TypeCode.UInt32: return FastCreate(target, pi); - case TypeCode.UInt64: return FastCreate(target, pi); - case TypeCode.String: return FastCreate(target, pi); - case TypeCode.SByte: return FastCreate(target, pi); - default: return SlowCreate(target, pi); - } - } - - private static CallInstruction FastCreate(MethodInfo target, ParameterInfo[] pi) { - Type t = TryGetParameterOrReturnType(target, pi, 2); - if (t == null) { - if (target.ReturnType == typeof(void)) { - return new ActionCallInstruction(target); - } - return new FuncCallInstruction(target); - } - - if (t.IsEnum()) return SlowCreate(target, pi); - switch (t.GetTypeCode()) { - case TypeCode.Object: { - Debug.Assert(pi.Length == 2); - if (t.IsValueType()) goto default; - - return new FuncCallInstruction(target); - } - case TypeCode.Int16: return new FuncCallInstruction(target); - case TypeCode.Int32: return new FuncCallInstruction(target); - case TypeCode.Int64: return new FuncCallInstruction(target); - case TypeCode.Boolean: return new FuncCallInstruction(target); - case TypeCode.Char: return new FuncCallInstruction(target); - case TypeCode.Byte: return new FuncCallInstruction(target); - case TypeCode.Decimal: return new FuncCallInstruction(target); - case TypeCode.DateTime: return new FuncCallInstruction(target); - case TypeCode.Double: return new FuncCallInstruction(target); - case TypeCode.Single: return new FuncCallInstruction(target); - case TypeCode.UInt16: return new FuncCallInstruction(target); - case TypeCode.UInt32: return new FuncCallInstruction(target); - case TypeCode.UInt64: return new FuncCallInstruction(target); - case TypeCode.String: return new FuncCallInstruction(target); - case TypeCode.SByte: return new FuncCallInstruction(target); - default: return SlowCreate(target, pi); - } - } - - private static Type GetHelperType(MethodInfo info, Type[] arrTypes) { - Type t; - if (info.ReturnType == typeof(void)) { - switch (arrTypes.Length) { - case 0: t = typeof(ActionCallInstruction); break; - case 1: t = typeof(ActionCallInstruction<>).MakeGenericType(arrTypes); break; - case 2: t = typeof(ActionCallInstruction<,>).MakeGenericType(arrTypes); break; - case 3: t = typeof(ActionCallInstruction<,,>).MakeGenericType(arrTypes); break; - case 4: t = typeof(ActionCallInstruction<,,,>).MakeGenericType(arrTypes); break; - case 5: t = typeof(ActionCallInstruction<,,,,>).MakeGenericType(arrTypes); break; - case 6: t = typeof(ActionCallInstruction<,,,,,>).MakeGenericType(arrTypes); break; - case 7: t = typeof(ActionCallInstruction<,,,,,,>).MakeGenericType(arrTypes); break; - case 8: t = typeof(ActionCallInstruction<,,,,,,,>).MakeGenericType(arrTypes); break; - case 9: t = typeof(ActionCallInstruction<,,,,,,,,>).MakeGenericType(arrTypes); break; - default: throw new InvalidOperationException(); - } - } else { - switch (arrTypes.Length) { - case 1: t = typeof(FuncCallInstruction<>).MakeGenericType(arrTypes); break; - case 2: t = typeof(FuncCallInstruction<,>).MakeGenericType(arrTypes); break; - case 3: t = typeof(FuncCallInstruction<,,>).MakeGenericType(arrTypes); break; - case 4: t = typeof(FuncCallInstruction<,,,>).MakeGenericType(arrTypes); break; - case 5: t = typeof(FuncCallInstruction<,,,,>).MakeGenericType(arrTypes); break; - case 6: t = typeof(FuncCallInstruction<,,,,,>).MakeGenericType(arrTypes); break; - case 7: t = typeof(FuncCallInstruction<,,,,,,>).MakeGenericType(arrTypes); break; - case 8: t = typeof(FuncCallInstruction<,,,,,,,>).MakeGenericType(arrTypes); break; - case 9: t = typeof(FuncCallInstruction<,,,,,,,,>).MakeGenericType(arrTypes); break; - case 10: t = typeof(FuncCallInstruction<,,,,,,,,,>).MakeGenericType(arrTypes); break; - default: throw new InvalidOperationException(); - } - } - return t; - } - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheFunc(Func method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new FuncCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - public static MethodInfo CacheAction(Action method) { - var info = method.GetMethodInfo(); - lock (_cache) { - _cache[info] = new ActionCallInstruction(method); - } - return info; - } - - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 0; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke() { - _target(); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target(); - frame.StackIndex -= 0; - return 1; - } - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 1; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke(object arg0) { - _target(arg0 != null ? (T0)arg0 : default(T0)); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target((T0)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 1; - return 1; - } - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 2; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke(object arg0, object arg1) { - _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1)); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target((T0)frame.Data[frame.StackIndex - 2], (T1)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 2; - return 1; - } - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 3; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke(object arg0, object arg1, object arg2) { - _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2)); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target((T0)frame.Data[frame.StackIndex - 3], (T1)frame.Data[frame.StackIndex - 2], (T2)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 3; - return 1; - } - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 4; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3) { - _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3)); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target((T0)frame.Data[frame.StackIndex - 4], (T1)frame.Data[frame.StackIndex - 3], (T2)frame.Data[frame.StackIndex - 2], (T3)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 4; - return 1; - } - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 5; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4) { - _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4)); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target((T0)frame.Data[frame.StackIndex - 5], (T1)frame.Data[frame.StackIndex - 4], (T2)frame.Data[frame.StackIndex - 3], (T3)frame.Data[frame.StackIndex - 2], (T4)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 5; - return 1; - } - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 6; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5) { - _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4), arg5 != null ? (T5)arg5 : default(T5)); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target((T0)frame.Data[frame.StackIndex - 6], (T1)frame.Data[frame.StackIndex - 5], (T2)frame.Data[frame.StackIndex - 4], (T3)frame.Data[frame.StackIndex - 3], (T4)frame.Data[frame.StackIndex - 2], (T5)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 6; - return 1; - } - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 7; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6) { - _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4), arg5 != null ? (T5)arg5 : default(T5), arg6 != null ? (T6)arg6 : default(T6)); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target((T0)frame.Data[frame.StackIndex - 7], (T1)frame.Data[frame.StackIndex - 6], (T2)frame.Data[frame.StackIndex - 5], (T3)frame.Data[frame.StackIndex - 4], (T4)frame.Data[frame.StackIndex - 3], (T5)frame.Data[frame.StackIndex - 2], (T6)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 7; - return 1; - } - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 8; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7) { - _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4), arg5 != null ? (T5)arg5 : default(T5), arg6 != null ? (T6)arg6 : default(T6), arg7 != null ? (T7)arg7 : default(T7)); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target((T0)frame.Data[frame.StackIndex - 8], (T1)frame.Data[frame.StackIndex - 7], (T2)frame.Data[frame.StackIndex - 6], (T3)frame.Data[frame.StackIndex - 5], (T4)frame.Data[frame.StackIndex - 4], (T5)frame.Data[frame.StackIndex - 3], (T6)frame.Data[frame.StackIndex - 2], (T7)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 8; - return 1; - } - } - - internal sealed class ActionCallInstruction : CallInstruction { - private readonly Action _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 9; } } - - public ActionCallInstruction(Action target) { - _target = target; - } - - public ActionCallInstruction(MethodInfo target) { - _target = (Action)target.CreateDelegate(typeof(Action)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8) { - _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4), arg5 != null ? (T5)arg5 : default(T5), arg6 != null ? (T6)arg6 : default(T6), arg7 != null ? (T7)arg7 : default(T7), arg8 != null ? (T8)arg8 : default(T8)); - return null; - } - - public override int Run(InterpretedFrame frame) { - _target((T0)frame.Data[frame.StackIndex - 9], (T1)frame.Data[frame.StackIndex - 8], (T2)frame.Data[frame.StackIndex - 7], (T3)frame.Data[frame.StackIndex - 6], (T4)frame.Data[frame.StackIndex - 5], (T5)frame.Data[frame.StackIndex - 4], (T6)frame.Data[frame.StackIndex - 3], (T7)frame.Data[frame.StackIndex - 2], (T8)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 9; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 0; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke() { - return _target(); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 0] = _target(); - frame.StackIndex -= -1; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 1; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke(object arg0) { - return _target(arg0 != null ? (T0)arg0 : default(T0)); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 1] = _target((T0)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 0; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 2; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke(object arg0, object arg1) { - return _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1)); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 2] = _target((T0)frame.Data[frame.StackIndex - 2], (T1)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 1; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 3; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke(object arg0, object arg1, object arg2) { - return _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2)); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 3] = _target((T0)frame.Data[frame.StackIndex - 3], (T1)frame.Data[frame.StackIndex - 2], (T2)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 2; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 4; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3) { - return _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3)); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 4] = _target((T0)frame.Data[frame.StackIndex - 4], (T1)frame.Data[frame.StackIndex - 3], (T2)frame.Data[frame.StackIndex - 2], (T3)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 3; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 5; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4) { - return _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4)); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 5] = _target((T0)frame.Data[frame.StackIndex - 5], (T1)frame.Data[frame.StackIndex - 4], (T2)frame.Data[frame.StackIndex - 3], (T3)frame.Data[frame.StackIndex - 2], (T4)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 4; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 6; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5) { - return _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4), arg5 != null ? (T5)arg5 : default(T5)); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 6] = _target((T0)frame.Data[frame.StackIndex - 6], (T1)frame.Data[frame.StackIndex - 5], (T2)frame.Data[frame.StackIndex - 4], (T3)frame.Data[frame.StackIndex - 3], (T4)frame.Data[frame.StackIndex - 2], (T5)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 5; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 7; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6) { - return _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4), arg5 != null ? (T5)arg5 : default(T5), arg6 != null ? (T6)arg6 : default(T6)); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 7] = _target((T0)frame.Data[frame.StackIndex - 7], (T1)frame.Data[frame.StackIndex - 6], (T2)frame.Data[frame.StackIndex - 5], (T3)frame.Data[frame.StackIndex - 4], (T4)frame.Data[frame.StackIndex - 3], (T5)frame.Data[frame.StackIndex - 2], (T6)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 6; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 8; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7) { - return _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4), arg5 != null ? (T5)arg5 : default(T5), arg6 != null ? (T6)arg6 : default(T6), arg7 != null ? (T7)arg7 : default(T7)); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 8] = _target((T0)frame.Data[frame.StackIndex - 8], (T1)frame.Data[frame.StackIndex - 7], (T2)frame.Data[frame.StackIndex - 6], (T3)frame.Data[frame.StackIndex - 5], (T4)frame.Data[frame.StackIndex - 4], (T5)frame.Data[frame.StackIndex - 3], (T6)frame.Data[frame.StackIndex - 2], (T7)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 7; - return 1; - } - } - - internal sealed class FuncCallInstruction : CallInstruction { - private readonly Func _target; - public override MethodInfo Info { get { return _target.GetMethodInfo(); } } - public override int ArgumentCount { get { return 9; } } - - public FuncCallInstruction(Func target) { - _target = target; - } - - public FuncCallInstruction(MethodInfo target) { - _target = (Func)target.CreateDelegate(typeof(Func)); - } - - public override object Invoke(object arg0, object arg1, object arg2, object arg3, object arg4, object arg5, object arg6, object arg7, object arg8) { - return _target(arg0 != null ? (T0)arg0 : default(T0), arg1 != null ? (T1)arg1 : default(T1), arg2 != null ? (T2)arg2 : default(T2), arg3 != null ? (T3)arg3 : default(T3), arg4 != null ? (T4)arg4 : default(T4), arg5 != null ? (T5)arg5 : default(T5), arg6 != null ? (T6)arg6 : default(T6), arg7 != null ? (T7)arg7 : default(T7), arg8 != null ? (T8)arg8 : default(T8)); - } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 9] = _target((T0)frame.Data[frame.StackIndex - 9], (T1)frame.Data[frame.StackIndex - 8], (T2)frame.Data[frame.StackIndex - 7], (T3)frame.Data[frame.StackIndex - 6], (T4)frame.Data[frame.StackIndex - 5], (T5)frame.Data[frame.StackIndex - 4], (T6)frame.Data[frame.StackIndex - 3], (T7)frame.Data[frame.StackIndex - 2], (T8)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 8; - return 1; - } - } - - internal sealed partial class MethodInfoCallInstruction : CallInstruction { - public override object Invoke() { - return InvokeWorker(); - } - public override object Invoke(object arg0) { - return InvokeWorker(arg0); - } - public override object Invoke(object arg0, object arg1) { - return InvokeWorker(arg0, arg1); - } - } - - // *** END GENERATED CODE *** - - #endregion -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs deleted file mode 100644 index 3875af308b9..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/CallInstruction.cs +++ /dev/null @@ -1,300 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * ironpy@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ -using System; -using System.Collections.Generic; -using System.Reflection; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif -using System.Security; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - public abstract partial class CallInstruction : Instruction { - public abstract MethodInfo Info { get; } - - /// - /// The number of arguments including "this" for instance methods. - /// - public abstract int ArgumentCount { get; } - - #region Construction - - internal CallInstruction() { } - - private static readonly Dictionary _cache = new Dictionary(); - - /// Instruction can't be created due to insufficient privileges. - public static CallInstruction Create(MethodInfo info) { - return Create(info, info.GetParameters()); - } - - /// Instruction can't be created due to insufficient privileges. - public static CallInstruction Create(MethodInfo info, ParameterInfo[] parameters) { - int argumentCount = parameters.Length; - if (!info.IsStatic) { - argumentCount++; - } - - // A workaround for CLR bug #796414 (Unable to create delegates for Array.Get/Set): - // T[]::Address - not supported by ETs due to T& return value - if (info.DeclaringType != null && info.DeclaringType.IsArray && (info.Name == "Get" || info.Name == "Set")) { - return GetArrayAccessor(info, argumentCount); - } - -#if FULL_AOT_RUNTIME - return new MethodInfoCallInstruction(info, argumentCount); -#else - if (ReflectionUtils.IsDynamicMethod(info) || !info.IsStatic && info.DeclaringType.IsValueType()) { - return new MethodInfoCallInstruction(info, argumentCount); - } - - if (argumentCount >= MaxHelpers) { - // no delegate for this size, fallback to reflection invoke - return new MethodInfoCallInstruction(info, argumentCount); - } - - foreach (ParameterInfo pi in parameters) { - if (pi.ParameterType.IsByRef) { - // we don't support ref args via generics. - return new MethodInfoCallInstruction(info, argumentCount); - } - } - - // see if we've created one w/ a delegate - CallInstruction res; - if (ShouldCache(info)) { - lock (_cache) { - if (_cache.TryGetValue(info, out res)) { - return res; - } - } - } - - // create it - try { - if (argumentCount < MaxArgs) { - res = FastCreate(info, parameters); - } else { - res = SlowCreate(info, parameters); - } - } catch (TargetInvocationException tie) { - if (!(tie.InnerException is NotSupportedException)) { - throw tie.InnerException; - } - - res = new MethodInfoCallInstruction(info, argumentCount); - } catch (NotSupportedException) { - // if Delegate.CreateDelegate can't handle the method fallback to - // the slow reflection version. For example this can happen w/ - // a generic method defined on an interface and implemented on a class or - // a virtual generic method. - res = new MethodInfoCallInstruction(info, argumentCount); - } - - // cache it for future users if it's a reasonable method to cache - if (ShouldCache(info)) { - lock (_cache) { - _cache[info] = res; - } - } - - return res; -#endif - } - - private static CallInstruction GetArrayAccessor(MethodInfo info, int argumentCount) { - Type arrayType = info.DeclaringType; - bool isGetter = info.Name == "Get"; - switch (arrayType.GetArrayRank()) { - case 1: - return Create(isGetter ? - arrayType.GetMethod("GetValue", new[] { typeof(int)}) : - new Action(ArrayItemSetter1).GetMethodInfo() - ); - - case 2: - return Create(isGetter ? - arrayType.GetMethod("GetValue", new[] { typeof(int), typeof(int) }) : - new Action(ArrayItemSetter2).GetMethodInfo() - ); - - case 3: - return Create(isGetter ? - arrayType.GetMethod("GetValue", new[] { typeof(int), typeof(int), typeof(int) }) : - new Action(ArrayItemSetter3).GetMethodInfo() - ); - - default: - return new MethodInfoCallInstruction(info, argumentCount); - } - } - - public static void ArrayItemSetter1(Array array, int index0, object value) { - array.SetValue(value, index0); - } - - public static void ArrayItemSetter2(Array array, int index0, int index1, object value) { - array.SetValue(value, index0, index1); - } - - public static void ArrayItemSetter3(Array array, int index0, int index1, int index2, object value) { - array.SetValue(value, index0, index1, index2); - } - - private static bool ShouldCache(MethodInfo info) { - return !ReflectionUtils.IsDynamicMethod(info); - } - - /// - /// Gets the next type or null if no more types are available. - /// - private static Type TryGetParameterOrReturnType(MethodInfo target, ParameterInfo[] pi, int index) { - if (!target.IsStatic) { - index--; - if (index < 0) { - return target.DeclaringType; - } - } - - if (index < pi.Length) { - // next in signature - return pi[index].ParameterType; - } - - if (target.ReturnType == typeof(void) || index > pi.Length) { - // no more parameters - return null; - } - - // last parameter on Invoke is return type - return target.ReturnType; - } - - private static bool IndexIsNotReturnType(int index, MethodInfo target, ParameterInfo[] pi) { - return pi.Length != index || (pi.Length == index && !target.IsStatic); - } - - /// - /// Uses reflection to create new instance of the appropriate ReflectedCaller - /// - private static CallInstruction SlowCreate(MethodInfo info, ParameterInfo[] pis) { - List types = new List(); - if (!info.IsStatic) types.Add(info.DeclaringType); - foreach (ParameterInfo pi in pis) { - types.Add(pi.ParameterType); - } - if (info.ReturnType != typeof(void)) { - types.Add(info.ReturnType); - } - Type[] arrTypes = types.ToArray(); - - return (CallInstruction)Activator.CreateInstance(GetHelperType(info, arrTypes), info); - } - - #endregion - - #region Instruction - - public sealed override int ProducedStack { get { return Info.ReturnType == typeof(void) ? 0 : 1; } } - public sealed override int ConsumedStack { get { return ArgumentCount; } } - - public sealed override string InstructionName { - get { return "Call"; } - } - - public override string ToString() { - return "Call(" + Info + ")"; - } - - #endregion - } - - internal sealed partial class MethodInfoCallInstruction : CallInstruction { - private readonly MethodInfo _target; - private readonly int _argumentCount; - - public override MethodInfo Info { get { return _target; } } - public override int ArgumentCount { get { return _argumentCount; } } - - internal MethodInfoCallInstruction(MethodInfo target, int argumentCount) { - _target = target; - _argumentCount = argumentCount; - } - - public override object Invoke(params object[] args) { - return InvokeWorker(args); - } - - public override object InvokeInstance(object instance, params object[] args) { - if (_target.IsStatic) { - try { - return _target.Invoke(null, args); - } catch (TargetInvocationException e) { - throw ExceptionHelpers.UpdateForRethrow(e.InnerException); - } - } - - try { - return _target.Invoke(instance, args); - } catch (TargetInvocationException e) { - throw ExceptionHelpers.UpdateForRethrow(e.InnerException); - } - } - - private object InvokeWorker(params object[] args) { - if (_target.IsStatic) { - try { - return _target.Invoke(null, args); - } catch (TargetInvocationException e) { - throw ExceptionHelpers.UpdateForRethrow(e.InnerException); - } - } - - try { - return _target.Invoke(args[0], GetNonStaticArgs(args)); - } catch (TargetInvocationException e) { - throw ExceptionHelpers.UpdateForRethrow(e.InnerException); - } - } - - private static object[] GetNonStaticArgs(object[] args) { - object[] newArgs = new object[args.Length - 1]; - for (int i = 0; i < newArgs.Length; i++) { - newArgs[i] = args[i + 1]; - } - return newArgs; - } - - public sealed override int Run(InterpretedFrame frame) { - int first = frame.StackIndex - _argumentCount; - object[] args = new object[_argumentCount]; - for (int i = 0; i < args.Length; i++) { - args[i] = frame.Data[first + i]; - } - - object ret = Invoke(args); - if (_target.ReturnType != typeof(void)) { - frame.Data[first] = ret; - frame.StackIndex = first + 1; - } else { - frame.StackIndex = first; - } - return 1; - } - } - -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ComparisonInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ComparisonInstruction.cs deleted file mode 100644 index 95fe9e67838..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ComparisonInstruction.cs +++ /dev/null @@ -1,50 +0,0 @@ -// -// ArithmeticInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class ComparisonInstruction : ArithmeticInstruction { - - protected bool LiftedToNull { get; set; } - - protected override object Calculate (object l, object r) - { - if (l == null || r == null) - return DoNullComparison (l, r); - - return DoCalculate (l, r); - } - - protected abstract object DoNullComparison (object l, object r); - protected abstract object DoCalculate (object l, object r); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ConstantInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ConstantInstruction.cs deleted file mode 100644 index 1ef324c25db..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ConstantInstruction.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -// ConstantInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - sealed class PushValueInstruction : Instruction { - object value; - - public override int ConsumedStack { get { return 0; } } - public override int ProducedStack { get { return 1; } } - - public PushValueInstruction (object value) - { - this.value = value; - } - - public override int Run(InterpretedFrame frame) { - frame.Push (value); - return +1; - } - - public override string ToString() { - return "Push(" + value + ")"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ControlFlowInstructions.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ControlFlowInstructions.cs deleted file mode 100644 index b7549ee4b77..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ControlFlowInstructions.cs +++ /dev/null @@ -1,623 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_TASKS -using System.Threading.Tasks; -#endif - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#endif - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - using LoopFunc = Func[], InterpretedFrame, int>; - - internal abstract class OffsetInstruction : Instruction { - internal const int Unknown = Int32.MinValue; - internal const int CacheSize = 32; - - // the offset to jump to (relative to this instruction): - protected int _offset = Unknown; - - public int Offset { get { return _offset; } } - public abstract Instruction[] Cache { get; } - - public Instruction Fixup(int offset) { - Debug.Assert(_offset == Unknown && offset != Unknown); - _offset = offset; - - var cache = Cache; - if (cache != null && offset >= 0 && offset < cache.Length) { - return cache[offset] ?? (cache[offset] = this); - } - - return this; - } - - public override string ToDebugString(int instructionIndex, object cookie, Func labelIndexer, IList objects) { - return ToString() + (_offset != Unknown ? " -> " + (instructionIndex + _offset).ToString() : ""); - } - - public override string ToString() { - return InstructionName + (_offset == Unknown ? "(?)" : "(" + _offset + ")"); - } - } - - internal sealed class BranchFalseInstruction : OffsetInstruction { - private static Instruction[] _cache; - - public override Instruction[] Cache { - get { - if (_cache == null) { - _cache = new Instruction[CacheSize]; - } - return _cache; - } - } - - internal BranchFalseInstruction() { - } - - public override int ConsumedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - Debug.Assert(_offset != Unknown); - - if (!(bool)frame.Pop()) { - return _offset; - } - - return +1; - } - } - - internal sealed class BranchTrueInstruction : OffsetInstruction { - private static Instruction[] _cache; - - public override Instruction[] Cache { - get { - if (_cache == null) { - _cache = new Instruction[CacheSize]; - } - return _cache; - } - } - - internal BranchTrueInstruction() { - } - - public override int ConsumedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - Debug.Assert(_offset != Unknown); - - if ((bool)frame.Pop()) { - return _offset; - } - - return +1; - } - } - - internal sealed class BranchNullInstruction : OffsetInstruction { - private static Instruction[] _cache; - - public override Instruction[] Cache { - get { - if (_cache == null) { - _cache = new Instruction[CacheSize]; - } - return _cache; - } - } - - internal BranchNullInstruction() { - } - - public override int ConsumedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - Debug.Assert(_offset != Unknown); - - if (frame.Pop() == null) { - return _offset; - } - - return +1; - } - } - - internal sealed class CoalescingBranchInstruction : OffsetInstruction { - private static Instruction[] _cache; - - public override Instruction[] Cache { - get { - if (_cache == null) { - _cache = new Instruction[CacheSize]; - } - return _cache; - } - } - - internal CoalescingBranchInstruction() { - } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - Debug.Assert(_offset != Unknown); - - if (frame.Peek() != null) { - return _offset; - } - - return +1; - } - } - - internal class BranchInstruction : OffsetInstruction { - private static Instruction[][][] _caches; - - public override Instruction[] Cache { - get { - if (_caches == null) { - _caches = new Instruction[2][][] { new Instruction[2][], new Instruction[2][] }; - } - return _caches[ConsumedStack][ProducedStack] ?? (_caches[ConsumedStack][ProducedStack] = new Instruction[CacheSize]); - } - } - - internal readonly bool _hasResult; - internal readonly bool _hasValue; - - internal BranchInstruction() - : this(false, false) { - } - - public BranchInstruction(bool hasResult, bool hasValue) { - _hasResult = hasResult; - _hasValue = hasValue; - } - - public override int ConsumedStack { - get { return _hasValue ? 1 : 0; } - } - - public override int ProducedStack { - get { return _hasResult ? 1 : 0; } - } - - public override int Run(InterpretedFrame frame) { - Debug.Assert(_offset != Unknown); - - return _offset; - } - } - - internal abstract class IndexedBranchInstruction : Instruction { - protected const int CacheSize = 32; - - internal readonly int _labelIndex; - - public IndexedBranchInstruction(int labelIndex) { - _labelIndex = labelIndex; - } - - public RuntimeLabel GetLabel(InterpretedFrame frame) { - return frame.Interpreter._labels[_labelIndex]; - } - - public override string ToDebugString(int instructionIndex, object cookie, Func labelIndexer, IList objects) { - int targetIndex = labelIndexer(_labelIndex); - return ToString() + (targetIndex != BranchLabel.UnknownIndex ? " -> " + targetIndex.ToString() : ""); - } - - public override string ToString() { - return InstructionName + "[" + _labelIndex + "]"; - } - } - - /// - /// This instruction implements a goto expression that can jump out of any expression. - /// It pops values (arguments) from the evaluation stack that the expression tree nodes in between - /// the goto expression and the target label node pushed and not consumed yet. - /// A goto expression can jump into a node that evaluates arguments only if it carries - /// a value and jumps right after the first argument (the carried value will be used as the first argument). - /// Goto can jump into an arbitrary child of a BlockExpression since the block doesn’t accumulate values - /// on evaluation stack as its child expressions are being evaluated. - /// - /// Goto needs to execute any finally blocks on the way to the target label. - /// - /// { - /// f(1, 2, try { g(3, 4, try { goto L } finally { ... }, 6) } finally { ... }, 7, 8) - /// L: ... - /// } - /// - /// The goto expression here jumps to label L while having 4 items on evaluation stack (1, 2, 3 and 4). - /// The jump needs to execute both finally blocks, the first one on stack level 4 the - /// second one on stack level 2. So, it needs to jump the first finally block, pop 2 items from the stack, - /// run second finally block and pop another 2 items from the stack and set instruction pointer to label L. - /// - /// Goto also needs to rethrow ThreadAbortException iff it jumps out of a catch handler and - /// the current thread is in "abort requested" state. - /// - internal sealed class GotoInstruction : IndexedBranchInstruction { - private const int Variants = 4; - private static readonly GotoInstruction[] Cache = new GotoInstruction[Variants * CacheSize]; - - private readonly bool _hasResult; - - // TODO: We can remember hasValue in label and look it up when calculating stack balance. That would save some cache. - private readonly bool _hasValue; - - // The values should technically be Consumed = 1, Produced = 1 for gotos that target a label whose continuation depth - // is different from the current continuation depth. However, in case of forward gotos, we don't not know that is the - // case until the label is emitted. By then the consumed and produced stack information is useless. - // The important thing here is that the stack balance is 0. - public override int ConsumedContinuations { get { return 0; } } - public override int ProducedContinuations { get { return 0; } } - - public override int ConsumedStack { - get { return _hasValue ? 1 : 0; } - } - - public override int ProducedStack { - get { return _hasResult ? 1 : 0; } - } - - private GotoInstruction(int targetIndex, bool hasResult, bool hasValue) - : base(targetIndex) { - _hasResult = hasResult; - _hasValue = hasValue; - } - - internal static GotoInstruction Create(int labelIndex, bool hasResult, bool hasValue) { - if (labelIndex < CacheSize) { - var index = Variants * labelIndex | (hasResult ? 2 : 0) | (hasValue ? 1 : 0); - return Cache[index] ?? (Cache[index] = new GotoInstruction(labelIndex, hasResult, hasValue)); - } - return new GotoInstruction(labelIndex, hasResult, hasValue); - } - - public override int Run(InterpretedFrame frame) { - // Are we jumping out of catch/finally while aborting the current thread? - Interpreter.AbortThreadIfRequested(frame, _labelIndex); - - // goto the target label or the current finally continuation: - return frame.Goto(_labelIndex, _hasValue ? frame.Pop() : Interpreter.NoValue); - } - } - - internal sealed class EnterTryFinallyInstruction : IndexedBranchInstruction { - private readonly static EnterTryFinallyInstruction[] Cache = new EnterTryFinallyInstruction[CacheSize]; - - public override int ProducedContinuations { get { return 1; } } - - private EnterTryFinallyInstruction(int targetIndex) - : base(targetIndex) { - } - - internal static EnterTryFinallyInstruction Create(int labelIndex) { - if (labelIndex < CacheSize) { - return Cache[labelIndex] ?? (Cache[labelIndex] = new EnterTryFinallyInstruction(labelIndex)); - } - return new EnterTryFinallyInstruction(labelIndex); - } - - public override int Run(InterpretedFrame frame) { - // Push finally. - frame.PushContinuation(_labelIndex); - return 1; - } - } - - /// - /// The first instruction of finally block. - /// - internal sealed class EnterFinallyInstruction : Instruction { - internal static readonly Instruction Instance = new EnterFinallyInstruction(); - - public override int ProducedStack { get { return 2; } } - public override int ConsumedContinuations { get { return 1; } } - - private EnterFinallyInstruction() { - } - - public override int Run(InterpretedFrame frame) { - frame.PushPendingContinuation(); - frame.RemoveContinuation(); - return 1; - } - } - - /// - /// The last instruction of finally block. - /// - internal sealed class LeaveFinallyInstruction : Instruction { - internal static readonly Instruction Instance = new LeaveFinallyInstruction(); - - public override int ConsumedStack { get { return 2; } } - - private LeaveFinallyInstruction() { - } - - public override int Run(InterpretedFrame frame) { - frame.PopPendingContinuation(); - - // jump to goto target or to the next finally: - return frame.YieldToPendingContinuation(); - } - } - - // no-op: we need this just to balance the stack depth. - internal sealed class EnterExceptionHandlerInstruction : Instruction { - internal static readonly EnterExceptionHandlerInstruction Void = new EnterExceptionHandlerInstruction(false); - internal static readonly EnterExceptionHandlerInstruction NonVoid = new EnterExceptionHandlerInstruction(true); - - // True if try-expression is non-void. - private readonly bool _hasValue; - - private EnterExceptionHandlerInstruction(bool hasValue) { - _hasValue = hasValue; - } - - // If an exception is throws in try-body the expression result of try-body is not evaluated and loaded to the stack. - // So the stack doesn't contain the try-body's value when we start executing the handler. - // However, while emitting instructions try block falls thru the catch block with a value on stack. - // We need to declare it consumed so that the stack state upon entry to the handler corresponds to the real - // stack depth after throw jumped to this catch block. - public override int ConsumedStack { get { return _hasValue ? 1 : 0; } } - - // A variable storing the current exception is pushed to the stack by exception handling. - // Catch handlers: The value is immediately popped and stored into a local. - // Fault handlers: The value is kept on stack during fault handler evaluation. - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - // nop (the exception value is pushed by the interpreter in HandleCatch) - return 1; - } - } - - /// - /// The last instruction of a catch exception handler. - /// - internal sealed class LeaveExceptionHandlerInstruction : IndexedBranchInstruction { - private static LeaveExceptionHandlerInstruction[] Cache = new LeaveExceptionHandlerInstruction[2 * CacheSize]; - - private readonly bool _hasValue; - - // The catch block yields a value if the body is non-void. This value is left on the stack. - public override int ConsumedStack { - get { return _hasValue ? 1 : 0; } - } - - public override int ProducedStack { - get { return _hasValue ? 1 : 0; } - } - - private LeaveExceptionHandlerInstruction(int labelIndex, bool hasValue) - : base(labelIndex) { - _hasValue = hasValue; - } - - internal static LeaveExceptionHandlerInstruction Create(int labelIndex, bool hasValue) { - if (labelIndex < CacheSize) { - int index = (2 * labelIndex) | (hasValue ? 1 : 0); - return Cache[index] ?? (Cache[index] = new LeaveExceptionHandlerInstruction(labelIndex, hasValue)); - } - return new LeaveExceptionHandlerInstruction(labelIndex, hasValue); - } - - public override int Run(InterpretedFrame frame) { - // CLR rethrows ThreadAbortException when leaving catch handler if abort is requested on the current thread. - Interpreter.AbortThreadIfRequested(frame, _labelIndex); - return GetLabel(frame).Index - frame.InstructionIndex; - } - } - - /// - /// The last instruction of a fault exception handler. - /// - internal sealed class LeaveFaultInstruction : Instruction { - internal static readonly Instruction NonVoid = new LeaveFaultInstruction(true); - internal static readonly Instruction Void = new LeaveFaultInstruction(false); - - private readonly bool _hasValue; - - // The fault block has a value if the body is non-void, but the value is never used. - // We compile the body of a fault block as void. - // However, we keep the exception object that was pushed upon entering the fault block on the stack during execution of the block - // and pop it at the end. - public override int ConsumedStack { - get { return 1; } - } - - // While emitting instructions a non-void try-fault expression is expected to produce a value. - public override int ProducedStack { - get { return _hasValue ? 1 : 0; } - } - - private LeaveFaultInstruction(bool hasValue) { - _hasValue = hasValue; - } - - public override int Run(InterpretedFrame frame) { - // TODO: ThreadAbortException ? - - object exception = frame.Pop(); - ExceptionHandler handler; - return frame.Interpreter.GotoHandler(frame, exception, out handler); - } - } - - - internal sealed class ThrowInstruction : Instruction { - internal static readonly ThrowInstruction Throw = new ThrowInstruction(true, false); - internal static readonly ThrowInstruction VoidThrow = new ThrowInstruction(false, false); - internal static readonly ThrowInstruction Rethrow = new ThrowInstruction(true, true); - internal static readonly ThrowInstruction VoidRethrow = new ThrowInstruction(false, true); - - private readonly bool _hasResult, _rethrow; - - private ThrowInstruction(bool hasResult, bool isRethrow) { - _hasResult = hasResult; - _rethrow = isRethrow; - } - - public override int ProducedStack { - get { return _hasResult ? 1 : 0; } - } - - public override int ConsumedStack { - get { - return 1; - } - } - - public override int Run(InterpretedFrame frame) { - var ex = (Exception)frame.Pop(); - if (_rethrow) { - ExceptionHandler handler; - return frame.Interpreter.GotoHandler(frame, ex, out handler); - } - throw ex; - } - } - - internal sealed class SwitchInstruction : Instruction { - private readonly Dictionary _cases; - - internal SwitchInstruction(Dictionary cases) { - Assert.NotNull(cases); - _cases = cases; - } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 0; } } - - public override int Run(InterpretedFrame frame) { - int target; - return _cases.TryGetValue((int)frame.Pop(), out target) ? target : 1; - } - } - - internal sealed class EnterLoopInstruction : Instruction { - private readonly int _instructionIndex; - private Dictionary _variables; - private Dictionary _closureVariables; - private LoopExpression _loop; - private int _loopEnd; - private int _compilationThreshold; - - internal EnterLoopInstruction(LoopExpression loop, LocalVariables locals, int compilationThreshold, int instructionIndex) { - _loop = loop; - _variables = locals.CopyLocals(); - _closureVariables = locals.ClosureVariables; - _compilationThreshold = compilationThreshold; - _instructionIndex = instructionIndex; - } - - internal void FinishLoop(int loopEnd) { - _loopEnd = loopEnd; - } - - public override int Run(InterpretedFrame frame) { - // Don't lock here, it's a frequently hit path. - // - // There could be multiple threads racing, but that is okay. - // Two bad things can happen: - // * We miss decrements (some thread sets the counter forward) - // * We might enter the "if" branch more than once. - // - // The first is okay, it just means we take longer to compile. - // The second we explicitly guard against inside of Compile(). - // - // We can't miss 0. The first thread that writes -1 must have read 0 and hence start compilation. - if (unchecked(_compilationThreshold--) == 0) { -#if SILVERLIGHT - if (PlatformAdaptationLayer.IsCompactFramework) { - _compilationThreshold = Int32.MaxValue; - return 1; - } -#endif - if (frame.Interpreter.CompileSynchronously) { - Compile(frame); - } else { - // Kick off the compile on another thread so this one can keep going, - // Compile method backpatches the instruction when finished so we don't need to await the task. -#if FEATURE_TASKS - new Task(Compile, frame).Start(); -#else - ThreadPool.QueueUserWorkItem(Compile, frame); -#endif - } - } - return 1; - } - - private bool Compiled { - get { return _loop == null; } - } - - private void Compile(object frameObj) { - if (Compiled) { - return; - } - - lock (this) { - if (Compiled) { - return; - } - - PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Interpreted loop compiled"); - - InterpretedFrame frame = (InterpretedFrame)frameObj; - var compiler = new LoopCompiler(_loop, frame.Interpreter.LabelMapping, _variables, _closureVariables, _instructionIndex, _loopEnd); - var instructions = frame.Interpreter.Instructions.Instructions; - - // replace this instruction with an optimized one: - Interlocked.Exchange(ref instructions[_instructionIndex], new CompiledLoopInstruction(compiler.CreateDelegate())); - - // invalidate this instruction, some threads may still hold on it: - _loop = null; - _variables = null; - _closureVariables = null; - } - } - } - - internal sealed class CompiledLoopInstruction : Instruction { - private readonly LoopFunc _compiledLoop; - - public CompiledLoopInstruction(LoopFunc compiledLoop) { - Assert.NotNull(compiledLoop); - _compiledLoop = compiledLoop; - } - - public override int Run(InterpretedFrame frame) { - return _compiledLoop(frame.Data, frame.Closure, frame); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DivInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DivInstruction.cs deleted file mode 100644 index f7d14972564..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DivInstruction.cs +++ /dev/null @@ -1,132 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class DivInstruction : Instruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Single, _Double; - - public override int ConsumedStack { get { return 2; } } - public override int ProducedStack { get { return 1; } } - - private DivInstruction() { - } - - internal sealed class DivInt32 : DivInstruction { - public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 2] = ScriptingRuntimeHelpers.Int32ToObject((Int32)l / (Int32)r); - frame.StackIndex--; - return 1; - } - } - - internal sealed class DivInt16 : DivInstruction { - public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 2] = (Int16)((Int16)l / (Int16)r); - frame.StackIndex--; - return 1; - } - } - - internal sealed class DivInt64 : DivInstruction { - public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 2] = (Int64)((Int64)l / (Int64)r); - frame.StackIndex--; - return 1; - } - } - - internal sealed class DivUInt16 : DivInstruction { - public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 2] = (UInt16)((UInt16)l / (UInt16)r); - frame.StackIndex--; - return 1; - } - } - - internal sealed class DivUInt32 : DivInstruction { - public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 2] = (UInt32)((UInt32)l / (UInt32)r); - frame.StackIndex--; - return 1; - } - } - - internal sealed class DivUInt64 : DivInstruction { - public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 2] = (UInt64)((UInt64)l / (UInt64)r); - frame.StackIndex--; - return 1; - } - } - - internal sealed class DivSingle : DivInstruction { - public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 2] = (Single)((Single)l / (Single)r); - frame.StackIndex--; - return 1; - } - } - - internal sealed class DivDouble : DivInstruction { - public override int Run(InterpretedFrame frame) { - object l = frame.Data[frame.StackIndex - 2]; - object r = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 2] = (Double)l / (Double)r; - frame.StackIndex--; - return 1; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new DivInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new DivInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new DivInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new DivUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new DivUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new DivUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new DivSingle()); - case TypeCode.Double: return _Double ?? (_Double = new DivDouble()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Div()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicInstructionN.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicInstructionN.cs deleted file mode 100644 index 70576695132..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicInstructionN.cs +++ /dev/null @@ -1,76 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - - -using System; -using System.Linq; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Reflection; - -using Microsoft.Scripting.Utils; -using System.Security; - -namespace Microsoft.Scripting.Interpreter { - internal sealed partial class DynamicInstructionN : Instruction { - private readonly CallInstruction _targetInvocationInstruction; - private readonly object _targetDelegate; - private readonly CallSite _site; - private readonly int _argumentCount; - private readonly bool _isVoid; - - public DynamicInstructionN(Type delegateType, CallSite site) { - var methodInfo = delegateType.GetMethod("Invoke"); - var parameters = methodInfo.GetParameters(); - - // .Invoke is ok to target by a delegate in partial trust (SecurityException is not thrown): - _targetInvocationInstruction = CallInstruction.Create(methodInfo, parameters); - _site = site; - _argumentCount = parameters.Length - 1; - _targetDelegate = site.GetType().GetInheritedFields("Target").First().GetValue(site); - } - - public DynamicInstructionN(Type delegateType, CallSite site, bool isVoid) - : this(delegateType, site) { - _isVoid = isVoid; - } - - public override int ProducedStack { get { return _isVoid ? 0 : 1; } } - public override int ConsumedStack { get { return _argumentCount; } } - - public override int Run(InterpretedFrame frame) { - int first = frame.StackIndex - _argumentCount; - object[] args = new object[1 + _argumentCount]; - args[0] = _site; - for (int i = 0; i < _argumentCount; i++) { - args[1 + i] = frame.Data[first + i]; - } - - object ret = _targetInvocationInstruction.InvokeInstance(_targetDelegate, args); - if (_isVoid) { - frame.StackIndex = first; - } else { - frame.Data[first] = ret; - frame.StackIndex = first + 1; - } - - return 1; - } - - public override string ToString() { - return "DynamicInstructionN(" + _site + ")"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicInstructions.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicInstructions.Generated.cs deleted file mode 100644 index c98b957f6ce..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicInstructions.Generated.cs +++ /dev/null @@ -1,509 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - - -using System; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal partial class DynamicInstructionN { - internal static Type GetDynamicInstructionType(Type delegateType) { - Type[] argTypes = delegateType.GetGenericArguments(); - if (argTypes.Length == 0) return null; - Type genericType; - Type[] newArgTypes = ArrayUtils.RemoveFirst(argTypes); - switch (newArgTypes.Length) { - #region Generated Dynamic Instruction Types - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_types from: generate_dynamic_instructions.py - - case 1: genericType = typeof(DynamicInstruction<>); break; - case 2: genericType = typeof(DynamicInstruction<,>); break; - case 3: genericType = typeof(DynamicInstruction<,,>); break; - case 4: genericType = typeof(DynamicInstruction<,,,>); break; - case 5: genericType = typeof(DynamicInstruction<,,,,>); break; - case 6: genericType = typeof(DynamicInstruction<,,,,,>); break; - case 7: genericType = typeof(DynamicInstruction<,,,,,,>); break; - case 8: genericType = typeof(DynamicInstruction<,,,,,,,>); break; - case 9: genericType = typeof(DynamicInstruction<,,,,,,,,>); break; - case 10: genericType = typeof(DynamicInstruction<,,,,,,,,,>); break; - case 11: genericType = typeof(DynamicInstruction<,,,,,,,,,,>); break; - case 12: genericType = typeof(DynamicInstruction<,,,,,,,,,,,>); break; - case 13: genericType = typeof(DynamicInstruction<,,,,,,,,,,,,>); break; - case 14: genericType = typeof(DynamicInstruction<,,,,,,,,,,,,,>); break; - case 15: genericType = typeof(DynamicInstruction<,,,,,,,,,,,,,,>); break; - case 16: genericType = typeof(DynamicInstruction<,,,,,,,,,,,,,,,>); break; - - // *** END GENERATED CODE *** - - #endregion - default: - throw Assert.Unreachable; - } - - return genericType.MakeGenericType(newArgTypes); - } - - internal static Instruction CreateUntypedInstruction(CallSiteBinder binder, int argCount) { - // DLR Ref.Emits an UpdateAndExecute delegate for sites with more than 10 parameters - if (argCount > 10 && PlatformAdaptationLayer.IsCompactFramework) { - return null; - } - - switch (argCount) { - #region Generated Untyped Dynamic Instructions - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_untyped from: generate_dynamic_instructions.py - - case 0: return DynamicInstruction.Factory(binder); - case 1: return DynamicInstruction.Factory(binder); - case 2: return DynamicInstruction.Factory(binder); - case 3: return DynamicInstruction.Factory(binder); - case 4: return DynamicInstruction.Factory(binder); - case 5: return DynamicInstruction.Factory(binder); - case 6: return DynamicInstruction.Factory(binder); - case 7: return DynamicInstruction.Factory(binder); - case 8: return DynamicInstruction.Factory(binder); - case 9: return DynamicInstruction.Factory(binder); - case 10: return DynamicInstruction.Factory(binder); - case 11: return DynamicInstruction.Factory(binder); - case 12: return DynamicInstruction.Factory(binder); - case 13: return DynamicInstruction.Factory(binder); - case 14: return DynamicInstruction.Factory(binder); - case 15: return DynamicInstruction.Factory(binder); - - // *** END GENERATED CODE *** - - #endregion - - default: return null; - } - } - } - - #region Generated Dynamic Instructions - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_instructions from: generate_dynamic_instructions.py - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 0; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 0] = _site.Target(_site); - frame.StackIndex -= -1; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 1] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 1]); - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 2; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 2] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 2], (T1)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 1; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 3; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 3] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 3], (T1)frame.Data[frame.StackIndex - 2], (T2)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 2; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 4; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 4] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 4], (T1)frame.Data[frame.StackIndex - 3], (T2)frame.Data[frame.StackIndex - 2], (T3)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 3; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 5; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 5] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 5], (T1)frame.Data[frame.StackIndex - 4], (T2)frame.Data[frame.StackIndex - 3], (T3)frame.Data[frame.StackIndex - 2], (T4)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 4; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 6; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 6] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 6], (T1)frame.Data[frame.StackIndex - 5], (T2)frame.Data[frame.StackIndex - 4], (T3)frame.Data[frame.StackIndex - 3], (T4)frame.Data[frame.StackIndex - 2], (T5)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 5; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 7; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 7] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 7], (T1)frame.Data[frame.StackIndex - 6], (T2)frame.Data[frame.StackIndex - 5], (T3)frame.Data[frame.StackIndex - 4], (T4)frame.Data[frame.StackIndex - 3], (T5)frame.Data[frame.StackIndex - 2], (T6)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 6; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 8; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 8] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 8], (T1)frame.Data[frame.StackIndex - 7], (T2)frame.Data[frame.StackIndex - 6], (T3)frame.Data[frame.StackIndex - 5], (T4)frame.Data[frame.StackIndex - 4], (T5)frame.Data[frame.StackIndex - 3], (T6)frame.Data[frame.StackIndex - 2], (T7)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 7; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 9; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 9] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 9], (T1)frame.Data[frame.StackIndex - 8], (T2)frame.Data[frame.StackIndex - 7], (T3)frame.Data[frame.StackIndex - 6], (T4)frame.Data[frame.StackIndex - 5], (T5)frame.Data[frame.StackIndex - 4], (T6)frame.Data[frame.StackIndex - 3], (T7)frame.Data[frame.StackIndex - 2], (T8)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 8; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 10; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 10] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 10], (T1)frame.Data[frame.StackIndex - 9], (T2)frame.Data[frame.StackIndex - 8], (T3)frame.Data[frame.StackIndex - 7], (T4)frame.Data[frame.StackIndex - 6], (T5)frame.Data[frame.StackIndex - 5], (T6)frame.Data[frame.StackIndex - 4], (T7)frame.Data[frame.StackIndex - 3], (T8)frame.Data[frame.StackIndex - 2], (T9)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 9; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 11; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 11] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 11], (T1)frame.Data[frame.StackIndex - 10], (T2)frame.Data[frame.StackIndex - 9], (T3)frame.Data[frame.StackIndex - 8], (T4)frame.Data[frame.StackIndex - 7], (T5)frame.Data[frame.StackIndex - 6], (T6)frame.Data[frame.StackIndex - 5], (T7)frame.Data[frame.StackIndex - 4], (T8)frame.Data[frame.StackIndex - 3], (T9)frame.Data[frame.StackIndex - 2], (T10)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 10; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 12; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 12] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 12], (T1)frame.Data[frame.StackIndex - 11], (T2)frame.Data[frame.StackIndex - 10], (T3)frame.Data[frame.StackIndex - 9], (T4)frame.Data[frame.StackIndex - 8], (T5)frame.Data[frame.StackIndex - 7], (T6)frame.Data[frame.StackIndex - 6], (T7)frame.Data[frame.StackIndex - 5], (T8)frame.Data[frame.StackIndex - 4], (T9)frame.Data[frame.StackIndex - 3], (T10)frame.Data[frame.StackIndex - 2], (T11)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 11; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 13; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 13] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 13], (T1)frame.Data[frame.StackIndex - 12], (T2)frame.Data[frame.StackIndex - 11], (T3)frame.Data[frame.StackIndex - 10], (T4)frame.Data[frame.StackIndex - 9], (T5)frame.Data[frame.StackIndex - 8], (T6)frame.Data[frame.StackIndex - 7], (T7)frame.Data[frame.StackIndex - 6], (T8)frame.Data[frame.StackIndex - 5], (T9)frame.Data[frame.StackIndex - 4], (T10)frame.Data[frame.StackIndex - 3], (T11)frame.Data[frame.StackIndex - 2], (T12)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 12; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 14; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 14] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 14], (T1)frame.Data[frame.StackIndex - 13], (T2)frame.Data[frame.StackIndex - 12], (T3)frame.Data[frame.StackIndex - 11], (T4)frame.Data[frame.StackIndex - 10], (T5)frame.Data[frame.StackIndex - 9], (T6)frame.Data[frame.StackIndex - 8], (T7)frame.Data[frame.StackIndex - 7], (T8)frame.Data[frame.StackIndex - 6], (T9)frame.Data[frame.StackIndex - 5], (T10)frame.Data[frame.StackIndex - 4], (T11)frame.Data[frame.StackIndex - 3], (T12)frame.Data[frame.StackIndex - 2], (T13)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 13; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - internal class DynamicInstruction : Instruction { - private CallSite> _site; - - public static Instruction Factory(CallSiteBinder binder) { - return new DynamicInstruction(CallSite>.Create(binder)); - } - - private DynamicInstruction(CallSite> site) { - _site = site; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return 15; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex - 15] = _site.Target(_site, (T0)frame.Data[frame.StackIndex - 15], (T1)frame.Data[frame.StackIndex - 14], (T2)frame.Data[frame.StackIndex - 13], (T3)frame.Data[frame.StackIndex - 12], (T4)frame.Data[frame.StackIndex - 11], (T5)frame.Data[frame.StackIndex - 10], (T6)frame.Data[frame.StackIndex - 9], (T7)frame.Data[frame.StackIndex - 8], (T8)frame.Data[frame.StackIndex - 7], (T9)frame.Data[frame.StackIndex - 6], (T10)frame.Data[frame.StackIndex - 5], (T11)frame.Data[frame.StackIndex - 4], (T12)frame.Data[frame.StackIndex - 3], (T13)frame.Data[frame.StackIndex - 2], (T14)frame.Data[frame.StackIndex - 1]); - frame.StackIndex -= 14; - return 1; - } - - public override string ToString() { - return "Dynamic(" + _site.Binder.ToString() + ")"; - } - } - - - // *** END GENERATED CODE *** - - #endregion - - -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicSplatInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicSplatInstruction.cs deleted file mode 100644 index b2426e7b414..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/DynamicSplatInstruction.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - - -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Reflection; - -using Microsoft.Scripting.Utils; -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Runtime; - -namespace Microsoft.Scripting.Interpreter { - /// - /// Implements dynamic call site with many arguments. Wraps the arguments into . - /// - internal sealed partial class DynamicSplatInstruction : Instruction { - private readonly CallSite> _site; - private readonly int _argumentCount; - - internal DynamicSplatInstruction(int argumentCount, CallSite> site) { - _site = site; - _argumentCount = argumentCount; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return _argumentCount; } } - - public override int Run(InterpretedFrame frame) { - int first = frame.StackIndex - _argumentCount; - object ret = _site.Target(_site, new ArgumentArray(frame.Data, first, _argumentCount)); - frame.Data[first] = ret; - frame.StackIndex = first + 1; - - return 1; - } - - public override string ToString() { - return "DynamicSplatInstruction(" + _site + ")"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/EqualInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/EqualInstruction.cs deleted file mode 100644 index ad4c33d19fb..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/EqualInstruction.cs +++ /dev/null @@ -1,201 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class EqualInstruction : ComparisonInstruction { - // Perf: EqualityComparer but is 3/2 to 2 times slower. - private static Instruction _Reference, _Boolean, _SByte, _Int16, _Char, _String, _Int32, _Int64, _Byte, _UInt16, _UInt32, _UInt64, _Single, _Double; - private static Instruction _BooleanLifted, _SByteLifted, _Int16Lifted, _CharLifted, _Int32Lifted, _Int64Lifted, - _ByteLifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _SingleLifted, _DoubleLifted; - - private EqualInstruction() { - } - - protected override object DoNullComparison (object l, object r) - { - return LiftedToNull ? (object) null : (object) l == r; - } - - internal sealed class EqualBoolean : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Boolean)l == (Boolean)r; - } - } - - internal sealed class EqualSByte : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (SByte)l == (SByte)r; - } - } - - internal sealed class EqualInt16 : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int16)l == (Int16)r; - } - } - - internal sealed class EqualChar : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Char)l == (Char)r; - } - } - - internal sealed class EqualString : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (String)l == (String)r; - } - } - - internal sealed class EqualInt32 : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int32)l == (Int32)r; - } - } - - internal sealed class EqualInt64 : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int64)l == (Int64)r; - } - } - - internal sealed class EqualByte : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Byte)l == (Byte)r; - } - } - - internal sealed class EqualUInt16 : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt16)l == (UInt16)r; - } - } - - internal sealed class EqualUInt32 : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt32)l == (UInt32)r; - } - } - - internal sealed class EqualUInt64 : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt64)l == (UInt64)r; - } - } - - internal sealed class EqualSingle : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Single)l == (Single)r; - } - } - - internal sealed class EqualDouble : EqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Double)l == (Double)r; - } - } - - internal sealed class EqualReference : EqualInstruction { - protected override object Calculate (object l, object r) - { - return l == r; - } - - protected override object DoCalculate (object l, object r) - { - throw Assert.Unreachable; - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - public static Instruction Create(Type type) { - // Boxed enums can be unboxed as their underlying types: - switch ((type.IsEnum() ? Enum.GetUnderlyingType(type) : type).GetTypeCode()) { - case TypeCode.Boolean: return _Boolean ?? (_Boolean = new EqualBoolean()); - case TypeCode.SByte: return _SByte ?? (_SByte = new EqualSByte()); - case TypeCode.Byte: return _Byte ?? (_Byte = new EqualByte()); - case TypeCode.Char: return _Char ?? (_Char = new EqualChar()); - case TypeCode.String: return _String ?? (_String = new EqualString()); - case TypeCode.Int16: return _Int16 ?? (_Int16 = new EqualInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new EqualInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new EqualInt64()); - - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new EqualInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new EqualInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new EqualInt64()); - - case TypeCode.Single: return _Single ?? (_Single = new EqualSingle()); - case TypeCode.Double: return _Double ?? (_Double = new EqualDouble()); - - case TypeCode.Object: - if (!type.IsValueType()) { - return _Reference ?? (_Reference = new EqualReference()); - } - // TODO: Nullable - throw new NotImplementedException(); - - default: - throw new NotImplementedException(); - } - } - - public static Instruction CreateLifted(Type type) { - // Boxed enums can be unboxed as their underlying types: - switch ((type.IsEnum() ? Enum.GetUnderlyingType(type) : type).GetTypeCode()) { - case TypeCode.Boolean: return _BooleanLifted ?? (_BooleanLifted = new EqualBoolean() { LiftedToNull = true }); - case TypeCode.SByte: return _SByteLifted ?? (_SByteLifted = new EqualSByte() { LiftedToNull = true }); - case TypeCode.Byte: return _ByteLifted ?? (_ByteLifted = new EqualByte() { LiftedToNull = true }); - case TypeCode.Char: return _CharLifted ?? (_CharLifted = new EqualChar() { LiftedToNull = true }); - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new EqualInt16() { LiftedToNull = true }); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new EqualInt32() { LiftedToNull = true }); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new EqualInt64() { LiftedToNull = true }); - - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new EqualInt16() { LiftedToNull = true }); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new EqualInt32() { LiftedToNull = true }); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new EqualInt64() { LiftedToNull = true }); - - case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new EqualSingle() { LiftedToNull = true }); - case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new EqualDouble() { LiftedToNull = true }); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Equal()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/FieldOperations.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/FieldOperations.cs deleted file mode 100644 index 4bb8ec65c46..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/FieldOperations.cs +++ /dev/null @@ -1,94 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal sealed class LoadStaticFieldInstruction : Instruction { - private readonly FieldInfo _field; - - public LoadStaticFieldInstruction(FieldInfo field) { - Debug.Assert(field.IsStatic); - _field = field; - } - - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Push(_field.GetValue(null)); - return +1; - } - } - - internal sealed class LoadFieldInstruction : Instruction { - private readonly FieldInfo _field; - - public LoadFieldInstruction(FieldInfo field) { - Assert.NotNull(field); - _field = field; - } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Push(_field.GetValue(frame.Pop())); - return +1; - } - } - - internal sealed class StoreFieldInstruction : Instruction { - private readonly FieldInfo _field; - - public StoreFieldInstruction(FieldInfo field) { - Assert.NotNull(field); - _field = field; - } - - public override int ConsumedStack { get { return 2; } } - public override int ProducedStack { get { return 0; } } - - public override int Run(InterpretedFrame frame) { - object value = frame.Pop(); - object self = frame.Pop(); - _field.SetValue(self, value); - return +1; - } - } - - internal sealed class StoreStaticFieldInstruction : Instruction { - private readonly FieldInfo _field; - - public StoreStaticFieldInstruction(FieldInfo field) { - Assert.NotNull(field); - _field = field; - } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 0; } } - - public override int Run(InterpretedFrame frame) { - object value = frame.Pop(); - _field.SetValue(null, value); - return +1; - } - } -} \ No newline at end of file diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/GreaterThanInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/GreaterThanInstruction.cs deleted file mode 100644 index 48d69a85ae6..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/GreaterThanInstruction.cs +++ /dev/null @@ -1,171 +0,0 @@ -// -// GreaterThanInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - abstract class GreaterThanInstruction : ComparisonInstruction { - private static Instruction _SByte, _Int16, _Char, _Int32, _Int64, _Byte, _UInt16, _UInt32, _UInt64, _Single, _Double; - private static Instruction _SByteLifted, _Int16Lifted, _CharLifted, _Int32Lifted, _Int64Lifted, _ByteLifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _SingleLifted, _DoubleLifted; - - private GreaterThanInstruction() { - } - - protected override object DoNullComparison (object l, object r) - { - return LiftedToNull ? (object) null : (object) false; - } - - internal sealed class GreaterThanSByte : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (SByte)l > (SByte)r; - } - } - - internal sealed class GreaterThanInt16 : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int16)l > (Int16)r; - } - } - - internal sealed class GreaterThanChar : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Char)l > (Char)r; - } - } - - internal sealed class GreaterThanInt32 : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int32)l > (Int32)r; - } - } - - internal sealed class GreaterThanInt64 : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int64)l > (Int64)r; - } - } - - internal sealed class GreaterThanByte : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Byte)l > (Byte)r; - } - } - - internal sealed class GreaterThanUInt16 : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt16)l > (UInt16)r; - } - } - - internal sealed class GreaterThanUInt32 : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt32)l > (UInt32)r; - } - } - - internal sealed class GreaterThanUInt64 : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt64)l > (UInt64)r; - } - } - - internal sealed class GreaterThanSingle : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Single)l > (Single)r; - } - } - - internal sealed class GreaterThanDouble : GreaterThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Double)l > (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.SByte: return _SByte ?? (_SByte = new GreaterThanSByte()); - case TypeCode.Byte: return _Byte ?? (_Byte = new GreaterThanByte()); - case TypeCode.Char: return _Char ?? (_Char = new GreaterThanChar()); - case TypeCode.Int16: return _Int16 ?? (_Int16 = new GreaterThanInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new GreaterThanInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new GreaterThanInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new GreaterThanUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new GreaterThanUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new GreaterThanUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new GreaterThanSingle()); - case TypeCode.Double: return _Double ?? (_Double = new GreaterThanDouble()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.SByte: return _SByteLifted ?? (_SByteLifted = new GreaterThanSByte() { LiftedToNull = true }); - case TypeCode.Byte: return _ByteLifted ?? (_ByteLifted = new GreaterThanByte() { LiftedToNull = true }); - case TypeCode.Char: return _CharLifted ?? (_CharLifted = new GreaterThanChar() { LiftedToNull = true }); - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new GreaterThanInt16() { LiftedToNull = true }); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new GreaterThanInt32() { LiftedToNull = true }); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new GreaterThanInt64() { LiftedToNull = true }); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new GreaterThanUInt16() { LiftedToNull = true }); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new GreaterThanUInt32() { LiftedToNull = true }); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new GreaterThanUInt64() { LiftedToNull = true }); - case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new GreaterThanSingle() { LiftedToNull = true }); - case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new GreaterThanDouble() { LiftedToNull = true }); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "GreaterThan()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/GreaterThanOrEqualInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/GreaterThanOrEqualInstruction.cs deleted file mode 100644 index fd3f5ecdb17..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/GreaterThanOrEqualInstruction.cs +++ /dev/null @@ -1,171 +0,0 @@ -// -// GreaterThanOrEqualInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - abstract class GreaterThanOrEqualInstruction : ComparisonInstruction { - private static Instruction _SByte, _Int16, _Char, _Int32, _Int64, _Byte, _UInt16, _UInt32, _UInt64, _Single, _Double; - private static Instruction _SByteLifted, _Int16Lifted, _CharLifted, _Int32Lifted, _Int64Lifted, _ByteLifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _SingleLifted, _DoubleLifted; - - private GreaterThanOrEqualInstruction() { - } - - protected override object DoNullComparison (object l, object r) - { - return LiftedToNull ? (object) null : (object) false; - } - - internal sealed class GreaterThanOrEqualSByte : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (SByte)l >= (SByte)r; - } - } - - internal sealed class GreaterThanOrEqualInt16 : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int16)l >= (Int16)r; - } - } - - internal sealed class GreaterThanOrEqualChar : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Char)l >= (Char)r; - } - } - - internal sealed class GreaterThanOrEqualInt32 : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int32)l >= (Int32)r; - } - } - - internal sealed class GreaterThanOrEqualInt64 : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int64)l >= (Int64)r; - } - } - - internal sealed class GreaterThanOrEqualByte : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Byte)l >= (Byte)r; - } - } - - internal sealed class GreaterThanOrEqualUInt16 : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt16)l >= (UInt16)r; - } - } - - internal sealed class GreaterThanOrEqualUInt32 : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt32)l >= (UInt32)r; - } - } - - internal sealed class GreaterThanOrEqualUInt64 : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt64)l >= (UInt64)r; - } - } - - internal sealed class GreaterThanOrEqualSingle : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Single)l >= (Single)r; - } - } - - internal sealed class GreaterThanOrEqualDouble : GreaterThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Double)l >= (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.SByte: return _SByte ?? (_SByte = new GreaterThanOrEqualSByte()); - case TypeCode.Byte: return _Byte ?? (_Byte = new GreaterThanOrEqualByte()); - case TypeCode.Char: return _Char ?? (_Char = new GreaterThanOrEqualChar()); - case TypeCode.Int16: return _Int16 ?? (_Int16 = new GreaterThanOrEqualInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new GreaterThanOrEqualInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new GreaterThanOrEqualInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new GreaterThanOrEqualUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new GreaterThanOrEqualUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new GreaterThanOrEqualUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new GreaterThanOrEqualSingle()); - case TypeCode.Double: return _Double ?? (_Double = new GreaterThanOrEqualDouble()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.SByte: return _SByteLifted ?? (_SByteLifted = new GreaterThanOrEqualSByte() { LiftedToNull = true }); - case TypeCode.Byte: return _ByteLifted ?? (_ByteLifted = new GreaterThanOrEqualByte() { LiftedToNull = true }); - case TypeCode.Char: return _CharLifted ?? (_CharLifted = new GreaterThanOrEqualChar() { LiftedToNull = true }); - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new GreaterThanOrEqualInt16() { LiftedToNull = true }); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new GreaterThanOrEqualInt32() { LiftedToNull = true }); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new GreaterThanOrEqualInt64() { LiftedToNull = true }); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new GreaterThanOrEqualUInt16() { LiftedToNull = true }); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new GreaterThanOrEqualUInt32() { LiftedToNull = true }); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new GreaterThanOrEqualUInt64() { LiftedToNull = true }); - case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new GreaterThanOrEqualSingle() { LiftedToNull = true }); - case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new GreaterThanOrEqualDouble() { LiftedToNull = true }); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "GreaterThanOrEqual()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/Instruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/Instruction.cs deleted file mode 100644 index 6f67063353b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/Instruction.cs +++ /dev/null @@ -1,61 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - public interface IInstructionProvider { - void AddInstructions(LightCompiler compiler); - } - - public abstract partial class Instruction { - public virtual int ConsumedStack { get { return 0; } } - public virtual int ProducedStack { get { return 0; } } - public virtual int ConsumedContinuations { get { return 0; } } - public virtual int ProducedContinuations { get { return 0; } } - - public int StackBalance { - get { return ProducedStack - ConsumedStack; } - } - - public int ContinuationsBalance { - get { return ProducedContinuations - ConsumedContinuations; } - } - - public abstract int Run(InterpretedFrame frame); - - public virtual string InstructionName { - get { return GetType().Name.Replace("Instruction", ""); } - } - - public override string ToString() { - return InstructionName + "()"; - } - - public virtual string ToDebugString(int instructionIndex, object cookie, Func labelIndexer, IList objects) { - return ToString(); - } - - public virtual object GetDebugCookie(LightCompiler compiler) { - return null; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionFactory.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionFactory.cs deleted file mode 100644 index 4a1f464a53e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionFactory.cs +++ /dev/null @@ -1,123 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_NUMERICS -using BigInt = System.Numerics.BigInteger; -#endif - -using System; -using System.Collections.Generic; - -using Microsoft.Scripting.Math; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - public abstract class InstructionFactory { - // TODO: weak table for types in a collectible assembly? - private static Dictionary _factories; - - internal static InstructionFactory GetFactory(Type type) { - if (_factories == null) { - _factories = new Dictionary() { - { typeof(object), InstructionFactory.Factory }, - { typeof(bool), InstructionFactory.Factory }, - { typeof(byte), InstructionFactory.Factory }, - { typeof(sbyte), InstructionFactory.Factory }, - { typeof(short), InstructionFactory.Factory }, - { typeof(ushort), InstructionFactory.Factory }, - { typeof(int), InstructionFactory.Factory }, - { typeof(uint), InstructionFactory.Factory }, - { typeof(long), InstructionFactory.Factory }, - { typeof(ulong), InstructionFactory.Factory }, - { typeof(float), InstructionFactory.Factory }, - { typeof(double), InstructionFactory.Factory }, - { typeof(char), InstructionFactory.Factory }, - { typeof(string), InstructionFactory.Factory }, -#if FEATURE_NUMERICS - { typeof(BigInt), InstructionFactory.Factory }, -#endif -#if !MONO_INTERPRETER - { typeof(BigInteger), InstructionFactory.Factory } -#endif - }; - } - - lock (_factories) { - InstructionFactory factory; - if (!_factories.TryGetValue(type, out factory)) { - factory = (InstructionFactory)typeof(InstructionFactory<>).MakeGenericType(type).GetDeclaredField("Factory").GetValue(null); - _factories[type] = factory; - } - return factory; - } - } - - internal protected abstract Instruction GetArrayItem(); - internal protected abstract Instruction SetArrayItem(); - internal protected abstract Instruction TypeIs(); - internal protected abstract Instruction TypeAs(); - internal protected abstract Instruction DefaultValue(); - internal protected abstract Instruction NewArray(); - internal protected abstract Instruction NewArrayInit(int elementCount); - internal protected abstract Instruction WrapToNullable(Type elementType); - } - - public sealed class InstructionFactory : InstructionFactory { - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public static readonly InstructionFactory Factory = new InstructionFactory(); - - private Instruction _getArrayItem; - private Instruction _setArrayItem; - private Instruction _typeIs; - private Instruction _defaultValue; - private Instruction _newArray; - private Instruction _typeAs; - private Instruction _nullableWrap; - - private InstructionFactory() { } - - internal protected override Instruction GetArrayItem() { - return _getArrayItem ?? (_getArrayItem = new GetArrayItemInstruction()); - } - - internal protected override Instruction SetArrayItem() { - return _setArrayItem ?? (_setArrayItem = new SetArrayItemInstruction()); - } - - internal protected override Instruction TypeIs() { - return _typeIs ?? (_typeIs = new TypeIsInstruction()); - } - - internal protected override Instruction TypeAs() { - return _typeAs ?? (_typeAs = new TypeAsInstruction()); - } - - internal protected override Instruction DefaultValue() { - return _defaultValue ?? (_defaultValue = new DefaultValueInstruction()); - } - - internal protected override Instruction NewArray() { - return _newArray ?? (_newArray = new NewArrayInstruction()); - } - - internal protected override Instruction NewArrayInit(int elementCount) { - return new NewArrayInitInstruction(elementCount); - } - - internal protected override Instruction WrapToNullable(Type elementType) { - return _nullableWrap ?? (_nullableWrap = new WrapToNullableInstruction(elementType)); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs deleted file mode 100644 index d6ebd1ae35f..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/InstructionList.cs +++ /dev/null @@ -1,1074 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ -// Enables instruction counting and displaying stats at process exit. -// #define STATS - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Security; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes")] - [DebuggerTypeProxy(typeof(InstructionArray.DebugView))] - public struct InstructionArray { - internal readonly int MaxStackDepth; - internal readonly int MaxContinuationDepth; - internal readonly Instruction[] Instructions; - internal readonly object[] Objects; - internal readonly RuntimeLabel[] Labels; - - // list of (instruction index, cookie) sorted by instruction index: - internal readonly List> DebugCookies; - - internal InstructionArray(int maxStackDepth, int maxContinuationDepth, Instruction[] instructions, - object[] objects, RuntimeLabel[] labels, List> debugCookies) { - - MaxStackDepth = maxStackDepth; - MaxContinuationDepth = maxContinuationDepth; - Instructions = instructions; - DebugCookies = debugCookies; - Objects = objects; - Labels = labels; - } - - internal int Length { - get { return Instructions.Length; } - } - - #region Debug View - - internal sealed class DebugView { - private readonly InstructionArray _array; - - public DebugView(InstructionArray array) { - _array = array; - - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public InstructionList.DebugView.InstructionView[]/*!*/ A0 { - get { - return InstructionList.DebugView.GetInstructionViews( - _array.Instructions, - _array.Objects, - (index) => _array.Labels[index].Index, - _array.DebugCookies - ); - } - } - } - - #endregion - } - - [DebuggerTypeProxy(typeof(InstructionList.DebugView))] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] - public sealed class InstructionList { - private readonly List _instructions = new List(); - private List _objects; - - private int _currentStackDepth; - private int _maxStackDepth; - private int _currentContinuationsDepth; - private int _maxContinuationDepth; - private int _runtimeLabelCount; - private List _labels; - - // list of (instruction index, cookie) sorted by instruction index: - private List> _debugCookies = null; - - #region Debug View - - internal sealed class DebugView { - private readonly InstructionList _list; - - public DebugView(InstructionList list) { - _list = list; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public InstructionView[]/*!*/ A0 { - get { - return GetInstructionViews( - _list._instructions, - _list._objects, - (index) => _list._labels[index].TargetIndex, - _list._debugCookies - ); - } - } - - internal static InstructionView[] GetInstructionViews(IList instructions, IList objects, - Func labelIndexer, IList> debugCookies) { - - var result = new List(); - int index = 0; - int stackDepth = 0; - int continuationsDepth = 0; - - var cookieEnumerator = (debugCookies != null ? debugCookies : new KeyValuePair[0]).GetEnumerator(); - var hasCookie = cookieEnumerator.MoveNext(); - - for (int i = 0; i < instructions.Count; i++) { - object cookie = null; - while (hasCookie && cookieEnumerator.Current.Key == i) { - cookie = cookieEnumerator.Current.Value; - hasCookie = cookieEnumerator.MoveNext(); - } - - int stackDiff = instructions[i].StackBalance; - int contDiff = instructions[i].ContinuationsBalance; - string name = instructions[i].ToDebugString(i, cookie, labelIndexer, objects); - result.Add(new InstructionView(instructions[i], name, i, stackDepth, continuationsDepth)); - - index++; - stackDepth += stackDiff; - continuationsDepth += contDiff; - } - return result.ToArray(); - } - - [DebuggerDisplay("{GetValue(),nq}", Name = "{GetName(),nq}", Type = "{GetDisplayType(), nq}")] - internal struct InstructionView { - private readonly int _index; - private readonly int _stackDepth; - private readonly int _continuationsDepth; - private readonly string _name; - private readonly Instruction _instruction; - - internal string GetName() { - return _index.ToString() + - (_continuationsDepth == 0 ? "" : " C(" + _continuationsDepth.ToString() + ")") + - (_stackDepth == 0 ? "" : " S(" + _stackDepth.ToString() + ")"); - } - - internal string GetValue() { - return _name; - } - - internal string GetDisplayType() { - return _instruction.ContinuationsBalance.ToString() + "/" + _instruction.StackBalance.ToString(); - } - - public InstructionView(Instruction instruction, string name, int index, int stackDepth, int continuationsDepth) { - _instruction = instruction; - _name = name; - _index = index; - _stackDepth = stackDepth; - _continuationsDepth = continuationsDepth; - } - } - } - - #endregion - - #region Core Emit Ops - - public void Emit(Instruction instruction) { - _instructions.Add(instruction); - UpdateStackDepth(instruction); - } - - private void UpdateStackDepth(Instruction instruction) { - Debug.Assert(instruction.ConsumedStack >= 0 && instruction.ProducedStack >= 0 && - instruction.ConsumedContinuations >= 0 && instruction.ProducedContinuations >= 0); - - _currentStackDepth -= instruction.ConsumedStack; - Debug.Assert(_currentStackDepth >= 0); - _currentStackDepth += instruction.ProducedStack; - if (_currentStackDepth > _maxStackDepth) { - _maxStackDepth = _currentStackDepth; - } - - _currentContinuationsDepth -= instruction.ConsumedContinuations; - Debug.Assert(_currentContinuationsDepth >= 0); - _currentContinuationsDepth += instruction.ProducedContinuations; - if (_currentContinuationsDepth > _maxContinuationDepth) { - _maxContinuationDepth = _currentContinuationsDepth; - } - } - - /// - /// Attaches a cookie to the last emitted instruction. - /// - [Conditional("DEBUG")] - public void SetDebugCookie(object cookie) { -#if DEBUG - if (_debugCookies == null) { - _debugCookies = new List>(); - } - - Debug.Assert(Count > 0); - _debugCookies.Add(new KeyValuePair(Count - 1, cookie)); -#endif - } - - public int Count { - get { return _instructions.Count; } - } - - public int CurrentStackDepth { - get { return _currentStackDepth; } - } - - public int CurrentContinuationsDepth { - get { return _currentContinuationsDepth; } - } - - public int MaxStackDepth { - get { return _maxStackDepth; } - } - - internal Instruction GetInstruction(int index) { - return _instructions[index]; - } - -#if STATS - private static Dictionary _executedInstructions = new Dictionary(); - private static Dictionary> _instances = new Dictionary>(); - - static InstructionList() { - AppDomain.CurrentDomain.ProcessExit += new EventHandler((_, __) => { - PerfTrack.DumpHistogram(_executedInstructions); - Console.WriteLine("-- Total executed: {0}", _executedInstructions.Values.Aggregate(0, (sum, value) => sum + value)); - Console.WriteLine("-----"); - - var referenced = new Dictionary(); - int total = 0; - foreach (var entry in _instances) { - referenced[entry.Key] = entry.Value.Count; - total += entry.Value.Count; - } - - PerfTrack.DumpHistogram(referenced); - Console.WriteLine("-- Total referenced: {0}", total); - Console.WriteLine("-----"); - }); - } -#endif - public InstructionArray ToArray() { -#if STATS - lock (_executedInstructions) { - _instructions.ForEach((instr) => { - int value = 0; - var name = instr.GetType().Name; - _executedInstructions.TryGetValue(name, out value); - _executedInstructions[name] = value + 1; - - Dictionary dict; - if (!_instances.TryGetValue(name, out dict)) { - _instances[name] = dict = new Dictionary(); - } - dict[instr] = true; - }); - } -#endif - return new InstructionArray( - _maxStackDepth, - _maxContinuationDepth, - _instructions.ToArray(), - (_objects != null) ? _objects.ToArray() : null, - BuildRuntimeLabels(), - _debugCookies - ); - } - - #endregion - - #region Stack Operations - - private const int PushIntMinCachedValue = -100; - private const int PushIntMaxCachedValue = 100; - private const int CachedObjectCount = 256; - - private static Instruction _null; - private static Instruction _true; - private static Instruction _false; - private static Instruction[] _ints; - private static Instruction[] _loadObjectCached; - - public void EmitLoad(object value) { - EmitLoad(value, null); - } - - public void EmitLoad(bool value) { - if ((bool)value) { - Emit(_true ?? (_true = new LoadObjectInstruction(value))); - } else { - Emit(_false ?? (_false = new LoadObjectInstruction(value))); - } - } - - public void EmitLoad(object value, Type type) { - if (value == null) { - Emit(_null ?? (_null = new LoadObjectInstruction(null))); - return; - } - - if (type == null || type.IsValueType()) { - if (value is bool) { - EmitLoad((bool)value); - return; - } - - if (value is int) { - int i = (int)value; - if (i >= PushIntMinCachedValue && i <= PushIntMaxCachedValue) { - if (_ints == null) { - _ints = new Instruction[PushIntMaxCachedValue - PushIntMinCachedValue + 1]; - } - i -= PushIntMinCachedValue; - Emit(_ints[i] ?? (_ints[i] = new LoadObjectInstruction(value))); - return; - } - } - } - - if (_objects == null) { - _objects = new List(); - if (_loadObjectCached == null) { - _loadObjectCached = new Instruction[CachedObjectCount]; - } - } - - if (_objects.Count < _loadObjectCached.Length) { - uint index = (uint)_objects.Count; - _objects.Add(value); - Emit(_loadObjectCached[index] ?? (_loadObjectCached[index] = new LoadCachedObjectInstruction(index))); - } else { - Emit(new LoadObjectInstruction(value)); - } - } - - public void EmitDup() { - Emit(DupInstruction.Instance); - } - - public void EmitPop() { - Emit(PopInstruction.Instance); - } - - public void EmitStore(object value) { - Emit (new PushValueInstruction (value)); - } - - #endregion - - #region Locals - - internal void SwitchToBoxed(int index, int instructionIndex) { - var instruction = _instructions[instructionIndex] as IBoxableInstruction; - - if (instruction != null) { - var newInstruction = instruction.BoxIfIndexMatches(index); - if (newInstruction != null) { - _instructions[instructionIndex] = newInstruction; - } - } - } - - private const int LocalInstrCacheSize = 64; - - private static Instruction[] _loadLocal; - private static Instruction[] _loadLocalBoxed; - private static Instruction[] _loadLocalFromClosure; - private static Instruction[] _loadLocalFromClosureBoxed; - private static Instruction[] _assignLocal; - private static Instruction[] _storeLocal; - private static Instruction[] _assignLocalBoxed; - private static Instruction[] _storeLocalBoxed; - private static Instruction[] _assignLocalToClosure; - private static Instruction[] _initReference; - private static Instruction[] _initImmutableRefBox; - private static Instruction[] _parameterBox; - private static Instruction[] _parameter; - - public void EmitLoadLocal(int index) { - if (_loadLocal == null) { - _loadLocal = new Instruction[LocalInstrCacheSize]; - } - - if (index < _loadLocal.Length) { - Emit(_loadLocal[index] ?? (_loadLocal[index] = new LoadLocalInstruction(index))); - } else { - Emit(new LoadLocalInstruction(index)); - } - } - - public void EmitLoadLocalBoxed(int index) { - Emit(LoadLocalBoxed(index)); - } - - internal static Instruction LoadLocalBoxed(int index) { - if (_loadLocalBoxed == null) { - _loadLocalBoxed = new Instruction[LocalInstrCacheSize]; - } - - if (index < _loadLocalBoxed.Length) { - return _loadLocalBoxed[index] ?? (_loadLocalBoxed[index] = new LoadLocalBoxedInstruction(index)); - } else { - return new LoadLocalBoxedInstruction(index); - } - } - - public void EmitLoadLocalFromClosure(int index) { - if (_loadLocalFromClosure == null) { - _loadLocalFromClosure = new Instruction[LocalInstrCacheSize]; - } - - if (index < _loadLocalFromClosure.Length) { - Emit(_loadLocalFromClosure[index] ?? (_loadLocalFromClosure[index] = new LoadLocalFromClosureInstruction(index))); - } else { - Emit(new LoadLocalFromClosureInstruction(index)); - } - } - - public void EmitLoadLocalFromClosureBoxed(int index) { - if (_loadLocalFromClosureBoxed == null) { - _loadLocalFromClosureBoxed = new Instruction[LocalInstrCacheSize]; - } - - if (index < _loadLocalFromClosureBoxed.Length) { - Emit(_loadLocalFromClosureBoxed[index] ?? (_loadLocalFromClosureBoxed[index] = new LoadLocalFromClosureBoxedInstruction(index))); - } else { - Emit(new LoadLocalFromClosureBoxedInstruction(index)); - } - } - - public void EmitAssignLocal(int index) { - if (_assignLocal == null) { - _assignLocal = new Instruction[LocalInstrCacheSize]; - } - - if (index < _assignLocal.Length) { - Emit(_assignLocal[index] ?? (_assignLocal[index] = new AssignLocalInstruction(index))); - } else { - Emit(new AssignLocalInstruction(index)); - } - } - - public void EmitStoreLocal(int index) { - if (_storeLocal == null) { - _storeLocal = new Instruction[LocalInstrCacheSize]; - } - - if (index < _storeLocal.Length) { - Emit(_storeLocal[index] ?? (_storeLocal[index] = new StoreLocalInstruction(index))); - } else { - Emit(new StoreLocalInstruction(index)); - } - } - - public void EmitAssignLocalBoxed(int index) { - Emit(AssignLocalBoxed(index)); - } - - internal static Instruction AssignLocalBoxed(int index) { - if (_assignLocalBoxed == null) { - _assignLocalBoxed = new Instruction[LocalInstrCacheSize]; - } - - if (index < _assignLocalBoxed.Length) { - return _assignLocalBoxed[index] ?? (_assignLocalBoxed[index] = new AssignLocalBoxedInstruction(index)); - } else { - return new AssignLocalBoxedInstruction(index); - } - } - - public void EmitStoreLocalBoxed(int index) { - Emit(StoreLocalBoxed(index)); - } - - internal static Instruction StoreLocalBoxed(int index) { - if (_storeLocalBoxed == null) { - _storeLocalBoxed = new Instruction[LocalInstrCacheSize]; - } - - if (index < _storeLocalBoxed.Length) { - return _storeLocalBoxed[index] ?? (_storeLocalBoxed[index] = new StoreLocalBoxedInstruction(index)); - } else { - return new StoreLocalBoxedInstruction(index); - } - } - - public void EmitAssignLocalToClosure(int index) { - if (_assignLocalToClosure == null) { - _assignLocalToClosure = new Instruction[LocalInstrCacheSize]; - } - - if (index < _assignLocalToClosure.Length) { - Emit(_assignLocalToClosure[index] ?? (_assignLocalToClosure[index] = new AssignLocalToClosureInstruction(index))); - } else { - Emit(new AssignLocalToClosureInstruction(index)); - } - } - - public void EmitStoreLocalToClosure(int index) { - EmitAssignLocalToClosure(index); - EmitPop(); - } - - public void EmitInitializeLocal(int index, Type type) { - object value = ScriptingRuntimeHelpers.GetPrimitiveDefaultValue(type); - if (value != null) { - Emit(new InitializeLocalInstruction.ImmutableValue(index, value)); - } else if (type.IsValueType()) { - Emit(new InitializeLocalInstruction.MutableValue(index, type)); - } else { - Emit(InitReference(index)); - } - } - - internal void EmitInitializeParameter(int index) { - Emit(Parameter(index)); - } - - internal static Instruction Parameter(int index) { - if (_parameter == null) { - _parameter = new Instruction[LocalInstrCacheSize]; - } - - if (index < _parameter.Length) { - return _parameter[index] ?? (_parameter[index] = new InitializeLocalInstruction.Parameter(index)); - } - - return new InitializeLocalInstruction.Parameter(index); - } - - internal static Instruction ParameterBox(int index) { - if (_parameterBox == null) { - _parameterBox = new Instruction[LocalInstrCacheSize]; - } - - if (index < _parameterBox.Length) { - return _parameterBox[index] ?? (_parameterBox[index] = new InitializeLocalInstruction.ParameterBox(index)); - } - - return new InitializeLocalInstruction.ParameterBox(index); - } - - internal static Instruction InitReference(int index) { - if (_initReference == null) { - _initReference = new Instruction[LocalInstrCacheSize]; - } - - if (index < _initReference.Length) { - return _initReference[index] ?? (_initReference[index] = new InitializeLocalInstruction.Reference(index)); - } - - return new InitializeLocalInstruction.Reference(index); - } - - internal static Instruction InitImmutableRefBox(int index) { - if (_initImmutableRefBox == null) { - _initImmutableRefBox = new Instruction[LocalInstrCacheSize]; - } - - if (index < _initImmutableRefBox.Length) { - return _initImmutableRefBox[index] ?? (_initImmutableRefBox[index] = new InitializeLocalInstruction.ImmutableBox(index, null)); - } - - return new InitializeLocalInstruction.ImmutableBox(index, null); - } - - public void EmitNewRuntimeVariables(int count) { - Emit(new RuntimeVariablesInstruction(count)); - } - - #endregion - - #region Array Operations - - public void EmitGetArrayItem(Type arrayType) { - Type elementType = arrayType.GetElementType(); - if (elementType.IsClass() || elementType.IsInterface()) { - Emit(InstructionFactory.Factory.GetArrayItem()); - } else { - Emit(InstructionFactory.GetFactory(elementType).GetArrayItem()); - } - } - - public void EmitGetArrayLength(Type arrayType) { - Emit(GetArrayLengthInstruction.Create()); - } - - public void EmitSetArrayItem(Type arrayType) { - Type elementType = arrayType.GetElementType(); - if (elementType.IsClass() || elementType.IsInterface()) { - Emit(InstructionFactory.Factory.SetArrayItem()); - } else { - Emit(InstructionFactory.GetFactory(elementType).SetArrayItem()); - } - } - - public void EmitNewArray(Type elementType) { - Emit(InstructionFactory.GetFactory(elementType).NewArray()); - } - - public void EmitNewArrayBounds(Type elementType, int rank) { - Emit(new NewArrayBoundsInstruction(elementType, rank)); - } - - public void EmitNewArrayInit(Type elementType, int elementCount) { - Emit(InstructionFactory.GetFactory(elementType).NewArrayInit(elementCount)); - } - - #endregion - - #region Arithmetic Operations - - public void EmitAdd(Type type, bool @checked) { - if (@checked) { - Emit(AddOvfInstruction.Create(type)); - } else { - Emit(AddInstruction.Create(type)); - } - } - - public void EmitSub(Type type, bool @checked) { - if (@checked) { - Emit(SubOvfInstruction.Create(type)); - } else { - Emit(SubInstruction.Create(type)); - } - } - - public void EmitMul(Type type, bool @checked) { - if (@checked) { - Emit(MulOvfInstruction.Create(type)); - } else { - Emit(MulInstruction.Create(type)); - } - } - - public void EmitDiv(Type type) { - Emit(DivInstruction.Create(type)); - } - - public void EmitMod(Type type) { - Emit(ModInstruction.Create(type)); - } - - #endregion - - public void EmitIncrement (Type type) { - Emit (new PushValueInstruction (1)); - EmitAdd (type, false); - } - - public void EmitShl(Type type, bool lifted) { - Emit(lifted ? ShlInstruction.CreateLifted(type) : ShlInstruction.Create(type)); - } - - public void EmitShr(Type type, bool lifted) { - Emit(lifted ? ShrInstruction.CreateLifted(type) : ShrInstruction.Create(type)); - } - - public void EmitOr(Type type, bool lifted) { - Emit(lifted ? OrInstruction.CreateLifted(type) : OrInstruction.Create(type)); - } - - public void EmitAnd(Type type, bool lifted) { - Emit(lifted ? AndInstruction.CreateLifted (type) : AndInstruction.Create(type)); - } - - public void EmitExclusiveOr(Type type, bool lifted) { - Emit(lifted ? XorInstruction.CreateLifted(type) : XorInstruction.Create(type)); - } - - #region Comparisons - - public void EmitEqual(Type type, bool liftedResult) { - Emit(liftedResult ? - EqualInstruction.CreateLifted(TypeUtils.GetNonNullableType (type)) : - EqualInstruction.Create(TypeUtils.GetNonNullableType (type))); - } - - public void EmitNotEqual(Type type, bool liftedResult) { - Emit(liftedResult ? - NotEqualInstruction.CreateLifted(TypeUtils.GetNonNullableType (type)) : - NotEqualInstruction.Create(TypeUtils.GetNonNullableType (type))); - } - - public void EmitLessThan(Type type, bool liftedResult) { - Emit(liftedResult ? - LessThanInstruction.CreateLifted(TypeUtils.GetNonNullableType (type)) : - LessThanInstruction.Create(TypeUtils.GetNonNullableType (type))); - } - - public void EmitLessThanOrEqual(Type type, bool liftedResult) { - Emit(liftedResult ? - LessThanOrEqualInstruction.CreateLifted(TypeUtils.GetNonNullableType (type)) : - LessThanOrEqualInstruction.Create(TypeUtils.GetNonNullableType (type))); - } - - public void EmitGreaterThan(Type type, bool liftedResult) { - Emit(liftedResult ? - GreaterThanInstruction.CreateLifted(TypeUtils.GetNonNullableType (type)) : - GreaterThanInstruction.Create(TypeUtils.GetNonNullableType (type))); - } - - public void EmitGreaterThanOrEqual(Type type, bool liftedResult) { - Emit(liftedResult ? - GreaterThanOrEqualInstruction.CreateLifted(TypeUtils.GetNonNullableType (type)) : - GreaterThanOrEqualInstruction.Create(TypeUtils.GetNonNullableType (type))); - } - - #endregion - - #region Conversions - - public void EmitNumericConvertChecked(TypeCode from, TypeCode to) { - Emit(new NumericConvertInstruction.Checked(from, to)); - } - - public void EmitNumericConvertUnchecked(TypeCode from, TypeCode to) { - Emit(new NumericConvertInstruction.Unchecked(from, to)); - } - - #endregion - - #region Unary Operators - - public void EmitNegate(Type type, bool @checked, bool lifted) { - if (@checked) - Emit(lifted ? NegateOvfInstruction.CreateLifted(type) : NegateOvfInstruction.Create(type)); - else - Emit(lifted ? NegateInstruction.CreateLifted(type) : NegateInstruction.Create(type)); - } - - public void EmitNot(Type type, bool lifted) { - Emit(lifted ? NotInstruction.CreateLifted (type) : NotInstruction.Create(type)); - } - - #endregion - - #region Nullable operations - - public void EmitWrap (Type elementType) - { - Emit(InstructionFactory.GetFactory(elementType).WrapToNullable (elementType)); - } - - #endregion - - #region Types - - public void EmitDefaultValue(Type type) { - Emit(InstructionFactory.GetFactory(type).DefaultValue()); - } - - public void EmitNew(ConstructorInfo constructorInfo) { - Emit(new NewInstruction(constructorInfo)); - } - - internal void EmitCreateDelegate(LightDelegateCreator creator) { - Emit(new CreateDelegateInstruction(creator)); - } - - public void EmitTypeEquals() { - Emit(TypeEqualsInstruction.Instance); - } - - public void EmitTypeIs(Type type) { - Emit(InstructionFactory.GetFactory(type).TypeIs()); - } - - public void EmitTypeAs(Type type) { - Emit(InstructionFactory.GetFactory(type).TypeAs()); - } - - #endregion - - #region Fields and Methods - - private static readonly Dictionary _loadFields = new Dictionary(); - - public void EmitLoadField(FieldInfo field) { - Emit(GetLoadField(field)); - } - - private Instruction GetLoadField(FieldInfo field) { - lock (_loadFields) { - Instruction instruction; - if (!_loadFields.TryGetValue(field, out instruction)) { - if (field.IsStatic) { - instruction = new LoadStaticFieldInstruction(field); - } else { - instruction = new LoadFieldInstruction(field); - } - _loadFields.Add(field, instruction); - } - return instruction; - } - } - - public void EmitStoreField(FieldInfo field) { - if (field.IsStatic) { - Emit(new StoreStaticFieldInstruction(field)); - } else { - Emit(new StoreFieldInstruction(field)); - } - } - - #endregion - - #region Dynamic - - public void EmitDynamic(Type type, CallSiteBinder binder) { - Emit(CreateDynamicInstruction(type, binder)); - } - - #region Generated Dynamic InstructionList Factory - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_instructionlist_factory from: generate_dynamic_instructions.py - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - public void EmitDynamic(CallSiteBinder binder) { - Emit(DynamicInstruction.Factory(binder)); - } - - - // *** END GENERATED CODE *** - - #endregion - - private static Dictionary> _factories = - new Dictionary>(); - - /// Instruction can't be created due to insufficient privileges. - internal static Instruction CreateDynamicInstruction(Type delegateType, CallSiteBinder binder) { - Func factory; - lock (_factories) { - if (!_factories.TryGetValue(delegateType, out factory)) { - if (delegateType.GetMethod("Invoke").ReturnType == typeof(void)) { - // TODO: We should generally support void returning binders but the only - // ones that exist are delete index/member who's perf isn't that critical. - return new DynamicInstructionN(delegateType, CallSite.Create(delegateType, binder), true); - } - - Type instructionType = DynamicInstructionN.GetDynamicInstructionType(delegateType); - if (instructionType == null) { - return new DynamicInstructionN(delegateType, CallSite.Create(delegateType, binder)); - } - - factory = (Func)instructionType.GetMethod("Factory").CreateDelegate(typeof(Func)); - _factories[delegateType] = factory; - } - } - return factory(binder); - } - - #endregion - - #region Control Flow - - private static readonly RuntimeLabel[] EmptyRuntimeLabels = new RuntimeLabel[] { new RuntimeLabel(Interpreter.RethrowOnReturn, 0, 0) }; - - private RuntimeLabel[] BuildRuntimeLabels() { - if (_runtimeLabelCount == 0) { - return EmptyRuntimeLabels; - } - - var result = new RuntimeLabel[_runtimeLabelCount + 1]; - foreach (BranchLabel label in _labels) { - if (label.HasRuntimeLabel) { - result[label.LabelIndex] = label.ToRuntimeLabel(); - } - } - // "return and rethrow" label: - result[result.Length - 1] = new RuntimeLabel(Interpreter.RethrowOnReturn, 0, 0); - return result; - } - - public BranchLabel MakeLabel() { - if (_labels == null) { - _labels = new List(); - } - - var label = new BranchLabel(); - _labels.Add(label); - return label; - } - - internal void FixupBranch(int branchIndex, int offset) { - _instructions[branchIndex] = ((OffsetInstruction)_instructions[branchIndex]).Fixup(offset); - } - - private int EnsureLabelIndex(BranchLabel label) { - if (label.HasRuntimeLabel) { - return label.LabelIndex; - } - - label.LabelIndex = _runtimeLabelCount; - _runtimeLabelCount++; - return label.LabelIndex; - } - - public int MarkRuntimeLabel() { - BranchLabel handlerLabel = MakeLabel(); - MarkLabel(handlerLabel); - return EnsureLabelIndex(handlerLabel); - } - - public void MarkLabel(BranchLabel label) { - label.Mark(this); - } - - public void EmitGoto(BranchLabel label, bool hasResult, bool hasValue) { - Emit(GotoInstruction.Create(EnsureLabelIndex(label), hasResult, hasValue)); - } - - private void EmitBranch(OffsetInstruction instruction, BranchLabel label) { - Emit(instruction); - label.AddBranch(this, Count - 1); - } - - public void EmitBranch(BranchLabel label) { - EmitBranch(new BranchInstruction(), label); - } - - public void EmitBranch(BranchLabel label, bool hasResult, bool hasValue) { - EmitBranch(new BranchInstruction(hasResult, hasValue), label); - } - - public void EmitCoalescingBranch(BranchLabel leftNotNull) { - EmitBranch(new CoalescingBranchInstruction(), leftNotNull); - } - - public void EmitBranchTrue(BranchLabel elseLabel) { - EmitBranch(new BranchTrueInstruction(), elseLabel); - } - - public void EmitBranchFalse(BranchLabel elseLabel) { - EmitBranch(new BranchFalseInstruction(), elseLabel); - } - - public void EmitBranchNull(BranchLabel elseLabel) { - EmitBranch(new BranchNullInstruction(), elseLabel); - } - - public void EmitThrow() { - Emit(ThrowInstruction.Throw); - } - - public void EmitThrowVoid() { - Emit(ThrowInstruction.VoidThrow); - } - - public void EmitRethrow() { - Emit(ThrowInstruction.Rethrow); - } - - public void EmitRethrowVoid() { - Emit(ThrowInstruction.VoidRethrow); - } - - public void EmitEnterTryFinally(BranchLabel finallyStartLabel) { - Emit(EnterTryFinallyInstruction.Create(EnsureLabelIndex(finallyStartLabel))); - } - - public void EmitEnterFinally() { - Emit(EnterFinallyInstruction.Instance); - } - - public void EmitLeaveFinally() { - Emit(LeaveFinallyInstruction.Instance); - } - - public void EmitLeaveFault(bool hasValue) { - Emit(hasValue ? LeaveFaultInstruction.NonVoid : LeaveFaultInstruction.Void); - } - - public void EmitEnterExceptionHandlerNonVoid() { - Emit(EnterExceptionHandlerInstruction.NonVoid); - } - - public void EmitEnterExceptionHandlerVoid() { - Emit(EnterExceptionHandlerInstruction.Void); - } - - public void EmitLeaveExceptionHandler(bool hasValue, BranchLabel tryExpressionEndLabel) { - Emit(LeaveExceptionHandlerInstruction.Create(EnsureLabelIndex(tryExpressionEndLabel), hasValue)); - } - - public void EmitSwitch(Dictionary cases) { - Emit(new SwitchInstruction(cases)); - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LabelInfo.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LabelInfo.cs deleted file mode 100644 index 2517a85baf1..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LabelInfo.cs +++ /dev/null @@ -1,309 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif -using System.Text; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - - /// - /// Contains compiler state corresponding to a LabelTarget - /// See also LabelScopeInfo. - /// - internal sealed class LabelInfo { - // The tree node representing this label - private readonly LabelTarget _node; - - // The BranchLabel label, will be mutated if Node is redefined - private BranchLabel _label; - - // The blocks where this label is defined. If it has more than one item, - // the blocks can't be jumped to except from a child block - // If there's only 1 block (the common case) it's stored here, if there's multiple blocks it's stored - // as a HashSet - private object _definitions; - - // Blocks that jump to this block - private readonly List _references = new List(); - - // True if at least one jump is across blocks - // If we have any jump across blocks to this label, then the - // LabelTarget can only be defined in one place - private bool _acrossBlockJump; - - internal LabelInfo(LabelTarget node) { - _node = node; - } - - internal BranchLabel GetLabel(LightCompiler compiler) { - EnsureLabel(compiler); - return _label; - } - - internal void Reference(LabelScopeInfo block) { - _references.Add(block); - if (HasDefinitions) { - ValidateJump(block); - } - } - - internal void Define(LabelScopeInfo block) { - // Prevent the label from being shadowed, which enforces cleaner - // trees. Also we depend on this for simplicity (keeping only one - // active IL Label per LabelInfo) - for (LabelScopeInfo j = block; j != null; j = j.Parent) { - if (j.ContainsTarget(_node)) { - throw new InvalidOperationException(String.Format("Label target already defined: {0}", _node.Name)); - } - } - - AddDefinition(block); - block.AddLabelInfo(_node, this); - - // Once defined, validate all jumps - if (HasDefinitions && !HasMultipleDefinitions) { - foreach (var r in _references) { - ValidateJump(r); - } - } else { - // Was just redefined, if we had any across block jumps, they're - // now invalid - if (_acrossBlockJump) { - throw new InvalidOperationException("Ambiguous jump"); - } - // For local jumps, we need a new IL label - // This is okay because: - // 1. no across block jumps have been made or will be made - // 2. we don't allow the label to be shadowed - _label = null; - } - } - - private void ValidateJump(LabelScopeInfo reference) { - // look for a simple jump out - for (LabelScopeInfo j = reference; j != null; j = j.Parent) { - if (DefinedIn(j)) { - // found it, jump is valid! - return; - } - if (j.Kind == LabelScopeKind.Filter) { - break; - } - } - - _acrossBlockJump = true; - - if (HasMultipleDefinitions) { - throw new InvalidOperationException(String.Format("Ambiguous jump {0}", _node.Name)); - } - - // We didn't find an outward jump. Look for a jump across blocks - LabelScopeInfo def = FirstDefinition(); - LabelScopeInfo common = CommonNode(def, reference, b => b.Parent); - - // Validate that we aren't jumping across a finally - for (LabelScopeInfo j = reference; j != common; j = j.Parent) { - if (j.Kind == LabelScopeKind.Filter) { - throw new InvalidOperationException("Control cannot leave filter test"); - } - } - - // Valdiate that we aren't jumping into a catch or an expression - for (LabelScopeInfo j = def; j != common; j = j.Parent) { - if (!j.CanJumpInto) { - if (j.Kind == LabelScopeKind.Expression) { - throw new InvalidOperationException("Control cannot enter an expression"); - } else { - throw new InvalidOperationException("Control cannot enter try"); - } - } - } - } - - internal void ValidateFinish() { - // Make sure that if this label was jumped to, it is also defined - if (_references.Count > 0 && !HasDefinitions) { - throw new InvalidOperationException("label target undefined"); - } - } - - private void EnsureLabel(LightCompiler compiler) { - if (_label == null) { - _label = compiler.Instructions.MakeLabel(); - } - } - - private bool DefinedIn(LabelScopeInfo scope) { - if (_definitions == scope) { - return true; - } - - HashSet definitions = _definitions as HashSet; - if (definitions != null) { - return definitions.Contains(scope); - } - return false; - } - - private bool HasDefinitions { - get { - return _definitions != null; - } - } - - private LabelScopeInfo FirstDefinition() { - LabelScopeInfo scope = _definitions as LabelScopeInfo; - if (scope != null) { - return scope; - } - return ((HashSet)_definitions).First(); - } - - private void AddDefinition(LabelScopeInfo scope) { - if (_definitions == null) { - _definitions = scope; - } else { - HashSet set = _definitions as HashSet; - if(set == null) { - _definitions = set = new HashSet() { (LabelScopeInfo)_definitions }; - } - set.Add(scope); - } - } - - private bool HasMultipleDefinitions { - get { - return _definitions is HashSet; - } - } - - internal static T CommonNode(T first, T second, Func parent) where T : class { - var cmp = EqualityComparer.Default; - if (cmp.Equals(first, second)) { - return first; - } - var set = new HashSet(cmp); - for (T t = first; t != null; t = parent(t)) { - set.Add(t); - } - for (T t = second; t != null; t = parent(t)) { - if (set.Contains(t)) { - return t; - } - } - return null; - } - } - - public enum LabelScopeKind { - // any "statement like" node that can be jumped into - Statement, - - // these correspond to the node of the same name - Block, - Switch, - Lambda, - Try, - - // these correspond to the part of the try block we're in - Catch, - Finally, - Filter, - - // the catch-all value for any other expression type - // (means we can't jump into it) - Expression, - } - - // - // Tracks scoping information for LabelTargets. Logically corresponds to a - // "label scope". Even though we have arbitrary goto support, we still need - // to track what kinds of nodes that gotos are jumping through, both to - // emit property IL ("leave" out of a try block), and for validation, and - // to allow labels to be duplicated in the tree, as long as the jumps are - // considered "up only" jumps. - // - // We create one of these for every Expression that can be jumped into, as - // well as creating them for the first expression we can't jump into. The - // "Kind" property indicates what kind of scope this is. - // - internal sealed class LabelScopeInfo { - private HybridReferenceDictionary Labels; // lazily allocated, we typically use this only once every 6th-7th block - internal readonly LabelScopeKind Kind; - internal readonly LabelScopeInfo Parent; - - internal LabelScopeInfo(LabelScopeInfo parent, LabelScopeKind kind) { - Parent = parent; - Kind = kind; - } - - /// - /// Returns true if we can jump into this node - /// - internal bool CanJumpInto { - get { - switch (Kind) { - case LabelScopeKind.Block: - case LabelScopeKind.Statement: - case LabelScopeKind.Switch: - case LabelScopeKind.Lambda: - return true; - } - return false; - } - } - - - internal bool ContainsTarget(LabelTarget target) { - if (Labels == null) { - return false; - } - - return Labels.ContainsKey(target); - } - - internal bool TryGetLabelInfo(LabelTarget target, out LabelInfo info) { - if (Labels == null) { - info = null; - return false; - } - - return Labels.TryGetValue(target, out info); - } - - internal void AddLabelInfo(LabelTarget target, LabelInfo info) { - Debug.Assert(CanJumpInto); - - if (Labels == null) { - Labels = new HybridReferenceDictionary(); - } - - Labels[target] = info; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LessThanInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LessThanInstruction.cs deleted file mode 100644 index 586deb8bd23..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LessThanInstruction.cs +++ /dev/null @@ -1,171 +0,0 @@ -// -// LessThanInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - abstract class LessThanInstruction : ComparisonInstruction { - private static Instruction _SByte, _Int16, _Char, _Int32, _Int64, _Byte, _UInt16, _UInt32, _UInt64, _Single, _Double; - private static Instruction _SByteLifted, _Int16Lifted, _CharLifted, _Int32Lifted, _Int64Lifted, _ByteLifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _SingleLifted, _DoubleLifted; - - private LessThanInstruction() { - } - - protected override object DoNullComparison (object l, object r) - { - return LiftedToNull ? (object) null : (object) false; - } - - internal sealed class LessThanSByte : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (SByte)l < (SByte)r; - } - } - - internal sealed class LessThanInt16 : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int16)l < (Int16)r; - } - } - - internal sealed class LessThanChar : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Char)l < (Char)r; - } - } - - internal sealed class LessThanInt32 : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int32)l < (Int32)r; - } - } - - internal sealed class LessThanInt64 : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int64)l < (Int64)r; - } - } - - internal sealed class LessThanByte : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Byte)l < (Byte)r; - } - } - - internal sealed class LessThanUInt16 : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt16)l < (UInt16)r; - } - } - - internal sealed class LessThanUInt32 : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt32)l < (UInt32)r; - } - } - - internal sealed class LessThanUInt64 : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt64)l < (UInt64)r; - } - } - - internal sealed class LessThanSingle : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Single)l < (Single)r; - } - } - - internal sealed class LessThanDouble : LessThanInstruction { - protected override object DoCalculate (object l, object r) - { - return (Double)l < (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.SByte: return _SByte ?? (_SByte = new LessThanSByte()); - case TypeCode.Byte: return _Byte ?? (_Byte = new LessThanByte()); - case TypeCode.Char: return _Char ?? (_Char = new LessThanChar()); - case TypeCode.Int16: return _Int16 ?? (_Int16 = new LessThanInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new LessThanInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new LessThanInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new LessThanUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new LessThanUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new LessThanUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new LessThanSingle()); - case TypeCode.Double: return _Double ?? (_Double = new LessThanDouble()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.SByte: return _SByteLifted ?? (_SByteLifted = new LessThanSByte() { LiftedToNull = true }); - case TypeCode.Byte: return _ByteLifted ?? (_ByteLifted = new LessThanByte() { LiftedToNull = true }); - case TypeCode.Char: return _CharLifted ?? (_CharLifted = new LessThanChar() { LiftedToNull = true }); - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new LessThanInt16() { LiftedToNull = true }); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new LessThanInt32() { LiftedToNull = true }); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new LessThanInt64() { LiftedToNull = true }); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new LessThanUInt16() { LiftedToNull = true }); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new LessThanUInt32() { LiftedToNull = true }); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new LessThanUInt64() { LiftedToNull = true }); - case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new LessThanSingle() { LiftedToNull = true }); - case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new LessThanDouble() { LiftedToNull = true }); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "LessThan()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LessThanOrEqualInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LessThanOrEqualInstruction.cs deleted file mode 100644 index a441ee52a2b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LessThanOrEqualInstruction.cs +++ /dev/null @@ -1,171 +0,0 @@ -// -// LessThanOrEqualInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - abstract class LessThanOrEqualInstruction : ComparisonInstruction { - private static Instruction _SByte, _Int16, _Char, _Int32, _Int64, _Byte, _UInt16, _UInt32, _UInt64, _Single, _Double; - private static Instruction _SByteLifted, _Int16Lifted, _CharLifted, _Int32Lifted, _Int64Lifted, _ByteLifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _SingleLifted, _DoubleLifted; - - private LessThanOrEqualInstruction() { - } - - protected override object DoNullComparison (object l, object r) - { - return LiftedToNull ? (object) null : (object) false; - } - - internal sealed class LessThanOrEqualSByte : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (SByte)l <= (SByte)r; - } - } - - internal sealed class LessThanOrEqualInt16 : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int16)l <= (Int16)r; - } - } - - internal sealed class LessThanOrEqualChar : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Char)l <= (Char)r; - } - } - - internal sealed class LessThanOrEqualInt32 : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int32)l <= (Int32)r; - } - } - - internal sealed class LessThanOrEqualInt64 : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int64)l <= (Int64)r; - } - } - - internal sealed class LessThanOrEqualByte : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Byte)l <= (Byte)r; - } - } - - internal sealed class LessThanOrEqualUInt16 : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt16)l <= (UInt16)r; - } - } - - internal sealed class LessThanOrEqualUInt32 : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt32)l <= (UInt32)r; - } - } - - internal sealed class LessThanOrEqualUInt64 : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt64)l <= (UInt64)r; - } - } - - internal sealed class LessThanOrEqualSingle : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Single)l <= (Single)r; - } - } - - internal sealed class LessThanOrEqualDouble : LessThanOrEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Double)l <= (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.SByte: return _SByte ?? (_SByte = new LessThanOrEqualSByte()); - case TypeCode.Byte: return _Byte ?? (_Byte = new LessThanOrEqualByte()); - case TypeCode.Char: return _Char ?? (_Char = new LessThanOrEqualChar()); - case TypeCode.Int16: return _Int16 ?? (_Int16 = new LessThanOrEqualInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new LessThanOrEqualInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new LessThanOrEqualInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new LessThanOrEqualUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new LessThanOrEqualUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new LessThanOrEqualUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new LessThanOrEqualSingle()); - case TypeCode.Double: return _Double ?? (_Double = new LessThanOrEqualDouble()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.SByte: return _SByteLifted ?? (_SByteLifted = new LessThanOrEqualSByte() { LiftedToNull = true }); - case TypeCode.Byte: return _ByteLifted ?? (_ByteLifted = new LessThanOrEqualByte() { LiftedToNull = true }); - case TypeCode.Char: return _CharLifted ?? (_CharLifted = new LessThanOrEqualChar() { LiftedToNull = true }); - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new LessThanOrEqualInt16() { LiftedToNull = true }); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new LessThanOrEqualInt32() { LiftedToNull = true }); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new LessThanOrEqualInt64() { LiftedToNull = true }); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new LessThanOrEqualUInt16() { LiftedToNull = true }); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new LessThanOrEqualUInt32() { LiftedToNull = true }); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new LessThanOrEqualUInt64() { LiftedToNull = true }); - case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new LessThanOrEqualSingle() { LiftedToNull = true }); - case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new LessThanOrEqualDouble() { LiftedToNull = true }); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "LessThanOrEqual()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LocalAccess.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LocalAccess.cs deleted file mode 100644 index bc0709553d1..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/LocalAccess.cs +++ /dev/null @@ -1,374 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using System.Collections.Generic; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal interface IBoxableInstruction { - Instruction BoxIfIndexMatches(int index); - } - - internal abstract class LocalAccessInstruction : Instruction { - internal readonly int _index; - - protected LocalAccessInstruction(int index) { - _index = index; - } - - public override string ToDebugString(int instructionIndex, object cookie, Func labelIndexer, IList objects) { - return cookie == null ? - InstructionName + "(" + _index + ")" : - InstructionName + "(" + cookie + ": " + _index + ")"; - } - } - - #region Load - - internal sealed class LoadLocalInstruction : LocalAccessInstruction, IBoxableInstruction { - internal LoadLocalInstruction(int index) - : base(index) { - } - - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex++] = frame.Data[_index]; - //frame.Push(frame.Data[_index]); - return +1; - } - - public Instruction BoxIfIndexMatches(int index) { - return (index == _index) ? InstructionList.LoadLocalBoxed(index) : null; - } - } - - internal sealed class LoadLocalBoxedInstruction : LocalAccessInstruction { - internal LoadLocalBoxedInstruction(int index) - : base(index) { - } - - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - var box = (StrongBox)frame.Data[_index]; - frame.Data[frame.StackIndex++] = box.Value; - return +1; - } - } - - internal sealed class LoadLocalFromClosureInstruction : LocalAccessInstruction { - internal LoadLocalFromClosureInstruction(int index) - : base(index) { - } - - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - var box = frame.Closure[_index]; - frame.Data[frame.StackIndex++] = box.Value; - return +1; - } - } - - internal sealed class LoadLocalFromClosureBoxedInstruction : LocalAccessInstruction { - internal LoadLocalFromClosureBoxedInstruction(int index) - : base(index) { - } - - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - var box = frame.Closure[_index]; - frame.Data[frame.StackIndex++] = box; - return +1; - } - } - - #endregion - - #region Store, Assign - - internal sealed class AssignLocalInstruction : LocalAccessInstruction, IBoxableInstruction { - internal AssignLocalInstruction(int index) - : base(index) { - } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[_index] = frame.Peek(); - return +1; - } - - public Instruction BoxIfIndexMatches(int index) { - return (index == _index) ? InstructionList.AssignLocalBoxed(index) : null; - } - } - - internal sealed class StoreLocalInstruction : LocalAccessInstruction, IBoxableInstruction { - internal StoreLocalInstruction(int index) - : base(index) { - } - - public override int ConsumedStack { get { return 1; } } - public override int Run(InterpretedFrame frame) { - frame.Data[_index] = frame.Data[--frame.StackIndex]; - //frame.Data[_index] = frame.Pop(); - return +1; - } - - public Instruction BoxIfIndexMatches(int index) { - return (index == _index) ? InstructionList.StoreLocalBoxed(index) : null; - } - } - - internal sealed class AssignLocalBoxedInstruction : LocalAccessInstruction { - internal AssignLocalBoxedInstruction(int index) - : base(index) { - } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - var box = (StrongBox)frame.Data[_index]; - box.Value = frame.Peek(); - return +1; - } - } - - internal sealed class StoreLocalBoxedInstruction : LocalAccessInstruction { - internal StoreLocalBoxedInstruction(int index) - : base(index) { - } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 0; } } - - public override int Run(InterpretedFrame frame) { - var box = (StrongBox)frame.Data[_index]; - box.Value = frame.Data[--frame.StackIndex]; - return +1; - } - } - - internal sealed class AssignLocalToClosureInstruction : LocalAccessInstruction { - internal AssignLocalToClosureInstruction(int index) - : base(index) { - } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - var box = frame.Closure[_index]; - box.Value = frame.Peek(); - return +1; - } - } - - #endregion - - #region Initialize - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1012:AbstractTypesShouldNotHaveConstructors")] - internal abstract class InitializeLocalInstruction : LocalAccessInstruction { - internal InitializeLocalInstruction(int index) - : base(index) { - } - - internal sealed class Reference : InitializeLocalInstruction, IBoxableInstruction { - internal Reference(int index) - : base(index) { - } - - public override int Run(InterpretedFrame frame) { - frame.Data[_index] = null; - return 1; - } - - public Instruction BoxIfIndexMatches(int index) { - return (index == _index) ? InstructionList.InitImmutableRefBox(index) : null; - } - - public override string InstructionName { - get { return "InitRef"; } - } - } - - internal sealed class ImmutableValue : InitializeLocalInstruction, IBoxableInstruction { - private readonly object _defaultValue; - - internal ImmutableValue(int index, object defaultValue) - : base(index) { - _defaultValue = defaultValue; - } - - public override int Run(InterpretedFrame frame) { - frame.Data[_index] = _defaultValue; - return 1; - } - - public Instruction BoxIfIndexMatches(int index) { - return (index == _index) ? new ImmutableBox(index, _defaultValue) : null; - } - - public override string InstructionName { - get { return "InitImmutableValue"; } - } - } - - internal sealed class ImmutableBox : InitializeLocalInstruction { - // immutable value: - private readonly object _defaultValue; - - internal ImmutableBox(int index, object defaultValue) - : base(index) { - _defaultValue = defaultValue; - } - - public override int Run(InterpretedFrame frame) { - frame.Data[_index] = new StrongBox(_defaultValue); - return 1; - } - - public override string InstructionName { - get { return "InitImmutableBox"; } - } - } - - internal sealed class ParameterBox : InitializeLocalInstruction { - public ParameterBox(int index) - : base(index) { - } - - public override int Run(InterpretedFrame frame) { - frame.Data[_index] = new StrongBox(frame.Data[_index]); - return 1; - } - - } - - internal sealed class Parameter : InitializeLocalInstruction, IBoxableInstruction { - internal Parameter(int index) - : base(index) { - } - - public override int Run(InterpretedFrame frame) { - // nop - return 1; - } - - public Instruction BoxIfIndexMatches(int index) { - if (index == _index) { - return InstructionList.ParameterBox(index); - } - return null; - } - - public override string InstructionName { - get { return "InitParameter"; } - } - } - - internal sealed class MutableValue : InitializeLocalInstruction, IBoxableInstruction { - private readonly Type _type; - - internal MutableValue(int index, Type type) - : base(index) { - _type = type; - } - - public override int Run(InterpretedFrame frame) { - try { - frame.Data[_index] = Activator.CreateInstance(_type); - } catch (TargetInvocationException e) { - ExceptionHelpers.UpdateForRethrow(e.InnerException); - throw e.InnerException; - } - - return 1; - } - - public Instruction BoxIfIndexMatches(int index) { - return (index == _index) ? new MutableBox(index, _type) : null; - } - - public override string InstructionName { - get { return "InitMutableValue"; } - } - } - - internal sealed class MutableBox : InitializeLocalInstruction { - private readonly Type _type; - - internal MutableBox(int index, Type type) - : base(index) { - _type = type; - } - - public override int Run(InterpretedFrame frame) { - frame.Data[_index] = new StrongBox(Activator.CreateInstance(_type)); - return 1; - } - - public override string InstructionName { - get { return "InitMutableBox"; } - } - } - } - - #endregion - - #region RuntimeVariables - - internal sealed class RuntimeVariablesInstruction : Instruction { - private readonly int _count; - - public RuntimeVariablesInstruction(int count) { - _count = count; - } - - public override int ProducedStack { get { return 1; } } - public override int ConsumedStack { get { return _count; } } - - public override int Run(InterpretedFrame frame) { - var ret = new IStrongBox[_count]; - for (int i = ret.Length - 1; i >= 0; i--) { - ret[i] = (IStrongBox)frame.Pop(); - } - frame.Push(RuntimeVariables.Create(ret)); - return +1; - } - - public override string ToString() { - return "GetRuntimeVariables()"; - } - } - - #endregion -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ModInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ModInstruction.cs deleted file mode 100644 index c8ff766e5e1..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ModInstruction.cs +++ /dev/null @@ -1,118 +0,0 @@ -// -// ModInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class ModInstruction : ArithmeticInstruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Single, _Double; - - private ModInstruction() { - } - - internal sealed class ModInt32 : ModInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject(unchecked((Int32)l % (Int32)r)); - } - } - - internal sealed class ModInt16 : ModInstruction { - protected override object Calculate (object l, object r) - { - return (Int16)unchecked((Int16)l % (Int16)r); - } - } - - internal sealed class ModInt64 : ModInstruction { - protected override object Calculate (object l, object r) - { - return (Int64)unchecked((Int64)l % (Int64)r); - } - } - - internal sealed class ModUInt16 : ModInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16)unchecked((UInt16)l % (UInt16)r); - } - } - - internal sealed class ModUInt32 : ModInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32)unchecked((UInt32)l % (UInt32)r); - } - } - - internal sealed class ModUInt64 : ModInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64)unchecked((UInt64)l % (UInt64)r); - } - } - - internal sealed class ModSingle : ModInstruction { - protected override object Calculate (object l, object r) - { - return (Single)((Single)l % (Single)r); - } - } - - internal sealed class ModDouble : ModInstruction { - protected override object Calculate (object l, object r) - { - return (Double)l % (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new ModInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new ModInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new ModInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new ModUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new ModUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new ModUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new ModSingle()); - case TypeCode.Double: return _Double ?? (_Double = new ModDouble()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Mod()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/MulInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/MulInstruction.cs deleted file mode 100644 index 48ef3518bb2..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/MulInstruction.cs +++ /dev/null @@ -1,204 +0,0 @@ -// -// MulInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class MulInstruction : ArithmeticInstruction { - - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Single, _Double; - - private MulInstruction() { - } - - internal sealed class MulInt32 : MulInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject(unchecked((Int32)l * (Int32)r)); - } - } - - internal sealed class MulInt16 : MulInstruction { - protected override object Calculate (object l, object r) - { - return (Int16)unchecked((Int16)l * (Int16)r); - } - } - - internal sealed class MulInt64 : MulInstruction { - protected override object Calculate (object l, object r) - { - return (Int64)unchecked((Int64)l * (Int64)r); - } - } - - internal sealed class MulUInt16 : MulInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16)unchecked((UInt16)l * (UInt16)r); - } - } - - internal sealed class MulUInt32 : MulInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32)unchecked((UInt32)l * (UInt32)r); - } - } - - internal sealed class MulUInt64 : MulInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64)unchecked((UInt64)l * (UInt64)r); - } - } - - internal sealed class MulSingle : MulInstruction { - protected override object Calculate (object l, object r) - { - return (Single)((Single)l * (Single)r); - } - } - - internal sealed class MulDouble : MulInstruction { - protected override object Calculate (object l, object r) - { - return (Double)l * (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new MulInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new MulInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new MulInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new MulUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new MulUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new MulUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new MulSingle()); - case TypeCode.Double: return _Double ?? (_Double = new MulDouble()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Mul()"; - } - } - - internal abstract class MulOvfInstruction : ArithmeticInstruction { - - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Single, _Double; - - private MulOvfInstruction() { - } - - internal sealed class MulOvfInt32 : MulOvfInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject(checked((Int32)l * (Int32)r)); - } - } - - internal sealed class MulOvfInt16 : MulOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((Int16)((Int16)l * (Int16)r)); - } - } - - internal sealed class MulOvfInt64 : MulOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((Int64)((Int64)l * (Int64)r)); - } - } - - internal sealed class MulOvfUInt16 : MulOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((UInt16)((UInt16)l * (UInt16)r)); - } - } - - internal sealed class MulOvfUInt32 : MulOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((UInt32)((UInt32)l * (UInt32)r)); - } - } - - internal sealed class MulOvfUInt64 : MulOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((UInt64)((UInt64)l * (UInt64)r)); - } - } - - internal sealed class MulOvfSingle : MulOvfInstruction { - protected override object Calculate (object l, object r) - { - return (Single)((Single)l * (Single)r); - } - } - - internal sealed class MulOvfDouble : MulOvfInstruction { - protected override object Calculate (object l, object r) - { - return (Double)l * (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new MulOvfInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new MulOvfInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new MulOvfInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new MulOvfUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new MulOvfUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new MulOvfUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new MulOvfSingle()); - case TypeCode.Double: return _Double ?? (_Double = new MulOvfDouble()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "MulOvf()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NegateInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NegateInstruction.cs deleted file mode 100644 index 5652f5bc78b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NegateInstruction.cs +++ /dev/null @@ -1,368 +0,0 @@ -// -// NegateInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class NegateInstruction : Instruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _Single, _Double; - private static Instruction _Int16Lifted, _Int32Lifted, _Int64Lifted, _UInt16Lifted, _UInt32Lifted, _SingleLifted, _DoubleLifted; - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - private NegateInstruction() { - } - - internal sealed class NegateInt32 : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = ScriptingRuntimeHelpers.Int32ToObject(unchecked(-(Int32)v)); - return 1; - } - } - - internal sealed class NegateInt16 : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int16)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int16)unchecked(-v); - return 1; - } - } - - internal sealed class NegateInt64 : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int64)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int64)unchecked(-v); - return 1; - } - } - - internal sealed class NegateUInt16 : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt16)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt16)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateUInt32 : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt32)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt32)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateSingle : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Single)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Single)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateDouble : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Double)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Double)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateInt32Lifted : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int32?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int32?)(unchecked(-v)); - return 1; - } - } - - internal sealed class NegateInt16Lifted : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int16?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int16?)unchecked(-v); - return 1; - } - } - - internal sealed class NegateInt64Lifted : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int64?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int64?)unchecked(-v); - return 1; - } - } - - internal sealed class NegateUInt16Lifted : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt16?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt16?)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateUInt32Lifted : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt32?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt32?)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateSingleLifted : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Single?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Single?)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateDoubleLifted : NegateInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Double?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Double?)unchecked(-v); - return 1; - - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new NegateInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new NegateInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new NegateInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new NegateUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new NegateUInt32()); - case TypeCode.Single: return _Single ?? (_Single = new NegateSingle()); - case TypeCode.Double: return _Double ?? (_Double = new NegateDouble()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new NegateInt16Lifted()); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new NegateInt32Lifted()); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new NegateInt64Lifted()); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new NegateUInt16Lifted()); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new NegateUInt32Lifted()); - case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new NegateSingleLifted()); - case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new NegateDoubleLifted()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Negate()"; - } - } - - internal abstract class NegateOvfInstruction : Instruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _Single, _Double; - private static Instruction _Int16Lifted, _Int32Lifted, _Int64Lifted, _UInt16Lifted, _UInt32Lifted, _SingleLifted, _DoubleLifted; - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - private NegateOvfInstruction() { - } - - internal sealed class NegateOvfInt32 : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int32)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = ScriptingRuntimeHelpers.Int32ToObject(checked(-v)); - return 1; - } - } - - internal sealed class NegateOvfInt16 : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int16)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = checked((Int16)(-v)); - return 1; - } - } - - internal sealed class NegateOvfInt64 : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int64)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = checked((Int64)(-v)); - return 1; - } - } - - internal sealed class NegateOvfUInt16 : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt16)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = checked((UInt16)(-v)); - return 1; - - } - } - - internal sealed class NegateOvfUInt32 : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt32)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = checked((UInt32)(-v)); - return 1; - - } - } - - internal sealed class NegateOvfSingle : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Single)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Single)checked(-v); - return 1; - - } - } - - internal sealed class NegateOvfDouble : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Double)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Double)checked(-v); - return 1; - - } - } - - internal sealed class NegateOvfInt32Lifted : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int32?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int32?)(unchecked(-v)); - return 1; - } - } - - internal sealed class NegateOvfInt16Lifted : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int16?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int16?)unchecked(-v); - return 1; - } - } - - internal sealed class NegateOvfInt64Lifted : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int64?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int64?)unchecked(-v); - return 1; - } - } - - internal sealed class NegateOvfUInt16Lifted : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt16?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt16?)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateOvfUInt32Lifted : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt32?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt32?)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateOvfSingleLifted : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Single?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Single?)unchecked(-v); - return 1; - - } - } - - internal sealed class NegateOvfDoubleLifted : NegateOvfInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Double?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Double?)unchecked(-v); - return 1; - - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new NegateOvfInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new NegateOvfInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new NegateOvfInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new NegateOvfUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new NegateOvfUInt32()); - case TypeCode.Single: return _Single ?? (_Single = new NegateOvfSingle()); - case TypeCode.Double: return _Double ?? (_Double = new NegateOvfDouble()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new NegateOvfInt16Lifted()); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new NegateOvfInt32Lifted()); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new NegateOvfInt64Lifted()); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new NegateOvfUInt16Lifted()); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new NegateOvfUInt32Lifted()); - case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new NegateOvfSingleLifted()); - case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new NegateOvfDoubleLifted()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "NegateOvf()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NotEqualInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NotEqualInstruction.cs deleted file mode 100644 index ebf5e68885a..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NotEqualInstruction.cs +++ /dev/null @@ -1,202 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class NotEqualInstruction : ComparisonInstruction { - // Perf: EqualityComparer but is 3/2 to 2 times slower. - private static Instruction _Reference, _Boolean, _SByte, _Int16, _Char, _String, _Int32, _Int64, _Byte, _UInt16, _UInt32, _UInt64, _Single, _Double; - private static Instruction _BooleanLifted, _SByteLifted, _Int16Lifted, _CharLifted, _Int32Lifted, _Int64Lifted, - _ByteLifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _SingleLifted, _DoubleLifted; - - private NotEqualInstruction() { - } - - protected override object DoNullComparison (object l, object r) - { - return LiftedToNull ? (object) null : (object) l != r; - } - - internal sealed class NotEqualBoolean : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Boolean)l != (Boolean)r; - } - } - - internal sealed class NotEqualSByte : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (SByte)l != (SByte)r; - } - } - - internal sealed class NotEqualInt16 : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int16)l != (Int16)r; - } - } - - internal sealed class NotEqualChar : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Char)l != (Char)r; - } - } - - internal sealed class NotEqualString : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (String)l != (String)r; - } - } - - internal sealed class NotEqualInt32 : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int32)l != (Int32)r; - } - } - - internal sealed class NotEqualInt64 : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Int64)l != (Int64)r; - } - } - - internal sealed class NotEqualByte : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Byte)l != (Byte)r; - } - } - - internal sealed class NotEqualUInt16 : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt16)l != (UInt16)r; - } - } - - internal sealed class NotEqualUInt32 : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt32)l != (UInt32)r; - } - } - - internal sealed class NotEqualUInt64 : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (UInt64)l != (UInt64)r; - } - } - - internal sealed class NotEqualSingle : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Single)l != (Single)r; - } - } - - internal sealed class NotEqualDouble : NotEqualInstruction { - protected override object DoCalculate (object l, object r) - { - return (Double)l != (Double)r; - } - } - - internal sealed class NotEqualReference : NotEqualInstruction { - protected override object Calculate (object l, object r) - { - return l != r; - } - - protected override object DoCalculate (object l, object r) - { - throw Assert.Unreachable; - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - public static Instruction Create(Type type) { - // Boxed enums can be unboxed as their underlying types: - switch ((type.IsEnum() ? Enum.GetUnderlyingType(type) : type).GetTypeCode()) { - case TypeCode.Boolean: return _Boolean ?? (_Boolean = new NotEqualBoolean()); - case TypeCode.SByte: return _SByte ?? (_SByte = new NotEqualSByte()); - case TypeCode.Byte: return _Byte ?? (_Byte = new NotEqualByte()); - case TypeCode.Char: return _Char ?? (_Char = new NotEqualChar()); - case TypeCode.String: return _String ?? (_String = new NotEqualString()); - case TypeCode.Int16: return _Int16 ?? (_Int16 = new NotEqualInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new NotEqualInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new NotEqualInt64()); - - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new NotEqualInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new NotEqualInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new NotEqualInt64()); - - case TypeCode.Single: return _Single ?? (_Single = new NotEqualSingle()); - case TypeCode.Double: return _Double ?? (_Double = new NotEqualDouble()); - - case TypeCode.Object: - if (!type.IsValueType()) { - return _Reference ?? (_Reference = new NotEqualReference()); - } - // TODO: Nullable - throw new NotImplementedException(); - - default: - throw new NotImplementedException(); - } - } - - public static Instruction CreateLifted(Type type) { - // Boxed enums can be unboxed as their underlying types: - switch ((type.IsEnum() ? Enum.GetUnderlyingType(type) : type).GetTypeCode()) { - case TypeCode.Boolean: return _BooleanLifted ?? (_BooleanLifted = new NotEqualBoolean() { LiftedToNull = true }); - case TypeCode.SByte: return _SByteLifted ?? (_SByteLifted = new NotEqualSByte() { LiftedToNull = true }); - case TypeCode.Byte: return _ByteLifted ?? (_ByteLifted = new NotEqualByte() { LiftedToNull = true }); - case TypeCode.Char: return _CharLifted ?? (_CharLifted = new NotEqualChar() { LiftedToNull = true }); - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new NotEqualInt16() { LiftedToNull = true }); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new NotEqualInt32() { LiftedToNull = true }); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new NotEqualInt64() { LiftedToNull = true }); - - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new NotEqualInt16() { LiftedToNull = true }); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new NotEqualInt32() { LiftedToNull = true }); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new NotEqualInt64() { LiftedToNull = true }); - - case TypeCode.Single: return _SingleLifted ?? (_SingleLifted = new NotEqualSingle() { LiftedToNull = true }); - case TypeCode.Double: return _DoubleLifted ?? (_DoubleLifted = new NotEqualDouble() { LiftedToNull = true }); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "NotEqual()"; - } - } -} - diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NotInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NotInstruction.cs deleted file mode 100644 index e1eb3d8bd11..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NotInstruction.cs +++ /dev/null @@ -1,191 +0,0 @@ -// -// NotInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class NotInstruction : Instruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Boolean; - private static Instruction _Int16Lifted, _Int32Lifted, _Int64Lifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _BooleanLifted; - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - private NotInstruction() { - } - - internal sealed class NotBoolean : NotInstruction { - public override int Run(InterpretedFrame frame) { - frame.Push((bool)frame.Pop() ? ScriptingRuntimeHelpers.False : ScriptingRuntimeHelpers.True); - return 1; - } - } - - internal sealed class NotInt32 : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int32)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = ScriptingRuntimeHelpers.Int32ToObject(~v); - return 1; - } - } - - internal sealed class NotInt16 : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int16)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int16)(~v); - return 1; - } - } - - internal sealed class NotInt64 : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int64)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int64)(~v); - return 1; - } - } - - internal sealed class NotUInt16 : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt64)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt64)(~v); - return 1; - } - } - - internal sealed class NotUInt32 : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt32)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt32)(~v); - return 1; - } - } - - internal sealed class NotUInt64 : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt64)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt64)(~v); - return 1; - } - } - - internal sealed class NotBooleanLifted : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Boolean?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Boolean?)(!v); - return 1; - } - } - - internal sealed class NotInt32Lifted : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int32?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int32?)(~v); - return 1; - } - } - - internal sealed class NotInt16Lifted : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int16?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int16?)(~v); - return 1; - } - } - - internal sealed class NotInt64Lifted : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (Int64?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (Int64?)(~v); - return 1; - } - } - - internal sealed class NotUInt16Lifted : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt64?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt64?)(~v); - return 1; - } - } - - internal sealed class NotUInt32Lifted : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt32?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt32?)(~v); - return 1; - } - } - - internal sealed class NotUInt64Lifted : NotInstruction { - public override int Run(InterpretedFrame frame) { - var v = (UInt64?)frame.Data[frame.StackIndex - 1]; - frame.Data[frame.StackIndex - 1] = (UInt64?)(~v); - return 1; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new NotInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new NotInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new NotInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new NotUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new NotUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new NotUInt64()); - case TypeCode.Boolean: return _Boolean ?? (_Boolean = new NotBoolean()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new NotInt16Lifted()); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new NotInt32Lifted()); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new NotInt64Lifted()); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new NotUInt16Lifted()); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new NotUInt32Lifted()); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new NotUInt64Lifted()); - case TypeCode.Boolean: return _BooleanLifted ?? (_BooleanLifted = new NotBooleanLifted()); - - default: - throw Assert.Unreachable; - } - } - public override string ToString() { - return "Not()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NumericConvertInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NumericConvertInstruction.cs deleted file mode 100644 index 7406f6babee..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/NumericConvertInstruction.cs +++ /dev/null @@ -1,254 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class NumericConvertInstruction : Instruction { - internal readonly TypeCode _from, _to; - - protected NumericConvertInstruction(TypeCode from, TypeCode to) { - _from = from; - _to = to; - } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override string ToString() { - return InstructionName + "(" + _from + "->" + _to + ")"; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - public sealed class Unchecked : NumericConvertInstruction { - public override string InstructionName { get { return "UncheckedConvert"; } } - - public Unchecked(TypeCode from, TypeCode to) - : base(from, to) { - } - - public override int Run(InterpretedFrame frame) { - frame.Push(Convert(frame.Pop())); - return +1; - } - - private object Convert(object obj) { - switch (_from) { - case TypeCode.Byte: return ConvertInt32((Byte)obj); - case TypeCode.SByte: return ConvertInt32((SByte)obj); - case TypeCode.Int16: return ConvertInt32((Int16)obj); - case TypeCode.Char: return ConvertInt32((Char)obj); - case TypeCode.Int32: return ConvertInt32((Int32)obj); - case TypeCode.Int64: return ConvertInt64((Int64)obj); - case TypeCode.UInt16: return ConvertInt32((UInt16)obj); - case TypeCode.UInt32: return ConvertInt64((UInt32)obj); - case TypeCode.UInt64: return ConvertUInt64((UInt64)obj); - case TypeCode.Single: return ConvertDouble((Single)obj); - case TypeCode.Double: return ConvertDouble((Double)obj); - default: throw Assert.Unreachable; - } - } - - private object ConvertInt32(int obj) { - unchecked { - switch (_to) { - case TypeCode.Byte: return (Byte)obj; - case TypeCode.SByte: return (SByte)obj; - case TypeCode.Int16: return (Int16)obj; - case TypeCode.Char: return (Char)obj; - case TypeCode.Int32: return (Int32)obj; - case TypeCode.Int64: return (Int64)obj; - case TypeCode.UInt16: return (UInt16)obj; - case TypeCode.UInt32: return (UInt32)obj; - case TypeCode.UInt64: return (UInt64)obj; - case TypeCode.Single: return (Single)obj; - case TypeCode.Double: return (Double)obj; - default: throw Assert.Unreachable; - } - } - } - - private object ConvertInt64(Int64 obj) { - unchecked { - switch (_to) { - case TypeCode.Byte: return (Byte)obj; - case TypeCode.SByte: return (SByte)obj; - case TypeCode.Int16: return (Int16)obj; - case TypeCode.Char: return (Char)obj; - case TypeCode.Int32: return (Int32)obj; - case TypeCode.Int64: return (Int64)obj; - case TypeCode.UInt16: return (UInt16)obj; - case TypeCode.UInt32: return (UInt32)obj; - case TypeCode.UInt64: return (UInt64)obj; - case TypeCode.Single: return (Single)obj; - case TypeCode.Double: return (Double)obj; - default: throw Assert.Unreachable; - } - } - } - - private object ConvertUInt64(UInt64 obj) { - unchecked { - switch (_to) { - case TypeCode.Byte: return (Byte)obj; - case TypeCode.SByte: return (SByte)obj; - case TypeCode.Int16: return (Int16)obj; - case TypeCode.Char: return (Char)obj; - case TypeCode.Int32: return (Int32)obj; - case TypeCode.Int64: return (Int64)obj; - case TypeCode.UInt16: return (UInt16)obj; - case TypeCode.UInt32: return (UInt32)obj; - case TypeCode.UInt64: return (UInt64)obj; - case TypeCode.Single: return (Single)obj; - case TypeCode.Double: return (Double)obj; - default: throw Assert.Unreachable; - } - } - } - - private object ConvertDouble(Double obj) { - unchecked { - switch (_to) { - case TypeCode.Byte: return (Byte)obj; - case TypeCode.SByte: return (SByte)obj; - case TypeCode.Int16: return (Int16)obj; - case TypeCode.Char: return (Char)obj; - case TypeCode.Int32: return (Int32)obj; - case TypeCode.Int64: return (Int64)obj; - case TypeCode.UInt16: return (UInt16)obj; - case TypeCode.UInt32: return (UInt32)obj; - case TypeCode.UInt64: return (UInt64)obj; - case TypeCode.Single: return (Single)obj; - case TypeCode.Double: return (Double)obj; - default: throw Assert.Unreachable; - } - } - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] - public sealed class Checked : NumericConvertInstruction { - public override string InstructionName { get { return "CheckedConvert"; } } - - public Checked(TypeCode from, TypeCode to) - : base(from, to) { - } - - public override int Run(InterpretedFrame frame) { - frame.Push(Convert(frame.Pop())); - return +1; - } - - private object Convert(object obj) { - switch (_from) { - case TypeCode.Byte: return ConvertInt32((Byte)obj); - case TypeCode.SByte: return ConvertInt32((SByte)obj); - case TypeCode.Int16: return ConvertInt32((Int16)obj); - case TypeCode.Char: return ConvertInt32((Char)obj); - case TypeCode.Int32: return ConvertInt32((Int32)obj); - case TypeCode.Int64: return ConvertInt64((Int64)obj); - case TypeCode.UInt16: return ConvertInt32((UInt16)obj); - case TypeCode.UInt32: return ConvertInt64((UInt32)obj); - case TypeCode.UInt64: return ConvertUInt64((UInt64)obj); - case TypeCode.Single: return ConvertDouble((Single)obj); - case TypeCode.Double: return ConvertDouble((Double)obj); - default: throw Assert.Unreachable; - } - } - - private object ConvertInt32(int obj) { - checked { - switch (_to) { - case TypeCode.Byte: return (Byte)obj; - case TypeCode.SByte: return (SByte)obj; - case TypeCode.Int16: return (Int16)obj; - case TypeCode.Char: return (Char)obj; - case TypeCode.Int32: return (Int32)obj; - case TypeCode.Int64: return (Int64)obj; - case TypeCode.UInt16: return (UInt16)obj; - case TypeCode.UInt32: return (UInt32)obj; - case TypeCode.UInt64: return (UInt64)obj; - case TypeCode.Single: return (Single)obj; - case TypeCode.Double: return (Double)obj; - default: throw Assert.Unreachable; - } - } - } - - private object ConvertInt64(Int64 obj) { - checked { - switch (_to) { - case TypeCode.Byte: return (Byte)obj; - case TypeCode.SByte: return (SByte)obj; - case TypeCode.Int16: return (Int16)obj; - case TypeCode.Char: return (Char)obj; - case TypeCode.Int32: return (Int32)obj; - case TypeCode.Int64: return (Int64)obj; - case TypeCode.UInt16: return (UInt16)obj; - case TypeCode.UInt32: return (UInt32)obj; - case TypeCode.UInt64: return (UInt64)obj; - case TypeCode.Single: return (Single)obj; - case TypeCode.Double: return (Double)obj; - default: throw Assert.Unreachable; - } - } - } - - private object ConvertUInt64(UInt64 obj) { - checked { - switch (_to) { - case TypeCode.Byte: return (Byte)obj; - case TypeCode.SByte: return (SByte)obj; - case TypeCode.Int16: return (Int16)obj; - case TypeCode.Char: return (Char)obj; - case TypeCode.Int32: return (Int32)obj; - case TypeCode.Int64: return (Int64)obj; - case TypeCode.UInt16: return (UInt16)obj; - case TypeCode.UInt32: return (UInt32)obj; - case TypeCode.UInt64: return (UInt64)obj; - case TypeCode.Single: return (Single)obj; - case TypeCode.Double: return (Double)obj; - default: throw Assert.Unreachable; - } - } - } - - private object ConvertDouble(Double obj) { - checked { - switch (_to) { - case TypeCode.Byte: return (Byte)obj; - case TypeCode.SByte: return (SByte)obj; - case TypeCode.Int16: return (Int16)obj; - case TypeCode.Char: return (Char)obj; - case TypeCode.Int32: return (Int32)obj; - case TypeCode.Int64: return (Int64)obj; - case TypeCode.UInt16: return (UInt16)obj; - case TypeCode.UInt32: return (UInt32)obj; - case TypeCode.UInt64: return (UInt64)obj; - case TypeCode.Single: return (Single)obj; - case TypeCode.Double: return (Double)obj; - default: throw Assert.Unreachable; - } - } - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/OrInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/OrInstruction.cs deleted file mode 100644 index bf72dbf9537..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/OrInstruction.cs +++ /dev/null @@ -1,176 +0,0 @@ -// -// OrInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class OrInstruction : ArithmeticInstruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Boolean; - private static Instruction _Int16Lifted, _Int32Lifted, _Int64Lifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _BooleanLifted; - - private OrInstruction() { - } - - internal sealed class OrInt32 : OrInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject((Int32)l | (Int32)r); - } - } - - internal sealed class OrInt16 : OrInstruction { - protected override object Calculate (object l, object r) - { - return (Int16)((Int16)l | (Int16)r); - } - } - - internal sealed class OrInt64 : OrInstruction { - protected override object Calculate (object l, object r) - { - return (Int64)((Int64)l | (Int64)r); - } - } - - internal sealed class OrUInt16 : OrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16)((UInt16)l | (UInt16)r); - } - } - - internal sealed class OrUInt32 : OrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32)((UInt32)l | (UInt32)r); - } - } - - internal sealed class OrUInt64 : OrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64)((UInt64)l | (UInt64)r); - } - } - - internal sealed class OrBoolean : OrInstruction { - protected override object Calculate (object l, object r) - { - return (Boolean)((Boolean)l | (Boolean)r); - } - } - - internal sealed class OrInt32Lifted : OrInstruction { - protected override object Calculate (object l, object r) - { - return (Int32?)((Int32?)l | (Int32?)r); - } - } - - internal sealed class OrInt16Lifted : OrInstruction { - protected override object Calculate (object l, object r) - { - return (Int16?)((Int16?)l | (Int16?)r); - } - } - - internal sealed class OrInt64Lifted : OrInstruction { - protected override object Calculate (object l, object r) - { - return (Int64?)((Int64?)l | (Int64?)r); - } - } - - internal sealed class OrUInt16Lifted : OrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16?)((Int16?)l | (Int16?)r); - } - } - - internal sealed class OrUInt32Lifted : OrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32?)((UInt32?)l | (UInt32?)r); - } - } - - internal sealed class OrUInt64Lifted : OrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64?)((UInt64?)l | (UInt64?)r); - } - } - - internal sealed class OrBooleanLifted : OrInstruction { - protected override object Calculate (object l, object r) - { - return (Boolean?)((Boolean?)l | (Boolean?)r); - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new OrInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new OrInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new OrInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new OrUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new OrUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new OrUInt64()); - case TypeCode.Boolean: return _Boolean ?? (_Boolean = new OrBoolean()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new OrInt16Lifted()); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new OrInt32Lifted()); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new OrInt64Lifted()); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new OrUInt16Lifted()); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new OrUInt32Lifted()); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new OrUInt64Lifted()); - case TypeCode.Boolean: return _BooleanLifted ?? (_BooleanLifted = new OrBooleanLifted()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Or()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ShlInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ShlInstruction.cs deleted file mode 100644 index 7bb2c00c521..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ShlInstruction.cs +++ /dev/null @@ -1,160 +0,0 @@ -// -// ShlInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class ShlInstruction : ArithmeticInstruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64; - private static Instruction _Int16Lifted, _Int32Lifted, _Int64Lifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted; - - private ShlInstruction() { - } - - internal sealed class ShlInt32 : ShlInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject((Int32)l << (Int32)r); - } - } - - internal sealed class ShlInt16 : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (Int32)((Int16)l << (Int32)r); - } - } - - internal sealed class ShlInt64 : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (Int64)((Int64)l << (Int32)r); - } - } - - internal sealed class ShlUInt16 : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (Int32)((UInt16)l << (Int32)r); - } - } - - internal sealed class ShlUInt32 : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32)((UInt32)l << (Int32)r); - } - } - - internal sealed class ShlUInt64 : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64)((UInt64)l << (Int32)r); - } - } - - internal sealed class ShlInt32Lifted : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (Int32?)((Int32?)l << (Int32?)r); - } - } - - internal sealed class ShlInt16Lifted : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (Int32)((Int16?)l << (Int32?)r); - } - } - - internal sealed class ShlInt64Lifted : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (Int64?)((Int64?)l << (Int32?)r); - } - } - - internal sealed class ShlUInt16Lifted : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (Int32?)((UInt16?)l << (Int32?)r); - } - } - - internal sealed class ShlUInt32Lifted : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32?)((UInt32?)l << (Int32?)r); - } - } - - internal sealed class ShlUInt64Lifted : ShlInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64?)((UInt64?)l << (Int32?)r); - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new ShlInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new ShlInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new ShlInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new ShlUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new ShlUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new ShlUInt64()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new ShlInt16Lifted()); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new ShlInt32Lifted()); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new ShlInt64Lifted()); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new ShlUInt16Lifted()); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new ShlUInt32Lifted()); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new ShlUInt64Lifted()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Shl()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ShrInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ShrInstruction.cs deleted file mode 100644 index 5663f18418f..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/ShrInstruction.cs +++ /dev/null @@ -1,160 +0,0 @@ -// -// ShrInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class ShrInstruction : ArithmeticInstruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64; - private static Instruction _Int16Lifted, _Int32Lifted, _Int64Lifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted; - - private ShrInstruction() { - } - - internal sealed class ShrInt32 : ShrInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject((Int32)l >> (Int32)r); - } - } - - internal sealed class ShrInt16 : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (Int32)((Int16)l >> (Int32)r); - } - } - - internal sealed class ShrInt64 : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (Int64)((Int64)l >> (Int32)r); - } - } - - internal sealed class ShrUInt16 : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (Int32)((UInt16)l >> (Int32)r); - } - } - - internal sealed class ShrUInt32 : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32)((UInt32)l >> (Int32)r); - } - } - - internal sealed class ShrUInt64 : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64)((UInt64)l >> (Int32)r); - } - } - - internal sealed class ShrInt32Lifted : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (Int32?)((Int32?)l >> (Int32?)r); - } - } - - internal sealed class ShrInt16Lifted : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (Int32)((Int16?)l >> (Int32?)r); - } - } - - internal sealed class ShrInt64Lifted : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (Int64?)((Int64?)l >> (Int32?)r); - } - } - - internal sealed class ShrUInt16Lifted : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (Int32?)((UInt16?)l >> (Int32?)r); - } - } - - internal sealed class ShrUInt32Lifted : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32?)((UInt32?)l >> (Int32?)r); - } - } - - internal sealed class ShrUInt64Lifted : ShrInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64?)((UInt64?)l >> (Int32?)r); - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new ShrInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new ShrInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new ShrInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new ShrUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new ShrUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new ShrUInt64()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new ShrInt16Lifted()); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new ShrInt32Lifted()); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new ShrInt64Lifted()); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new ShrUInt16Lifted()); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new ShrUInt32Lifted()); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new ShrUInt64Lifted()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Shr()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/StackOperations.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/StackOperations.cs deleted file mode 100644 index 6cff464f0aa..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/StackOperations.cs +++ /dev/null @@ -1,118 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections.Generic; -using System; -using System.Diagnostics; -using Microsoft.Scripting.Utils; -namespace Microsoft.Scripting.Interpreter { - internal sealed class LoadObjectInstruction : Instruction { - private readonly object _value; - - internal LoadObjectInstruction(object value) { - _value = value; - } - - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex++] = _value; - return +1; - } - - public override string ToString() { - return "LoadObject(" + (_value ?? "null") + ")"; - } - } - - internal sealed class LoadCachedObjectInstruction : Instruction { - private readonly uint _index; - - internal LoadCachedObjectInstruction(uint index) { - _index = index; - } - - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex++] = frame.Interpreter._objects[_index]; - return +1; - } - - public override string ToDebugString(int instructionIndex, object cookie, Func labelIndexer, IList objects) { - return String.Format("LoadCached({0}: {1})", _index, objects[(int)_index]); - } - - public override string ToString() { - return "LoadCached(" + _index + ")"; - } - } - - internal sealed class PopInstruction : Instruction { - internal static readonly PopInstruction Instance = new PopInstruction(); - - private PopInstruction() { } - - public override int ConsumedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Pop(); - return +1; - } - - public override string ToString() { - return "Pop()"; - } - } - - // NOTE: Consider caching if used frequently - internal sealed class PopNInstruction : Instruction { - private readonly int _n; - - internal PopNInstruction(int n) { - _n = n; - } - - public override int ConsumedStack { get { return _n; } } - - public override int Run(InterpretedFrame frame) { - frame.Pop(_n); - return +1; - } - - public override string ToString() { - return "Pop(" + _n + ")"; - } - } - - internal sealed class DupInstruction : Instruction { - internal readonly static DupInstruction Instance = new DupInstruction(); - - private DupInstruction() { } - - public override int ConsumedStack { get { return 0; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Data[frame.StackIndex] = frame.Peek(); - frame.StackIndex++; - return +1; - } - - public override string ToString() { - return "Dup()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/SubInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/SubInstruction.cs deleted file mode 100644 index 95fc003f0f8..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/SubInstruction.cs +++ /dev/null @@ -1,204 +0,0 @@ -// -// SubInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class SubInstruction : ArithmeticInstruction { - - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Single, _Double; - - private SubInstruction() { - } - - internal sealed class SubInt32 : SubInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject(unchecked((Int32)l - (Int32)r)); - } - } - - internal sealed class SubInt16 : SubInstruction { - protected override object Calculate (object l, object r) - { - return (Int16)unchecked((Int16)l - (Int16)r); - } - } - - internal sealed class SubInt64 : SubInstruction { - protected override object Calculate (object l, object r) - { - return (Int64)unchecked((Int64)l - (Int64)r); - } - } - - internal sealed class SubUInt16 : SubInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16)unchecked((UInt16)l - (UInt16)r); - } - } - - internal sealed class SubUInt32 : SubInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32)unchecked((UInt32)l - (UInt32)r); - } - } - - internal sealed class SubUInt64 : SubInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64)unchecked((UInt64)l - (UInt64)r); - } - } - - internal sealed class SubSingle : SubInstruction { - protected override object Calculate (object l, object r) - { - return (Single)((Single)l - (Single)r); - } - } - - internal sealed class SubDouble : SubInstruction { - protected override object Calculate (object l, object r) - { - return (Double)l - (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new SubInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new SubInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new SubInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new SubUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new SubUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new SubUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new SubSingle()); - case TypeCode.Double: return _Double ?? (_Double = new SubDouble()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Sub()"; - } - } - - internal abstract class SubOvfInstruction : ArithmeticInstruction { - - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Single, _Double; - - private SubOvfInstruction() { - } - - internal sealed class SubOvfInt32 : SubOvfInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject(checked((Int32)l - (Int32)r)); - } - } - - internal sealed class SubOvfInt16 : SubOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((Int16)((Int16)l - (Int16)r)); - } - } - - internal sealed class SubOvfInt64 : SubOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((Int64)((Int64)l - (Int64)r)); - } - } - - internal sealed class SubOvfUInt16 : SubOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((UInt16)((UInt16)l - (UInt16)r)); - } - } - - internal sealed class SubOvfUInt32 : SubOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((UInt32)((UInt32)l - (UInt32)r)); - } - } - - internal sealed class SubOvfUInt64 : SubOvfInstruction { - protected override object Calculate (object l, object r) - { - return checked((UInt64)((UInt64)l - (UInt64)r)); - } - } - - internal sealed class SubOvfSingle : SubOvfInstruction { - protected override object Calculate (object l, object r) - { - return (Single)((Single)l - (Single)r); - } - } - - internal sealed class SubOvfDouble : SubOvfInstruction { - protected override object Calculate (object l, object r) - { - return (Double)l - (Double)r; - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new SubOvfInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new SubOvfInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new SubOvfInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new SubOvfUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new SubOvfUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new SubOvfUInt64()); - case TypeCode.Single: return _Single ?? (_Single = new SubOvfSingle()); - case TypeCode.Double: return _Double ?? (_Double = new SubOvfDouble()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "SubOvf()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/TypeOperations.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/TypeOperations.cs deleted file mode 100644 index 44354f7f41b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/TypeOperations.cs +++ /dev/null @@ -1,193 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; -using System.Linq; - -namespace Microsoft.Scripting.Interpreter { - internal sealed class CreateDelegateInstruction : Instruction { - private readonly LightDelegateCreator _creator; - - internal CreateDelegateInstruction(LightDelegateCreator delegateCreator) { - _creator = delegateCreator; - } - - public override int ConsumedStack { get { return _creator.Interpreter.ClosureSize; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - StrongBox[] closure; - if (ConsumedStack > 0) { - closure = new StrongBox[ConsumedStack]; - for (int i = closure.Length - 1; i >= 0; i--) { - closure[i] = (StrongBox)frame.Pop(); - } - } else { - closure = null; - } - - Delegate d = _creator.CreateDelegate(closure); - - frame.Push(d); - return +1; - } - } - - internal sealed class NewInstruction : Instruction { - private readonly ConstructorInfo _constructor; - private readonly int _argCount; - - public NewInstruction(ConstructorInfo constructor) { - _constructor = constructor; - _argCount = constructor.GetParameters().Length; - - } - public override int ConsumedStack { get { return _argCount; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - object[] args = new object[_argCount]; - for (int i = _argCount - 1; i >= 0; i--) { - args[i] = frame.Pop(); - } - - object ret; - try { - ret = _constructor.Invoke(args); - } catch (TargetInvocationException e) { - ExceptionHelpers.UpdateForRethrow(e.InnerException); - throw e.InnerException; - } - - frame.Push(ret); - return +1; - } - - public override string ToString() { - return "New " + _constructor.DeclaringType.Name + "(" + _constructor + ")"; - } - } - - internal sealed class DefaultValueInstruction : Instruction { - internal DefaultValueInstruction() { } - - public override int ConsumedStack { get { return 0; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - frame.Push(default(T)); - return +1; - } - - public override string ToString() { - return "New " + typeof(T); - } - } - - internal sealed class TypeIsInstruction : Instruction { - internal TypeIsInstruction() { } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - // unfortunately Type.IsInstanceOfType() is 35-times slower than "is T" so we use generic code: - frame.Push(ScriptingRuntimeHelpers.BooleanToObject(frame.Pop() is T)); - return +1; - } - - public override string ToString() { - return "TypeIs " + typeof(T).Name; - } - } - - internal sealed class TypeAsInstruction : Instruction { - internal TypeAsInstruction() { } - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - public override int Run(InterpretedFrame frame) { - // can't use as w/o generic constraint - object value = frame.Pop(); - if (value is T) { - frame.Push(value); - } else { - frame.Push(null); - } - return +1; - } - - public override string ToString() { - return "TypeAs " + typeof(T).Name; - } - } - - internal sealed class TypeEqualsInstruction : Instruction { - public static readonly TypeEqualsInstruction Instance = new TypeEqualsInstruction(); - - public override int ConsumedStack { get { return 2; } } - public override int ProducedStack { get { return 1; } } - - private TypeEqualsInstruction() { - } - - public override int Run(InterpretedFrame frame) { - object type = frame.Pop(); - object obj = frame.Pop(); - frame.Push(ScriptingRuntimeHelpers.BooleanToObject(obj != null && (object)obj.GetType() == type)); - return +1; - } - - public override string InstructionName { - get { return "TypeEquals()"; } - } - } - - internal sealed class WrapToNullableInstruction : Instruction { - - readonly Type elementType; - ConstructorInfo ctor; - - public override int ConsumedStack { get { return 1; } } - public override int ProducedStack { get { return 1; } } - - internal WrapToNullableInstruction(Type elementType) { - this.elementType = elementType; - } - - public override int Run(InterpretedFrame frame) { - var r = frame.Data[frame.StackIndex - 1]; - - // Don't need to wrap null values - if (r == null) - return 1; - - ctor = typeof (Nullable<>).MakeGenericType (elementType).GetDeclaredConstructors ().First (); - frame.Data[frame.StackIndex - 1] = ctor.Invoke (new [] { r }); - return 1; - } - - public override string InstructionName { - get { return "WrapTo " + typeof(T) + "?"; } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/XorInstruction.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/XorInstruction.cs deleted file mode 100644 index 5cea8b38606..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Instructions/XorInstruction.cs +++ /dev/null @@ -1,176 +0,0 @@ -// -// XorInstruction.cs: -// -// Authors: Marek Safar (marek.safar@gmail.com) -// -// Copyright 2014 Xamarin Inc -// -// Permission is hereby granted, free of charge, to any person obtaining -// a copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to -// permit persons to whom the Software is furnished to do so, subject to -// the following conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -// -// - -using System; -using System.Diagnostics; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - internal abstract class XorInstruction : ArithmeticInstruction { - private static Instruction _Int16, _Int32, _Int64, _UInt16, _UInt32, _UInt64, _Boolean; - private static Instruction _Int16Lifted, _Int32Lifted, _Int64Lifted, _UInt16Lifted, _UInt32Lifted, _UInt64Lifted, _BooleanLifted; - - private XorInstruction() { - } - - internal sealed class XorInt32 : XorInstruction { - protected override object Calculate (object l, object r) - { - return ScriptingRuntimeHelpers.Int32ToObject((Int32)l ^ (Int32)r); - } - } - - internal sealed class XorInt16 : XorInstruction { - protected override object Calculate (object l, object r) - { - return (Int16)((Int16)l ^ (Int16)r); - } - } - - internal sealed class XorInt64 : XorInstruction { - protected override object Calculate (object l, object r) - { - return (Int64)((Int64)l ^ (Int64)r); - } - } - - internal sealed class XorUInt16 : XorInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16)((UInt16)l ^ (UInt16)r); - } - } - - internal sealed class XorUInt32 : XorInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32)((UInt32)l ^ (UInt32)r); - } - } - - internal sealed class XorUInt64 : XorInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64)((UInt64)l ^ (UInt64)r); - } - } - - internal sealed class XorBoolean : XorInstruction { - protected override object Calculate (object l, object r) - { - return (Boolean)((Boolean)l ^ (Boolean)r); - } - } - - internal sealed class XorInt32Lifted : XorInstruction { - protected override object Calculate (object l, object r) - { - return (Int32?)((Int32?)l ^ (Int32?)r); - } - } - - internal sealed class XorInt16Lifted : XorInstruction { - protected override object Calculate (object l, object r) - { - return (Int16?)((Int16?)l ^ (Int16?)r); - } - } - - internal sealed class XorInt64Lifted : XorInstruction { - protected override object Calculate (object l, object r) - { - return (Int64?)((Int64?)l ^ (Int64?)r); - } - } - - internal sealed class XorUInt16Lifted : XorInstruction { - protected override object Calculate (object l, object r) - { - return (UInt16?)((UInt16?)l ^ (UInt16?)r); - } - } - - internal sealed class XorUInt32Lifted : XorInstruction { - protected override object Calculate (object l, object r) - { - return (UInt32?)((UInt32?)l ^ (UInt32?)r); - } - } - - internal sealed class XorUInt64Lifted : XorInstruction { - protected override object Calculate (object l, object r) - { - return (UInt64?)((UInt64?)l ^ (UInt64?)r); - } - } - - internal sealed class XorBooleanLifted : XorInstruction { - protected override object Calculate (object l, object r) - { - return (Boolean?)((Boolean?)l ^ (Boolean?)r); - } - } - - public static Instruction Create(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16 ?? (_Int16 = new XorInt16()); - case TypeCode.Int32: return _Int32 ?? (_Int32 = new XorInt32()); - case TypeCode.Int64: return _Int64 ?? (_Int64 = new XorInt64()); - case TypeCode.UInt16: return _UInt16 ?? (_UInt16 = new XorUInt16()); - case TypeCode.UInt32: return _UInt32 ?? (_UInt32 = new XorUInt32()); - case TypeCode.UInt64: return _UInt64 ?? (_UInt64 = new XorUInt64()); - case TypeCode.Boolean: return _Boolean ?? (_Boolean = new XorBoolean()); - - default: - throw Assert.Unreachable; - } - } - - public static Instruction CreateLifted(Type type) { - Debug.Assert(!type.IsEnum()); - switch (type.GetTypeCode()) { - case TypeCode.Int16: return _Int16Lifted ?? (_Int16Lifted = new XorInt16Lifted()); - case TypeCode.Int32: return _Int32Lifted ?? (_Int32Lifted = new XorInt32Lifted()); - case TypeCode.Int64: return _Int64Lifted ?? (_Int64Lifted = new XorInt64Lifted()); - case TypeCode.UInt16: return _UInt16Lifted ?? (_UInt16Lifted = new XorUInt16Lifted()); - case TypeCode.UInt32: return _UInt32Lifted ?? (_UInt32Lifted = new XorUInt32Lifted()); - case TypeCode.UInt64: return _UInt64Lifted ?? (_UInt64Lifted = new XorUInt64Lifted()); - case TypeCode.Boolean: return _BooleanLifted ?? (_BooleanLifted = new XorBooleanLifted()); - - default: - throw Assert.Unreachable; - } - } - - public override string ToString() { - return "Xor()"; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/InterpretedFrame.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/InterpretedFrame.cs deleted file mode 100644 index cd3a0784842..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/InterpretedFrame.cs +++ /dev/null @@ -1,297 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Threading; -using Microsoft.Scripting.Utils; -using Microsoft.Scripting.Runtime; - -namespace Microsoft.Scripting.Interpreter { -#if CLR45 - using InterpretedFrameThreadLocal = ThreadLocal; -#else - using InterpretedFrameThreadLocal = Microsoft.Scripting.Utils.ThreadLocal; -#endif - - public sealed class InterpretedFrame { - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public static readonly InterpretedFrameThreadLocal CurrentFrame = new InterpretedFrameThreadLocal(); - - internal readonly Interpreter Interpreter; - internal InterpretedFrame _parent; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")] - private int[] _continuations; - private int _continuationIndex; - private int _pendingContinuation; - private object _pendingValue; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")] - public readonly object[] Data; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")] - public readonly StrongBox[] Closure; - - public int StackIndex; - public int InstructionIndex; - - // When a ThreadAbortException is raised from interpreted code this is the first frame that caught it. - // No handlers within this handler re-abort the current thread when left. - public ExceptionHandler CurrentAbortHandler; - - internal InterpretedFrame(Interpreter interpreter, StrongBox[] closure) { - Interpreter = interpreter; - StackIndex = interpreter.LocalCount; - Data = new object[StackIndex + interpreter.Instructions.MaxStackDepth]; - - int c = interpreter.Instructions.MaxContinuationDepth; - if (c > 0) { - _continuations = new int[c]; - } - - Closure = closure; - } - - public DebugInfo GetDebugInfo(int instructionIndex) { - return DebugInfo.GetMatchingDebugInfo(Interpreter._debugInfos, instructionIndex); - } - - public string Name { - get { return Interpreter._name; } - } - - #region Data Stack Operations - - public void Push(object value) { - Data[StackIndex++] = value; - } - - public void Push(bool value) { - Data[StackIndex++] = value ? ScriptingRuntimeHelpers.True : ScriptingRuntimeHelpers.False; - } - - public void Push(int value) { - Data[StackIndex++] = ScriptingRuntimeHelpers.Int32ToObject(value); - } - - public object Pop() { - return Data[--StackIndex]; - } - - public object Pop(int n) { - int si = StackIndex - n; - StackIndex = si; - return Data[si]; - } - - internal void SetStackDepth(int depth) { - StackIndex = Interpreter.LocalCount + depth; - } - - public object Peek() { - return Data[StackIndex - 1]; - } - - public void Dup() { - int i = StackIndex; - Data[i] = Data[i - 1]; - StackIndex = i + 1; - } - - #endregion - - #region Stack Trace - - public InterpretedFrame Parent { - get { return _parent; } - } - - public static bool IsInterpretedFrame(MethodBase method) { - ContractUtils.RequiresNotNull(method, "method"); - return method.DeclaringType == typeof(Interpreter) && method.Name == "Run"; - } - -#if FEATURE_STACK_TRACE - /// - /// A single interpreted frame might be represented by multiple subsequent Interpreter.Run CLR frames. - /// This method filters out the duplicate CLR frames. - /// - public static IEnumerable GroupStackFrames(IEnumerable stackTrace) { - bool inInterpretedFrame = false; - foreach (StackFrame frame in stackTrace) { - if (InterpretedFrame.IsInterpretedFrame(frame.GetMethod())) { - if (inInterpretedFrame) { - continue; - } - inInterpretedFrame = true; - } else { - inInterpretedFrame = false; - } - yield return frame; - } - } -#endif - - public IEnumerable GetStackTraceDebugInfo() { - var frame = this; - do { - yield return new InterpretedFrameInfo(frame.Name, frame.GetDebugInfo(frame.InstructionIndex)); - frame = frame.Parent; - } while (frame != null); - } - - internal void SaveTraceToException(Exception exception) { - if (exception.GetData(typeof(InterpretedFrameInfo)) == null) { - exception.SetData(typeof(InterpretedFrameInfo), new List(GetStackTraceDebugInfo()).ToArray()); - } - } - - public static InterpretedFrameInfo[] GetExceptionStackTrace(Exception exception) { - return exception.GetData(typeof(InterpretedFrameInfo)) as InterpretedFrameInfo[]; - } - -#if DEBUG - internal string[] Trace { - get { - var trace = new List(); - var frame = this; - do { - trace.Add(frame.Name); - frame = frame.Parent; - } while (frame != null); - return trace.ToArray(); - } - } -#endif - -#if CLR45 - internal InterpretedFrameThreadLocal Enter() { - var currentFrame = InterpretedFrame.CurrentFrame; - _parent = currentFrame.Value; - currentFrame.Value = this; - return currentFrame; - } - - internal void Leave(InterpretedFrameThreadLocal currentFrame) { - currentFrame.Value = _parent; - } -#else - internal InterpretedFrameThreadLocal.StorageInfo Enter() { - var currentFrame = InterpretedFrame.CurrentFrame.GetStorageInfo(); - _parent = currentFrame.Value; - currentFrame.Value = this; - return currentFrame; - } - - internal void Leave(InterpretedFrameThreadLocal.StorageInfo currentFrame) { - currentFrame.Value = _parent; - } -#endif - #endregion - - #region Continuations - - public void RemoveContinuation() { - _continuationIndex--; - } - - public void PushContinuation(int continuation) { - _continuations[_continuationIndex++] = continuation; - } - - public int YieldToCurrentContinuation() { - var target = Interpreter._labels[_continuations[_continuationIndex - 1]]; - SetStackDepth(target.StackDepth); - return target.Index - InstructionIndex; - } - - public int YieldToPendingContinuation() { - Debug.Assert(_pendingContinuation >= 0); - - RuntimeLabel pendingTarget = Interpreter._labels[_pendingContinuation]; - - // the current continuation might have higher priority (continuationIndex is the depth of the current continuation): - if (pendingTarget.ContinuationStackDepth < _continuationIndex) { - RuntimeLabel currentTarget = Interpreter._labels[_continuations[_continuationIndex - 1]]; - SetStackDepth(currentTarget.StackDepth); - return currentTarget.Index - InstructionIndex; - } - - SetStackDepth(pendingTarget.StackDepth); - if (_pendingValue != Interpreter.NoValue) { - Data[StackIndex - 1] = _pendingValue; - } - return pendingTarget.Index - InstructionIndex; - } - - internal void PushPendingContinuation() { - Push(_pendingContinuation); - Push(_pendingValue); -#if DEBUG - _pendingContinuation = -1; -#endif - } - - internal void PopPendingContinuation() { - _pendingValue = Pop(); - _pendingContinuation = (int)Pop(); - } - - private static MethodInfo _Goto; - private static MethodInfo _VoidGoto; - - internal static MethodInfo GotoMethod { - get { return _Goto ?? (_Goto = typeof(InterpretedFrame).GetMethod("Goto")); } - } - - internal static MethodInfo VoidGotoMethod { - get { return _VoidGoto ?? (_VoidGoto = typeof(InterpretedFrame).GetMethod("VoidGoto")); } - } - - public int VoidGoto(int labelIndex) { - return Goto(labelIndex, Interpreter.NoValue); - } - - public int Goto(int labelIndex, object value) { - // TODO: we know this at compile time (except for compiled loop): - RuntimeLabel target = Interpreter._labels[labelIndex]; - if (_continuationIndex == target.ContinuationStackDepth) { - SetStackDepth(target.StackDepth); - if (value != Interpreter.NoValue) { - Data[StackIndex - 1] = value; - } - return target.Index - InstructionIndex; - } - - // if we are in the middle of executing jump we forget the previous target and replace it by a new one: - _pendingContinuation = labelIndex; - _pendingValue = value; - return YieldToCurrentContinuation(); - } - - #endregion - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Interpreter.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Interpreter.cs deleted file mode 100644 index 81c7d5b043f..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/Interpreter.cs +++ /dev/null @@ -1,262 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Threading; - -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; -using System.Diagnostics; -using System.Collections.Generic; - -namespace Microsoft.Scripting.Interpreter { - /// - /// A simple forth-style stack machine for executing Expression trees - /// without the need to compile to IL and then invoke the JIT. This trades - /// off much faster compilation time for a slower execution performance. - /// For code that is only run a small number of times this can be a - /// sweet spot. - /// - /// The core loop in the interpreter is the RunInstructions method. - /// - internal sealed class Interpreter { - internal static readonly object NoValue = new object(); - internal const int RethrowOnReturn = Int32.MaxValue; - - // zero: sync compilation - // negative: default - internal readonly int _compilationThreshold; - - private readonly int _localCount; - private readonly HybridReferenceDictionary _labelMapping; - private readonly Dictionary _closureVariables; - - private readonly InstructionArray _instructions; - internal readonly object[] _objects; - internal readonly RuntimeLabel[] _labels; - - internal readonly string _name; - private readonly ExceptionHandler[] _handlers; - internal readonly DebugInfo[] _debugInfos; - - internal Interpreter(string name, LocalVariables locals, HybridReferenceDictionary labelMapping, - InstructionArray instructions, ExceptionHandler[] handlers, DebugInfo[] debugInfos, int compilationThreshold) { - - _name = name; - _localCount = locals.LocalCount; - _closureVariables = locals.ClosureVariables; - - _instructions = instructions; - _objects = instructions.Objects; - _labels = instructions.Labels; - _labelMapping = labelMapping; - - _handlers = handlers; - _debugInfos = debugInfos; - _compilationThreshold = compilationThreshold; - } - - internal int ClosureSize { - get { - if (_closureVariables == null) { - return 0; - } - return _closureVariables.Count; - } - } - - internal int LocalCount { - get { - return _localCount; - } - } - - internal bool CompileSynchronously { - get { return _compilationThreshold <= 1; } - } - - internal InstructionArray Instructions { - get { return _instructions; } - } - - internal Dictionary ClosureVariables { - get { return _closureVariables; } - } - - internal HybridReferenceDictionary LabelMapping { - get { return _labelMapping; } - } - - /// - /// Runs instructions within the given frame. - /// - /// - /// Interpreted stack frames are linked via Parent reference so that each CLR frame of this method corresponds - /// to an interpreted stack frame in the chain. It is therefore possible to combine CLR stack traces with - /// interpreted stack traces by aligning interpreted frames to the frames of this method. - /// Each group of subsequent frames of Run method corresponds to a single interpreted frame. - /// - [SpecialName, MethodImpl(MethodImplOptions.NoInlining)] - public void Run(InterpretedFrame frame) { - while (true) { - try { - var instructions = _instructions.Instructions; - int index = frame.InstructionIndex; - while (index < instructions.Length) { - index += instructions[index].Run(frame); - frame.InstructionIndex = index; - } - return; - } catch (Exception exception) { - switch (HandleException(frame, exception)) { - case ExceptionHandlingResult.Rethrow: throw; - case ExceptionHandlingResult.Continue: continue; - case ExceptionHandlingResult.Return: return; - } - } - } - } - - private ExceptionHandlingResult HandleException(InterpretedFrame frame, Exception exception) { - frame.SaveTraceToException(exception); - ExceptionHandler handler; - frame.InstructionIndex += GotoHandler(frame, exception, out handler); - - if (handler == null || handler.IsFault) { - // run finally/fault blocks: - Run(frame); - - // a finally block can throw an exception caught by a handler, which cancels the previous exception: - if (frame.InstructionIndex == RethrowOnReturn) { - return ExceptionHandlingResult.Rethrow; - } - return ExceptionHandlingResult.Return; - } - -#if FEATURE_THREAD - // stay in the current catch so that ThreadAbortException is not rethrown by CLR: - var abort = exception as ThreadAbortException; - if (abort != null) { - _anyAbortException = abort; - frame.CurrentAbortHandler = handler; - } -#endif - while (true) { - try { - var instructions = _instructions.Instructions; - int index = frame.InstructionIndex; - - while (index < instructions.Length) { - var curInstr = instructions[index]; - - index += curInstr.Run(frame); - frame.InstructionIndex = index; - - if (curInstr is LeaveExceptionHandlerInstruction) { - // we've completed handling of this exception - return ExceptionHandlingResult.Continue; - } - } - - if (frame.InstructionIndex == RethrowOnReturn) { - return ExceptionHandlingResult.Rethrow; - } - - return ExceptionHandlingResult.Return; - } catch (Exception nestedException) { - switch (HandleException(frame, nestedException)) { - case ExceptionHandlingResult.Rethrow: throw; - case ExceptionHandlingResult.Continue: continue; - case ExceptionHandlingResult.Return: return ExceptionHandlingResult.Return; - default: throw Assert.Unreachable; - } - } - } - } - - enum ExceptionHandlingResult { - Rethrow, - Continue, - Return - } - -#if FEATURE_THREAD - // To get to the current AbortReason object on Thread.CurrentThread - // we need to use ExceptionState property of any ThreadAbortException instance. - [ThreadStatic] - private static ThreadAbortException _anyAbortException = null; - - internal static void AbortThreadIfRequested(InterpretedFrame frame, int targetLabelIndex) { - var abortHandler = frame.CurrentAbortHandler; - if (abortHandler != null && !abortHandler.IsInside(frame.Interpreter._labels[targetLabelIndex].Index)) { - frame.CurrentAbortHandler = null; - - var currentThread = Thread.CurrentThread; - if ((currentThread.ThreadState & System.Threading.ThreadState.AbortRequested) != 0) { - Debug.Assert(_anyAbortException != null); - -#if FEATURE_EXCEPTION_STATE - // The current abort reason needs to be preserved. - currentThread.Abort(_anyAbortException.ExceptionState); -#else - currentThread.Abort(); -#endif - } - } - } -#else - internal static void AbortThreadIfRequested(InterpretedFrame frame, int targetLabelIndex) { - // nop - } -#endif - - internal ExceptionHandler GetBestHandler(int instructionIndex, Type exceptionType) { - ExceptionHandler best = null; - foreach (var handler in _handlers) { - if (handler.Matches(exceptionType, instructionIndex)) { - if (handler.IsBetterThan(best)) { - best = handler; - } - } - } - return best; - } - - internal int ReturnAndRethrowLabelIndex { - get { - // the last label is "return and rethrow" label: - Debug.Assert(_labels[_labels.Length - 1].Index == RethrowOnReturn); - return _labels.Length - 1; - } - } - - internal int GotoHandler(InterpretedFrame frame, object exception, out ExceptionHandler handler) { - handler = GetBestHandler(frame.InstructionIndex, exception.GetType()); - if (handler == null) { - return frame.Goto(ReturnAndRethrowLabelIndex, Interpreter.NoValue); - } else { - return frame.Goto(handler.LabelIndex, exception); - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs deleted file mode 100644 index 779d93a1086..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightCompiler.cs +++ /dev/null @@ -1,1736 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -using Microsoft.Scripting.Ast; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Linq; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif - -using AstUtils = Microsoft.Scripting.Ast.Utils; -using Microsoft.Scripting.Utils; -using Microsoft.Scripting.Runtime; -using System.Security; - -namespace Microsoft.Scripting.Interpreter { - public sealed class ExceptionHandler { - public readonly Type ExceptionType; - public readonly int StartIndex; - public readonly int EndIndex; - public readonly int LabelIndex; - public readonly int HandlerStartIndex; - - public bool IsFault { get { return ExceptionType == null; } } - - internal ExceptionHandler(int start, int end, int labelIndex, int handlerStartIndex, Type exceptionType) { - StartIndex = start; - EndIndex = end; - LabelIndex = labelIndex; - ExceptionType = exceptionType; - HandlerStartIndex = handlerStartIndex; - } - - public bool Matches(Type exceptionType, int index) { - if (index >= StartIndex && index < EndIndex) { - if (ExceptionType == null || ExceptionType.IsAssignableFrom(exceptionType)) { - return true; - } - } - return false; - } - - public bool IsBetterThan(ExceptionHandler other) { - if (other == null) return true; - - if (StartIndex == other.StartIndex && EndIndex == other.EndIndex) { - return HandlerStartIndex < other.HandlerStartIndex; - } - - if (StartIndex > other.StartIndex) { - Debug.Assert(EndIndex <= other.EndIndex); - return true; - } else if (EndIndex < other.EndIndex) { - Debug.Assert(StartIndex == other.StartIndex); - return true; - } else { - return false; - } - } - - internal bool IsInside(int index) { - return index >= StartIndex && index < EndIndex; - } - - public override string ToString() { - return String.Format("{0} [{1}-{2}] [{3}->]", - (IsFault ? "fault" : "catch(" + ExceptionType.Name + ")"), - StartIndex, EndIndex, - HandlerStartIndex - ); - } - } - - [Serializable] - public class DebugInfo { - // TODO: readonly - - public int StartLine, EndLine; - public int Index; - public string FileName; - public bool IsClear; - private static readonly DebugInfoComparer _debugComparer = new DebugInfoComparer(); - - private class DebugInfoComparer : IComparer { - //We allow comparison between int and DebugInfo here - int IComparer.Compare(DebugInfo d1, DebugInfo d2) { - if (d1.Index > d2.Index) return 1; - else if (d1.Index == d2.Index) return 0; - else return -1; - } - } - - public static DebugInfo GetMatchingDebugInfo(DebugInfo[] debugInfos, int index) { - //Create a faked DebugInfo to do the search - DebugInfo d = new DebugInfo { Index = index }; - - //to find the closest debug info before the current index - - int i = Array.BinarySearch(debugInfos, d, _debugComparer); - if (i < 0) { - //~i is the index for the first bigger element - //if there is no bigger element, ~i is the length of the array - i = ~i; - if (i == 0) { - return null; - } - //return the last one that is smaller - i = i - 1; - } - - return debugInfos[i]; - } - - public override string ToString() { - if (IsClear) { - return String.Format("{0}: clear", Index); - } else { - return String.Format("{0}: [{1}-{2}] '{3}'", Index, StartLine, EndLine, FileName); - } - } - } - - // TODO: - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes")] - [Serializable] - public struct InterpretedFrameInfo { - public readonly string MethodName; - - // TODO: - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public readonly DebugInfo DebugInfo; - - public InterpretedFrameInfo(string methodName, DebugInfo info) { - MethodName = methodName; - DebugInfo = info; - } - - public override string ToString() { - return MethodName + (DebugInfo != null ? ": " + DebugInfo.ToString() : null); - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] - public sealed class LightCompiler { - internal const int DefaultCompilationThreshold = 32; - - // zero: sync compilation - private readonly int _compilationThreshold; - - private readonly InstructionList _instructions; - private readonly LocalVariables _locals = new LocalVariables(); - - private readonly List _handlers = new List(); - - private readonly List _debugInfos = new List(); - private readonly HybridReferenceDictionary _treeLabels = new HybridReferenceDictionary(); - private LabelScopeInfo _labelBlock = new LabelScopeInfo(null, LabelScopeKind.Lambda); - - private readonly Stack _exceptionForRethrowStack = new Stack(); - - // Set to true to force compiliation of this lambda. - // This disables the interpreter for this lambda. We still need to - // walk it, however, to resolve variables closed over from the parent - // lambdas (because they may be interpreted). - private bool _forceCompile; - - private readonly LightCompiler _parent; - - private static LocalDefinition[] EmptyLocals = new LocalDefinition[0]; - - internal LightCompiler(int compilationThreshold) { - _instructions = new InstructionList(); - _compilationThreshold = compilationThreshold < 0 ? DefaultCompilationThreshold : compilationThreshold; - } - - private LightCompiler(LightCompiler parent) - : this(parent._compilationThreshold) { - _parent = parent; - } - - public InstructionList Instructions { - get { return _instructions; } - } - - public LocalVariables Locals { - get { return _locals; } - } - - internal static Expression Unbox(Expression strongBoxExpression) { - return Expression.Field(strongBoxExpression, typeof(StrongBox).GetDeclaredField("Value")); - } - - internal LightDelegateCreator CompileTop(LambdaExpression node) { - foreach (var p in node.Parameters) { - var local = _locals.DefineLocal(p, 0); - _instructions.EmitInitializeParameter(local.Index); - } - - Compile(node.Body); - - // pop the result of the last expression: - if (node.Body.Type != typeof(void) && node.ReturnType == typeof(void)) { - _instructions.EmitPop(); - } - - Debug.Assert(_instructions.CurrentStackDepth == (node.ReturnType != typeof(void) ? 1 : 0)); - - return new LightDelegateCreator(MakeInterpreter(node.Name), node); - } - - internal LightDelegateCreator CompileTop(LightLambdaExpression node) { - foreach (var p in node.Parameters) { - var local = _locals.DefineLocal(p, 0); - _instructions.EmitInitializeParameter(local.Index); - } - - Compile(node.Body); - - // pop the result of the last expression: - if (node.Body.Type != typeof(void) && node.ReturnType == typeof(void)) { - _instructions.EmitPop(); - } - - Debug.Assert(_instructions.CurrentStackDepth == (node.ReturnType != typeof(void) ? 1 : 0)); - - return new LightDelegateCreator(MakeInterpreter(node.Name), node); - } - - private Interpreter MakeInterpreter(string lambdaName) { - if (_forceCompile) { - return null; - } - - var handlers = _handlers.ToArray(); - var debugInfos = _debugInfos.ToArray(); - - return new Interpreter(lambdaName, _locals, GetBranchMapping(), _instructions.ToArray(), handlers, debugInfos, _compilationThreshold); - } - - - private void CompileConstantExpression(Expression expr) { - var node = (ConstantExpression)expr; - _instructions.EmitLoad(node.Value, node.Type); - } - - private void CompileDefaultExpression(Expression expr) { - CompileDefaultExpression(expr.Type); - } - - private void CompileDefaultExpression(Type type) { - if (type != typeof(void)) { - if (type.IsValueType()) { - object value = ScriptingRuntimeHelpers.GetPrimitiveDefaultValue(type); - if (value != null) { - _instructions.EmitLoad(value); - } else { - _instructions.EmitDefaultValue(type); - } - } else { - _instructions.EmitLoad(null); - } - } - } - - private LocalVariable EnsureAvailableForClosure(ParameterExpression expr) { - LocalVariable local; - if (_locals.TryGetLocalOrClosure(expr, out local)) { - if (!local.InClosure && !local.IsBoxed) { - _locals.Box(expr, _instructions); - } - return local; - } else if (_parent != null) { - _parent.EnsureAvailableForClosure(expr); - return _locals.AddClosureVariable(expr); - } else { - throw new InvalidOperationException("unbound variable: " + expr); - } - } - - private void EnsureVariable(ParameterExpression variable) { - if (!_locals.ContainsVariable(variable)) { - EnsureAvailableForClosure(variable); - } - } - - private LocalVariable ResolveLocal(ParameterExpression variable) { - LocalVariable local; - if (!_locals.TryGetLocalOrClosure(variable, out local)) { - local = EnsureAvailableForClosure(variable); - } - return local; - } - - public void CompileGetVariable(ParameterExpression variable) { - LocalVariable local = ResolveLocal(variable); - - if (local.InClosure) { - _instructions.EmitLoadLocalFromClosure(local.Index); - } else if (local.IsBoxed) { - _instructions.EmitLoadLocalBoxed(local.Index); - } else { - _instructions.EmitLoadLocal(local.Index); - } - - _instructions.SetDebugCookie(variable.Name); - } - - public void CompileGetBoxedVariable(ParameterExpression variable) { - LocalVariable local = ResolveLocal(variable); - - if (local.InClosure) { - _instructions.EmitLoadLocalFromClosureBoxed(local.Index); - } else { - Debug.Assert(local.IsBoxed); - _instructions.EmitLoadLocal(local.Index); - } - - _instructions.SetDebugCookie(variable.Name); - } - - public void CompileSetVariable(ParameterExpression variable, bool isVoid) { - LocalVariable local = ResolveLocal(variable); - - if (local.InClosure) { - if (isVoid) { - _instructions.EmitStoreLocalToClosure(local.Index); - } else { - _instructions.EmitAssignLocalToClosure(local.Index); - } - } else if (local.IsBoxed) { - if (isVoid) { - _instructions.EmitStoreLocalBoxed(local.Index); - } else { - _instructions.EmitAssignLocalBoxed(local.Index); - } - } else { - if (isVoid) { - _instructions.EmitStoreLocal(local.Index); - } else { - _instructions.EmitAssignLocal(local.Index); - } - } - - _instructions.SetDebugCookie(variable.Name); - } - - public void CompileParameterExpression(Expression expr) { - var node = (ParameterExpression)expr; - CompileGetVariable(node); - } - - private void CompileBlockExpression(Expression expr, bool asVoid) { - var node = (BlockExpression)expr; - var end = CompileBlockStart(node); - - var lastExpression = node.Expressions[node.Expressions.Count - 1]; - Compile(lastExpression, asVoid); - CompileBlockEnd(end); - } - - private LocalDefinition[] CompileBlockStart(BlockExpression node) { - var start = _instructions.Count; - - LocalDefinition[] locals; - var variables = node.Variables; - if (variables.Count != 0) { - // TODO: basic flow analysis so we don't have to initialize all - // variables. - locals = new LocalDefinition[variables.Count]; - int localCnt = 0; - foreach (var variable in variables) { - var local = _locals.DefineLocal(variable, start); - locals[localCnt++] = local; - - _instructions.EmitInitializeLocal(local.Index, variable.Type); - _instructions.SetDebugCookie(variable.Name); - } - } else { - locals = EmptyLocals; - } - - for (int i = 0; i < node.Expressions.Count - 1; i++) { - CompileAsVoid(node.Expressions[i]); - } - return locals; - } - - private void CompileBlockEnd(LocalDefinition[] locals) { - foreach (var local in locals) { - _locals.UndefineLocal(local, _instructions.Count); - } - } - - private void CompileIndexExpression(Expression expr) { - var index = (IndexExpression)expr; - - // instance: - if (index.Object != null) { - Compile(index.Object); - } - - // indexes, byref args not allowed. - foreach (var arg in index.Arguments) { - Compile(arg); - } - - if (index.Indexer != null) { - EmitCall(index.Indexer.GetGetMethod(true)); - } else if (index.Arguments.Count != 1) { - EmitCall(index.Object.Type.GetMethod("Get", BindingFlags.Public | BindingFlags.Instance)); - } else { - _instructions.EmitGetArrayItem(index.Object.Type); - } - } - - private void CompileIndexAssignment(BinaryExpression node, bool asVoid) { - var index = (IndexExpression)node.Left; - - if (!asVoid) { - throw new NotImplementedException(); - } - - // instance: - if (index.Object != null) { - Compile(index.Object); - } - - // indexes, byref args not allowed. - foreach (var arg in index.Arguments) { - Compile(arg); - } - - // value: - Compile(node.Right); - - if (index.Indexer != null) { - EmitCall(index.Indexer.GetSetMethod(true)); - } else if (index.Arguments.Count != 1) { - EmitCall(index.Object.Type.GetMethod("Set", BindingFlags.Public | BindingFlags.Instance)); - } else { - _instructions.EmitSetArrayItem(index.Object.Type); - } - } - - private void CompileMemberAssignment(BinaryExpression node, bool asVoid) { - var member = (MemberExpression)node.Left; - - PropertyInfo pi = member.Member as PropertyInfo; - if (pi != null) { - var method = pi.GetSetMethod(true); - Compile(member.Expression); - Compile(node.Right); - - int start = _instructions.Count; - if (!asVoid) { - LocalDefinition local = _locals.DefineLocal(Expression.Parameter(node.Right.Type), start); - _instructions.EmitAssignLocal(local.Index); - EmitCall(method); - _instructions.EmitLoadLocal(local.Index); - _locals.UndefineLocal(local, _instructions.Count); - } else { - EmitCall(method); - } - return; - } - - FieldInfo fi = member.Member as FieldInfo; - if (fi != null) { - if (member.Expression != null) { - Compile(member.Expression); - } - Compile(node.Right); - - int start = _instructions.Count; - if (!asVoid) { - LocalDefinition local = _locals.DefineLocal(Expression.Parameter(node.Right.Type), start); - _instructions.EmitAssignLocal(local.Index); - _instructions.EmitStoreField(fi); - _instructions.EmitLoadLocal(local.Index); - _locals.UndefineLocal(local, _instructions.Count); - } else { - _instructions.EmitStoreField(fi); - } - return; - } - - throw new NotImplementedException(); - } - - private void CompileVariableAssignment(BinaryExpression node, bool asVoid) { - this.Compile(node.Right); - - var target = (ParameterExpression)node.Left; - CompileSetVariable(target, asVoid); - } - - private void CompileAssignBinaryExpression(Expression expr, bool asVoid) { - var node = (BinaryExpression)expr; - - switch (node.Left.NodeType) { - case ExpressionType.Index: - CompileIndexAssignment(node, asVoid); - break; - - case ExpressionType.MemberAccess: - CompileMemberAssignment(node, asVoid); - break; - - case ExpressionType.Parameter: - case ExpressionType.Extension: - CompileVariableAssignment(node, asVoid); - break; - - default: - throw new InvalidOperationException("Invalid lvalue for assignment: " + node.Left.NodeType); - } - } - - private void CompileBinaryExpression(Expression expr) { - var node = (BinaryExpression)expr; - - if (node.Method != null) { - Compile(node.Left); - Compile(node.Right); - EmitCall(node.Method); - } else { - switch (node.NodeType) { - case ExpressionType.ArrayIndex: - Debug.Assert(node.Right.Type == typeof(int)); - Compile(node.Left); - Compile(node.Right); - _instructions.EmitGetArrayItem(node.Left.Type); - return; - - case ExpressionType.Add: - case ExpressionType.AddChecked: - case ExpressionType.Subtract: - case ExpressionType.SubtractChecked: - case ExpressionType.Multiply: - case ExpressionType.MultiplyChecked: - case ExpressionType.Divide: - case ExpressionType.Modulo: - CompileArithmetic(node.NodeType, node.Left, node.Right); - return; - - case ExpressionType.Equal: - CompileEqual(node.Left, node.Right, node.IsLiftedToNull); - return; - - case ExpressionType.NotEqual: - CompileNotEqual(node.Left, node.Right, node.IsLiftedToNull); - return; - - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - CompileComparison(node.NodeType, node.Left, node.Right, node.IsLiftedToNull); - return; - - case ExpressionType.LeftShift: - case ExpressionType.RightShift: - CompileShift(node.NodeType, node.Left, node.Right, node.IsLifted); - return; - - case ExpressionType.And: - case ExpressionType.Or: - case ExpressionType.ExclusiveOr: - CompileLogical(node.NodeType, node.Left, node.Right, node.IsLifted); - return; - - default: - throw new NotImplementedException(node.NodeType.ToString()); - } - } - } - - private void CompileEqual(Expression left, Expression right, bool liftedResult) { - Debug.Assert(left.Type == right.Type || !left.Type.IsValueType() && !right.Type.IsValueType()); - Compile(left); - Compile(right); - _instructions.EmitEqual(left.Type, liftedResult); - } - - private void CompileNotEqual(Expression left, Expression right, bool liftedResult) { - Debug.Assert(left.Type == right.Type || !left.Type.IsValueType() && !right.Type.IsValueType()); - Compile(left); - Compile(right); - _instructions.EmitNotEqual(left.Type, liftedResult); - } - - private void CompileComparison(ExpressionType nodeType, Expression left, Expression right, bool liftedResult) { - Debug.Assert(left.Type == right.Type && TypeUtils.IsNumeric(left.Type)); - - Compile(left); - Compile(right); - - switch (nodeType) { - case ExpressionType.LessThan: _instructions.EmitLessThan(left.Type, liftedResult); break; - case ExpressionType.LessThanOrEqual: _instructions.EmitLessThanOrEqual(left.Type, liftedResult); break; - case ExpressionType.GreaterThan: _instructions.EmitGreaterThan(left.Type, liftedResult); break; - case ExpressionType.GreaterThanOrEqual: _instructions.EmitGreaterThanOrEqual(left.Type, liftedResult); break; - default: throw Assert.Unreachable; - } - } - - private void CompileArithmetic(ExpressionType nodeType, Expression left, Expression right) { - Debug.Assert(left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)); - Compile(left); - Compile(right); - switch (nodeType) { - case ExpressionType.Add: _instructions.EmitAdd(left.Type, false); break; - case ExpressionType.AddChecked: _instructions.EmitAdd(left.Type, true); break; - case ExpressionType.Subtract: _instructions.EmitSub(left.Type, false); break; - case ExpressionType.SubtractChecked: _instructions.EmitSub(left.Type, true); break; - case ExpressionType.Multiply: _instructions.EmitMul(left.Type, false); break; - case ExpressionType.MultiplyChecked: _instructions.EmitMul(left.Type, true); break; - case ExpressionType.Divide: _instructions.EmitDiv(left.Type); break; - case ExpressionType.Modulo: _instructions.EmitMod(left.Type); break; - default: throw Assert.Unreachable; - } - } - - private void CompileShift(ExpressionType nodeType, Expression left, Expression right, bool lifted) { - Debug.Assert(right.Type == typeof (int) || right.Type == typeof (int?)); - Compile(left); - Compile(right); - switch (nodeType) { - case ExpressionType.LeftShift: _instructions.EmitShl(TypeUtils.GetNonNullableType (left.Type), lifted); break; - case ExpressionType.RightShift: _instructions.EmitShr(TypeUtils.GetNonNullableType (left.Type), lifted); break; - default: throw Assert.Unreachable; - } - } - - private void CompileLogical(ExpressionType nodeType, Expression left, Expression right, bool lifted) { - Debug.Assert(left.Type == right.Type); // && TypeUtils.IsIntegerOrBool(left.Type)); - Compile(left); - Compile(right); - switch (nodeType) { - case ExpressionType.And: _instructions.EmitAnd(TypeUtils.GetNonNullableType (left.Type), lifted); break; - case ExpressionType.Or: _instructions.EmitOr(TypeUtils.GetNonNullableType (left.Type), lifted); break; - case ExpressionType.ExclusiveOr: _instructions.EmitExclusiveOr(TypeUtils.GetNonNullableType (left.Type), lifted); break; - default: throw Assert.Unreachable; - } - } - - private void CompileConvertUnaryExpression(Expression expr) { - var node = (UnaryExpression)expr; - if (node.Method != null) { - Compile(node.Operand); - - if (node.IsLifted) - throw new NotImplementedException (); - - // We should be able to ignore Int32ToObject - if (node.Method != Runtime.ScriptingRuntimeHelpers.Int32ToObjectMethod) { - EmitCall(node.Method); - } - } else if (node.Type == typeof(void)) { - CompileAsVoid(node.Operand); - } else { - Compile(node.Operand); - CompileConvertToType(node.Operand.Type, node.Type, node.NodeType == ExpressionType.ConvertChecked); - } - } - - private void CompileConvertToType(Type typeFrom, Type typeTo, bool isChecked) { - Debug.Assert(typeFrom != typeof(void) && typeTo != typeof(void)); - - if (TypeUtils.AreEquivalent(typeTo, typeFrom)) { - return; - } - - if (TypeUtils.IsNullableType (typeTo)) { - typeFrom = TypeUtils.GetNonNullableType (typeFrom); - typeTo = TypeUtils.GetNonNullableType (typeTo); - - var nullValue = _instructions.MakeLabel(); - var end = _instructions.MakeLabel(); - - _instructions.EmitDup (); - _instructions.EmitBranchNull(nullValue); - CompileConvertToType (typeFrom, typeTo, isChecked); - _instructions.EmitWrap (typeTo); - _instructions.MarkLabel(nullValue); - return; - } - - if (TypeUtils.IsNullableType (typeFrom)) { - if (typeTo.IsClass) - return; - - // TODO: should throw same exception as (int)(int?)null - throw new NotImplementedException (); - } - - TypeCode from = typeFrom.GetTypeCode(); - TypeCode to = typeTo.GetTypeCode(); - if (TypeUtils.IsNumeric(from) && TypeUtils.IsNumeric(to)) { - if (isChecked) { - _instructions.EmitNumericConvertChecked(from, to); - } else { - _instructions.EmitNumericConvertUnchecked(from, to); - } - return; - } - - // TODO: Conversions to a super-class or implemented interfaces are no-op. - // A conversion to a non-implemented interface or an unrelated class, etc. should fail. - return; - } - - private void CompileNegateExpression(UnaryExpression node, bool @checked, bool lifted) { - Compile(node.Operand); - _instructions.EmitNegate(TypeUtils.GetNonNullableType (node.Type), @checked, lifted); - } - - private void CompileNotExpression(UnaryExpression node, bool lifted) { - Compile(node.Operand); - _instructions.EmitNot(TypeUtils.GetNonNullableType (node.Type), lifted); - } - - private void CompileUnaryExpression(Expression expr) { - var node = (UnaryExpression)expr; - - if (node.Method != null) { - Compile(node.Operand); - EmitCall(node.Method); - } else { - switch (node.NodeType) { - case ExpressionType.ArrayLength: - Compile(node.Operand); - _instructions.EmitGetArrayLength (node.Type); - return; - case ExpressionType.Negate: - CompileNegateExpression(node, false, node.IsLifted); - return; - case ExpressionType.NegateChecked: - CompileNegateExpression(node, true, node.IsLifted); - return; - case ExpressionType.Not: - CompileNotExpression(node, node.IsLifted); - return; - case ExpressionType.UnaryPlus: - // unary plus is a nop: - Compile(node.Operand); - return; - case ExpressionType.TypeAs: - CompileTypeAsExpression(node); - return; - default: - throw new NotImplementedException(node.NodeType.ToString()); - } - } - } - - private void CompileAndAlsoBinaryExpression(Expression expr) { - CompileLogicalBinaryExpression(expr, true); - } - - private void CompileOrElseBinaryExpression(Expression expr) { - CompileLogicalBinaryExpression(expr, false); - } - - private void CompileLogicalBinaryExpression(Expression expr, bool andAlso) { - var node = (BinaryExpression)expr; - if (node.Method != null) { - throw new NotImplementedException(); - } - - Debug.Assert(node.Left.Type == node.Right.Type); - - if (node.Left.Type == typeof(bool)) { - var elseLabel = _instructions.MakeLabel(); - var endLabel = _instructions.MakeLabel(); - Compile(node.Left); - if (andAlso) { - _instructions.EmitBranchFalse(elseLabel); - } else { - _instructions.EmitBranchTrue(elseLabel); - } - Compile(node.Right); - _instructions.EmitBranch(endLabel, false, true); - _instructions.MarkLabel(elseLabel); - _instructions.EmitLoad(!andAlso); - _instructions.MarkLabel(endLabel); - return; - } - - Debug.Assert(node.Left.Type == typeof(bool?)); - throw new NotImplementedException(); - } - - private void CompileConditionalExpression(Expression expr, bool asVoid) { - var node = (ConditionalExpression)expr; - Compile(node.Test); - - if (node.IfTrue == AstUtils.Empty()) { - var endOfFalse = _instructions.MakeLabel(); - _instructions.EmitBranchTrue(endOfFalse); - Compile(node.IfFalse, asVoid); - _instructions.MarkLabel(endOfFalse); - } else { - var endOfTrue = _instructions.MakeLabel(); - _instructions.EmitBranchFalse(endOfTrue); - Compile(node.IfTrue, asVoid); - - if (node.IfFalse != AstUtils.Empty()) { - var endOfFalse = _instructions.MakeLabel(); - _instructions.EmitBranch(endOfFalse, false, !asVoid); - _instructions.MarkLabel(endOfTrue); - Compile(node.IfFalse, asVoid); - _instructions.MarkLabel(endOfFalse); - } else { - _instructions.MarkLabel(endOfTrue); - } - } - } - - #region Loops - - private void CompileLoopExpression(Expression expr) { - var node = (LoopExpression)expr; - var enterLoop = new EnterLoopInstruction(node, _locals, _compilationThreshold, _instructions.Count); - - PushLabelBlock(LabelScopeKind.Statement); - LabelInfo breakLabel = DefineLabel(node.BreakLabel); - LabelInfo continueLabel = DefineLabel(node.ContinueLabel); - - _instructions.MarkLabel(continueLabel.GetLabel(this)); - - // emit loop body: - _instructions.Emit(enterLoop); - CompileAsVoid(node.Body); - - // emit loop branch: - _instructions.EmitBranch(continueLabel.GetLabel(this), expr.Type != typeof(void), false); - - _instructions.MarkLabel(breakLabel.GetLabel(this)); - - PopLabelBlock(LabelScopeKind.Statement); - - enterLoop.FinishLoop(_instructions.Count); - } - - #endregion - - private void CompileSwitchExpression(Expression expr) { - var node = (SwitchExpression)expr; - - // Currently only supports int test values, with no method - if (node.SwitchValue.Type != typeof(int) || node.Comparison != null) { - throw new NotImplementedException(); - } - - // Test values must be constant - if (!node.Cases.All(c => c.TestValues.All(t => t is ConstantExpression))) { - throw new NotImplementedException(); - } - LabelInfo end = DefineLabel(null); - bool hasValue = node.Type != typeof(void); - - Compile(node.SwitchValue); - var caseDict = new Dictionary(); - int switchIndex = _instructions.Count; - _instructions.EmitSwitch(caseDict); - - if (node.DefaultBody != null) { - Compile(node.DefaultBody); - } else { - Debug.Assert(!hasValue); - } - _instructions.EmitBranch(end.GetLabel(this), false, hasValue); - - for (int i = 0; i < node.Cases.Count; i++) { - var switchCase = node.Cases[i]; - - int caseOffset = _instructions.Count - switchIndex; - foreach (ConstantExpression testValue in switchCase.TestValues) { - caseDict[(int)testValue.Value] = caseOffset; - } - - Compile(switchCase.Body); - - if (i < node.Cases.Count - 1) { - _instructions.EmitBranch(end.GetLabel(this), false, hasValue); - } - } - - _instructions.MarkLabel(end.GetLabel(this)); - } - - private void CompileLabelExpression(Expression expr) { - var node = (LabelExpression)expr; - - // If we're an immediate child of a block, our label will already - // be defined. If not, we need to define our own block so this - // label isn't exposed except to its own child expression. - LabelInfo label = null; - - if (_labelBlock.Kind == LabelScopeKind.Block) { - _labelBlock.TryGetLabelInfo(node.Target, out label); - - // We're in a block but didn't find our label, try switch - if (label == null && _labelBlock.Parent.Kind == LabelScopeKind.Switch) { - _labelBlock.Parent.TryGetLabelInfo(node.Target, out label); - } - - // if we're in a switch or block, we should've found the label - Debug.Assert(label != null); - } - - if (label == null) { - label = DefineLabel(node.Target); - } - - if (node.DefaultValue != null) { - if (node.Target.Type == typeof(void)) { - CompileAsVoid(node.DefaultValue); - } else { - Compile(node.DefaultValue); - } - } - - _instructions.MarkLabel(label.GetLabel(this)); - } - - private void CompileGotoExpression(Expression expr) { - var node = (GotoExpression)expr; - var labelInfo = ReferenceLabel(node.Target); - - if (node.Value != null) { - Compile(node.Value); - } - - _instructions.EmitGoto(labelInfo.GetLabel(this), node.Type != typeof(void), node.Value != null && node.Value.Type != typeof(void)); - } - - public BranchLabel GetBranchLabel(LabelTarget target) { - return ReferenceLabel(target).GetLabel(this); - } - - public void PushLabelBlock(LabelScopeKind type) { - _labelBlock = new LabelScopeInfo(_labelBlock, type); - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "kind")] - public void PopLabelBlock(LabelScopeKind kind) { - Debug.Assert(_labelBlock != null && _labelBlock.Kind == kind); - _labelBlock = _labelBlock.Parent; - } - - private LabelInfo EnsureLabel(LabelTarget node) { - LabelInfo result; - if (!_treeLabels.TryGetValue(node, out result)) { - _treeLabels[node] = result = new LabelInfo(node); - } - return result; - } - - private LabelInfo ReferenceLabel(LabelTarget node) { - LabelInfo result = EnsureLabel(node); - result.Reference(_labelBlock); - return result; - } - - internal LabelInfo DefineLabel(LabelTarget node) { - if (node == null) { - return new LabelInfo(null); - } - LabelInfo result = EnsureLabel(node); - result.Define(_labelBlock); - return result; - } - - private bool TryPushLabelBlock(Expression node) { - // Anything that is "statement-like" -- e.g. has no associated - // stack state can be jumped into, with the exception of try-blocks - // We indicate this by a "Block" - // - // Otherwise, we push an "Expression" to indicate that it can't be - // jumped into - switch (node.NodeType) { - default: - if (_labelBlock.Kind != LabelScopeKind.Expression) { - PushLabelBlock(LabelScopeKind.Expression); - return true; - } - return false; - case ExpressionType.Label: - // LabelExpression is a bit special, if it's directly in a - // block it becomes associate with the block's scope. Same - // thing if it's in a switch case body. - if (_labelBlock.Kind == LabelScopeKind.Block) { - var label = ((LabelExpression)node).Target; - if (_labelBlock.ContainsTarget(label)) { - return false; - } - if (_labelBlock.Parent.Kind == LabelScopeKind.Switch && - _labelBlock.Parent.ContainsTarget(label)) { - return false; - } - } - PushLabelBlock(LabelScopeKind.Statement); - return true; - case ExpressionType.Block: - PushLabelBlock(LabelScopeKind.Block); - // Labels defined immediately in the block are valid for - // the whole block. - if (_labelBlock.Parent.Kind != LabelScopeKind.Switch) { - DefineBlockLabels(node); - } - return true; - case ExpressionType.Switch: - PushLabelBlock(LabelScopeKind.Switch); - // Define labels inside of the switch cases so theyare in - // scope for the whole switch. This allows "goto case" and - // "goto default" to be considered as local jumps. - var @switch = (SwitchExpression)node; - foreach (SwitchCase c in @switch.Cases) { - DefineBlockLabels(c.Body); - } - DefineBlockLabels(@switch.DefaultBody); - return true; - - // Remove this when Convert(Void) goes away. - case ExpressionType.Convert: - if (node.Type != typeof(void)) { - // treat it as an expression - goto default; - } - PushLabelBlock(LabelScopeKind.Statement); - return true; - - case ExpressionType.Conditional: - case ExpressionType.Loop: - case ExpressionType.Goto: - PushLabelBlock(LabelScopeKind.Statement); - return true; - } - } - - private void DefineBlockLabels(Expression node) { - var block = node as BlockExpression; - if (block == null) { - return; - } - - for (int i = 0, n = block.Expressions.Count; i < n; i++) { - Expression e = block.Expressions[i]; - - var label = e as LabelExpression; - if (label != null) { - DefineLabel(label.Target); - } - } - } - - private HybridReferenceDictionary GetBranchMapping() { - var newLabelMapping = new HybridReferenceDictionary(_treeLabels.Count); - foreach (var kvp in _treeLabels) { - newLabelMapping[kvp.Key] = kvp.Value.GetLabel(this); - } - return newLabelMapping; - } - - private void CompileThrowUnaryExpression(Expression expr, bool asVoid) { - var node = (UnaryExpression)expr; - - if (node.Operand == null) { - CompileParameterExpression(_exceptionForRethrowStack.Peek()); - if (asVoid) { - _instructions.EmitRethrowVoid(); - } else { - _instructions.EmitRethrow(); - } - } else { - Compile(node.Operand); - if (asVoid) { - _instructions.EmitThrowVoid(); - } else { - _instructions.EmitThrow(); - } - } - - } - - // TODO: remove (replace by true fault support) - private bool EndsWithRethrow(Expression expr) { - if (expr.NodeType == ExpressionType.Throw) { - var node = (UnaryExpression)expr; - return node.Operand == null; - } - - BlockExpression block = expr as BlockExpression; - if (block != null) { - return EndsWithRethrow(block.Expressions[block.Expressions.Count - 1]); - } - return false; - } - - - // TODO: remove (replace by true fault support) - private void CompileAsVoidRemoveRethrow(Expression expr) { - int stackDepth = _instructions.CurrentStackDepth; - - if (expr.NodeType == ExpressionType.Throw) { - Debug.Assert(((UnaryExpression)expr).Operand == null); - return; - } - - var node = (BlockExpression)expr; - var end = CompileBlockStart(node); - - CompileAsVoidRemoveRethrow(node.Expressions[node.Expressions.Count - 1]); - - Debug.Assert(stackDepth == _instructions.CurrentStackDepth); - - CompileBlockEnd(end); - } - - private void CompileTryExpression(Expression expr) { - var node = (TryExpression)expr; - - BranchLabel end = _instructions.MakeLabel(); - BranchLabel gotoEnd = _instructions.MakeLabel(); - - int tryStart = _instructions.Count; - - BranchLabel startOfFinally = null; - if (node.Finally != null) { - startOfFinally = _instructions.MakeLabel(); - _instructions.EmitEnterTryFinally(startOfFinally); - } - - PushLabelBlock(LabelScopeKind.Try); - Compile(node.Body); - - bool hasValue = node.Body.Type != typeof(void); - int tryEnd = _instructions.Count; - - // handlers jump here: - _instructions.MarkLabel(gotoEnd); - _instructions.EmitGoto(end, hasValue, hasValue); - - // keep the result on the stack: - if (node.Handlers.Count > 0) { - // TODO: emulates faults (replace by true fault support) - if (node.Finally == null && node.Handlers.Count == 1) { - var handler = node.Handlers[0]; - if (handler.Filter == null && handler.Test == typeof(Exception) && handler.Variable == null) { - if (EndsWithRethrow(handler.Body)) { - if (hasValue) { - _instructions.EmitEnterExceptionHandlerNonVoid(); - } else { - _instructions.EmitEnterExceptionHandlerVoid(); - } - - // at this point the stack balance is prepared for the hidden exception variable: - int handlerLabel = _instructions.MarkRuntimeLabel(); - int handlerStart = _instructions.Count; - - CompileAsVoidRemoveRethrow(handler.Body); - _instructions.EmitLeaveFault(hasValue); - _instructions.MarkLabel(end); - - _handlers.Add(new ExceptionHandler(tryStart, tryEnd, handlerLabel, handlerStart, null)); - PopLabelBlock(LabelScopeKind.Try); - return; - } - } - } - - foreach (var handler in node.Handlers) { - PushLabelBlock(LabelScopeKind.Catch); - - if (handler.Filter != null) { - //PushLabelBlock(LabelScopeKind.Filter); - throw new NotImplementedException(); - //PopLabelBlock(LabelScopeKind.Filter); - } - - var parameter = handler.Variable ?? Expression.Parameter(handler.Test); - - var local = _locals.DefineLocal(parameter, _instructions.Count); - _exceptionForRethrowStack.Push(parameter); - - // add a stack balancing nop instruction (exception handling pushes the current exception): - if (hasValue) { - _instructions.EmitEnterExceptionHandlerNonVoid(); - } else { - _instructions.EmitEnterExceptionHandlerVoid(); - } - - // at this point the stack balance is prepared for the hidden exception variable: - int handlerLabel = _instructions.MarkRuntimeLabel(); - int handlerStart = _instructions.Count; - - CompileSetVariable(parameter, true); - Compile(handler.Body); - - _exceptionForRethrowStack.Pop(); - - // keep the value of the body on the stack: - Debug.Assert(hasValue == (handler.Body.Type != typeof(void))); - _instructions.EmitLeaveExceptionHandler(hasValue, gotoEnd); - - _handlers.Add(new ExceptionHandler(tryStart, tryEnd, handlerLabel, handlerStart, handler.Test)); - - PopLabelBlock(LabelScopeKind.Catch); - - _locals.UndefineLocal(local, _instructions.Count); - } - - if (node.Fault != null) { - throw new NotImplementedException(); - } - } - - if (node.Finally != null) { - PushLabelBlock(LabelScopeKind.Finally); - - _instructions.MarkLabel(startOfFinally); - _instructions.EmitEnterFinally(); - CompileAsVoid(node.Finally); - _instructions.EmitLeaveFinally(); - - PopLabelBlock(LabelScopeKind.Finally); - } - - _instructions.MarkLabel(end); - - PopLabelBlock(LabelScopeKind.Try); - } - - private void CompileDynamicExpression(Expression expr) { - var node = (DynamicExpression)expr; - - foreach (var arg in node.Arguments) { - Compile(arg); - } - - _instructions.EmitDynamic(node.DelegateType, node.Binder); - } - - private void CompileMethodCallExpression(Expression expr) { - var node = (MethodCallExpression)expr; - - var parameters = node.Method.GetParameters(); - - // TODO: - // Support pass by reference. - // Note that LoopCompiler needs to be updated too. - - // force compilation for now for ref types - // also could be a mutable value type, Delegate.CreateDelegate and MethodInfo.Invoke both can't handle this, we - // need to generate code. - if (!CollectionUtils.TrueForAll(parameters, (p) => !p.ParameterType.IsByRef) || - (!node.Method.IsStatic && node.Method.DeclaringType.IsValueType && node.Method.DeclaringType.Assembly != typeof (object).Assembly)) { -#if MONO_INTERPRETER - throw new NotImplementedException ("Interpreter of ref types"); -#else - _forceCompile = true; -#endif - } - - // CF bug workaround - // TODO: can we do better if the delegate targets LightLambda.Run* method? - if (PlatformAdaptationLayer.IsCompactFramework && - node.Method.Name == "Invoke" && typeof(Delegate).IsAssignableFrom(node.Object.Type) && !node.Method.IsStatic) { - - Compile( - AstUtils.Convert( - Expression.Call( - node.Object, - node.Object.Type.GetMethod("DynamicInvoke"), - Expression.NewArrayInit(typeof(object), node.Arguments.Map((e) => AstUtils.Convert(e, typeof(object)))) - ), - node.Type - ) - ); - - } else { - if (!node.Method.IsStatic) { - Compile(node.Object); - } - - foreach (var arg in node.Arguments) { - Compile(arg); - } - - EmitCall(node.Method, parameters); - } - } - - public void EmitCall(MethodInfo method) { - EmitCall(method, method.GetParameters()); - } - - public void EmitCall(MethodInfo method, ParameterInfo[] parameters) { - Instruction instruction; - - try { - instruction = CallInstruction.Create(method, parameters); - } catch (SecurityException) { - _forceCompile = true; - - _instructions.Emit(new PopNInstruction((method.IsStatic ? 0 : 1) + parameters.Length)); - if (method.ReturnType != typeof(void)) { - _instructions.EmitLoad(null); - } - - return; - } - - _instructions.Emit(instruction); - } - - private void CompileNewExpression(Expression expr) { - var node = (NewExpression)expr; - - if (node.Constructor != null) { - var parameters = node.Constructor.GetParameters(); - if (!CollectionUtils.TrueForAll(parameters, (p) => !p.ParameterType.IsByRef) -#if FEATURE_LCG - || node.Constructor.DeclaringType == typeof(DynamicMethod) -#endif - ) { - _forceCompile = true; - } - } - - if (node.Constructor != null) { - foreach (var arg in node.Arguments) { - this.Compile(arg); - } - _instructions.EmitNew(node.Constructor); - } else { - Debug.Assert(expr.Type.IsValueType()); - _instructions.EmitDefaultValue(node.Type); - } - } - - private void CompileMemberExpression(Expression expr) { - var node = (MemberExpression)expr; - - var member = node.Member; - FieldInfo fi = member as FieldInfo; - if (fi != null) { - if (fi.IsLiteral) { - _instructions.EmitLoad(fi.GetRawConstantValue(), fi.FieldType); - } else if (fi.IsStatic) { - if (fi.IsInitOnly) { - _instructions.EmitLoad(fi.GetValue(null), fi.FieldType); - } else { - _instructions.EmitLoadField(fi); - } - } else { - Compile(node.Expression); - _instructions.EmitLoadField(fi); - } - return; - } - - PropertyInfo pi = member as PropertyInfo; - if (pi != null) { - var method = pi.GetGetMethod(true); - if (node.Expression != null) { - Compile(node.Expression); - } - EmitCall(method); - return; - } - - - throw new System.NotImplementedException(); - } - - private void CompileNewArrayExpression(Expression expr) { - var node = (NewArrayExpression)expr; - - foreach (var arg in node.Expressions) { - Compile(arg); - } - - Type elementType = node.Type.GetElementType(); - int rank = node.Expressions.Count; - - if (node.NodeType == ExpressionType.NewArrayInit) { - _instructions.EmitNewArrayInit(elementType, rank); - } else if (node.NodeType == ExpressionType.NewArrayBounds) { - if (rank == 1) { - _instructions.EmitNewArray(elementType); - } else { - _instructions.EmitNewArrayBounds(elementType, rank); - } - } else { - throw new System.NotImplementedException(); - } - } - - private void CompileExtensionExpression(Expression expr) { - var instructionProvider = expr as IInstructionProvider; - if (instructionProvider != null) { - instructionProvider.AddInstructions(this); - return; - } - - if (expr.CanReduce) { - Compile(expr.Reduce()); - } else { - throw new System.NotImplementedException(); - } - } - - - private void CompileDebugInfoExpression(Expression expr) { - var node = (DebugInfoExpression)expr; - int start = _instructions.Count; - var info = new DebugInfo() - { - Index = start, - FileName = node.Document.FileName, - StartLine = node.StartLine, - EndLine = node.EndLine, - IsClear = node.IsClear - }; - _debugInfos.Add(info); - } - - private void CompileRuntimeVariablesExpression(Expression expr) { - // Generates IRuntimeVariables for all requested variables - var node = (RuntimeVariablesExpression)expr; - foreach (var variable in node.Variables) { - EnsureAvailableForClosure(variable); - CompileGetBoxedVariable(variable); - } - - _instructions.EmitNewRuntimeVariables(node.Variables.Count); - } - - - private void CompileLambdaExpression(Expression expr) { - var node = (LambdaExpression)expr; - var compiler = new LightCompiler(this); - var creator = compiler.CompileTop(node); - - if (compiler._locals.ClosureVariables != null) { - foreach (ParameterExpression variable in compiler._locals.ClosureVariables.Keys) { - CompileGetBoxedVariable(variable); - } - } - _instructions.EmitCreateDelegate(creator); - } - - private void CompileQuotedLambdaExpression(Expression expr) { - _instructions.EmitStore (expr); - } - - private void CompileCoalesceBinaryExpression(Expression expr) { - var node = (BinaryExpression)expr; - - if (TypeUtils.IsNullableType(node.Left.Type)) { - throw new NotImplementedException(); - } else if (node.Conversion != null) { - throw new NotImplementedException(); - } else { - var leftNotNull = _instructions.MakeLabel(); - Compile(node.Left); - _instructions.EmitCoalescingBranch(leftNotNull); - _instructions.EmitPop(); - Compile(node.Right); - _instructions.MarkLabel(leftNotNull); - } - } - - private void CompileInvocationExpression(Expression expr) { - var node = (InvocationExpression)expr; - - // TODO: LambdaOperand optimization (see compiler) - if (typeof(LambdaExpression).IsAssignableFrom(node.Expression.Type)) { - throw new System.NotImplementedException(); - } - - // TODO: do not create a new Call Expression - if (PlatformAdaptationLayer.IsCompactFramework) { - // Workaround for a bug in Compact Framework - Compile( - AstUtils.Convert( - Expression.Call( - node.Expression, - node.Expression.Type.GetMethod("DynamicInvoke"), - Expression.NewArrayInit(typeof(object), node.Arguments.Map((e) => AstUtils.Convert(e, typeof(object)))) - ), - node.Type - ) - ); - } else { - CompileMethodCallExpression(Expression.Call(node.Expression, node.Expression.Type.GetMethod("Invoke"), node.Arguments)); - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "expr")] - private void CompileListInitExpression(Expression expr) { - throw new System.NotImplementedException(); - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "expr")] - private void CompileMemberInitExpression(Expression expr) { - throw new System.NotImplementedException(); - } - - private void CompileQuoteUnaryExpression(Expression expr) { - var qe = (UnaryExpression)expr; - CompileQuotedLambdaExpression (qe.Operand); - } - - private void CompileUnboxUnaryExpression(Expression expr) { - var node = (UnaryExpression)expr; - // unboxing is a nop: - Compile(node.Operand); - } - - private void CompileTypeEqualExpression(Expression expr) { - Debug.Assert(expr.NodeType == ExpressionType.TypeEqual); - var node = (TypeBinaryExpression)expr; - - Compile(node.Expression); - _instructions.EmitLoad(node.TypeOperand); - _instructions.EmitTypeEquals(); - } - - private void CompileTypeAsExpression(UnaryExpression node) { - Compile(node.Operand); - _instructions.EmitTypeAs(node.Type); - } - - private void CompileTypeIsExpression(Expression expr) { - Debug.Assert(expr.NodeType == ExpressionType.TypeIs); - var node = (TypeBinaryExpression)expr; - - Compile(node.Expression); - if (node.Expression.Type == typeof (void)) { - _instructions.Emit (InstructionFactory.Factory.DefaultValue ()); - return; - } - - // use TypeEqual for sealed types: - if (node.TypeOperand.IsSealed()) { - _instructions.EmitLoad(node.TypeOperand); - _instructions.EmitTypeEquals(); - } else { - _instructions.EmitTypeIs(node.TypeOperand); - } - } - - private void CompileReducibleExpression(Expression expr) { - switch (expr.NodeType) { - case ExpressionType.PreIncrementAssign: - _instructions.EmitIncrement (expr.Type); - break; - default: - throw Assert.Unreachable; - } - } - - internal void Compile(Expression expr, bool asVoid) { - if (asVoid) { - CompileAsVoid(expr); - } else { - Compile(expr); - } - } - - internal void CompileAsVoid(Expression expr) { - bool pushLabelBlock = TryPushLabelBlock(expr); - int startingStackDepth = _instructions.CurrentStackDepth; - switch (expr.NodeType) { - case ExpressionType.Assign: - CompileAssignBinaryExpression(expr, true); - break; - - case ExpressionType.Block: - CompileBlockExpression(expr, true); - break; - - case ExpressionType.Throw: - CompileThrowUnaryExpression(expr, true); - break; - - case ExpressionType.Constant: - case ExpressionType.Default: - case ExpressionType.Parameter: - // no-op - break; - - default: - CompileNoLabelPush(expr); - if (expr.Type != typeof(void)) { - _instructions.EmitPop(); - } - break; - } - Debug.Assert(_instructions.CurrentStackDepth == startingStackDepth); - if (pushLabelBlock) { - PopLabelBlock(_labelBlock.Kind); - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void CompileNoLabelPush(Expression expr) { - int startingStackDepth = _instructions.CurrentStackDepth; - switch (expr.NodeType) { - case ExpressionType.Add: CompileBinaryExpression(expr); break; - case ExpressionType.AddChecked: CompileBinaryExpression(expr); break; - case ExpressionType.And: CompileBinaryExpression(expr); break; - case ExpressionType.AndAlso: CompileAndAlsoBinaryExpression(expr); break; - case ExpressionType.ArrayLength: CompileUnaryExpression(expr); break; - case ExpressionType.ArrayIndex: CompileBinaryExpression(expr); break; - case ExpressionType.Call: CompileMethodCallExpression(expr); break; - case ExpressionType.Coalesce: CompileCoalesceBinaryExpression(expr); break; - case ExpressionType.Conditional: CompileConditionalExpression(expr, expr.Type == typeof(void)); break; - case ExpressionType.Constant: CompileConstantExpression(expr); break; - case ExpressionType.Convert: CompileConvertUnaryExpression(expr); break; - case ExpressionType.ConvertChecked: CompileConvertUnaryExpression(expr); break; - case ExpressionType.Divide: CompileBinaryExpression(expr); break; - case ExpressionType.Equal: CompileBinaryExpression(expr); break; - case ExpressionType.ExclusiveOr: CompileBinaryExpression(expr); break; - case ExpressionType.GreaterThan: CompileBinaryExpression(expr); break; - case ExpressionType.GreaterThanOrEqual: CompileBinaryExpression(expr); break; - case ExpressionType.Invoke: CompileInvocationExpression(expr); break; - case ExpressionType.Lambda: CompileLambdaExpression(expr); break; - case ExpressionType.LeftShift: CompileBinaryExpression(expr); break; - case ExpressionType.LessThan: CompileBinaryExpression(expr); break; - case ExpressionType.LessThanOrEqual: CompileBinaryExpression(expr); break; - case ExpressionType.ListInit: CompileListInitExpression(expr); break; - case ExpressionType.MemberAccess: CompileMemberExpression(expr); break; - case ExpressionType.MemberInit: CompileMemberInitExpression(expr); break; - case ExpressionType.Modulo: CompileBinaryExpression(expr); break; - case ExpressionType.Multiply: CompileBinaryExpression(expr); break; - case ExpressionType.MultiplyChecked: CompileBinaryExpression(expr); break; - case ExpressionType.Negate: CompileUnaryExpression(expr); break; - case ExpressionType.UnaryPlus: CompileUnaryExpression(expr); break; - case ExpressionType.NegateChecked: CompileUnaryExpression(expr); break; - case ExpressionType.New: CompileNewExpression(expr); break; - case ExpressionType.NewArrayInit: CompileNewArrayExpression(expr); break; - case ExpressionType.NewArrayBounds: CompileNewArrayExpression(expr); break; - case ExpressionType.Not: CompileUnaryExpression(expr); break; - case ExpressionType.NotEqual: CompileBinaryExpression(expr); break; - case ExpressionType.Or: CompileBinaryExpression(expr); break; - case ExpressionType.OrElse: CompileOrElseBinaryExpression(expr); break; - case ExpressionType.Parameter: CompileParameterExpression(expr); break; - case ExpressionType.Power: CompileBinaryExpression(expr); break; - case ExpressionType.Quote: CompileQuoteUnaryExpression(expr); break; - case ExpressionType.RightShift: CompileBinaryExpression(expr); break; - case ExpressionType.Subtract: CompileBinaryExpression(expr); break; - case ExpressionType.SubtractChecked: CompileBinaryExpression(expr); break; - case ExpressionType.TypeAs: CompileUnaryExpression(expr); break; - case ExpressionType.TypeIs: CompileTypeIsExpression(expr); break; - case ExpressionType.Assign: CompileAssignBinaryExpression(expr, expr.Type == typeof(void)); break; - case ExpressionType.Block: CompileBlockExpression(expr, expr.Type == typeof(void)); break; - case ExpressionType.DebugInfo: CompileDebugInfoExpression(expr); break; - case ExpressionType.Decrement: CompileUnaryExpression(expr); break; - case ExpressionType.Dynamic: CompileDynamicExpression(expr); break; - case ExpressionType.Default: CompileDefaultExpression(expr); break; - case ExpressionType.Extension: CompileExtensionExpression(expr); break; - case ExpressionType.Goto: CompileGotoExpression(expr); break; - case ExpressionType.Increment: CompileUnaryExpression(expr); break; - case ExpressionType.Index: CompileIndexExpression(expr); break; - case ExpressionType.Label: CompileLabelExpression(expr); break; - case ExpressionType.RuntimeVariables: CompileRuntimeVariablesExpression(expr); break; - case ExpressionType.Loop: CompileLoopExpression(expr); break; - case ExpressionType.Switch: CompileSwitchExpression(expr); break; - case ExpressionType.Throw: CompileThrowUnaryExpression(expr, expr.Type == typeof(void)); break; - case ExpressionType.Try: CompileTryExpression(expr); break; - case ExpressionType.Unbox: CompileUnboxUnaryExpression(expr); break; - case ExpressionType.TypeEqual: CompileTypeEqualExpression(expr); break; - case ExpressionType.OnesComplement: CompileUnaryExpression(expr); break; - case ExpressionType.IsTrue: CompileUnaryExpression(expr); break; - case ExpressionType.IsFalse: CompileUnaryExpression(expr); break; - case ExpressionType.AddAssign: - case ExpressionType.AndAssign: - case ExpressionType.DivideAssign: - case ExpressionType.ExclusiveOrAssign: - case ExpressionType.LeftShiftAssign: - case ExpressionType.ModuloAssign: - case ExpressionType.MultiplyAssign: - case ExpressionType.OrAssign: - case ExpressionType.PowerAssign: - case ExpressionType.RightShiftAssign: - case ExpressionType.SubtractAssign: - case ExpressionType.AddAssignChecked: - case ExpressionType.MultiplyAssignChecked: - case ExpressionType.SubtractAssignChecked: - case ExpressionType.PreIncrementAssign: - case ExpressionType.PreDecrementAssign: - case ExpressionType.PostIncrementAssign: - case ExpressionType.PostDecrementAssign: - CompileReducibleExpression(expr); break; - default: throw Assert.Unreachable; - }; - Debug.Assert(_instructions.CurrentStackDepth == startingStackDepth + (expr.Type == typeof(void) ? 0 : 1)); - } - - public void Compile(Expression expr) { - bool pushLabelBlock = TryPushLabelBlock(expr); - CompileNoLabelPush(expr); - if (pushLabelBlock) { - PopLabelBlock(_labelBlock.Kind); - } - } - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightDelegateCreator.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightDelegateCreator.cs deleted file mode 100644 index c636a17050d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightDelegateCreator.cs +++ /dev/null @@ -1,198 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -using Microsoft.Scripting.Ast; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using System.Threading; -using Microsoft.Scripting.Generation; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - - /// - /// Manages creation of interpreted delegates. These delegates will get - /// compiled if they are executed often enough. - /// - internal sealed class LightDelegateCreator { - // null if we are forced to compile - private readonly Interpreter _interpreter; - private readonly Expression _lambda; - -#if !MONO_INTERPRETER - // Adaptive compilation support: - private Type _compiledDelegateType; - private Delegate _compiled; - private readonly object _compileLock = new object(); -#endif - internal LightDelegateCreator(Interpreter interpreter, LambdaExpression lambda) { - Assert.NotNull(lambda); - _interpreter = interpreter; - _lambda = lambda; - } - - internal LightDelegateCreator(Interpreter interpreter, LightLambdaExpression lambda) { - Assert.NotNull(lambda); - _interpreter = interpreter; - _lambda = lambda; - } - - internal Interpreter Interpreter { - get { return _interpreter; } - } - - private bool HasClosure { - get { return _interpreter != null && _interpreter.ClosureSize > 0; } - } -#if !MONO_INTERPRETER - internal bool HasCompiled { - get { return _compiled != null; } - } - - /// - /// true if the compiled delegate has the same type as the lambda; - /// false if the type was changed for interpretation. - /// - internal bool SameDelegateType { - get { return _compiledDelegateType == DelegateType; } - } -#endif - internal Delegate CreateDelegate() { - return CreateDelegate(null); - } - - internal Delegate CreateDelegate(StrongBox[] closure) { -#if !MONO_INTERPRETER - if (_compiled != null) { - // If the delegate type we want is not a Func/Action, we can't - // use the compiled code directly. So instead just fall through - // and create an interpreted LightLambda, which will pick up - // the compiled delegate on its first run. - // - // Ideally, we would just rebind the compiled delegate using - // Delegate.CreateDelegate. Unfortunately, it doesn't work on - // dynamic methods. - if (SameDelegateType) { - return CreateCompiledDelegate(closure); - } - } - - if (_interpreter == null) { - // We can't interpret, so force a compile - Compile(null); - Delegate compiled = CreateCompiledDelegate(closure); - Debug.Assert(compiled.GetType() == DelegateType); - return compiled; - } -#endif - // Otherwise, we'll create an interpreted LightLambda - return new LightLambda(this, closure, _interpreter._compilationThreshold).MakeDelegate(DelegateType); - } - - private Type DelegateType { - get { - LambdaExpression le = _lambda as LambdaExpression; - if (le != null) { - return le.Type; - } - - return ((LightLambdaExpression)_lambda).Type; - } - } - -#if !MONO_INTERPRETER - /// - /// Used by LightLambda to get the compiled delegate. - /// - internal Delegate CreateCompiledDelegate(StrongBox[] closure) { - Debug.Assert(HasClosure == (closure != null)); - - if (HasClosure) { - // We need to apply the closure to get the actual delegate. - var applyClosure = (Func[], Delegate>)_compiled; - return applyClosure(closure); - } - return _compiled; - } - - /// - /// Create a compiled delegate for the LightLambda, and saves it so - /// future calls to Run will execute the compiled code instead of - /// interpreting. - /// - internal void Compile(object state) { - if (_compiled != null) { - return; - } - - // Compilation is expensive, we only want to do it once. - lock (_compileLock) { - if (_compiled != null) { - return; - } - - PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Interpreted lambda compiled"); - - // Interpreter needs a standard delegate type. - // So change the lambda's delegate type to Func<...> or - // Action<...> so it can be called from the LightLambda.Run - // methods. - LambdaExpression lambda = (_lambda as LambdaExpression) ?? (LambdaExpression)((LightLambdaExpression)_lambda).Reduce(); - if (_interpreter != null) { - _compiledDelegateType = GetFuncOrAction(lambda); - lambda = Expression.Lambda(_compiledDelegateType, lambda.Body, lambda.Name, lambda.Parameters); - } - - if (HasClosure) { - _compiled = LightLambdaClosureVisitor.BindLambda(lambda, _interpreter.ClosureVariables); - } else { - _compiled = lambda.Compile(); - } - } - } - - private static Type GetFuncOrAction(LambdaExpression lambda) { - Type delegateType; - bool isVoid = lambda.ReturnType == typeof(void); - - if (isVoid && lambda.Parameters.Count == 2 && - lambda.Parameters[0].IsByRef && lambda.Parameters[1].IsByRef) { - return typeof(ActionRef<,>).MakeGenericType(lambda.Parameters.Map(p => p.Type)); - } else { - Type[] types = lambda.Parameters.Map(p => p.IsByRef ? p.Type.MakeByRefType() : p.Type); - if (isVoid) { - if (Expression.TryGetActionType(types, out delegateType)) { - return delegateType; - } - } else { - types = types.AddLast(lambda.ReturnType); - if (Expression.TryGetFuncType(types, out delegateType)) { - return delegateType; - } - } - return lambda.Type; - } - } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambda.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambda.Generated.cs deleted file mode 100644 index 1c376ff6f2c..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambda.Generated.cs +++ /dev/null @@ -1,756 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - - -using System; -using System.Runtime.CompilerServices; -using System.Reflection; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - public partial class LightLambda { - #region Generated LightLambda Run Methods - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_run_methods from: generate_dynamic_instructions.py - - internal const int MaxParameters = 16; - internal TRet Run0() { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(); - } -#endif - var frame = MakeFrame(); - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid0() { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(); - return; - } -#endif - var frame = MakeFrame(); - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun0(LightLambda lambda) { - return new Func(lambda.Run0); - } - internal static Delegate MakeRunVoid0(LightLambda lambda) { - return new Action(lambda.RunVoid0); - } - internal TRet Run1(T0 arg0) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid1(T0 arg0) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun1(LightLambda lambda) { - return new Func(lambda.Run1); - } - internal static Delegate MakeRunVoid1(LightLambda lambda) { - return new Action(lambda.RunVoid1); - } - internal TRet Run2(T0 arg0,T1 arg1) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid2(T0 arg0,T1 arg1) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun2(LightLambda lambda) { - return new Func(lambda.Run2); - } - internal static Delegate MakeRunVoid2(LightLambda lambda) { - return new Action(lambda.RunVoid2); - } - internal TRet Run3(T0 arg0,T1 arg1,T2 arg2) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid3(T0 arg0,T1 arg1,T2 arg2) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun3(LightLambda lambda) { - return new Func(lambda.Run3); - } - internal static Delegate MakeRunVoid3(LightLambda lambda) { - return new Action(lambda.RunVoid3); - } - internal TRet Run4(T0 arg0,T1 arg1,T2 arg2,T3 arg3) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid4(T0 arg0,T1 arg1,T2 arg2,T3 arg3) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun4(LightLambda lambda) { - return new Func(lambda.Run4); - } - internal static Delegate MakeRunVoid4(LightLambda lambda) { - return new Action(lambda.RunVoid4); - } - internal TRet Run5(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid5(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun5(LightLambda lambda) { - return new Func(lambda.Run5); - } - internal static Delegate MakeRunVoid5(LightLambda lambda) { - return new Action(lambda.RunVoid5); - } - internal TRet Run6(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid6(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun6(LightLambda lambda) { - return new Func(lambda.Run6); - } - internal static Delegate MakeRunVoid6(LightLambda lambda) { - return new Action(lambda.RunVoid6); - } - internal TRet Run7(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid7(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun7(LightLambda lambda) { - return new Func(lambda.Run7); - } - internal static Delegate MakeRunVoid7(LightLambda lambda) { - return new Action(lambda.RunVoid7); - } - internal TRet Run8(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid8(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun8(LightLambda lambda) { - return new Func(lambda.Run8); - } - internal static Delegate MakeRunVoid8(LightLambda lambda) { - return new Action(lambda.RunVoid8); - } - internal TRet Run9(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid9(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun9(LightLambda lambda) { - return new Func(lambda.Run9); - } - internal static Delegate MakeRunVoid9(LightLambda lambda) { - return new Action(lambda.RunVoid9); - } - internal TRet Run10(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid10(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun10(LightLambda lambda) { - return new Func(lambda.Run10); - } - internal static Delegate MakeRunVoid10(LightLambda lambda) { - return new Action(lambda.RunVoid10); - } - internal TRet Run11(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid11(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun11(LightLambda lambda) { - return new Func(lambda.Run11); - } - internal static Delegate MakeRunVoid11(LightLambda lambda) { - return new Action(lambda.RunVoid11); - } - internal TRet Run12(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - frame.Data[11] = arg11; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid12(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - frame.Data[11] = arg11; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun12(LightLambda lambda) { - return new Func(lambda.Run12); - } - internal static Delegate MakeRunVoid12(LightLambda lambda) { - return new Action(lambda.RunVoid12); - } - internal TRet Run13(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - frame.Data[11] = arg11; - frame.Data[12] = arg12; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid13(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - frame.Data[11] = arg11; - frame.Data[12] = arg12; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun13(LightLambda lambda) { - return new Func(lambda.Run13); - } - internal static Delegate MakeRunVoid13(LightLambda lambda) { - return new Action(lambda.RunVoid13); - } - internal TRet Run14(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - frame.Data[11] = arg11; - frame.Data[12] = arg12; - frame.Data[13] = arg13; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid14(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - frame.Data[11] = arg11; - frame.Data[12] = arg12; - frame.Data[13] = arg13; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun14(LightLambda lambda) { - return new Func(lambda.Run14); - } - internal static Delegate MakeRunVoid14(LightLambda lambda) { - return new Action(lambda.RunVoid14); - } - internal TRet Run15(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13,T14 arg14) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - return ((Func)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - frame.Data[11] = arg11; - frame.Data[12] = arg12; - frame.Data[13] = arg13; - frame.Data[14] = arg14; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - return (TRet)frame.Pop(); - } - - internal void RunVoid15(T0 arg0,T1 arg1,T2 arg2,T3 arg3,T4 arg4,T5 arg5,T6 arg6,T7 arg7,T8 arg8,T9 arg9,T10 arg10,T11 arg11,T12 arg12,T13 arg13,T14 arg14) { -#if !MONO_INTERPRETER - if (_compiled != null || TryGetCompiled()) { - ((Action)_compiled)(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); - return; - } -#endif - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - frame.Data[2] = arg2; - frame.Data[3] = arg3; - frame.Data[4] = arg4; - frame.Data[5] = arg5; - frame.Data[6] = arg6; - frame.Data[7] = arg7; - frame.Data[8] = arg8; - frame.Data[9] = arg9; - frame.Data[10] = arg10; - frame.Data[11] = arg11; - frame.Data[12] = arg12; - frame.Data[13] = arg13; - frame.Data[14] = arg14; - var current = frame.Enter(); - try { _interpreter.Run(frame); } finally { frame.Leave(current); } - } - - internal static Delegate MakeRun15(LightLambda lambda) { - return new Func(lambda.Run15); - } - internal static Delegate MakeRunVoid15(LightLambda lambda) { - return new Action(lambda.RunVoid15); - } - - // *** END GENERATED CODE *** - - #endregion - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambda.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambda.cs deleted file mode 100644 index bc9e01ee46a..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambda.cs +++ /dev/null @@ -1,280 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_TASKS -using System.Threading.Tasks; -#endif - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Reflection; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif -using System.Runtime.CompilerServices; -using System.Security; -using System.Threading; - -using Microsoft.Scripting.Generation; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -using AstUtils = Microsoft.Scripting.Ast.Utils; - -namespace Microsoft.Scripting.Interpreter { - - public sealed class LightLambdaCompileEventArgs : EventArgs { - public Delegate Compiled { get; private set; } - - internal LightLambdaCompileEventArgs(Delegate compiled) { - Compiled = compiled; - } - } - - public partial class LightLambda { - private readonly StrongBox[] _closure; - private readonly Interpreter _interpreter; - private static readonly CacheDict> _runCache = new CacheDict>(100); - - // Adaptive compilation support - private readonly LightDelegateCreator _delegateCreator; -#if MONO_INTERPRETER - const Delegate _compiled = null; -#else - private Delegate _compiled; -#endif - private int _compilationThreshold; - -#if !MONO_INTERPRETER - /// - /// Provides notification that the LightLambda has been compiled. - /// - public event EventHandler Compile; -#endif - - internal LightLambda(LightDelegateCreator delegateCreator, StrongBox[] closure, int compilationThreshold) { - _delegateCreator = delegateCreator; - _closure = closure; - _interpreter = delegateCreator.Interpreter; - _compilationThreshold = compilationThreshold; - } - - private static Func GetRunDelegateCtor(Type delegateType) { - lock (_runCache) { - Func fastCtor; - if (_runCache.TryGetValue(delegateType, out fastCtor)) { - return fastCtor; - } - return MakeRunDelegateCtor(delegateType); - } - } - - private static Func MakeRunDelegateCtor(Type delegateType) { - var method = delegateType.GetMethod("Invoke"); - var paramInfos = method.GetParameters(); - Type[] paramTypes; - string name = "Run"; - - if (paramInfos.Length >= MaxParameters) { - return null; - } - - if (method.ReturnType == typeof(void)) { - name += "Void"; - paramTypes = new Type[paramInfos.Length]; - } else { - paramTypes = new Type[paramInfos.Length + 1]; - paramTypes[paramTypes.Length - 1] = method.ReturnType; - } - - MethodInfo runMethod; - - if (method.ReturnType == typeof(void) && paramTypes.Length == 2 && - paramInfos[0].ParameterType.IsByRef && paramInfos[1].ParameterType.IsByRef) { - runMethod = typeof(LightLambda).GetMethod("RunVoidRef2", BindingFlags.NonPublic | BindingFlags.Instance); - paramTypes[0] = paramInfos[0].ParameterType.GetElementType(); - paramTypes[1] = paramInfos[1].ParameterType.GetElementType(); - } else if (method.ReturnType == typeof(void) && paramTypes.Length == 0) { - runMethod = typeof(LightLambda).GetMethod("RunVoid0", BindingFlags.NonPublic | BindingFlags.Instance); - } else { - for (int i = 0; i < paramInfos.Length; i++) { - paramTypes[i] = paramInfos[i].ParameterType; - if (paramTypes[i].IsByRef) { - return null; - } - } - - if (DelegateHelpers.MakeDelegate(paramTypes) == delegateType) { - name = "Make" + name + paramInfos.Length; - - MethodInfo ctorMethod = typeof(LightLambda).GetMethod(name, BindingFlags.NonPublic | BindingFlags.Static).MakeGenericMethod(paramTypes); - return _runCache[delegateType] = (Func)ctorMethod.CreateDelegate(typeof(Func)); - } - - runMethod = typeof(LightLambda).GetMethod(name + paramInfos.Length, BindingFlags.NonPublic | BindingFlags.Instance); - } - -#if FEATURE_LCG && !SILVERLIGHT && !WP75 - try { - DynamicMethod dm = new DynamicMethod("FastCtor", typeof(Delegate), new[] { typeof(LightLambda) }, typeof(LightLambda), true); - var ilgen = dm.GetILGenerator(); - ilgen.Emit(OpCodes.Ldarg_0); - ilgen.Emit(OpCodes.Ldftn, runMethod.IsGenericMethodDefinition ? runMethod.MakeGenericMethod(paramTypes) : runMethod); - ilgen.Emit(OpCodes.Newobj, delegateType.GetConstructor(new[] { typeof(object), typeof(IntPtr) })); - ilgen.Emit(OpCodes.Ret); - return _runCache[delegateType] = (Func)dm.CreateDelegate(typeof(Func)); - } catch (SecurityException) { - } -#endif - - // we don't have permission for restricted skip visibility dynamic methods, use the slower Delegate.CreateDelegate. - var targetMethod = runMethod.IsGenericMethodDefinition ? runMethod.MakeGenericMethod(paramTypes) : runMethod; - return _runCache[delegateType] = lambda => targetMethod.CreateDelegate(delegateType, lambda); - } - - //TODO enable sharing of these custom delegates - private Delegate CreateCustomDelegate(Type delegateType) { - PerfTrack.NoteEvent(PerfTrack.Categories.Compiler, "Synchronously compiling a custom delegate"); - - var method = delegateType.GetMethod("Invoke"); - var paramInfos = method.GetParameters(); - var parameters = new ParameterExpression[paramInfos.Length]; - var parametersAsObject = new Expression[paramInfos.Length]; - for (int i = 0; i < paramInfos.Length; i++) { - ParameterExpression parameter = Expression.Parameter(paramInfos[i].ParameterType, paramInfos[i].Name); - parameters[i] = parameter; - parametersAsObject[i] = Expression.Convert(parameter, typeof(object)); - } - - var data = Expression.NewArrayInit(typeof(object), parametersAsObject); - var self = AstUtils.Constant(this); - var runMethod = typeof(LightLambda).GetMethod("Run"); - var body = Expression.Convert(Expression.Call(self, runMethod, data), method.ReturnType); - var lambda = Expression.Lambda(delegateType, body, parameters); - return lambda.Compile(); - } - - internal Delegate MakeDelegate(Type delegateType) { - Func fastCtor = GetRunDelegateCtor(delegateType); - if (fastCtor != null) { - return fastCtor(this); - } else { - return CreateCustomDelegate(delegateType); - } - } - - private bool TryGetCompiled() { -#if !MONO_INTERPRETER - // Use the compiled delegate if available. - if (_delegateCreator.HasCompiled) { - _compiled = _delegateCreator.CreateCompiledDelegate(_closure); - - // Send it to anyone who's interested. - var compileEvent = Compile; - if (compileEvent != null && _delegateCreator.SameDelegateType) { - compileEvent(this, new LightLambdaCompileEventArgs(_compiled)); - } - - return true; - } - - // Don't lock here, it's a frequently hit path. - // - // There could be multiple threads racing, but that is okay. - // Two bad things can happen: - // * We miss decrements (some thread sets the counter forward) - // * We might enter the "if" branch more than once. - // - // The first is okay, it just means we take longer to compile. - // The second we explicitly guard against inside of Compile(). - // - // We can't miss 0. The first thread that writes -1 must have read 0 and hence start compilation. - if (unchecked(_compilationThreshold--) == 0) { -#if SILVERLIGHT - if (PlatformAdaptationLayer.IsCompactFramework) { - _compilationThreshold = Int32.MaxValue; - return false; - } -#endif - if (_interpreter.CompileSynchronously) { - _delegateCreator.Compile(null); - return TryGetCompiled(); - } else { - // Kick off the compile on another thread so this one can keep going -#if FEATURE_TASKS - new Task(_delegateCreator.Compile, null).Start(); -#else - ThreadPool.QueueUserWorkItem(_delegateCreator.Compile, null); -#endif - } - } -#endif - return false; - } - - private InterpretedFrame MakeFrame() { - return new InterpretedFrame(_interpreter, _closure); - } - - internal void RunVoidRef2(ref T0 arg0, ref T1 arg1) { - if (_compiled != null || TryGetCompiled()) { - ((ActionRef)_compiled)(ref arg0, ref arg1); - return; - } - - // copy in and copy out for today... - var frame = MakeFrame(); - frame.Data[0] = arg0; - frame.Data[1] = arg1; - var currentFrame = frame.Enter(); - try { - _interpreter.Run(frame); - } finally { - frame.Leave(currentFrame); - arg0 = (T0)frame.Data[0]; - arg1 = (T1)frame.Data[1]; - } - } - -#if !MONO_INTERPRETER - public object Run(params object[] arguments) { - if (_compiled != null || TryGetCompiled()) { - try { - return _compiled.DynamicInvoke(arguments); - } catch (TargetInvocationException e) { - throw ExceptionHelpers.UpdateForRethrow(e.InnerException); - } - } - - var frame = MakeFrame(); - for (int i = 0; i < arguments.Length; i++) { - frame.Data[i] = arguments[i]; - } - var currentFrame = frame.Enter(); - try { - _interpreter.Run(frame); - } finally { - frame.Leave(currentFrame); - } - return frame.Pop(); - } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambdaClosureVisitor.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambdaClosureVisitor.cs deleted file mode 100644 index e779e414855..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LightLambdaClosureVisitor.cs +++ /dev/null @@ -1,260 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Utils; -using AstUtils = Microsoft.Scripting.Ast.Utils; - -namespace Microsoft.Scripting.Interpreter { - - /// - /// Visits a LambdaExpression, replacing the constants with direct accesses - /// to their StrongBox fields. This is very similar to what - /// ExpressionQuoter does for LambdaCompiler. - /// - /// Also inserts debug information tracking similar to what the interpreter - /// would do. - /// - internal sealed class LightLambdaClosureVisitor : ExpressionVisitor { - /// - /// Local variable mapping. - /// - private readonly Dictionary _closureVars; - - /// - /// The variable that holds onto the StrongBox{object}[] closure from - /// the interpreter - /// - private readonly ParameterExpression _closureArray; - - /// - /// A stack of variables that are defined in nested scopes. We search - /// this first when resolving a variable in case a nested scope shadows - /// one of our variable instances. - /// - private readonly Stack> _shadowedVars = new Stack>(); - - private LightLambdaClosureVisitor(Dictionary closureVariables, ParameterExpression closureArray) { - Assert.NotNull(closureVariables, closureArray); - _closureArray = closureArray; - _closureVars = closureVariables; - } - - /// - /// Walks the lambda and produces a higher order function, which can be - /// used to bind the lambda to a closure array from the interpreter. - /// - /// The lambda to bind. - /// Variables which are being accessed defined in the outer scope. - /// A delegate that can be called to produce a delegate bound to the passed in closure array. - internal static Func[], Delegate> BindLambda(LambdaExpression lambda, Dictionary closureVariables) { - // 1. Create rewriter - var closure = Expression.Parameter(typeof(StrongBox[]), "closure"); - var visitor = new LightLambdaClosureVisitor(closureVariables, closure); - - // 2. Visit the lambda - lambda = (LambdaExpression)visitor.Visit(lambda); - - // 3. Create a higher-order function which fills in the parameters - var result = Expression.Lambda[], Delegate>>(lambda, closure); - - // 4. Compile it - return result.Compile(); - } - - #region closures - - protected override Expression VisitLambda(Expression node) { - _shadowedVars.Push(new HashSet(node.Parameters)); - Expression b = Visit(node.Body); - _shadowedVars.Pop(); - if (b == node.Body) { - return node; - } - return Expression.Lambda(b, node.Name, node.TailCall, node.Parameters); - } - - protected override Expression VisitBlock(BlockExpression node) { - if (node.Variables.Count > 0) { - _shadowedVars.Push(new HashSet(node.Variables)); - } - var b = Visit(node.Expressions); - if (node.Variables.Count > 0) { - _shadowedVars.Pop(); - } - if (b == node.Expressions) { - return node; - } - return Expression.Block(node.Variables, b); - } - - protected override CatchBlock VisitCatchBlock(CatchBlock node) { - if (node.Variable != null) { - _shadowedVars.Push(new HashSet(new[] { node.Variable })); - } - Expression b = Visit(node.Body); - Expression f = Visit(node.Filter); - if (node.Variable != null) { - _shadowedVars.Pop(); - } - if (b == node.Body && f == node.Filter) { - return node; - } - return Expression.MakeCatchBlock(node.Test, node.Variable, b, f); - } - - protected override Expression VisitRuntimeVariables(RuntimeVariablesExpression node) { - int count = node.Variables.Count; - var boxes = new List(); - var vars = new List(); - var indexes = new int[count]; - for (int i = 0; i < count; i++) { - Expression box = GetClosureItem(node.Variables[i], false); - if (box == null) { - indexes[i] = vars.Count; - vars.Add(node.Variables[i]); - } else { - indexes[i] = -1 - boxes.Count; - boxes.Add(box); - } - } - - // No variables were rewritten. Just return the original node. - if (boxes.Count == 0) { - return node; - } - - var boxesArray = Expression.NewArrayInit(typeof(IStrongBox), boxes); - - // All of them were rewritten. Just return the array, wrapped in a - // read-only collection. - if (vars.Count == 0) { - return Expression.Invoke( - Expression.Constant((Func)RuntimeVariables.Create), - boxesArray - ); - } - - // Otherwise, we need to return an object that merges them - Func helper = MergedRuntimeVariables.Create; - return Expression.Invoke(AstUtils.Constant(helper), Expression.RuntimeVariables(vars), boxesArray, AstUtils.Constant(indexes)); - } - - protected override Expression VisitParameter(ParameterExpression node) { - Expression closureItem = GetClosureItem(node, true); - if (closureItem == null) { - return node; - } - // Convert can go away if we switch to strongly typed StrongBox - return Ast.Utils.Convert(closureItem, node.Type); - } - - protected override Expression VisitBinary(BinaryExpression node) { - if (node.NodeType == ExpressionType.Assign && - node.Left.NodeType == ExpressionType.Parameter) { - - var variable = (ParameterExpression)node.Left; - Expression closureItem = GetClosureItem(variable, true); - if (closureItem != null) { - // We need to convert to object to store the value in the box. - return Expression.Block( - new[] { variable }, - Expression.Assign(variable, Visit(node.Right)), - Expression.Assign(closureItem, Ast.Utils.Convert(variable, typeof(object))), - variable - ); - } - } - return base.VisitBinary(node); - } - - private Expression GetClosureItem(ParameterExpression variable, bool unbox) { - // Skip variables that are shadowed by a nested scope/lambda - foreach (HashSet hidden in _shadowedVars) { - if (hidden.Contains(variable)) { - return null; - } - } - - LocalVariable loc; - if (!_closureVars.TryGetValue(variable, out loc)) { - throw new InvalidOperationException("unbound variable: " + variable.Name); - } - - var result = loc.LoadFromArray(null, _closureArray); - return (unbox) ? LightCompiler.Unbox(result) : result; - } - - protected override Expression VisitExtension(Expression node) { - // Reduce extensions now so we can find embedded variables - return Visit(node.ReduceExtensions()); - } - - - #region MergedRuntimeVariables - - /// - /// Provides a list of variables, supporing read/write of the values - /// - private sealed class MergedRuntimeVariables : IRuntimeVariables { - private readonly IRuntimeVariables _first; - private readonly IRuntimeVariables _second; - - // For reach item, the index into the first or second list - // Positive values mean the first array, negative means the second - private readonly int[] _indexes; - - private MergedRuntimeVariables(IRuntimeVariables first, IRuntimeVariables second, int[] indexes) { - _first = first; - _second = second; - _indexes = indexes; - } - - internal static IRuntimeVariables Create(IRuntimeVariables first, IRuntimeVariables second, int[] indexes) { - return new MergedRuntimeVariables(first, second, indexes); - } - - int IRuntimeVariables.Count { - get { return _indexes.Length; } - } - - object IRuntimeVariables.this[int index] { - get { - index = _indexes[index]; - return (index >= 0) ? _first[index] : _second[-1 - index]; - } - set { - index = _indexes[index]; - if (index >= 0) { - _first[index] = value; - } else { - _second[-1 - index] = value; - } - } - } - } - #endregion - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LocalVariables.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LocalVariables.cs deleted file mode 100644 index d848a643002..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LocalVariables.cs +++ /dev/null @@ -1,266 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - public sealed class LocalVariable { - private const int IsBoxedFlag = 1; - private const int InClosureFlag = 2; - - public readonly int Index; - private int _flags; - - public bool IsBoxed { - get { return (_flags & IsBoxedFlag) != 0; } - set { - if (value) { - _flags |= IsBoxedFlag; - } else { - _flags &= ~IsBoxedFlag; - } - } - } - - public bool InClosure { - get { return (_flags & InClosureFlag) != 0; } - } - - public bool InClosureOrBoxed { - get { return InClosure | IsBoxed; } - } - - internal LocalVariable(int index, bool closure, bool boxed) { - Index = index; - _flags = (closure ? InClosureFlag : 0) | (boxed ? IsBoxedFlag : 0); - } - - internal Expression LoadFromArray(Expression frameData, Expression closure) { - Expression result = Expression.ArrayAccess(InClosure ? closure : frameData, Expression.Constant(Index)); - return IsBoxed ? Expression.Convert(result, typeof(StrongBox)) : result; - } - - public override string ToString() { - return String.Format("{0}: {1} {2}", Index, IsBoxed ? "boxed" : null, InClosure ? "in closure" : null); - } - } - - public struct LocalDefinition { - private readonly int _index; - private readonly ParameterExpression _parameter; - - internal LocalDefinition(int localIndex, ParameterExpression parameter) { - _index = localIndex; - _parameter = parameter; - } - - public int Index { - get { - return _index; - } - } - - public ParameterExpression Parameter { - get { - return _parameter; - } - } - - public override bool Equals(object obj) { - if (obj is LocalDefinition) { - LocalDefinition other = (LocalDefinition)obj; - return other.Index == Index && other.Parameter == Parameter; - } - - return false; - } - - public override int GetHashCode() { - if (_parameter == null) { - return 0; - } - return _parameter.GetHashCode() ^ _index.GetHashCode(); - } - - public static bool operator ==(LocalDefinition self, LocalDefinition other) { - return self.Index == other.Index && self.Parameter == other.Parameter; - } - - public static bool operator !=(LocalDefinition self, LocalDefinition other) { - return self.Index != other.Index || self.Parameter != other.Parameter; - } - } - - public sealed class LocalVariables { - private readonly HybridReferenceDictionary _variables = new HybridReferenceDictionary(); - private Dictionary _closureVariables; - - private int _localCount, _maxLocalCount; - - internal LocalVariables() { - } - - public LocalDefinition DefineLocal(ParameterExpression variable, int start) { - ContractUtils.RequiresNotNull(variable, "variable"); - ContractUtils.Requires(start >= 0, "start", "start must be positive"); - - LocalVariable result = new LocalVariable(_localCount++, false, false); - _maxLocalCount = System.Math.Max(_localCount, _maxLocalCount); - - VariableScope existing, newScope; - if (_variables.TryGetValue(variable, out existing)) { - newScope = new VariableScope(result, start, existing); - if (existing.ChildScopes == null) { - existing.ChildScopes = new List(); - } - existing.ChildScopes.Add(newScope); - } else { - newScope = new VariableScope(result, start, null); - } - - _variables[variable] = newScope; - return new LocalDefinition(result.Index, variable); - } - - public void UndefineLocal(LocalDefinition definition, int end) { - var scope = _variables[definition.Parameter]; - scope.Stop = end; - if (scope.Parent != null) { - _variables[definition.Parameter] = scope.Parent; - } else { - _variables.Remove(definition.Parameter); - } - - _localCount--; - } - - internal void Box(ParameterExpression variable, InstructionList instructions) { - var scope = _variables[variable]; - - LocalVariable local = scope.Variable; - Debug.Assert(!local.IsBoxed && !local.InClosure); - _variables[variable].Variable.IsBoxed = true; - - int curChild = 0; - for (int i = scope.Start; i < scope.Stop && i < instructions.Count; i++) { - if (scope.ChildScopes != null && scope.ChildScopes[curChild].Start == i) { - // skip boxing in the child scope - var child = scope.ChildScopes[curChild]; - i = child.Stop; - - curChild++; - continue; - } - - instructions.SwitchToBoxed(local.Index, i); - } - } - - public int LocalCount { - get { return _maxLocalCount; } - } - - public int GetOrDefineLocal(ParameterExpression var) { - int index = GetLocalIndex(var); - if (index == -1) { - return DefineLocal(var, 0).Index; - } - return index; - } - - public int GetLocalIndex(ParameterExpression var) { - VariableScope loc; - return _variables.TryGetValue(var, out loc) ? loc.Variable.Index : -1; - } - - public bool TryGetLocalOrClosure(ParameterExpression var, out LocalVariable local) { - VariableScope scope; - if (_variables.TryGetValue(var, out scope)) { - local = scope.Variable; - return true; - } - if (_closureVariables != null && _closureVariables.TryGetValue(var, out local)) { - return true; - } - - local = null; - return false; - } - - /// - /// Gets a copy of the local variables which are defined in the current scope. - /// - /// - internal Dictionary CopyLocals() { - var res = new Dictionary(_variables.Count); - foreach (var keyValue in _variables) { - res[keyValue.Key] = keyValue.Value.Variable; - } - return res; - } - - /// - /// Checks to see if the given variable is defined within the current local scope. - /// - internal bool ContainsVariable(ParameterExpression variable) { - return _variables.ContainsKey(variable); - } - - /// - /// Gets the variables which are defined in an outer scope and available within the current scope. - /// - internal Dictionary ClosureVariables { - get { - return _closureVariables; - } - } - - internal LocalVariable AddClosureVariable(ParameterExpression variable) { - if (_closureVariables == null) { - _closureVariables = new Dictionary(); - } - LocalVariable result = new LocalVariable(_closureVariables.Count, true, false); - _closureVariables.Add(variable, result); - return result; - } - - /// - /// Tracks where a variable is defined and what range of instructions it's used in - /// - private sealed class VariableScope { - public readonly int Start; - public int Stop = Int32.MaxValue; - public readonly LocalVariable Variable; - public readonly VariableScope Parent; - public List ChildScopes; - - public VariableScope(LocalVariable variable, int start, VariableScope parent) { - Variable = variable; - Start = start; - Parent = parent; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LoopCompiler.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LoopCompiler.cs deleted file mode 100644 index acc416ea5e5..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/LoopCompiler.cs +++ /dev/null @@ -1,323 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#endif - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Interpreter { - using AstUtils = Microsoft.Scripting.Ast.Utils; - using LoopFunc = Func[], InterpretedFrame, int>; - using System.Collections.ObjectModel; - - internal sealed class LoopCompiler : ExpressionVisitor { - private struct LoopVariable { - public ExpressionAccess Access; - - // a variable that holds on the strong box for closure variables: - public ParameterExpression BoxStorage; - - public LoopVariable(ExpressionAccess access, ParameterExpression box) { - Access = access; - BoxStorage = box; - } - - public override string ToString() { - return Access.ToString() + " " + BoxStorage; - } - } - - private readonly ParameterExpression _frameDataVar; - private readonly ParameterExpression _frameClosureVar; - private readonly ParameterExpression _frameVar; - private readonly LabelTarget _returnLabel; - // locals and closure variables defined outside the loop - private readonly Dictionary _outerVariables, _closureVariables; - private readonly LoopExpression _loop; - private ReadOnlyCollectionBuilder _temps; - // tracks variables that flow in and flow out for initialization and - private readonly Dictionary _loopVariables; - // variables which are defined and used within the loop - private HashSet _loopLocals; - - private readonly HybridReferenceDictionary _labelMapping; - private readonly int _loopStartInstructionIndex; - private readonly int _loopEndInstructionIndex; - - internal LoopCompiler(LoopExpression loop, HybridReferenceDictionary labelMapping, Dictionary locals, - Dictionary closureVariables, int loopStartInstructionIndex, int loopEndInstructionIndex) { - _loop = loop; - _outerVariables = locals; - _closureVariables = closureVariables; - _frameDataVar = Expression.Parameter(typeof(object[])); - _frameClosureVar = Expression.Parameter(typeof(StrongBox[])); - _frameVar = Expression.Parameter(typeof(InterpretedFrame)); - _loopVariables = new Dictionary(); - _returnLabel = Expression.Label(typeof(int)); - _labelMapping = labelMapping; - _loopStartInstructionIndex = loopStartInstructionIndex; - _loopEndInstructionIndex = loopEndInstructionIndex; - } - - internal LoopFunc CreateDelegate() { - var loop = (LoopExpression)Visit(_loop); - var body = new ReadOnlyCollectionBuilder(); - var finallyClause = new ReadOnlyCollectionBuilder(); - - foreach (var variable in _loopVariables) { - LocalVariable local; - if (!_outerVariables.TryGetValue(variable.Key, out local)) { - local = _closureVariables[variable.Key]; - } - Expression elemRef = local.LoadFromArray(_frameDataVar, _frameClosureVar); - - if (local.InClosureOrBoxed) { - var box = variable.Value.BoxStorage; - Debug.Assert(box != null); - body.Add(Expression.Assign(box, elemRef)); - AddTemp(box); - } else { - // Always initialize the variable even if it is only written to. - // If a write-only variable is actually not assigned during execution of the loop we will still write some value back. - // This value must be the original value, which we assign at entry. - body.Add(Expression.Assign(variable.Key, AstUtils.Convert(elemRef, variable.Key.Type))); - - if ((variable.Value.Access & ExpressionAccess.Write) != 0) { - finallyClause.Add(Expression.Assign(elemRef, AstUtils.Box(variable.Key))); - } - - AddTemp(variable.Key); - } - } - - if (finallyClause.Count > 0) { - body.Add(Expression.TryFinally(loop, Expression.Block(finallyClause))); - } else { - body.Add(loop); - } - - body.Add(Expression.Label(_returnLabel, Expression.Constant(_loopEndInstructionIndex - _loopStartInstructionIndex))); - - var lambda = Expression.Lambda( - _temps != null ? Expression.Block(_temps.ToReadOnlyCollection(), body) : Expression.Block(body), - new[] { _frameDataVar, _frameClosureVar, _frameVar } - ); - return lambda.Compile(); - } - - protected override Expression VisitExtension(Expression node) { - // Reduce extensions before we visit them so that we operate on a plain DLR tree, - // where we know relationships among the nodes (which nodes represent write context etc.). - if (node.CanReduce) { - return Visit(node.Reduce()); - } - - return base.VisitExtension(node); - } - - #region Gotos - - protected override Expression VisitGoto(GotoExpression node) { - BranchLabel label; - - var target = node.Target; - var value = Visit(node.Value); - - // TODO: Is it possible for an inner reducible node of the loop to rely on nodes produced by reducing outer reducible nodes? - - // Unknown label => must be within the loop: - if (!_labelMapping.TryGetValue(target, out label)) { - return node.Update(target, value); - } - - // Known label within the loop: - if (label.TargetIndex >= _loopStartInstructionIndex && label.TargetIndex < _loopEndInstructionIndex) { - return node.Update(target, value); - } - - return Expression.Return(_returnLabel, - (value != null) ? - Expression.Call(_frameVar, InterpretedFrame.GotoMethod, Expression.Constant(label.LabelIndex), AstUtils.Box(value)) : - Expression.Call(_frameVar, InterpretedFrame.VoidGotoMethod, Expression.Constant(label.LabelIndex)), - node.Type - ); - } - - #endregion - - #region Local Variables - - // Gather all outer variables accessed in the loop. - // Determines which ones are read from and written to. - // We will consider a variable as "read" if it is read anywhere in the loop even though - // the first operation might actually always be "write". We could do better if we had CFG. - - protected override Expression VisitBlock(BlockExpression node) { - var variables = ((BlockExpression)node).Variables; - var prevLocals = EnterVariableScope(variables); - - var res = base.VisitBlock(node); - - ExitVariableScope(prevLocals); - return res; - } - - private HashSet EnterVariableScope(ICollection variables) { - if (_loopLocals == null) { - _loopLocals = new HashSet(variables); - return null; - } - - var prevLocals = new HashSet(_loopLocals); - _loopLocals.UnionWith(variables); - return prevLocals; - } - - protected override CatchBlock VisitCatchBlock(CatchBlock node) { - if (node.Variable != null) { - var prevLocals = EnterVariableScope(new[] { node.Variable }); - var res = base.VisitCatchBlock(node); - ExitVariableScope(prevLocals); - return res; - } else { - return base.VisitCatchBlock(node); - } - } - - protected override Expression VisitLambda(Expression node) { - var prevLocals = EnterVariableScope(node.Parameters); - try { - return base.VisitLambda(node); - } finally { - ExitVariableScope(prevLocals); - } - } - - private void ExitVariableScope(HashSet prevLocals) { - _loopLocals = prevLocals; - } - - protected override Expression VisitBinary(BinaryExpression node) { - // reduce compound assignments: - if (node.CanReduce) { - return Visit(node.Reduce()); - } - Debug.Assert(!node.NodeType.IsReadWriteAssignment()); - - var param = node.Left as ParameterExpression; - if (param != null && node.NodeType == ExpressionType.Assign) { - var left = VisitVariable(param, ExpressionAccess.Write); - var right = Visit(node.Right); - - // left parameter is a boxed variable: - if (left.Type != param.Type) { - Debug.Assert(left.Type == typeof(object)); - - Expression rightVar; - if (right.NodeType != ExpressionType.Parameter) { - // { left.Value = (object)(rightVar = right), rightVar } - rightVar = AddTemp(Expression.Parameter(right.Type)); - right = Expression.Assign(rightVar, right); - } else { - // { left.Value = (object)right, right } - rightVar = right; - } - - return Expression.Block( - node.Update(left, Expression.Convert(right, left.Type)), - rightVar - ); - } else { - return node.Update(left, right); - } - - } else { - return base.VisitBinary(node); - } - } - - protected override Expression VisitUnary(UnaryExpression node) { - // reduce inplace increment/decrement: - if (node.CanReduce) { - return Visit(node.Reduce()); - } - Debug.Assert(!node.NodeType.IsReadWriteAssignment()); - return base.VisitUnary(node); - } - - // TODO: if we supported ref/out parameter we would need to override - // MethodCallExpression, VisitDynamic and VisitNew - - protected override Expression VisitParameter(ParameterExpression node) { - return VisitVariable(node, ExpressionAccess.Read); - } - - private Expression VisitVariable(ParameterExpression node, ExpressionAccess access) { - ParameterExpression box; - LoopVariable existing; - LocalVariable loc; - - if (_loopLocals.Contains(node)) { - // local to the loop - not propagated in or out - return node; - } else if (_loopVariables.TryGetValue(node, out existing)) { - // existing outer variable that we are already tracking - box = existing.BoxStorage; - _loopVariables[node] = new LoopVariable(existing.Access | access, box); - } else if (_outerVariables.TryGetValue(node, out loc) || - (_closureVariables != null && _closureVariables.TryGetValue(node, out loc))) { - // not tracking this variable yet, but defined in outer scope and seen for the 1st time - box = loc.InClosureOrBoxed ? Expression.Parameter(typeof(StrongBox), node.Name) : null; - _loopVariables[node] = new LoopVariable(access, box); - } else { - // node is a variable defined in a nested lambda -> skip - return node; - } - - if (box != null) { - if ((access & ExpressionAccess.Write) != 0) { - // compound assignments were reduced: - Debug.Assert((access & ExpressionAccess.Read) == 0); - - // box.Value = (object)rhs - return LightCompiler.Unbox(box); - } else { - // (T)box.Value - return Expression.Convert(LightCompiler.Unbox(box), node.Type); - } - } - - return node; - } - - private ParameterExpression AddTemp(ParameterExpression variable) { - if (_temps == null) { - _temps = new ReadOnlyCollectionBuilder(); - } - - _temps.Add(variable); - return variable; - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/RuntimeVariables.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/RuntimeVariables.cs deleted file mode 100644 index e8b8e98520c..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Interpreter/RuntimeVariables.cs +++ /dev/null @@ -1,46 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Runtime.CompilerServices; - -namespace Microsoft.Scripting.Interpreter { - internal sealed class RuntimeVariables : IRuntimeVariables { - private readonly IStrongBox[] _boxes; - - private RuntimeVariables(IStrongBox[] boxes) { - _boxes = boxes; - } - - int IRuntimeVariables.Count { - get { - return _boxes.Length; - } - } - - object IRuntimeVariables.this[int index] { - get { - return _boxes[index].Value; - } - set { - _boxes[index].Value = value; - } - } - - internal static IRuntimeVariables Create(IStrongBox[] boxes) { - return new RuntimeVariables(boxes); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Math/BigIntegerV4.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Math/BigIntegerV4.cs deleted file mode 100644 index 303eb7521b6..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Math/BigIntegerV4.cs +++ /dev/null @@ -1,614 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ -#if FEATURE_NUMERICS - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Globalization; -using System.Text; -using Microsoft.Scripting.Utils; -using BigInt = System.Numerics.BigInteger; - -namespace Microsoft.Scripting.Math { - /// - /// arbitrary precision integers - /// - [Serializable] - public sealed class BigInteger : IFormattable, IComparable, IEquatable { - internal readonly BigInt Value; - - [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public static readonly BigInteger Zero = new BigInteger((BigInt)0); - [SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public static readonly BigInteger One = new BigInteger((BigInt)1); - - public BigInteger(BigInt value) { - Value = value; - } - - [CLSCompliant(false)] - public static BigInteger Create(ulong v) { - return new BigInteger(new BigInt(v)); - } - - [CLSCompliant(false)] - public static BigInteger Create(uint v) { - return new BigInteger(new BigInt(v)); - } - - public static BigInteger Create(long v) { - return new BigInteger(new BigInt(v)); - } - - public static BigInteger Create(int v) { - return new BigInteger(new BigInt(v)); - } - - public static BigInteger Create(decimal v) { - return new BigInteger(new BigInt(v)); - } - - public static BigInteger Create(byte[] v) { - return new BigInteger(v); - } - - public static BigInteger Create(double v) { - return new BigInteger(new BigInt(v)); - } - - public static implicit operator BigInteger(byte i) { - return new BigInteger((BigInt)i); - } - - [CLSCompliant(false)] - public static implicit operator BigInteger(sbyte i) { - return new BigInteger((BigInt)i); - } - - public static implicit operator BigInteger(short i) { - return new BigInteger((BigInt)i); - } - - [CLSCompliant(false)] - public static implicit operator BigInteger(ushort i) { - return new BigInteger((BigInt)i); - } - - [CLSCompliant(false)] - public static implicit operator BigInteger(uint i) { - return new BigInteger((BigInt)i); - } - - public static implicit operator BigInteger(int i) { - return new BigInteger((BigInt)i); - } - - [CLSCompliant(false)] - public static implicit operator BigInteger(ulong i) { - return new BigInteger((BigInt)i); - } - - public static implicit operator BigInteger(long i) { - return new BigInteger((BigInt)i); - } - - public static implicit operator BigInteger(decimal self) { - return new BigInteger((BigInt)self); - } - - public static explicit operator BigInteger(double self) { - return new BigInteger((BigInt)self); - } - - public static explicit operator BigInteger(float self) { - return new BigInteger((BigInt)self); - } - - public static explicit operator double(BigInteger self) { - return (double)self.Value; - } - - public static explicit operator float(BigInteger self) { - return (float)self.Value; - } - - public static explicit operator decimal(BigInteger self) { - return (decimal)self.Value; - } - - public static explicit operator byte(BigInteger self) { - return (byte)self.Value; - } - - [CLSCompliant(false)] - public static explicit operator sbyte(BigInteger self) { - return (sbyte)self.Value; - } - - [CLSCompliant(false)] - public static explicit operator UInt16(BigInteger self) { - return (UInt16)self.Value; - } - - public static explicit operator Int16(BigInteger self) { - return (Int16)self.Value; - } - - [CLSCompliant(false)] - public static explicit operator UInt32(BigInteger self) { - return (UInt32)self.Value; - } - - public static explicit operator Int32(BigInteger self) { - return (Int32)self.Value; - } - - public static explicit operator Int64(BigInteger self) { - return (Int64)self.Value; - } - - [CLSCompliant(false)] - public static explicit operator UInt64(BigInteger self) { - return (UInt64)self.Value; - } - - public static implicit operator BigInteger(BigInt value) { - return new BigInteger(value); - } - - public static implicit operator BigInt(BigInteger value) { - return value.Value; - } - - public BigInteger(BigInteger copy) { - if (object.ReferenceEquals(copy, null)) { - throw new ArgumentNullException("copy"); - } - Value = copy.Value; - } - - public BigInteger(byte[] data) { - ContractUtils.RequiresNotNull(data, "data"); - - Value = new BigInt(data); - } - - public BigInteger(int sign, byte[] data) { - ContractUtils.RequiresNotNull(data, "data"); - ContractUtils.Requires(sign >= -1 && sign <= +1, "sign"); - - Value = new BigInt(data); - if (sign < 0) { - Value = -Value; - } - } - - [CLSCompliant(false)] - public BigInteger(int sign, uint[] data) { - ContractUtils.RequiresNotNull(data, "data"); - ContractUtils.Requires(sign >= -1 && sign <= +1, "sign"); - int length = GetLength(data); - ContractUtils.Requires(length == 0 || sign != 0, "sign"); - if (length == 0) { - Value = 0; - return; - } - - bool highest = (data[length - 1] & 0x80000000) != 0; - byte[] bytes = new byte[length * 4 + (highest ? 1 : 0)]; - int j = 0; - for (int i = 0; i < length; i++) { - ulong w = data[i]; - bytes[j++] = (byte)(w & 0xff); - bytes[j++] = (byte)((w >> 8) & 0xff); - bytes[j++] = (byte)((w >> 16) & 0xff); - bytes[j++] = (byte)((w >> 24) & 0xff); - } - - Value = new BigInt(bytes); - if (sign < 0) { - Value = -Value; - } - } - - [CLSCompliant(false)] - public uint[] GetWords() { - return Value.GetWords(); - } - - public int GetBitCount() { - return Value.GetBitCount(); - } - - public int GetWordCount() { - return Value.GetWordCount(); - } - - public int GetByteCount() { - return Value.GetByteCount(); - } - - /// - /// Return the sign of this BigInteger: -1, 0, or 1. - /// - public int Sign { - get { - return Value.Sign; - } - } - - public bool AsInt64(out long ret) { - if (Value >= Int64.MinValue && Value <= Int64.MaxValue) { - ret = (long)Value; - return true; - } - ret = 0; - return false; - } - - [CLSCompliant(false)] - public bool AsUInt32(out uint ret) { - if (Value >= UInt32.MinValue && Value <= UInt32.MaxValue) { - ret = (UInt32)Value; - return true; - } - ret = 0; - return false; - } - - [CLSCompliant(false)] - public bool AsUInt64(out ulong ret) { - if (Value >= UInt64.MinValue && Value <= UInt64.MaxValue) { - ret = (UInt64)Value; - return true; - } - ret = 0; - return false; - } - - public bool AsInt32(out int ret) { - if (Value >= Int32.MinValue && Value <= Int32.MaxValue) { - ret = (Int32)Value; - return true; - } - ret = 0; - return false; - } - - [CLSCompliant(false)] - public uint ToUInt32() { - return (uint)Value; - } - - public int ToInt32() { - return (int)Value; - } - - public decimal ToDecimal() { - return (decimal)Value; - } - - [CLSCompliant(false)] - public ulong ToUInt64() { - return (ulong)Value; - } - - public long ToInt64() { - return (long)Value; - } - - private static int GetLength(uint[] data) { - int ret = data.Length - 1; - while (ret >= 0 && data[ret] == 0) ret--; - return ret + 1; - } - - public static int Compare(BigInteger x, BigInteger y) { - return BigInt.Compare(x.Value, y.Value); - } - - public static bool operator ==(BigInteger x, int y) { - return x.Value == y; - } - - public static bool operator !=(BigInteger x, int y) { - return x.Value != y; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")] // TODO: fix - public static bool operator ==(BigInteger x, double y) { - if (object.ReferenceEquals(x, null)) { - throw new ArgumentNullException("x"); - } - - // we can hold all double values, but not all double values - // can hold BigInteger values, and we may lose precision. Convert - // the double to a big int, then compare. - - if ((y % 1) != 0) return false; // not a whole number, can't be equal - - return x.Value == (BigInt)y; - } - - public static bool operator ==(double x, BigInteger y) { - return y == x; - } - - public static bool operator !=(BigInteger x, double y) { - return !(x == y); - } - - public static bool operator !=(double x, BigInteger y) { - return !(x == y); - } - - - public static bool operator ==(BigInteger x, BigInteger y) { - return Compare(x, y) == 0; - } - - public static bool operator !=(BigInteger x, BigInteger y) { - return Compare(x, y) != 0; - } - public static bool operator <(BigInteger x, BigInteger y) { - return Compare(x, y) < 0; - } - public static bool operator <=(BigInteger x, BigInteger y) { - return Compare(x, y) <= 0; - } - public static bool operator >(BigInteger x, BigInteger y) { - return Compare(x, y) > 0; - } - public static bool operator >=(BigInteger x, BigInteger y) { - return Compare(x, y) >= 0; - } - - public static BigInteger Add(BigInteger x, BigInteger y) { - return x + y; - } - - public static BigInteger operator +(BigInteger x, BigInteger y) { - return new BigInteger(x.Value + y.Value); - } - - public static BigInteger Subtract(BigInteger x, BigInteger y) { - return x - y; - } - - public static BigInteger operator -(BigInteger x, BigInteger y) { - return new BigInteger(x.Value - y.Value); - } - - public static BigInteger Multiply(BigInteger x, BigInteger y) { - return x * y; - } - - public static BigInteger operator *(BigInteger x, BigInteger y) { - return new BigInteger(x.Value * y.Value); - } - - public static BigInteger Divide(BigInteger x, BigInteger y) { - return x / y; - } - - public static BigInteger operator /(BigInteger x, BigInteger y) { - BigInteger dummy; - return DivRem(x, y, out dummy); - } - - public static BigInteger Mod(BigInteger x, BigInteger y) { - return x % y; - } - - public static BigInteger operator %(BigInteger x, BigInteger y) { - BigInteger ret; - DivRem(x, y, out ret); - return ret; - } - - public static BigInteger DivRem(BigInteger x, BigInteger y, out BigInteger remainder) { - BigInt rem; - BigInt result = BigInt.DivRem(x.Value, y.Value, out rem); - remainder = new BigInteger(rem); - return new BigInteger(result); - } - - public static BigInteger BitwiseAnd(BigInteger x, BigInteger y) { - return x & y; - } - - public static BigInteger operator &(BigInteger x, BigInteger y) { - return new BigInteger(x.Value & y.Value); - } - - public static BigInteger BitwiseOr(BigInteger x, BigInteger y) { - return x | y; - } - - public static BigInteger operator |(BigInteger x, BigInteger y) { - return new BigInteger(x.Value | y.Value); - } - - public static BigInteger Xor(BigInteger x, BigInteger y) { - return x ^ y; - } - - public static BigInteger operator ^(BigInteger x, BigInteger y) { - return new BigInteger(x.Value ^ y.Value); - } - - public static BigInteger LeftShift(BigInteger x, int shift) { - return x << shift; - } - - public static BigInteger operator <<(BigInteger x, int shift) { - return new BigInteger(x.Value << shift); - } - - public static BigInteger RightShift(BigInteger x, int shift) { - return x >> shift; - } - - public static BigInteger operator >>(BigInteger x, int shift) { - return new BigInteger(x.Value >> shift); - } - - public static BigInteger Negate(BigInteger x) { - return -x; - } - - public static BigInteger operator -(BigInteger x) { - return new BigInteger(-x.Value); - } - - public BigInteger OnesComplement() { - return ~this; - } - - public static BigInteger operator ~(BigInteger x) { - return new BigInteger(~x.Value); - } - - public BigInteger Abs() { - return new BigInteger(BigInt.Abs(Value)); - } - - public BigInteger Power(int exp) { - return new BigInteger(BigInt.Pow(Value, exp)); - } - - public BigInteger ModPow(int power, BigInteger mod) { - return new BigInteger(BigInt.ModPow(Value, power, mod.Value)); - } - - public BigInteger ModPow(BigInteger power, BigInteger mod) { - return new BigInteger(BigInt.ModPow(Value, power.Value, mod.Value)); - } - - public BigInteger Square() { - return this * this; - } - -#if !SILVERLIGHT - public static BigInteger Parse(string str) { - return new BigInteger(BigInt.Parse(str)); - } -#endif - - public override string ToString() { - return ToString(10); - } - - public string ToString(int @base) { - return MathUtils.BigIntegerToString(GetWords(), Sign, @base, false); - } - - public string ToString(string format) { - return Value.ToString(format); - } - - public override int GetHashCode() { - return Value.GetHashCode(); - } - - public override bool Equals(object obj) { - return Equals(obj as BigInteger); - } - - public bool Equals(BigInteger other) { - if (object.ReferenceEquals(other, null)) return false; - return this == other; - } - - public bool IsNegative() { - return Value.Sign < 0; - } - - public bool IsZero() { - return Value.Sign == 0; - } - - public bool IsPositive() { - return Value.Sign > 0; - } - - public bool IsEven { - get { return Value.IsEven; } - } - - public bool IsPowerOfTwo { - get { - return Value.IsPowerOfTwo; - } - } - - public double Log(Double newBase) { - return BigInt.Log(Value, newBase); - } - - /// - /// Calculates the natural logarithm of the BigInteger. - /// - public double Log() { - return BigInt.Log(Value); - } - - /// - /// Calculates log base 10 of a BigInteger. - /// - public double Log10() { - return BigInt.Log10(Value); - } - -#region IComparable Members - - public int CompareTo(object obj) { - if (obj == null) { - return 1; - } - BigInteger o = obj as BigInteger; - if (object.ReferenceEquals(o, null)) { - throw new ArgumentException("expected integer"); - } - return Compare(this, o); - } - - #endregion - - /// - /// Return the value of this BigInteger as a little-endian twos-complement - /// byte array, using the fewest number of bytes possible. If the value is zero, - /// return an array of one byte whose element is 0x00. - /// - public byte[] ToByteArray() { - return Value.ToByteArray(); - } - - public string ToString(IFormatProvider provider) { - return Value.ToString(provider); - } - -#region IFormattable Members - - string IFormattable.ToString(string format, IFormatProvider formatProvider) { - return Value.ToString(format, formatProvider); - } - - #endregion - } -} -#endif diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Math/Complex64.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Math/Complex64.cs deleted file mode 100644 index 6a57c23f15a..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Math/Complex64.cs +++ /dev/null @@ -1,280 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using Microsoft.Scripting.Utils; - -#if FEATURE_NUMERICS -using BigInt = System.Numerics.BigInteger; -#endif - -namespace Microsoft.Scripting.Math { - -#if !MONO_INTERPRETER - /// - /// Implementation of the complex number data type. - /// - [Serializable] - public struct Complex64 { - public static readonly Complex64 Zero = new Complex64(0.0, 0.0); - public static readonly Complex64 One = new Complex64(1.0, 0.0); - public static readonly Complex64 ImaginaryOne = new Complex64(0.0, 1.0); - - private readonly double real, imag; - - public static Complex64 MakeImaginary(double imag) { - return new Complex64(0.0, imag); - } - - public static Complex64 MakeReal(double real) { - return new Complex64(real, 0.0); - } - - public static Complex64 Make(double real, double imag) { - return new Complex64(real, imag); - } - - public Complex64(double real) - : this(real, 0.0) { - } - - public Complex64(double real, double imag) { - this.real = real; - this.imag = imag; - } - - public bool IsZero { - get { - return real == 0.0 && imag == 0.0; - } - } - - public double Real { - get { - return real; - } - } - - public double Imag { - get { - return imag; - } - } - - public Complex64 Conjugate() { - return new Complex64(real, -imag); - } - - - public override string ToString() { - if (real == 0.0) return imag.ToString(System.Globalization.CultureInfo.InvariantCulture.NumberFormat) + "j"; - else if (imag < 0.0) return string.Format(System.Globalization.CultureInfo.InvariantCulture.NumberFormat, "({0}{1}j)", real, imag); - else return string.Format(System.Globalization.CultureInfo.InvariantCulture.NumberFormat, "({0}+{1}j)", real, imag); - } - - public static implicit operator Complex64(bool b) { - return b ? One : Zero; - } - - public static implicit operator Complex64(int i) { - return MakeReal(i); - } - - [CLSCompliant(false)] - public static implicit operator Complex64(uint i) { - return MakeReal(i); - } - - public static implicit operator Complex64(short i) { - return MakeReal(i); - } - - [CLSCompliant(false)] - public static implicit operator Complex64(ushort i) { - return MakeReal(i); - } - - public static implicit operator Complex64(long l) { - return MakeReal(l); - } - [CLSCompliant(false)] - public static implicit operator Complex64(ulong i) { - return MakeReal(i); - } - - [CLSCompliant(false)] - public static implicit operator Complex64(sbyte i) { - return MakeReal(i); - } - - public static implicit operator Complex64(byte i) { - return MakeReal(i); - } - - public static implicit operator Complex64(float f) { - return MakeReal(f); - } - - public static implicit operator Complex64(double d) { - return MakeReal(d); - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")] // TODO: fix - public static implicit operator Complex64(BigInteger i) { - ContractUtils.RequiresNotNull(i, "i"); - - // throws an overflow exception if we can't handle the value. - return MakeReal((double)i); - } - -#if FEATURE_NUMERICS - public static implicit operator Complex64(BigInt i) { - // throws an overflow exception if we can't handle the value. - return MakeReal((double)i); - } -#endif - - public static bool operator ==(Complex64 x, Complex64 y) { - return x.real == y.real && x.imag == y.imag; - } - - public static bool operator !=(Complex64 x, Complex64 y) { - return x.real != y.real || x.imag != y.imag; - } - - public static Complex64 Add(Complex64 x, Complex64 y) { - return x + y; - } - - public static Complex64 operator +(Complex64 x, Complex64 y) { - return new Complex64(x.real + y.real, x.imag + y.imag); - } - - public static Complex64 Subtract(Complex64 x, Complex64 y) { - return x - y; - } - - public static Complex64 operator -(Complex64 x, Complex64 y) { - return new Complex64(x.real - y.real, x.imag - y.imag); - } - - public static Complex64 Multiply(Complex64 x, Complex64 y) { - return x * y; - } - - public static Complex64 operator *(Complex64 x, Complex64 y) { - return new Complex64(x.real * y.real - x.imag * y.imag, x.real * y.imag + x.imag * y.real); - } - - public static Complex64 Divide(Complex64 x, Complex64 y) { - return x / y; - } - - public static Complex64 operator /(Complex64 a, Complex64 b) { - if (b.IsZero) { - throw new DivideByZeroException("complex division by zero"); - } - - double real, imag, den, r; - - if (System.Math.Abs(b.real) >= System.Math.Abs(b.imag)) { - r = b.imag / b.real; - den = b.real + r * b.imag; - real = (a.real + a.imag * r) / den; - imag = (a.imag - a.real * r) / den; - } else { - r = b.real / b.imag; - den = b.imag + r * b.real; - real = (a.real * r + a.imag) / den; - imag = (a.imag * r - a.real) / den; - } - - return new Complex64(real, imag); - } - - public static Complex64 Negate(Complex64 x) { - return -x; - } - - public static Complex64 operator -(Complex64 x) { - return new Complex64(-x.real, -x.imag); - } - - public static Complex64 Plus(Complex64 x) { - return +x; - } - - public static Complex64 operator +(Complex64 x) { - return x; - } - - [Obsolete("Deprecated - consider using MS.Scripting.Utils.MathUtils.Hypot")] - public static double Hypot(double x, double y) { - return MathUtils.Hypot(x, y); - } - - public double Abs() { - return MathUtils.Hypot(real, imag); - } - - public Complex64 Power(Complex64 y) { - double c = y.real; - double d = y.imag; - int power = (int)c; - - if (power == c && power >= 0 && d == .0) { - Complex64 result = One; - if (power == 0) return result; - Complex64 factor = this; - while (power != 0) { - if ((power & 1) != 0) { - result = result * factor; - } - factor = factor * factor; - power >>= 1; - } - return result; - } else if (IsZero) { - return y.IsZero ? One : Zero; - } else { - double a = real; - double b = imag; - double powers = a * a + b * b; - double arg = System.Math.Atan2(b, a); - double mul = System.Math.Pow(powers, c / 2) * System.Math.Exp(-d * arg); - double common = c * arg + .5 * d * System.Math.Log(powers); - return new Complex64(mul * System.Math.Cos(common), mul * System.Math.Sin(common)); - } - } - - public override int GetHashCode() { - // The Object.GetHashCode function needs to be consistent with the Object.Equals function. - // Languages that build on top of this may have a more flexible equality function and - // so may not be able to use this hash function directly. - // For example, Python allows that c=Complex64(1.5, 0), f = 1.5f, c==f. - // so then the hash(f) == hash(c). Since the python (and other languages) can define an arbitrary - // hash(float) function, the language may need to define a matching hash(complex) function for - // the cases where the float and complex numbers overlap. - return (int)real + (int)imag * 1000003; - } - - public override bool Equals(object obj) { - if (!(obj is Complex64)) return false; - return this == ((Complex64)obj); - } - } -#endif - -} \ No newline at end of file diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Properties/AssemblyInfo.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Properties/AssemblyInfo.cs deleted file mode 100644 index 76977f57cd2..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,71 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Microsoft.Scripting")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Microsoft.Scripting")] -[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -[assembly: CLSCompliant(true)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("1bbee69c-30c5-41df-8912-b81da6d658c2")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -#if !CLR2 && !SILVERLIGHT && !WIN8 && !ANDROID && !WP75 -[assembly: System.Security.SecurityRules(SecurityRuleSet.Level1)] -#endif -[assembly: SecurityTransparent] - -[assembly: System.Resources.NeutralResourcesLanguage("en-US")] -[assembly: InternalsVisibleTo("TestInternalDLR, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c10ce00dd2e0ce5046d68183d3ad035b47e92bf0ce7bcf8a03a217ca5d0b0c7db973fdf97579b52b502a23d4069dbf043389e1ab65a1d6c508a9837f3e2350f15e05cc63c0fc4b0410867a51919090e4c33f80203e9b0035b21c32bae20f98b068f90d99a50133a5336480d94039b176519f5fd8524765f33be43da65c4b68ba")] - -#if !SILVERLIGHT -[assembly: AssemblyVersion("1.1.0.30")] -[assembly: AssemblyFileVersion("1.1.0.30")] -[assembly: AssemblyInformationalVersion("1.1")] -#endif - -#if !SILVERLIGHT && !WP75 -[assembly: AllowPartiallyTrustedCallers] -[assembly: TypeForwardedTo(typeof(Microsoft.Scripting.Runtime.DynamicStackFrame))] -#endif - diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Properties/GlobalSuppressions.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Properties/GlobalSuppressions.cs deleted file mode 100644 index 253f679b7e6..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Properties/GlobalSuppressions.cs +++ /dev/null @@ -1,17 +0,0 @@ -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -// -// To add a suppression to this file, right-click the message in the -// Error List, point to "Suppress Message(s)", and click -// "In Project Suppression File". -// You do not need to add suppressions to this file manually. - -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Dynamic.SR.#GetObject(System.String)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Dynamic.SR.#GetString(System.String,System.Boolean&)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Dynamic.SR.#Resources")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Dynamic.Error.#ArgumentNull(System.String)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Dynamic.Error.#ArgumentOutOfRange(System.String)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Dynamic.Error.#NotImplemented()")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "System.Dynamic.Error.#NotSupported()")] diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/ArgumentArray.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/ArgumentArray.cs deleted file mode 100644 index b6484afc31d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/ArgumentArray.cs +++ /dev/null @@ -1,76 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * ironruby@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Dynamic; -using System.Reflection; -using Microsoft.Scripting.Utils; - -namespace Microsoft.Scripting.Runtime { - using AstUtils = Microsoft.Scripting.Ast.Utils; - - /// - /// Wraps all arguments passed to a dynamic site with more arguments than can be accepted by a Func/Action delegate. - /// The binder generating a rule for such a site should unwrap the arguments first and then perform a binding to them. - /// - public sealed class ArgumentArray { - private readonly object[] _arguments; - - // the index of the first item _arguments that represents an argument: - private readonly int _first; - - // the number of items in _arguments that represent the arguments: - private readonly int _count; - - internal ArgumentArray(object[] arguments, int first, int count) { - _arguments = arguments; - _first = first; - _count = count; - } - - public int Count { - get { return _count; } - } - - public object GetArgument(int index) { - ContractUtils.RequiresArrayIndex(_arguments, index, "index"); - return _arguments[_first + index]; - } - - public DynamicMetaObject GetMetaObject(Expression parameter, int index) { - return DynamicMetaObject.Create( - GetArgument(index), - Expression.Call( - _GetArgMethod, - AstUtils.Convert(parameter, typeof(ArgumentArray)), - AstUtils.Constant(index) - ) - ); - } - - [CLSCompliant(false)] - public static object GetArg(ArgumentArray array, int index) { - return array._arguments[array._first + index]; - } - - private static readonly MethodInfo _GetArgMethod = new Func(GetArg).GetMethodInfo(); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/DynamicNull.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/DynamicNull.cs deleted file mode 100644 index 378bea4d090..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/DynamicNull.cs +++ /dev/null @@ -1,27 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -namespace Microsoft.Scripting.Runtime { - /// - /// Represents the type of a null value. - /// - public sealed class DynamicNull { - /// - /// Private constructor is never called since 'null' is the only valid instance. - /// - private DynamicNull() { } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/ExceptionHelpers.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/ExceptionHelpers.cs deleted file mode 100644 index 43350e7611e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/ExceptionHelpers.cs +++ /dev/null @@ -1,79 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Threading; -using Microsoft.Scripting.Actions; -using Microsoft.Scripting.Generation; - -namespace Microsoft.Scripting.Runtime { - public static class ExceptionHelpers { -#if FEATURE_STACK_TRACE - private const string prevStackTraces = "PreviousStackTraces"; - - /// - /// Updates an exception before it's getting re-thrown so - /// we can present a reasonable stack trace to the user. - /// - public static Exception UpdateForRethrow(Exception rethrow) { -#if !SILVERLIGHT - List prev; - - // we don't have any dynamic stack trace data, capture the data we can - // from the raw exception object. - StackTrace st = new StackTrace(rethrow, true); - - if (!TryGetAssociatedStackTraces(rethrow, out prev)) { - prev = new List(); - AssociateStackTraces(rethrow, prev); - } - - prev.Add(st); - -#endif - return rethrow; - } - - /// - /// Returns all the stack traces associates with an exception - /// - public static IList GetExceptionStackTraces(Exception rethrow) { - List result; - return TryGetAssociatedStackTraces(rethrow, out result) ? result : null; - } - - private static void AssociateStackTraces(Exception e, List traces) { - e.Data[prevStackTraces] = traces; - } - - private static bool TryGetAssociatedStackTraces(Exception e, out List traces) { - traces = e.Data[prevStackTraces] as List; - return traces != null; - } -#else - public static Exception UpdateForRethrow(Exception rethrow) { - return rethrow; - } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/ScriptingRuntimeHelpers.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/ScriptingRuntimeHelpers.cs deleted file mode 100644 index f7fc8b33eda..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Runtime/ScriptingRuntimeHelpers.cs +++ /dev/null @@ -1,261 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Actions; -using Microsoft.Scripting.Generation; -using Microsoft.Scripting.Utils; -using Microsoft.Scripting.Interpreter; - -namespace Microsoft.Scripting.Runtime { - /// - /// These are some generally useful helper methods. Currently the only methods are those to - /// cached boxed representations of commonly used primitive types so that they can be shared. - /// This is useful to most dynamic languages that use object as a universal type. - /// - /// The methods in RuntimeHelepers are caleld by the generated code. From here the methods may - /// dispatch to other parts of the runtime to get bulk of the work done, but the entry points - /// should be here. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] - public static partial class ScriptingRuntimeHelpers { - private const int MIN_CACHE = -100; - private const int MAX_CACHE = 1000; - private static readonly object[] cache = MakeCache(); - - /// - /// A singleton boxed boolean true. - /// - public static readonly object True = true; - - /// - ///A singleton boxed boolean false. - /// - public static readonly object False = false; - - internal static readonly MethodInfo BooleanToObjectMethod = typeof(ScriptingRuntimeHelpers).GetMethod("BooleanToObject"); - internal static readonly MethodInfo Int32ToObjectMethod = typeof(ScriptingRuntimeHelpers).GetMethod("Int32ToObject"); - - private static object[] MakeCache() { - object[] result = new object[MAX_CACHE - MIN_CACHE]; - - for (int i = 0; i < result.Length; i++) { - result[i] = (object)(i + MIN_CACHE); - } - - return result; - } - -#if DEBUG - public static void NoteException(Exception e) { - PerfTrack.NoteEvent(PerfTrack.Categories.Exceptions, "LightEH Missed: " + e.GetType()); - } -#endif - - /// - /// Gets a singleton boxed value for the given integer if possible, otherwise boxes the integer. - /// - /// The value to box. - /// The boxed value. - public static object Int32ToObject(Int32 value) { - // caches improves pystone by ~5-10% on MS .Net 1.1, this is a very integer intense app - // TODO: investigate if this still helps perf. There's evidence that it's harmful on - // .NET 3.5 and 4.0 - if (value < MAX_CACHE && value >= MIN_CACHE) { - return cache[value - MIN_CACHE]; - } - return (object)value; - } - - private static readonly string[] chars = MakeSingleCharStrings(); - - private static string[] MakeSingleCharStrings() { - string[] result = new string[255]; - - for (char ch = (char)0; ch < result.Length; ch++) { - result[ch] = new string(ch, 1); - } - - return result; - } - - public static object BooleanToObject(bool value) { - return value ? True : False; - } - - public static string CharToString(char ch) { - if (ch < 255) return chars[ch]; - return new string(ch, 1); - } - - internal static object GetPrimitiveDefaultValue(Type type) { - switch (type.GetTypeCode()) { - case TypeCode.Boolean: return ScriptingRuntimeHelpers.False; - case TypeCode.SByte: return default(SByte); - case TypeCode.Byte: return default(Byte); - case TypeCode.Char: return default(Char); - case TypeCode.Int16: return default(Int16); - case TypeCode.Int32: return ScriptingRuntimeHelpers.Int32ToObject(0); - case TypeCode.Int64: return default(Int64); - case TypeCode.UInt16: return default(UInt16); - case TypeCode.UInt32: return default(UInt32); - case TypeCode.UInt64: return default(UInt64); - case TypeCode.Single: return default(Single); - case TypeCode.Double: return default(Double); -#if FEATURE_DBNULL - case TypeCode.DBNull: return default(DBNull); -#endif - case TypeCode.DateTime: return default(DateTime); - case TypeCode.Decimal: return default(Decimal); - default: return null; - } - } - - public static ArgumentTypeException SimpleTypeError(string message) { - return new ArgumentTypeException(message); - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] // TODO: fix - public static Exception CannotConvertError(Type toType, object value) { - return SimpleTypeError(String.Format("Cannot convert {0}({1}) to {2}", CompilerHelpers.GetType(value).Name, value, toType.Name)); - } - - public static Exception SimpleAttributeError(string message) { - //TODO: localize - return new MissingMemberException(message); - } - - public static object ReadOnlyAssignError(bool field, string fieldName) { - if (field) { - throw Error.FieldReadonly(fieldName); - } else { - throw Error.PropertyReadonly(fieldName); - } - } - - /// - /// Helper method to create an instance. Work around for Silverlight where Activator.CreateInstance - /// is SecuritySafeCritical. - /// - /// TODO: Why can't we just emit the right thing for default(T)? - /// It's always null for reference types and it's well defined for value types - /// - public static T CreateInstance() { - return default(T); - } - - // TODO: can't we just emit a new array? - public static T[] CreateArray(int args) { - return new T[args]; - } - - /// - /// EventInfo.EventHandlerType getter is marked SecuritySafeCritical in CoreCLR - /// This method is to get to the property without using Reflection - /// - /// - /// - public static Type GetEventHandlerType(EventInfo eventInfo) { - ContractUtils.RequiresNotNull(eventInfo, "eventInfo"); - return eventInfo.EventHandlerType; - } - - public static IList GetStringMembers(IList members) { - List res = new List(); - foreach (object o in members) { - string str = o as string; - if (str != null) { - res.Add(str); - } - } - return res; - } -#if !MONO_INTERPRETER - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] // TODO: fix - public static void SetEvent(EventTracker eventTracker, object value) { - EventTracker et = value as EventTracker; - if (et != null) { - if (et != eventTracker) { - throw Error.UnexpectedEvent(eventTracker.DeclaringType.Name, - eventTracker.Name, - et.DeclaringType.Name, - et.Name); - } - return; - } - - BoundMemberTracker bmt = value as BoundMemberTracker; - if (bmt == null) { - throw Error.ExpectedBoundEvent(CompilerHelpers.GetType(value).Name); - } - if (bmt.BoundTo.MemberType != TrackerTypes.Event) throw Error.ExpectedBoundEvent(bmt.BoundTo.MemberType.ToString()); - - if (bmt.BoundTo != eventTracker) throw Error.UnexpectedEvent( - eventTracker.DeclaringType.Name, - eventTracker.Name, - bmt.BoundTo.DeclaringType.Name, - bmt.BoundTo.Name); - } -#endif - // TODO: just emit this in the generated code - public static bool CheckDictionaryMembers(IDictionary dict, string[] names) { - if (dict.Count != names.Length) return false; - - foreach (string name in names) { - if (!dict.Contains(name)) { - return false; - } - } - return true; - } - - // TODO: just emit this in the generated code - [Obsolete("use MakeIncorrectBoxTypeError instead")] - public static T IncorrectBoxType(object received) { - throw Error.UnexpectedType("StrongBox<" + typeof(T).Name + ">", CompilerHelpers.GetType(received).Name); - } - - public static Exception MakeIncorrectBoxTypeError(Type type, object received) { - return Error.UnexpectedType("StrongBox<" + type.Name + ">", CompilerHelpers.GetType(received).Name); - } - - /// - /// Provides the test to see if an interpreted call site should switch over to being compiled. - /// - public static bool InterpretedCallSiteTest(bool restrictionResult, object bindingInfo) { - if (restrictionResult) { - CachedBindingInfo bindInfo = (CachedBindingInfo)bindingInfo; - if (bindInfo.CompilationThreshold >= 0) { - // still interpreting... - bindInfo.CompilationThreshold--; - return true; - } -#if SILVERLIGHT - if (PlatformAdaptationLayer.IsCompactFramework) { - bindInfo.CompilationThreshold = Int32.MaxValue; - return true; - } -#endif - return bindInfo.CheckCompiled(); - } - return false; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ArrayUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ArrayUtils.cs deleted file mode 100644 index 4262c15b0de..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ArrayUtils.cs +++ /dev/null @@ -1,354 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Text; - -namespace Microsoft.Scripting.Utils { - public static class ArrayUtils { - internal sealed class FunctorComparer : IComparer { - private readonly Comparison _comparison; - - public FunctorComparer(Comparison comparison) { - Assert.NotNull(comparison); - _comparison = comparison; - } - - public int Compare(T x, T y) { - return _comparison(x, y); - } - } - - // Emitted: - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")] - public static readonly string[] EmptyStrings = new string[0]; - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")] - public static readonly object[] EmptyObjects = new object[0]; - - public static IComparer ToComparer(Comparison comparison) { - return new FunctorComparer(comparison); - } - - public static TOutput[] ConvertAll(TInput[] input, Func conv) { - ContractUtils.RequiresNotNull(input, "input"); - ContractUtils.RequiresNotNull(conv, "conv"); - - TOutput[] res = new TOutput[input.Length]; - for (int i = 0; i < input.Length; i++) { - res[i] = conv(input[i]); - } - - return res; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional", MessageId = "1#")] // TODO: fix - public static void PrintTable(StringBuilder output, string[,] table) { - ContractUtils.RequiresNotNull(output, "output"); - ContractUtils.RequiresNotNull(table, "table"); - - int max_width = 0; - for (int i = 0; i < table.GetLength(0); i++) { - if (table[i, 0].Length > max_width) { - max_width = table[i, 0].Length; - } - } - - for (int i = 0; i < table.GetLength(0); i++) { - output.Append(" "); - output.Append(table[i, 0]); - - for (int j = table[i, 0].Length; j < max_width + 1; j++) { - output.Append(' '); - } - - output.AppendLine(table[i, 1]); - } - } - - public static T[] Copy(T[] array) { - return (array.Length > 0) ? (T[])array.Clone() : array; - } - - /// - /// Converts a generic ICollection of T into an array of T. - /// - /// If the collection is already an array of T the original collection is returned. - /// - public static T[] ToArray(ICollection list) { - return (list as T[]) ?? MakeArray(list); - } - - /// - /// Converts a generic ICollection of T into an array of R using a given conversion. - /// - /// If the collection is already an array of R the original collection is returned. - /// - public static TResult[] ToArray(ICollection list, Func convertor) { - TResult[] res = list as TResult[]; - if (res == null) { - res = new TResult[list.Count]; - int i = 0; - foreach (TElement obj in list) { - res[i++] = convertor(obj); - } - } - return res; - } - - public static T[] MakeArray(ICollection list) { - if (list.Count == 0) { - return new T[0]; - } - - T[] res = new T[list.Count]; - list.CopyTo(res, 0); - return res; - } - - public static T[] MakeArray(ICollection elements, int reservedSlotsBefore, int reservedSlotsAfter) { - if (reservedSlotsAfter < 0) throw new ArgumentOutOfRangeException("reservedSlotsAfter"); - if (reservedSlotsBefore < 0) throw new ArgumentOutOfRangeException("reservedSlotsBefore"); - - if (elements == null) { - return new T[reservedSlotsBefore + reservedSlotsAfter]; - } - - T[] result = new T[reservedSlotsBefore + elements.Count + reservedSlotsAfter]; - elements.CopyTo(result, reservedSlotsBefore); - return result; - } - - public static T[] RotateRight(T[] array, int count) { - ContractUtils.RequiresNotNull(array, "array"); - if ((count < 0) || (count > array.Length)) throw new ArgumentOutOfRangeException("count"); - - T[] result = new T[array.Length]; - // The head of the array is shifted, and the tail will be rotated to the head of the resulting array - int sizeOfShiftedArray = array.Length - count; - Array.Copy(array, 0, result, count, sizeOfShiftedArray); - Array.Copy(array, sizeOfShiftedArray, result, 0, count); - return result; - } - - public static T[] ShiftRight(T[] array, int count) { - ContractUtils.RequiresNotNull(array, "array"); - if (count < 0) throw new ArgumentOutOfRangeException("count"); - - T[] result = new T[array.Length + count]; - System.Array.Copy(array, 0, result, count, array.Length); - return result; - } - - public static T[] ShiftLeft(T[] array, int count) { - ContractUtils.RequiresNotNull(array, "array"); - if (count < 0) throw new ArgumentOutOfRangeException("count"); - - T[] result = new T[array.Length - count]; - System.Array.Copy(array, count, result, 0, result.Length); - return result; - } - - public static T[] Insert(T item, IList list) { - T[] res = new T[list.Count + 1]; - res[0] = item; - list.CopyTo(res, 1); - return res; - } - - public static T[] Insert(T item1, T item2, IList list) { - T[] res = new T[list.Count + 2]; - res[0] = item1; - res[1] = item2; - list.CopyTo(res, 2); - return res; - } - - public static T[] Insert(T item, T[] array) { - T[] result = ShiftRight(array, 1); - result[0] = item; - return result; - } - - public static T[] Insert(T item1, T item2, T[] array) { - T[] result = ShiftRight(array, 2); - result[0] = item1; - result[1] = item2; - return result; - } - - public static T[] Append(T[] array, T item) { - System.Array.Resize(ref array, (array == null) ? 1 : array.Length + 1); - array[array.Length - 1] = item; - return array; - } - - public static T[] AppendRange(T[] array, IList items) { - return AppendRange(array, items, 0); - } - - public static T[] AppendRange(T[] array, IList items, int additionalItemCount) { - if (additionalItemCount < 0) { - throw new ArgumentOutOfRangeException("additionalItemCount"); - } - - int j = (array == null) ? 0 : array.Length; - System.Array.Resize(ref array, j + items.Count + additionalItemCount); - - for (int i = 0; i < items.Count; i++, j++) { - array[j] = items[i]; - } - - return array; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1814:PreferJaggedArraysOverMultidimensional")] // TODO: fix - public static T[,] Concatenate(T[,] array1, T[,] array2) { - int columnsCount = array1.GetLength(1); - Debug.Assert(array2.GetLength(1) == columnsCount); - - int row1Count = array1.GetLength(0); - int row2Count = array2.GetLength(0); - int totalRowsCount = row1Count + row2Count; - T[,] result = new T[totalRowsCount, columnsCount]; - - for (int i = 0; i < row1Count; i++) { - for (int j = 0; j < columnsCount; j++) { - result[i, j] = array1[i, j]; - } - } - - for (int i = 0; i < row2Count; i++) { - for (int j = 0; j < columnsCount; j++) { - result[(i + row1Count), j] = array2[i, j]; - } - } - - return result; - } - - public static void SwapLastTwo(T[] array) { - Debug.Assert(array != null && array.Length >= 2); - - T temp = array[array.Length - 1]; - array[array.Length - 1] = array[array.Length - 2]; - array[array.Length - 2] = temp; - } - - public static T[] RemoveFirst(IList list) { - return ShiftLeft(MakeArray(list), 1); - } - - public static T[] RemoveFirst(T[] array) { - return ShiftLeft(array, 1); - } - - public static T[] RemoveLast(T[] array) { - ContractUtils.RequiresNotNull(array, "array"); - - System.Array.Resize(ref array, array.Length - 1); - return array; - } - - public static T[] RemoveAt(IList list, int indexToRemove) { - return RemoveAt(MakeArray(list), indexToRemove); - } - - public static T[] RemoveAt(T[] array, int indexToRemove) { - ContractUtils.RequiresNotNull(array, "array"); - ContractUtils.Requires(indexToRemove >= 0 && indexToRemove < array.Length, "index"); - - T[] result = new T[array.Length - 1]; - if (indexToRemove > 0) { - Array.Copy(array, 0, result, 0, indexToRemove); - } - int remaining = array.Length - indexToRemove - 1; - if (remaining > 0) { - Array.Copy(array, array.Length - remaining, result, result.Length - remaining, remaining); - } - return result; - } - - public static T[] InsertAt(IList list, int index, params T[] items) { - return InsertAt(MakeArray(list), index, items); - } - - public static T[] InsertAt(T[] array, int index, params T[] items) { - ContractUtils.RequiresNotNull(array, "array"); - ContractUtils.RequiresNotNull(items, "items"); - ContractUtils.Requires(index >= 0 && index <= array.Length, "index"); - - if (items.Length == 0) { - return Copy(array); - } - - T[] result = new T[array.Length + items.Length]; - if (index > 0) { - Array.Copy(array, 0, result, 0, index); - } - Array.Copy(items, 0, result, index, items.Length); - - int remaining = array.Length - index; - if (remaining > 0) { - Array.Copy(array, array.Length - remaining, result, result.Length - remaining, remaining); - } - return result; - } - - public static bool ValueEquals(this T[] array, T[] other) { - if (other.Length != array.Length) { - return false; - } - - for (int i = 0; i < array.Length; i++) { - if (!Object.Equals(array[i], other[i])) { - return false; - } - } - - return true; - } - - public static int GetValueHashCode(this T[] array) { - return GetValueHashCode(array, 0, array.Length); - } - - public static int GetValueHashCode(this T[] array, int start, int count) { - ContractUtils.RequiresNotNull(array, "array"); - ContractUtils.RequiresArrayRange(array.Length, start, count, "start", "count"); - - if (count == 0) { - return 0; - } - - int result = array[start].GetHashCode(); - for (int i = 1; i < count; i++) { - result = ((result << 5) | (result >> 27)) ^ array[start + i].GetHashCode(); - } - - return result; - } - - public static T[] Reverse(this T[] array) { - T[] res = new T[array.Length]; - for (int i = 0; i < array.Length; i++) { - res[array.Length - i - 1] = array[i]; - } - return res; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/Assert.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/Assert.cs deleted file mode 100644 index adae9ddd77a..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/Assert.cs +++ /dev/null @@ -1,78 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#define DEBUG - -using System; -using System.Collections.Generic; -using System.Diagnostics; - -namespace Microsoft.Scripting.Utils { - - public static class Assert { - - public static Exception Unreachable { - get { - Debug.Assert(false, "Unreachable"); - return new InvalidOperationException("Code supposed to be unreachable"); - } - } - - [Conditional("DEBUG")] - public static void NotNull(object var) { - Debug.Assert(var != null); - } - - [Conditional("DEBUG")] - public static void NotNull(object var1, object var2) { - Debug.Assert(var1 != null && var2 != null); - } - - [Conditional("DEBUG")] - public static void NotNull(object var1, object var2, object var3) { - Debug.Assert(var1 != null && var2 != null && var3 != null); - } - - [Conditional("DEBUG")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1025:ReplaceRepetitiveArgumentsWithParamsArray")] - public static void NotNull(object var1, object var2, object var3, object var4) { - Debug.Assert(var1 != null && var2 != null && var3 != null && var4 != null); - } - - [Conditional("DEBUG")] - public static void NotEmpty(string str) { - Debug.Assert(!String.IsNullOrEmpty(str)); - } - - [Conditional("DEBUG")] - public static void NotEmpty(ICollection array) { - Debug.Assert(array != null && array.Count > 0); - } - - [Conditional("DEBUG")] - public static void NotNullItems(IEnumerable items) where T : class { - Debug.Assert(items != null); - foreach (object item in items) { - Debug.Assert(item != null); - } - } - - [Conditional("DEBUG")] - public static void IsTrue(Func predicate) { - ContractUtils.RequiresNotNull(predicate, "predicate"); - Debug.Assert(predicate()); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/CacheDict.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/CacheDict.cs deleted file mode 100644 index 57724cc447a..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/CacheDict.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; - -namespace Microsoft.Scripting.Utils { - /// - /// Provides a dictionary-like object used for caches which holds onto a maximum - /// number of elements specified at construction time. - /// - /// This class is not thread safe. - /// - public class CacheDict { - private readonly Dictionary _dict = new Dictionary(); - private readonly LinkedList _list = new LinkedList(); - private readonly int _maxSize; - - /// - /// Creates a dictionary-like object used for caches. - /// - /// The maximum number of elements to store. - public CacheDict(int maxSize) { - _maxSize = maxSize; - } - - /// - /// Tries to get the value associated with 'key', returning true if it's found and - /// false if it's not present. - /// - public bool TryGetValue(TKey key, out TValue value) { - KeyInfo storedValue; - if (_dict.TryGetValue(key, out storedValue)) { - LinkedListNode node = storedValue.List; - if (node.Previous != null) { - // move us to the head of the list... - _list.Remove(node); - _list.AddFirst(node); - } - - value = storedValue.Value; - return true; - } - - value = default(TValue); - return false; - } - - /// - /// Adds a new element to the cache, replacing and moving it to the front if the - /// element is already present. - /// - public void Add(TKey key, TValue value) { - KeyInfo keyInfo; - if (_dict.TryGetValue(key, out keyInfo)) { - // remove original entry from the linked list - _list.Remove(keyInfo.List); - } else if (_list.Count == _maxSize) { - // we've reached capacity, remove the last used element... - LinkedListNode node = _list.Last; - _list.RemoveLast(); - bool res = _dict.Remove(node.Value); - Debug.Assert(res); - } - - // add the new entry to the head of the list and into the dictionary - LinkedListNode listNode = new LinkedListNode(key); - _list.AddFirst(listNode); - _dict[key] = new CacheDict.KeyInfo(value, listNode); - } - - /// - /// Returns the value associated with the given key, or throws KeyNotFoundException - /// if the key is not present. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1065:DoNotRaiseExceptionsInUnexpectedLocations")] - public TValue this[TKey key] { - get { - TValue res; - if (TryGetValue(key, out res)) { - return res; - } - throw new KeyNotFoundException(); - } - set { - Add(key, value); - } - } - - private struct KeyInfo { - internal readonly TValue Value; - internal readonly LinkedListNode List; - - internal KeyInfo(TValue value, LinkedListNode list) { - Value = value; - List = list; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/CollectionExtensions.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/CollectionExtensions.cs deleted file mode 100644 index 7eaf4000160..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/CollectionExtensions.cs +++ /dev/null @@ -1,156 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; - -namespace Microsoft.Scripting.Utils { - internal static class CollectionExtensions { - /// - /// Wraps the provided enumerable into a ReadOnlyCollection{T} - /// - /// Copies all of the data into a new array, so the data can't be - /// changed after creation. The exception is if the enumerable is - /// already a ReadOnlyCollection{T}, in which case we just return it. - /// - internal static ReadOnlyCollection ToReadOnly(this IEnumerable enumerable) { - if (enumerable == null) { - return EmptyReadOnlyCollection.Instance; - } - - var roCollection = enumerable as ReadOnlyCollection; - if (roCollection != null) { - return roCollection; - } - - var collection = enumerable as ICollection; - if (collection != null) { - int count = collection.Count; - if (count == 0) { - return EmptyReadOnlyCollection.Instance; - } - - T[] array = new T[count]; - collection.CopyTo(array, 0); - return new ReadOnlyCollection(array); - } - - // ToArray trims the excess space and speeds up access - return new ReadOnlyCollection(new List(enumerable).ToArray()); - } - - // We could probably improve the hashing here - internal static int ListHashCode(this IEnumerable list) { - var cmp = EqualityComparer.Default; - int h = 6551; - foreach (T t in list) { - h ^= (h << 5) ^ cmp.GetHashCode(t); - } - return h; - } - - internal static bool ListEquals(this ICollection first, ICollection second) { - if (first.Count != second.Count) { - return false; - } - var cmp = EqualityComparer.Default; - var f = first.GetEnumerator(); - var s = second.GetEnumerator(); - while (f.MoveNext()) { - s.MoveNext(); - - if (!cmp.Equals(f.Current, s.Current)) { - return false; - } - } - return true; - } - - // Name needs to be different so it doesn't conflict with Enumerable.Select - internal static U[] Map(this ICollection collection, Func select) { - int count = collection.Count; - U[] result = new U[count]; - count = 0; - foreach (T t in collection) { - result[count++] = select(t); - } - return result; - } - - internal static T[] RemoveFirst(this T[] array) { - T[] result = new T[array.Length - 1]; - Array.Copy(array, 1, result, 0, result.Length); - return result; - } - - internal static T[] RemoveLast(this T[] array) { - T[] result = new T[array.Length - 1]; - Array.Copy(array, 0, result, 0, result.Length); - return result; - } - - internal static T[] AddFirst(this IList list, T item) { - T[] res = new T[list.Count + 1]; - res[0] = item; - list.CopyTo(res, 1); - return res; - } - - internal static T[] AddLast(this IList list, T item) { - T[] res = new T[list.Count + 1]; - list.CopyTo(res, 0); - res[list.Count] = item; - return res; - } - - internal static T[] RemoveAt(this T[] array, int indexToRemove) { - Debug.Assert(array != null); - Debug.Assert(indexToRemove >= 0 && indexToRemove < array.Length); - - T[] result = new T[array.Length - 1]; - if (indexToRemove > 0) { - Array.Copy(array, 0, result, 0, indexToRemove); - } - int remaining = array.Length - indexToRemove - 1; - if (remaining > 0) { - Array.Copy(array, array.Length - remaining, result, result.Length - remaining, remaining); - } - return result; - } - - internal static T[] RotateRight(this T[] array, int count) { - Debug.Assert(count >= 0 && count <= array.Length); - - T[] result = new T[array.Length]; - // The head of the array is shifted, and the tail will be rotated to the head of the resulting array - int sizeOfShiftedArray = array.Length - count; - Array.Copy(array, 0, result, count, sizeOfShiftedArray); - Array.Copy(array, sizeOfShiftedArray, result, 0, count); - return result; - } - } - - - internal static class EmptyReadOnlyCollection { - internal static ReadOnlyCollection Instance = new ReadOnlyCollection(new T[0]); - } - // TODO: Should we use this everywhere for empty arrays? - // my thought is, probably more hassle than its worth - internal static class EmptyArray { - internal static T[] Instance = new T[0]; - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/CollectionUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/CollectionUtils.cs deleted file mode 100644 index dec3b4e5992..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/CollectionUtils.cs +++ /dev/null @@ -1,322 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Microsoft.Scripting.Utils { - /// - /// Allows wrapping of proxy types (like COM RCWs) to expose their IEnumerable functionality - /// which is supported after casting to IEnumerable, even though Reflection will not indicate - /// IEnumerable as a supported interface - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1010:CollectionsShouldImplementGenericInterface")] // TODO - public class EnumerableWrapper : IEnumerable { - private IEnumerable _wrappedObject; - public EnumerableWrapper(IEnumerable o) { - _wrappedObject = o; - } - - public IEnumerator GetEnumerator() { - return _wrappedObject.GetEnumerator(); - } - } - - public static class CollectionUtils { -#if !FEATURE_VARIANCE - public static IEnumerable Cast(this IEnumerable sequence) where S : T { - foreach (var item in sequence) { - yield return (T)item; - } - } -#else - public static IEnumerable Cast(this IEnumerable sequence) where S : T { - return (IEnumerable)sequence; - } -#endif - - public static IEnumerable ToCovariant(IEnumerable enumerable) - where T : TSuper { -#if FEATURE_VARIANCE - return (IEnumerable)enumerable; -#else - return new CovariantConvertor(enumerable); -#endif - } - - public static void AddRange(ICollection collection, IEnumerable items) { - ContractUtils.RequiresNotNull(collection, "collection"); - ContractUtils.RequiresNotNull(items, "items"); - - List list = collection as List; - if (list != null) { - list.AddRange(items); - } else { - foreach (T item in items) { - collection.Add(item); - } - } - } - - public static void AddRange(this IList list, IEnumerable items) { - foreach (var item in items) { - list.Add(item); - } - } - - public static IEnumerable ToEnumerable(IEnumerable enumerable) { - foreach (T item in enumerable) { - yield return item; - } - } - - public static IEnumerator ToCovariant(IEnumerator enumerator) - where T : TSuper { - - ContractUtils.RequiresNotNull(enumerator, "enumerator"); - - while (enumerator.MoveNext()) { - yield return enumerator.Current; - } - } - - private class CovariantConvertor : IEnumerable where T : TSuper { - private IEnumerable _enumerable; - - public CovariantConvertor(IEnumerable enumerable) { - ContractUtils.RequiresNotNull(enumerable, "enumerable"); - _enumerable = enumerable; - } - - public IEnumerator GetEnumerator() { - return CollectionUtils.ToCovariant(_enumerable.GetEnumerator()); - } - - IEnumerator IEnumerable.GetEnumerator() { - return GetEnumerator(); - } - } - - public static IDictionaryEnumerator ToDictionaryEnumerator(IEnumerator> enumerator) { - return new DictionaryEnumerator(enumerator); - } - - private sealed class DictionaryEnumerator : IDictionaryEnumerator { - private readonly IEnumerator> _enumerator; - - public DictionaryEnumerator(IEnumerator> enumerator) { - _enumerator = enumerator; - } - - public DictionaryEntry Entry { - get { return new DictionaryEntry(_enumerator.Current.Key, _enumerator.Current.Value); } - } - - public object Key { - get { return _enumerator.Current.Key; } - } - - public object Value { - get { return _enumerator.Current.Value; } - } - - public object Current { - get { return Entry; } - } - - public bool MoveNext() { - return _enumerator.MoveNext(); - } - - public void Reset() { - _enumerator.Reset(); - } - } - - public static List MakeList(T item) { - List result = new List(); - result.Add(item); - return result; - } - - public static int CountOf(IList list, T item) where T : IEquatable { - if (list == null) return 0; - - int result = 0; - for (int i = 0; i < list.Count; i++) { - if (list[i].Equals(item)) { - result++; - } - } - return result; - } - - public static int Max(this IEnumerable values) { - ContractUtils.RequiresNotNull(values, "values"); - - int result = Int32.MinValue; - foreach (var value in values) { - if (value > result) { - result = value; - } - } - return result; - } - - public static bool TrueForAll(IEnumerable collection, Predicate predicate) { - ContractUtils.RequiresNotNull(collection, "collection"); - ContractUtils.RequiresNotNull(predicate, "predicate"); - - foreach (T item in collection) { - if (!predicate(item)) return false; - } - - return true; - } - - public static IList ConvertAll(IList collection, Func predicate) { - ContractUtils.RequiresNotNull(collection, "collection"); - ContractUtils.RequiresNotNull(predicate, "predicate"); - - List res = new List(collection.Count); - foreach (T item in collection) { - res.Add(predicate(item)); - } - - return res; - } - - public static List GetRange(IList list, int index, int count) { - ContractUtils.RequiresNotNull(list, "list"); - ContractUtils.RequiresArrayRange(list, index, count, "index", "count"); - - List result = new List(count); - int stop = index + count; - for (int i = index; i < stop; i++) { - result.Add(list[i]); - } - return result; - } - - public static void InsertRange(IList collection, int index, IEnumerable items) { - ContractUtils.RequiresNotNull(collection, "collection"); - ContractUtils.RequiresNotNull(items, "items"); - ContractUtils.RequiresArrayInsertIndex(collection, index, "index"); - - List list = collection as List; - if (list != null) { - list.InsertRange(index, items); - } else { - int i = index; - foreach (T obj in items) { - collection.Insert(i++, obj); - } - } - } - - public static void RemoveRange(IList collection, int index, int count) { - ContractUtils.RequiresNotNull(collection, "collection"); - ContractUtils.RequiresArrayRange(collection, index, count, "index", "count"); - - List list = collection as List; - if (list != null) { - list.RemoveRange(index, count); - } else { - for (int i = index + count - 1; i >= index; i--) { - collection.RemoveAt(i); - } - } - } - - public static int FindIndex(this IList collection, Predicate predicate) { - ContractUtils.RequiresNotNull(collection, "collection"); - ContractUtils.RequiresNotNull(predicate, "predicate"); - - for (int i = 0; i < collection.Count; i++) { - if (predicate(collection[i])) { - return i; - } - } - return -1; - } - - public static IList ToSortedList(this ICollection collection, Comparison comparison) { - ContractUtils.RequiresNotNull(collection, "collection"); - ContractUtils.RequiresNotNull(comparison, "comparison"); - - var array = new T[collection.Count]; - collection.CopyTo(array, 0); - Array.Sort(array, comparison); - return array; - } - - public static T[] ToReverseArray(this IList list) { - ContractUtils.RequiresNotNull(list, "list"); - T[] result = new T[list.Count]; - for (int i = 0; i < result.Length; i++) { - result[i] = list[result.Length - 1 - i]; - } - return result; - } - - -#if SILVERLIGHT || WIN8 || WP75 - // HashSet.CreateSetComparer not available on Silverlight - public static IEqualityComparer> CreateSetComparer() { - return new HashSetEqualityComparer(); - } - - class HashSetEqualityComparer : IEqualityComparer> { - private IEqualityComparer _comparer; - - public HashSetEqualityComparer() { - _comparer = EqualityComparer.Default; - } - - public bool Equals(HashSet x, HashSet y) { - if (x == y) { - return true; - } else if (x == null || y == null || x.Count != y.Count) { - return false; - } - - foreach (T value in x) { - if (!y.Contains(value)) { - return false; - } - } - - return true; - } - - public int GetHashCode(HashSet obj) { - int res = 6551; - if (obj != null) { - foreach (T t in obj) { - res = res ^ _comparer.GetHashCode(t); - } - } - - return res; - } - } -#else - public static IEqualityComparer> CreateSetComparer() { - return HashSet.CreateSetComparer(); - } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ContractUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ContractUtils.cs deleted file mode 100644 index 53a9ea256fd..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ContractUtils.cs +++ /dev/null @@ -1,233 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics; - -namespace Microsoft.Scripting.Utils { - public static class ContractUtils { - [Conditional("DEBUG")] - public static void Assert(bool precondition) { - Debug.Assert(precondition); - } - - public static void Requires(bool precondition) { - if (!precondition) { - throw new ArgumentException(Strings.MethodPreconditionViolated); - } - } - - public static void Requires(bool precondition, string paramName) { - Utils.Assert.NotEmpty(paramName); - - if (!precondition) { - throw new ArgumentException(Strings.InvalidArgumentValue, paramName); - } - } - - public static void Requires(bool precondition, string paramName, string message) { - Utils.Assert.NotEmpty(paramName); - - if (!precondition) { - throw new ArgumentException(message, paramName); - } - } - - public static void RequiresNotNull(object value, string paramName) { - Utils.Assert.NotEmpty(paramName); - - if (value == null) { - throw new ArgumentNullException(paramName); - } - } - - public static void RequiresNotEmpty(string str, string paramName) { - RequiresNotNull(str, paramName); - if (str.Length == 0) { - throw new ArgumentException(Strings.NonEmptyStringRequired, paramName); - } - } - - public static void RequiresNotEmpty(ICollection collection, string paramName) { - RequiresNotNull(collection, paramName); - if (collection.Count == 0) { - throw new ArgumentException(Strings.NonEmptyCollectionRequired, paramName); - } - } - - /// - /// Requires the specified index to point inside the array. - /// - /// Array is null. - /// Index is outside the array. - public static void RequiresArrayIndex(IList array, int index, string indexName) { - RequiresArrayIndex(array.Count, index, indexName); - } - - /// - /// Requires the specified index to point inside the array. - /// - /// Index is outside the array. - public static void RequiresArrayIndex(int arraySize, int index, string indexName) { - Utils.Assert.NotEmpty(indexName); - Debug.Assert(arraySize >= 0); - - if (index < 0 || index >= arraySize) throw new ArgumentOutOfRangeException(indexName); - } - - /// - /// Requires the specified index to point inside the array or at the end - /// - /// Array is null. - /// Index is outside the array. - public static void RequiresArrayInsertIndex(IList array, int index, string indexName) { - RequiresArrayInsertIndex(array.Count, index, indexName); - } - - /// - /// Requires the specified index to point inside the array or at the end - /// - /// Array is null. - /// Index is outside the array. - public static void RequiresArrayInsertIndex(int arraySize, int index, string indexName) { - Utils.Assert.NotEmpty(indexName); - Debug.Assert(arraySize >= 0); - - if (index < 0 || index > arraySize) throw new ArgumentOutOfRangeException(indexName); - } - - /// - /// Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - /// - /// Offset or count are out of range. - public static void RequiresArrayRange(IList array, int offset, int count, string offsetName, string countName) { - Utils.Assert.NotNull(array); - RequiresArrayRange(array.Count, offset, count, offsetName, countName); - } - - /// - /// Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - /// - /// Offset or count are out of range. - public static void RequiresArrayRange(int arraySize, int offset, int count, string offsetName, string countName) { - Utils.Assert.NotEmpty(offsetName); - Utils.Assert.NotEmpty(countName); - Debug.Assert(arraySize >= 0); - - if (count < 0) throw new ArgumentOutOfRangeException(countName); - if (offset < 0 || arraySize - offset < count) throw new ArgumentOutOfRangeException(offsetName); - } - - - /// - /// Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - /// - /// Array is null. - /// Offset or count are out of range. - public static void RequiresListRange(IList array, int offset, int count, string offsetName, string countName) { - Utils.Assert.NotEmpty(offsetName); - Utils.Assert.NotEmpty(countName); - Utils.Assert.NotNull(array); - - if (count < 0) throw new ArgumentOutOfRangeException(countName); - if (offset < 0 || array.Count - offset < count) throw new ArgumentOutOfRangeException(offsetName); - } - - /// - /// Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - /// - /// String is null. - /// Offset or count are out of range. - public static void RequiresArrayRange(string str, int offset, int count, string offsetName, string countName) { - Utils.Assert.NotEmpty(offsetName); - Utils.Assert.NotEmpty(countName); - Utils.Assert.NotNull(str); - - if (count < 0) throw new ArgumentOutOfRangeException(countName); - if (offset < 0 || str.Length - offset < count) throw new ArgumentOutOfRangeException(offsetName); - } - - /// - /// Requires the array and all its items to be non-null. - /// - public static void RequiresNotNullItems(IList array, string arrayName) { - Utils.Assert.NotNull(arrayName); - RequiresNotNull(array, arrayName); - - for (int i = 0; i < array.Count; i++) { - if (array[i] == null) { - throw ExceptionUtils.MakeArgumentItemNullException(i, arrayName); - } - } - } - - /// - /// Requires the enumerable collection and all its items to be non-null. - /// - public static void RequiresNotNullItems(IEnumerable collection, string collectionName) { - Utils.Assert.NotNull(collectionName); - RequiresNotNull(collection, collectionName); - - int i = 0; - foreach (var item in collection) { - if (item == null) { - throw ExceptionUtils.MakeArgumentItemNullException(i, collectionName); - } - i++; - } - } - - [Conditional("FALSE")] - public static void Invariant(bool condition) { - Debug.Assert(condition); - } - - [Conditional("FALSE")] - public static void Invariant(bool condition, string message) { - Debug.Assert(condition, message); - } - - [Conditional("FALSE")] - public static void Ensures(bool condition) { - // nop - } - - [Conditional("FALSE")] - public static void Ensures(bool condition, string message) { - // nop - } - - public static T Result() { - return default(T); - } - - public static T Parameter(out T value) { - value = default(T); - return value; - } - - public static T Old(T value) { - return value; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/DynamicUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/DynamicUtils.cs deleted file mode 100644 index 3c8e955c587..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/DynamicUtils.cs +++ /dev/null @@ -1,297 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_TASKS -using System.Threading.Tasks; -#endif - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Threading; -using Microsoft.Scripting.Generation; -using Microsoft.Scripting.Interpreter; -using Microsoft.Scripting.Runtime; - -#if !FEATURE_DYNAMIC_EXPRESSION_VISITOR -#if FEATURE_CORE_DLR -namespace System.Linq.Expressions { -#else -namespace Microsoft.Scripting.Ast { -#endif - public abstract class DynamicExpressionVisitor : ExpressionVisitor { - } -} -#endif - -namespace Microsoft.Scripting.Utils { - using AstUtils = Microsoft.Scripting.Ast.Utils; - - public static class DynamicUtils { - /// - /// Returns the list of expressions represented by the instances. - /// - /// An array of instances to extract expressions from. - /// The array of expressions. - public static Expression[] GetExpressions(DynamicMetaObject[] objects) { - ContractUtils.RequiresNotNull(objects, "objects"); - - Expression[] res = new Expression[objects.Length]; - for (int i = 0; i < objects.Length; i++) { - DynamicMetaObject mo = objects[i]; - res[i] = mo != null ? mo.Expression : null; - } - - return res; - } - - /// - /// Creates an instance of for a runtime value and the expression that represents it during the binding process. - /// - /// The runtime value to be represented by the . - /// An expression to represent this during the binding process. - /// The new instance of . - public static DynamicMetaObject ObjectToMetaObject(object argValue, Expression parameterExpression) { - IDynamicMetaObjectProvider ido = argValue as IDynamicMetaObjectProvider; - if (ido != null) { - return ido.GetMetaObject(parameterExpression); - } else { - return new DynamicMetaObject(parameterExpression, BindingRestrictions.Empty, argValue); - } - } - - /// - /// Produces an interpreted binding using the given binder which falls over to a compiled - /// binding after hitCount tries. - /// - /// This method should be called whenever an interpreted binding is required. Sometimes it will - /// return a compiled binding if a previous binding was produced and it's hit count was exhausted. - /// In this case the binder will not be called back for a new binding - the previous one will - /// be used. - /// - /// The delegate type being used for the call site - /// The binder used for the call site - /// The number of calls before the binder should switch to a compiled mode. - /// The arguments that are passed for the binding (as received in a BindDelegate call) - /// A delegate which represents the interpreted binding. - public static T/*!*/ LightBind(this DynamicMetaObjectBinder/*!*/ binder, object[]/*!*/ args, int compilationThreshold) where T : class { - ContractUtils.RequiresNotNull(binder, "binder"); - ContractUtils.RequiresNotNull(args, "args"); - - return GenericInterpretedBinder.Instance.Bind(binder, compilationThreshold < 0 ? LightCompiler.DefaultCompilationThreshold : compilationThreshold, args); - } - - private class GenericInterpretedBinder where T : class { - public static GenericInterpretedBinder/*!*/ Instance = new GenericInterpretedBinder(); - private readonly ReadOnlyCollection/*!*/ _parameters; - private readonly Expression/*!*/ _updateExpression; - - private GenericInterpretedBinder() { - var invokeMethod = typeof(T).GetMethod("Invoke"); - var methodParams = invokeMethod.GetParameters(); - - ReadOnlyCollectionBuilder prms = new ReadOnlyCollectionBuilder(methodParams.Length); - ReadOnlyCollectionBuilder invokePrms = new ReadOnlyCollectionBuilder(methodParams.Length); - for (int i = 0; i < methodParams.Length; i++) { - var param = Expression.Parameter(methodParams[i].ParameterType); - if (i == 0) { - invokePrms.Add(Expression.Convert(param, typeof(CallSite))); - } else { - invokePrms.Add(param); - } - prms.Add(param); - } - - _parameters = prms.ToReadOnlyCollection(); - - _updateExpression = Expression.Block( - Expression.Label(CallSiteBinder.UpdateLabel), - Expression.Invoke( - Expression.Property( - invokePrms[0], - typeof(CallSite).GetDeclaredProperty("Update") - ), - invokePrms.ToReadOnlyCollection() - ) - ); - } - - public T/*!*/ Bind(DynamicMetaObjectBinder/*!*/ binder, int compilationThreshold, object[] args) { - if (CachedBindingInfo.LastInterpretedFailure != null && CachedBindingInfo.LastInterpretedFailure.Binder == binder) { - // we failed the rule because we have a compiled target available, return the compiled target - Debug.Assert(CachedBindingInfo.LastInterpretedFailure.CompiledTarget != null); - var res = CachedBindingInfo.LastInterpretedFailure.CompiledTarget; - CachedBindingInfo.LastInterpretedFailure = null; - return res; - } - - // we haven't produced a rule yet.... - var bindingInfo = new CachedBindingInfo(binder, compilationThreshold); - - var targetMO = DynamicMetaObject.Create(args[0], _parameters[1]); // 1 is skipping CallSite - DynamicMetaObject[] argsMO = new DynamicMetaObject[args.Length - 1]; - for (int i = 0; i < argsMO.Length; i++) { - argsMO[i] = DynamicMetaObject.Create(args[i + 1], _parameters[i + 2]); - } - var binding = binder.Bind(targetMO, argsMO); - - return CreateDelegate(binding, bindingInfo); - } - - private T/*!*/ CreateDelegate(DynamicMetaObject/*!*/ binding, CachedBindingInfo/*!*/ bindingInfo) { - return Compile(binding, bindingInfo).LightCompile(Int32.MaxValue); - } - - private Expression/*!*/ Compile(DynamicMetaObject/*!*/ obj, CachedBindingInfo/*!*/ bindingInfo) { - var restrictions = obj.Restrictions.ToExpression(); - - var body = Expression.Condition( - new InterpretedRuleHitCheckExpression(restrictions, bindingInfo), - AstUtils.Convert(obj.Expression, _updateExpression.Type), - _updateExpression - ); - - var res = Expression.Lambda( - body, - "CallSite.Target", - true, // always compile the rules with tail call optimization - _parameters - ); - - bindingInfo.Target = res; - return res; - } - - /// - /// Expression which reduces to the normal test but under the interpreter adds a count down - /// check which enables compiling when the count down is reached. - /// - class InterpretedRuleHitCheckExpression : Expression, IInstructionProvider { - private readonly Expression/*!*/ _test; - private readonly CachedBindingInfo/*!*/ _bindingInfo; - - private static readonly MethodInfo InterpretedCallSiteTest = typeof(ScriptingRuntimeHelpers).GetMethod("InterpretedCallSiteTest"); - public InterpretedRuleHitCheckExpression(Expression/*!*/ test, CachedBindingInfo/*!*/ bindingInfo) { - Assert.NotNull(test, bindingInfo); - - _test = test; - _bindingInfo = bindingInfo; - } - - public override Expression Reduce() { - return _test; - } - - protected override Expression VisitChildren(ExpressionVisitor visitor) { - var test = visitor.Visit(_test); - if (test != _test) { - return new InterpretedRuleHitCheckExpression(test, _bindingInfo); - } - return this; - } - - public override bool CanReduce { - get { return true; } - } - - public override ExpressionType NodeType { - get { return ExpressionType.Extension; } - } - - public override Type Type { - get { return typeof(bool); } - } - - #region IInstructionProvider Members - - public void AddInstructions(LightCompiler compiler) { - compiler.Compile(_test); - compiler.Instructions.EmitLoad(_bindingInfo); - compiler.EmitCall(InterpretedCallSiteTest); - } - - #endregion - } - } - } - - - /// - /// Base class for storing information about the binding that a specific rule is applicable for. - /// - /// We have a derived generic class but this class enables us to refer to it w/o having the - /// generic type information around. - /// - /// This class tracks both the count down to when we should compile. When we compile we - /// take the Expression[T] that was used before and compile it. While this is happening - /// we continue to allow the interpreted code to run. When the compilation is complete we - /// store a thread static which tells us what binding failed and the current rule is no - /// longer functional. Finally the language binder will call us again and we'll retrieve - /// and return the compiled overload. - /// - abstract class CachedBindingInfo { - public readonly DynamicMetaObjectBinder/*!*/ Binder; - public int CompilationThreshold; - - public CachedBindingInfo(DynamicMetaObjectBinder binder, int compilationThreshold) { - Binder = binder; - CompilationThreshold = compilationThreshold; - } - - public abstract bool CheckCompiled(); - } - - class CachedBindingInfo : CachedBindingInfo where T : class { - public T CompiledTarget; - public Expression Target; - - [ThreadStatic] - public static CachedBindingInfo LastInterpretedFailure; - - public CachedBindingInfo(DynamicMetaObjectBinder binder, int compilationThreshold) - : base(binder, compilationThreshold) { - } - - public override bool CheckCompiled() { - if (Target != null) { - // start compiling the target if no one else has - var lambda = Interlocked.Exchange(ref Target, null); - if (lambda != null) { -#if FEATURE_TASKS - new Task(() => { CompiledTarget = lambda.Compile(); }).Start(); -#else - ThreadPool.QueueUserWorkItem(x => { CompiledTarget = lambda.Compile(); }); -#endif - } - } - - if (CompiledTarget != null) { - LastInterpretedFailure = this; - return false; - } - - return true; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ExceptionFactory.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ExceptionFactory.Generated.cs deleted file mode 100644 index 1214351549a..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ExceptionFactory.Generated.cs +++ /dev/null @@ -1,1050 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; - -namespace Microsoft.Scripting { - - internal static partial class Strings { - private static string FormatString(string format, params object[] args) { - return string.Format(System.Globalization.CultureInfo.CurrentCulture, format, args); - } - } - - #region Generated Microsoft.Scripting Exception Factory - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_expr_factory_scripting from: generate_exception_factory.py - - /// - /// Strongly-typed and parameterized string factory. - /// - - internal static partial class Strings { - /// - /// A string like "Cannot access member {1} declared on type {0} because the type contains generic parameters." - /// - internal static string InvalidOperation_ContainsGenericParameters(object p0, object p1) { - return FormatString("Cannot access member {1} declared on type {0} because the type contains generic parameters.", p0, p1); - } - - /// - /// A string like "Type '{0}' is missing or cannot be loaded." - /// - internal static string MissingType(object p0) { - return FormatString("Type '{0}' is missing or cannot be loaded.", p0); - } - - /// - /// A string like "static property "{0}" of "{1}" can only be read through a type, not an instance" - /// - internal static string StaticAccessFromInstanceError(object p0, object p1) { - return FormatString("static property \"{0}\" of \"{1}\" can only be read through a type, not an instance", p0, p1); - } - - /// - /// A string like "static property "{0}" of "{1}" can only be assigned to through a type, not an instance" - /// - internal static string StaticAssignmentFromInstanceError(object p0, object p1) { - return FormatString("static property \"{0}\" of \"{1}\" can only be assigned to through a type, not an instance", p0, p1); - } - - /// - /// A string like "Method precondition violated" - /// - internal static string MethodPreconditionViolated { - get { - return "Method precondition violated"; - } - } - - /// - /// A string like "Invalid argument value" - /// - internal static string InvalidArgumentValue { - get { - return "Invalid argument value"; - } - } - - /// - /// A string like "Non-empty string required" - /// - internal static string NonEmptyStringRequired { - get { - return "Non-empty string required"; - } - } - - /// - /// A string like "Non-empty collection required" - /// - internal static string NonEmptyCollectionRequired { - get { - return "Non-empty collection required"; - } - } - - /// - /// A string like "must by an Exception instance" - /// - internal static string MustBeExceptionInstance { - get { - return "must by an Exception instance"; - } - } - - /// - /// A string like "Type of test must be bool" - /// - internal static string TypeOfTestMustBeBool { - get { - return "Type of test must be bool"; - } - } - - /// - /// A string like "Type of the expression must be bool" - /// - internal static string TypeOfExpressionMustBeBool { - get { - return "Type of the expression must be bool"; - } - } - - /// - /// A string like "Empty string is not a valid path." - /// - internal static string EmptyStringIsInvalidPath { - get { - return "Empty string is not a valid path."; - } - } - - /// - /// A string like "Invalid delegate type (Invoke method not found)." - /// - internal static string InvalidDelegate { - get { - return "Invalid delegate type (Invoke method not found)."; - } - } - - /// - /// A string like "expected only static property" - /// - internal static string ExpectedStaticProperty { - get { - return "expected only static property"; - } - } - - /// - /// A string like "Property doesn't exist on the provided type" - /// - internal static string PropertyDoesNotExist { - get { - return "Property doesn't exist on the provided type"; - } - } - - /// - /// A string like "Field doesn't exist on provided type" - /// - internal static string FieldDoesNotExist { - get { - return "Field doesn't exist on provided type"; - } - } - - /// - /// A string like "Type doesn't have constructor with a given signature" - /// - internal static string TypeDoesNotHaveConstructorForTheSignature { - get { - return "Type doesn't have constructor with a given signature"; - } - } - - /// - /// A string like "Type doesn't have a method with a given name." - /// - internal static string TypeDoesNotHaveMethodForName { - get { - return "Type doesn't have a method with a given name."; - } - } - - /// - /// A string like "Type doesn't have a method with a given name and signature." - /// - internal static string TypeDoesNotHaveMethodForNameSignature { - get { - return "Type doesn't have a method with a given name and signature."; - } - } - - /// - /// A string like "Count must be non-negative." - /// - internal static string CountCannotBeNegative { - get { - return "Count must be non-negative."; - } - } - - /// - /// A string like "arrayType must be an array type" - /// - internal static string ArrayTypeMustBeArray { - get { - return "arrayType must be an array type"; - } - } - - /// - /// A string like "Either code or target must be specified." - /// - internal static string MustHaveCodeOrTarget { - get { - return "Either code or target must be specified."; - } - } - - /// - /// A string like "Type parameter is {0}. Expected a delegate." - /// - internal static string TypeParameterIsNotDelegate(object p0) { - return FormatString("Type parameter is {0}. Expected a delegate.", p0); - } - - /// - /// A string like "Cannot cast from type '{0}' to type '{1}" - /// - internal static string InvalidCast(object p0, object p1) { - return FormatString("Cannot cast from type '{0}' to type '{1}", p0, p1); - } - - /// - /// A string like "unknown member type: '{0}'. " - /// - internal static string UnknownMemberType(object p0) { - return FormatString("unknown member type: '{0}'. ", p0); - } - - /// - /// A string like "RuleBuilder can only be used with delegates whose first argument is CallSite." - /// - internal static string FirstArgumentMustBeCallSite { - get { - return "RuleBuilder can only be used with delegates whose first argument is CallSite."; - } - } - - /// - /// A string like "no instance for call." - /// - internal static string NoInstanceForCall { - get { - return "no instance for call."; - } - } - - /// - /// A string like "Missing Test." - /// - internal static string MissingTest { - get { - return "Missing Test."; - } - } - - /// - /// A string like "Missing Target." - /// - internal static string MissingTarget { - get { - return "Missing Target."; - } - } - - /// - /// A string like "The operation requires a non-generic type for {0}, but this represents generic types only" - /// - internal static string NonGenericWithGenericGroup(object p0) { - return FormatString("The operation requires a non-generic type for {0}, but this represents generic types only", p0); - } - - /// - /// A string like "Invalid operation: '{0}'" - /// - internal static string InvalidOperation(object p0) { - return FormatString("Invalid operation: '{0}'", p0); - } - - /// - /// A string like "Finally already defined." - /// - internal static string FinallyAlreadyDefined { - get { - return "Finally already defined."; - } - } - - /// - /// A string like "Can not have fault and finally." - /// - internal static string CannotHaveFaultAndFinally { - get { - return "Can not have fault and finally."; - } - } - - /// - /// A string like "Fault already defined." - /// - internal static string FaultAlreadyDefined { - get { - return "Fault already defined."; - } - } - - /// - /// A string like "Cannot create default value for type {0}." - /// - internal static string CantCreateDefaultTypeFor(object p0) { - return FormatString("Cannot create default value for type {0}.", p0); - } - - /// - /// A string like "Unhandled convert: {0}" - /// - internal static string UnhandledConvert(object p0) { - return FormatString("Unhandled convert: {0}", p0); - } - - /// - /// A string like "{0}.{1} has no publiclly visible method." - /// - internal static string NoCallableMethods(object p0, object p1) { - return FormatString("{0}.{1} has no publiclly visible method.", p0, p1); - } - - /// - /// A string like "Global/top-level local variable names must be unique." - /// - internal static string GlobalsMustBeUnique { - get { - return "Global/top-level local variable names must be unique."; - } - } - - /// - /// A string like "Generating code from non-serializable CallSiteBinder." - /// - internal static string GenNonSerializableBinder { - get { - return "Generating code from non-serializable CallSiteBinder."; - } - } - - /// - /// A string like "pecified path is invalid." - /// - internal static string InvalidPath { - get { - return "pecified path is invalid."; - } - } - - /// - /// A string like "Dictionaries are not hashable." - /// - internal static string DictionaryNotHashable { - get { - return "Dictionaries are not hashable."; - } - } - - /// - /// A string like "language already registered." - /// - internal static string LanguageRegistered { - get { - return "language already registered."; - } - } - - /// - /// A string like "The method or operation is not implemented." - /// - internal static string MethodOrOperatorNotImplemented { - get { - return "The method or operation is not implemented."; - } - } - - /// - /// A string like "No exception." - /// - internal static string NoException { - get { - return "No exception."; - } - } - - /// - /// A string like "Extension type {0} must be public." - /// - internal static string ExtensionMustBePublic(object p0) { - return FormatString("Extension type {0} must be public.", p0); - } - - /// - /// A string like "Already initialized." - /// - internal static string AlreadyInitialized { - get { - return "Already initialized."; - } - } - - /// - /// A string like "CreateScopeExtension must return a scope extension." - /// - internal static string MustReturnScopeExtension { - get { - return "CreateScopeExtension must return a scope extension."; - } - } - - /// - /// A string like "Invalid number of parameters for the service." - /// - internal static string InvalidParamNumForService { - get { - return "Invalid number of parameters for the service."; - } - } - - /// - /// A string like "Invalid type of argument {0}; expecting {1}." - /// - internal static string InvalidArgumentType(object p0, object p1) { - return FormatString("Invalid type of argument {0}; expecting {1}.", p0, p1); - } - - /// - /// A string like "Cannot change non-caching value." - /// - internal static string CannotChangeNonCachingValue { - get { - return "Cannot change non-caching value."; - } - } - - /// - /// A string like "Field {0} is read-only" - /// - internal static string FieldReadonly(object p0) { - return FormatString("Field {0} is read-only", p0); - } - - /// - /// A string like "Property {0} is read-only" - /// - internal static string PropertyReadonly(object p0) { - return FormatString("Property {0} is read-only", p0); - } - - /// - /// A string like "Expected event from {0}.{1}, got event from {2}.{3}." - /// - internal static string UnexpectedEvent(object p0, object p1, object p2, object p3) { - return FormatString("Expected event from {0}.{1}, got event from {2}.{3}.", p0, p1, p2, p3); - } - - /// - /// A string like "expected bound event, got {0}." - /// - internal static string ExpectedBoundEvent(object p0) { - return FormatString("expected bound event, got {0}.", p0); - } - - /// - /// A string like "Expected type {0}, got {1}." - /// - internal static string UnexpectedType(object p0, object p1) { - return FormatString("Expected type {0}, got {1}.", p0, p1); - } - - /// - /// A string like "can only write to member {0}." - /// - internal static string MemberWriteOnly(object p0) { - return FormatString("can only write to member {0}.", p0); - } - - /// - /// A string like "No code to compile." - /// - internal static string NoCodeToCompile { - get { - return "No code to compile."; - } - } - - /// - /// A string like "Invalid stream type: {0}." - /// - internal static string InvalidStreamType(object p0) { - return FormatString("Invalid stream type: {0}.", p0); - } - - /// - /// A string like "Queue empty." - /// - internal static string QueueEmpty { - get { - return "Queue empty."; - } - } - - /// - /// A string like "Enumeration has not started. Call MoveNext." - /// - internal static string EnumerationNotStarted { - get { - return "Enumeration has not started. Call MoveNext."; - } - } - - /// - /// A string like "Enumeration already finished." - /// - internal static string EnumerationFinished { - get { - return "Enumeration already finished."; - } - } - - /// - /// A string like "can't add another casing for identifier {0}" - /// - internal static string CantAddCasing(object p0) { - return FormatString("can't add another casing for identifier {0}", p0); - } - - /// - /// A string like "can't add new identifier {0}" - /// - internal static string CantAddIdentifier(object p0) { - return FormatString("can't add new identifier {0}", p0); - } - - /// - /// A string like "Type '{0}' doesn't provide a suitable public constructor or its implementation is faulty: {1}" - /// - internal static string InvalidCtorImplementation(object p0, object p1) { - return FormatString("Type '{0}' doesn't provide a suitable public constructor or its implementation is faulty: {1}", p0, p1); - } - - /// - /// A string like "Invalid output directory." - /// - internal static string InvalidOutputDir { - get { - return "Invalid output directory."; - } - } - - /// - /// A string like "Invalid assembly name or file extension." - /// - internal static string InvalidAsmNameOrExtension { - get { - return "Invalid assembly name or file extension."; - } - } - - /// - /// A string like "Cannot emit constant {0} ({1})" - /// - internal static string CanotEmitConstant(object p0, object p1) { - return FormatString("Cannot emit constant {0} ({1})", p0, p1); - } - - /// - /// A string like "No implicit cast from {0} to {1}" - /// - internal static string NoImplicitCast(object p0, object p1) { - return FormatString("No implicit cast from {0} to {1}", p0, p1); - } - - /// - /// A string like "No explicit cast from {0} to {1}" - /// - internal static string NoExplicitCast(object p0, object p1) { - return FormatString("No explicit cast from {0} to {1}", p0, p1); - } - - /// - /// A string like "name '{0}' not defined" - /// - internal static string NameNotDefined(object p0) { - return FormatString("name '{0}' not defined", p0); - } - - /// - /// A string like "No default value for a given type." - /// - internal static string NoDefaultValue { - get { - return "No default value for a given type."; - } - } - - /// - /// A string like "Specified language provider type is not registered." - /// - internal static string UnknownLanguageProviderType { - get { - return "Specified language provider type is not registered."; - } - } - - /// - /// A string like "can't read from property" - /// - internal static string CantReadProperty { - get { - return "can't read from property"; - } - } - - /// - /// A string like "can't write to property" - /// - internal static string CantWriteProperty { - get { - return "can't write to property"; - } - } - - /// - /// A string like "Cannot create instance of {0} because it contains generic parameters" - /// - internal static string IllegalNew_GenericParams(object p0) { - return FormatString("Cannot create instance of {0} because it contains generic parameters", p0); - } - - /// - /// A string like "Non-verifiable assembly generated: {0}:\nAssembly preserved as {1}\nError text:\n{2}\n" - /// - internal static string VerificationException(object p0, object p1, object p2) { - return FormatString("Non-verifiable assembly generated: {0}:\nAssembly preserved as {1}\nError text:\n{2}\n", p0, p1, p2); - } - - } - /// - /// Strongly-typed and parameterized exception factory. - /// - - internal static partial class Error { - /// - /// ArgumentException with message like "Either code or target must be specified." - /// - internal static Exception MustHaveCodeOrTarget() { - return new ArgumentException(Strings.MustHaveCodeOrTarget); - } - - /// - /// InvalidOperationException with message like "Type parameter is {0}. Expected a delegate." - /// - internal static Exception TypeParameterIsNotDelegate(object p0) { - return new InvalidOperationException(Strings.TypeParameterIsNotDelegate(p0)); - } - - /// - /// InvalidOperationException with message like "Cannot cast from type '{0}' to type '{1}" - /// - internal static Exception InvalidCast(object p0, object p1) { - return new InvalidOperationException(Strings.InvalidCast(p0, p1)); - } - - /// - /// InvalidOperationException with message like "unknown member type: '{0}'. " - /// - internal static Exception UnknownMemberType(object p0) { - return new InvalidOperationException(Strings.UnknownMemberType(p0)); - } - - /// - /// InvalidOperationException with message like "RuleBuilder can only be used with delegates whose first argument is CallSite." - /// - internal static Exception FirstArgumentMustBeCallSite() { - return new InvalidOperationException(Strings.FirstArgumentMustBeCallSite); - } - - /// - /// InvalidOperationException with message like "no instance for call." - /// - internal static Exception NoInstanceForCall() { - return new InvalidOperationException(Strings.NoInstanceForCall); - } - - /// - /// InvalidOperationException with message like "Missing Test." - /// - internal static Exception MissingTest() { - return new InvalidOperationException(Strings.MissingTest); - } - - /// - /// InvalidOperationException with message like "Missing Target." - /// - internal static Exception MissingTarget() { - return new InvalidOperationException(Strings.MissingTarget); - } - - /// - /// TypeLoadException with message like "The operation requires a non-generic type for {0}, but this represents generic types only" - /// - internal static Exception NonGenericWithGenericGroup(object p0) { - return new TypeLoadException(Strings.NonGenericWithGenericGroup(p0)); - } - - /// - /// ArgumentException with message like "Invalid operation: '{0}'" - /// - internal static Exception InvalidOperation(object p0) { - return new ArgumentException(Strings.InvalidOperation(p0)); - } - - /// - /// InvalidOperationException with message like "Finally already defined." - /// - internal static Exception FinallyAlreadyDefined() { - return new InvalidOperationException(Strings.FinallyAlreadyDefined); - } - - /// - /// InvalidOperationException with message like "Can not have fault and finally." - /// - internal static Exception CannotHaveFaultAndFinally() { - return new InvalidOperationException(Strings.CannotHaveFaultAndFinally); - } - - /// - /// InvalidOperationException with message like "Fault already defined." - /// - internal static Exception FaultAlreadyDefined() { - return new InvalidOperationException(Strings.FaultAlreadyDefined); - } - - /// - /// ArgumentException with message like "Cannot create default value for type {0}." - /// - internal static Exception CantCreateDefaultTypeFor(object p0) { - return new ArgumentException(Strings.CantCreateDefaultTypeFor(p0)); - } - - /// - /// ArgumentException with message like "Unhandled convert: {0}" - /// - internal static Exception UnhandledConvert(object p0) { - return new ArgumentException(Strings.UnhandledConvert(p0)); - } - - /// - /// InvalidOperationException with message like "{0}.{1} has no publiclly visible method." - /// - internal static Exception NoCallableMethods(object p0, object p1) { - return new InvalidOperationException(Strings.NoCallableMethods(p0, p1)); - } - - /// - /// ArgumentException with message like "Global/top-level local variable names must be unique." - /// - internal static Exception GlobalsMustBeUnique() { - return new ArgumentException(Strings.GlobalsMustBeUnique); - } - - /// - /// ArgumentException with message like "Generating code from non-serializable CallSiteBinder." - /// - internal static Exception GenNonSerializableBinder() { - return new ArgumentException(Strings.GenNonSerializableBinder); - } - - /// - /// ArgumentException with message like "pecified path is invalid." - /// - internal static Exception InvalidPath() { - return new ArgumentException(Strings.InvalidPath); - } - - /// - /// ArgumentTypeException with message like "Dictionaries are not hashable." - /// - internal static Exception DictionaryNotHashable() { - return new ArgumentTypeException(Strings.DictionaryNotHashable); - } - - /// - /// InvalidOperationException with message like "language already registered." - /// - internal static Exception LanguageRegistered() { - return new InvalidOperationException(Strings.LanguageRegistered); - } - - /// - /// NotImplementedException with message like "The method or operation is not implemented." - /// - internal static Exception MethodOrOperatorNotImplemented() { - return new NotImplementedException(Strings.MethodOrOperatorNotImplemented); - } - - /// - /// InvalidOperationException with message like "No exception." - /// - internal static Exception NoException() { - return new InvalidOperationException(Strings.NoException); - } - - /// - /// ArgumentException with message like "Extension type {0} must be public." - /// - internal static Exception ExtensionMustBePublic(object p0) { - return new ArgumentException(Strings.ExtensionMustBePublic(p0)); - } - - /// - /// InvalidOperationException with message like "Already initialized." - /// - internal static Exception AlreadyInitialized() { - return new InvalidOperationException(Strings.AlreadyInitialized); - } - - /// - /// InvalidImplementationException with message like "CreateScopeExtension must return a scope extension." - /// - internal static Exception MustReturnScopeExtension() { - return new InvalidImplementationException(Strings.MustReturnScopeExtension); - } - - /// - /// ArgumentException with message like "Invalid number of parameters for the service." - /// - internal static Exception InvalidParamNumForService() { - return new ArgumentException(Strings.InvalidParamNumForService); - } - - /// - /// ArgumentException with message like "Invalid type of argument {0}; expecting {1}." - /// - internal static Exception InvalidArgumentType(object p0, object p1) { - return new ArgumentException(Strings.InvalidArgumentType(p0, p1)); - } - - /// - /// ArgumentException with message like "Cannot change non-caching value." - /// - internal static Exception CannotChangeNonCachingValue() { - return new ArgumentException(Strings.CannotChangeNonCachingValue); - } - - /// - /// MissingMemberException with message like "Field {0} is read-only" - /// - internal static Exception FieldReadonly(object p0) { - return new MissingMemberException(Strings.FieldReadonly(p0)); - } - - /// - /// MissingMemberException with message like "Property {0} is read-only" - /// - internal static Exception PropertyReadonly(object p0) { - return new MissingMemberException(Strings.PropertyReadonly(p0)); - } - - /// - /// ArgumentException with message like "Expected event from {0}.{1}, got event from {2}.{3}." - /// - internal static Exception UnexpectedEvent(object p0, object p1, object p2, object p3) { - return new ArgumentException(Strings.UnexpectedEvent(p0, p1, p2, p3)); - } - - /// - /// ArgumentTypeException with message like "expected bound event, got {0}." - /// - internal static Exception ExpectedBoundEvent(object p0) { - return new ArgumentTypeException(Strings.ExpectedBoundEvent(p0)); - } - - /// - /// ArgumentTypeException with message like "Expected type {0}, got {1}." - /// - internal static Exception UnexpectedType(object p0, object p1) { - return new ArgumentTypeException(Strings.UnexpectedType(p0, p1)); - } - - /// - /// MemberAccessException with message like "can only write to member {0}." - /// - internal static Exception MemberWriteOnly(object p0) { - return new MemberAccessException(Strings.MemberWriteOnly(p0)); - } - - /// - /// InvalidOperationException with message like "No code to compile." - /// - internal static Exception NoCodeToCompile() { - return new InvalidOperationException(Strings.NoCodeToCompile); - } - - /// - /// ArgumentException with message like "Invalid stream type: {0}." - /// - internal static Exception InvalidStreamType(object p0) { - return new ArgumentException(Strings.InvalidStreamType(p0)); - } - - /// - /// InvalidOperationException with message like "Queue empty." - /// - internal static Exception QueueEmpty() { - return new InvalidOperationException(Strings.QueueEmpty); - } - - /// - /// InvalidOperationException with message like "Enumeration has not started. Call MoveNext." - /// - internal static Exception EnumerationNotStarted() { - return new InvalidOperationException(Strings.EnumerationNotStarted); - } - - /// - /// InvalidOperationException with message like "Enumeration already finished." - /// - internal static Exception EnumerationFinished() { - return new InvalidOperationException(Strings.EnumerationFinished); - } - - /// - /// InvalidOperationException with message like "can't add another casing for identifier {0}" - /// - internal static Exception CantAddCasing(object p0) { - return new InvalidOperationException(Strings.CantAddCasing(p0)); - } - - /// - /// InvalidOperationException with message like "can't add new identifier {0}" - /// - internal static Exception CantAddIdentifier(object p0) { - return new InvalidOperationException(Strings.CantAddIdentifier(p0)); - } - - /// - /// ArgumentException with message like "Invalid output directory." - /// - internal static Exception InvalidOutputDir() { - return new ArgumentException(Strings.InvalidOutputDir); - } - - /// - /// ArgumentException with message like "Invalid assembly name or file extension." - /// - internal static Exception InvalidAsmNameOrExtension() { - return new ArgumentException(Strings.InvalidAsmNameOrExtension); - } - - /// - /// ArgumentException with message like "Cannot emit constant {0} ({1})" - /// - internal static Exception CanotEmitConstant(object p0, object p1) { - return new ArgumentException(Strings.CanotEmitConstant(p0, p1)); - } - - /// - /// ArgumentException with message like "No implicit cast from {0} to {1}" - /// - internal static Exception NoImplicitCast(object p0, object p1) { - return new ArgumentException(Strings.NoImplicitCast(p0, p1)); - } - - /// - /// ArgumentException with message like "No explicit cast from {0} to {1}" - /// - internal static Exception NoExplicitCast(object p0, object p1) { - return new ArgumentException(Strings.NoExplicitCast(p0, p1)); - } - - /// - /// MissingMemberException with message like "name '{0}' not defined" - /// - internal static Exception NameNotDefined(object p0) { - return new MissingMemberException(Strings.NameNotDefined(p0)); - } - - /// - /// ArgumentException with message like "No default value for a given type." - /// - internal static Exception NoDefaultValue() { - return new ArgumentException(Strings.NoDefaultValue); - } - - /// - /// ArgumentException with message like "Specified language provider type is not registered." - /// - internal static Exception UnknownLanguageProviderType() { - return new ArgumentException(Strings.UnknownLanguageProviderType); - } - - /// - /// InvalidOperationException with message like "can't read from property" - /// - internal static Exception CantReadProperty() { - return new InvalidOperationException(Strings.CantReadProperty); - } - - /// - /// InvalidOperationException with message like "can't write to property" - /// - internal static Exception CantWriteProperty() { - return new InvalidOperationException(Strings.CantWriteProperty); - } - - /// - /// ArgumentException with message like "Cannot create instance of {0} because it contains generic parameters" - /// - internal static Exception IllegalNew_GenericParams(object p0) { - return new ArgumentException(Strings.IllegalNew_GenericParams(p0)); - } - - /// - /// System.Security.VerificationException with message like "Non-verifiable assembly generated: {0}:\nAssembly preserved as {1}\nError text:\n{2}\n" - /// - internal static Exception VerificationException(object p0, object p1, object p2) { - return new System.Security.VerificationException(Strings.VerificationException(p0, p1, p2)); - } - - } - - // *** END GENERATED CODE *** - - #endregion - -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ExceptionUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ExceptionUtils.cs deleted file mode 100644 index 89449659612..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ExceptionUtils.cs +++ /dev/null @@ -1,111 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Collections.Generic; -using System.Threading; - -namespace Microsoft.Scripting.Utils { - public static class ExceptionUtils { - public static ArgumentOutOfRangeException MakeArgumentOutOfRangeException(string paramName, object actualValue, string message) { -#if SILVERLIGHT || WP75 // ArgumentOutOfRangeException ctor overload - throw new ArgumentOutOfRangeException(paramName, string.Format("{0} (actual value is '{1}')", message, actualValue)); -#else - throw new ArgumentOutOfRangeException(paramName, actualValue, message); -#endif - } - - public static ArgumentNullException MakeArgumentItemNullException(int index, string arrayName) { - return new ArgumentNullException(String.Format("{0}[{1}]", arrayName, index)); - } - -#if FEATURE_REMOTING - public static object GetData(this Exception e, object key) { - return e.Data[key]; - } - - public static void SetData(this Exception e, object key, object data) { - e.Data[key] = data; - } - - public static void RemoveData(this Exception e, object key) { - e.Data.Remove(key); - } -#else - -#if WP75 - private static WeakDictionary>> _exceptionData; -#else - private static ConditionalWeakTable>> _exceptionData; -#endif - - public static void SetData(this Exception e, object key, object value) { - if (_exceptionData == null) { -#if WP75 - Interlocked.CompareExchange(ref _exceptionData, new WeakDictionary>>(), null); -#else - Interlocked.CompareExchange(ref _exceptionData, new ConditionalWeakTable>>(), null); -#endif - } - - lock (_exceptionData) { - var data = _exceptionData.GetOrCreateValue(e); - - int index = data.FindIndex(entry => entry.Key == key); - if (index >= 0) { - data[index] = new KeyValuePair(key, value); - } else { - data.Add(new KeyValuePair(key, value)); - } - } - } - - public static object GetData(this Exception e, object key) { - if (_exceptionData == null) { - return null; - } - - lock (_exceptionData) { - List> data; - if (!_exceptionData.TryGetValue(e, out data)) { - return null; - } - - return data.FirstOrDefault(entry => entry.Key == key).Value; - } - } - - public static void RemoveData(this Exception e, object key) { - if (_exceptionData == null) { - return; - } - - lock (_exceptionData) { - List> data; - if (!_exceptionData.TryGetValue(e, out data)) { - return; - } - - int index = data.FindIndex(entry => entry.Key == key); - if (index >= 0) { - data.RemoveAt(index); - } - } - } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/HybridReferenceDictionary.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/HybridReferenceDictionary.cs deleted file mode 100644 index 13b62d45f07..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/HybridReferenceDictionary.cs +++ /dev/null @@ -1,170 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; - -namespace Microsoft.Scripting.Utils { - /// - /// A hybrid dictionary which compares based upon object identity. - /// - class HybridReferenceDictionary where TKey : class { - private KeyValuePair[] _keysAndValues; - private Dictionary _dict; - private int _count; - private const int _arraySize = 10; - - public HybridReferenceDictionary() { - } - - public HybridReferenceDictionary(int initialCapicity) { - if (initialCapicity > _arraySize) { - _dict = new Dictionary(initialCapicity); - } else { - _keysAndValues = new KeyValuePair[initialCapicity]; - } - } - - public bool TryGetValue(TKey key, out TValue value) { - Debug.Assert(key != null); - - if (_dict != null) { - return _dict.TryGetValue(key, out value); - } else if (_keysAndValues != null) { - for (int i = 0; i < _keysAndValues.Length; i++) { - if (_keysAndValues[i].Key == key) { - value = _keysAndValues[i].Value; - return true; - } - } - } - value = default(TValue); - return false; - } - - public bool Remove(TKey key) { - Debug.Assert(key != null); - - if (_dict != null) { - return _dict.Remove(key); - } else if (_keysAndValues != null) { - for (int i = 0; i < _keysAndValues.Length; i++) { - if (_keysAndValues[i].Key == key) { - _keysAndValues[i] = new KeyValuePair(); - _count--; - return true; - } - } - } - - return false; - } - - public bool ContainsKey(TKey key) { - Debug.Assert(key != null); - - if (_dict != null) { - return _dict.ContainsKey(key); - } else if (_keysAndValues != null) { - for (int i = 0; i < _keysAndValues.Length; i++) { - if (_keysAndValues[i].Key == key) { - return true; - } - } - } - - return false; - } - - public int Count { - get { - if (_dict != null) { - return _dict.Count; - } - return _count; - } - - } - - public IEnumerator> GetEnumerator() { - if (_dict != null) { - return _dict.GetEnumerator(); - } - - return GetEnumeratorWorker(); - } - - private IEnumerator> GetEnumeratorWorker() { - if (_keysAndValues != null) { - for (int i = 0; i < _keysAndValues.Length; i++) { - if (_keysAndValues[i].Key != null) { - yield return _keysAndValues[i]; - } - } - } - } - - public TValue this[TKey key] { - get { - Debug.Assert(key != null); - - TValue res; - if (TryGetValue(key, out res)) { - return res; - } - - throw new KeyNotFoundException(); - } - set { - Debug.Assert(key != null); - - if (_dict != null) { - _dict[key] = value; - } else { - int index; - if (_keysAndValues != null) { - index = -1; - for (int i = 0; i < _keysAndValues.Length; i++) { - if (_keysAndValues[i].Key == key) { - _keysAndValues[i] = new KeyValuePair(key, value); - return; - } else if (_keysAndValues[i].Key == null) { - index = i; - } - } - } else { - _keysAndValues = new KeyValuePair[_arraySize]; - index = 0; - } - - if (index != -1) { - _count++; - _keysAndValues[index] = new KeyValuePair(key, value); - } else { - _dict = new Dictionary(); - for (int i = 0; i < _keysAndValues.Length; i++) { - _dict[_keysAndValues[i].Key] = _keysAndValues[i].Value; - } - _keysAndValues = null; - - _dict[key] = value; - } - } - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ListEqualityComparer.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ListEqualityComparer.cs deleted file mode 100644 index 3d04b8f27f3..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ListEqualityComparer.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections.Generic; - -namespace Microsoft.Scripting.Utils { - // Compares two ICollection's using element equality - internal sealed class ListEqualityComparer : EqualityComparer> { - internal static readonly ListEqualityComparer Instance = new ListEqualityComparer(); - - private ListEqualityComparer() { } - - // EqualityComparer handles null and object identity for us - public override bool Equals(ICollection x, ICollection y) { - return x.ListEquals(y); - } - - public override int GetHashCode(ICollection obj) { - return obj.ListHashCode(); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/MathUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/MathUtils.cs deleted file mode 100644 index 435fb259b6b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/MathUtils.cs +++ /dev/null @@ -1,1230 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_NUMERICS -using BigInt = System.Numerics.BigInteger; -using Complex = System.Numerics.Complex; -#endif - -using System; -using System.Text; -using System.Collections.Generic; -using Microsoft.Scripting.Math; -using Microsoft.Scripting.Runtime; - -namespace Microsoft.Scripting.Utils { - using Math = System.Math; - - public static class MathUtils { - /// - /// Calculates the quotient of two 32-bit signed integers rounded towards negative infinity. - /// - /// Dividend. - /// Divisor. - /// The quotient of the specified numbers rounded towards negative infinity, or (int)Floor((double)x/(double)y). - /// is 0. - /// The caller must check for overflow (x = Int32.MinValue, y = -1) - public static int FloorDivideUnchecked(int x, int y) { - int q = x / y; - - if (x >= 0) { - if (y > 0) { - return q; - } else if (x % y == 0) { - return q; - } else { - return q - 1; - } - } else { - if (y > 0) { - if (x % y == 0) { - return q; - } else { - return q - 1; - } - } else { - return q; - } - } - } - - /// - /// Calculates the quotient of two 32-bit signed integers rounded towards negative infinity. - /// - /// Dividend. - /// Divisor. - /// The quotient of the specified numbers rounded towards negative infinity, or (int)Floor((double)x/(double)y). - /// is 0. - /// The caller must check for overflow (x = Int64.MinValue, y = -1) - public static long FloorDivideUnchecked(long x, long y) { - long q = x / y; - - if (x >= 0) { - if (y > 0) { - return q; - } else if (x % y == 0) { - return q; - } else { - return q - 1; - } - } else { - if (y > 0) { - if (x % y == 0) { - return q; - } else { - return q - 1; - } - } else { - return q; - } - } - } - - /// - /// Calculates the remainder of floor division of two 32-bit signed integers. - /// - /// Dividend. - /// Divisor. - /// The remainder of of floor division of the specified numbers, or x - (int)Floor((double)x/(double)y) * y. - /// is 0. - public static int FloorRemainder(int x, int y) { - if (y == -1) return 0; - int r = x % y; - - if (x >= 0) { - if (y > 0) { - return r; - } else if (r == 0) { - return 0; - } else { - return r + y; - } - } else { - if (y > 0) { - if (r == 0) { - return 0; - } else { - return r + y; - } - } else { - return r; - } - } - } - - /// - /// Calculates the remainder of floor division of two 32-bit signed integers. - /// - /// Dividend. - /// Divisor. - /// The remainder of of floor division of the specified numbers, or x - (int)Floor((double)x/(double)y) * y. - /// is 0. - public static long FloorRemainder(long x, long y) { - if (y == -1) return 0; - long r = x % y; - - if (x >= 0) { - if (y > 0) { - return r; - } else if (r == 0) { - return 0; - } else { - return r + y; - } - } else { - if (y > 0) { - if (r == 0) { - return 0; - } else { - return r + y; - } - } else { - return r; - } - } - } - - /// - /// Behaves like Math.Round(value, MidpointRounding.AwayFromZero) - /// Needed because CoreCLR doesn't support this particular overload of Math.Round - /// - public static double RoundAwayFromZero(double value) { -#if !SILVERLIGHT && !WP75 - return Math.Round(value, MidpointRounding.AwayFromZero); -#else - if (value < 0) { - return -RoundAwayFromZero(-value); - } - - // we can assume positive value - double result = Math.Floor(value); - if (value - result >= 0.5) { - result += 1.0; - } - return result; -#endif - } - - private static readonly double[] _RoundPowersOfTens = new double[] { 1E0, 1E1, 1E2, 1E3, 1E4, 1E5, 1E6, 1E7, 1E8, 1E9, 1E10, 1E11, 1E12, 1E13, 1E14, 1E15 }; - - private static double GetPowerOf10(int precision) { - return (precision < 16) ? _RoundPowersOfTens[precision] : Math.Pow(10, precision); - } - - /// - /// Behaves like Math.Round(value, precision, MidpointRounding.AwayFromZero) - /// However, it works correctly on negative precisions and cases where precision is - /// outside of the [-15, 15] range. - /// - /// (This function is also needed because CoreCLR lacks this overload.) - /// - public static double RoundAwayFromZero(double value, int precision) { - if (double.IsInfinity(value) || double.IsNaN(value)) { - return value; - } - - if (precision >= 0) { - if (precision > 308) { - return value; - } - - double num = GetPowerOf10(precision); - return RoundAwayFromZero(value * num) / num; - } else if (precision >= -308) { - // Note: this code path could be merged with the precision >= 0 path, - // (by extending the cache to negative powers of 10) - // but the results seem to be more precise if we do it this way - double num = GetPowerOf10(-precision); - return RoundAwayFromZero(value / num) * num; - } else { - // Preserve the sign of the input, including +/-0.0 - return value < 0.0 || 1.0 / value < 0.0 ? -0.0 : 0.0; - } - } - - public static bool IsNegativeZero(double self) { -#if SILVERLIGHT // BitConverter.DoubleToInt64Bits - if ( self != 0.0 ) { - return false; - } - byte[] bits = BitConverter.GetBytes(self); - return (bits[7] == 0x80 && bits[6] == 0x00 && bits[5] == 0x00 && bits[4] == 0x00 - && bits[3] == 0x00 && bits[2] == 0x00 && bits[1] == 0x00 && bits[0] == 0x00); -#else - return (self == 0.0 && 1.0 / self < 0); -#endif - } - - #region Special Functions - - public static double Erf(double v0) { - // Calculate the error function using the approximation method outlined in - // W. J. Cody's "Rational Chebyshev Approximations for the Error Function" - - if (v0 >= 10.0) { - return 1.0; - } else if (v0 <= -10.0) { - return -1.0; - } - - if (v0 > 0.47 || v0 < -0.47) { - return 1.0 - ErfComplement(v0); - } - - double sq = v0 * v0; - double numer = EvalPolynomial(sq, ErfNumerCoeffs); - double denom = EvalPolynomial(sq, ErfDenomCoeffs); - - return v0 * numer / denom; - } - - public static double ErfComplement(double v0) { - if (v0 >= 30.0) { - return 0.0; - } else if (v0 <= -10.0) { - return 2.0; - } - - double a = Math.Abs(v0); - if (a < 0.47) { - return 1.0 - Erf(v0); - } - - // Different approximations are required for different ranges of v0 - double res; - if (a <= 4.0) { - // Use the approximation method outlined in W. J. Cody's "Rational Chebyshev - // Approximations for the Error Function" - double numer = EvalPolynomial(a, ErfcNumerCoeffs); - double denom = EvalPolynomial(a, ErfcDenomCoeffs); - - res = Math.Exp(-a * a) * numer / denom; - } else { - // Use the approximation method introduced by C. Tellambura and A. Annamalai - // in "Efficient Computation of erfc(x) for Large Arguments" - const double h = 0.5; - const double hSquared = 0.25; - const int nTerms = 10; - double sq = a * a; - res = 0.0; - for (int i = nTerms; i > 0; i--) { - double term = i * i * hSquared; - res += Math.Exp(-term) / (term + sq); - } - - res = h * a * Math.Exp(-sq) / Math.PI * (res * 2 + 1.0 / sq); - } - - if (v0 < 0.0) { - res = 2.0 - res; - } - return res; - } - - public static double Gamma(double v0) { - // Calculate the Gamma function using the Lanczos approximation - - if (double.IsNegativeInfinity(v0)) { - return double.NaN; - } - double a = Math.Abs(v0); - - // Special-case integers - if (a % 1.0 == 0.0) { - // Gamma is undefined on non-positive integers - if (v0 <= 0.0) { - return double.NaN; - } - - // factorial(v0 - 1) - if (a <= 25.0) { - if (a <= 2.0) { - return 1.0; - } - a -= 1.0; - v0 -= 1.0; - while (--v0 > 1.0) { - a *= v0; - } - return a; - } - } - - // lim(Gamma(v0)) = 1.0 / v0 as v0 approaches 0.0 - if (a < 1e-50) { - return 1.0 / v0; - } - - double res; - if (v0 < -150.0) { - // If Gamma(1 - v0) could overflow for large v0, use the duplication formula to - // compute Gamma(1 - v0): - // Gamma(x) * Gamma(x + 0,5) = sqrt(pi) * 2**(1 - 2x) * Gamma(2x) - // ==> Gamma(1 - x) = Gamma((1-x)/2) * Gamma((2-x)/2) / (2**x * sqrt(pi)) - // Then apply the reflection formula: - // Gamma(x) = pi / sin(pi * x) / Gamma(1 - x) - double halfV0 = v0 / 2.0; - res = Math.Pow(Math.PI, 1.5) / SinPi(v0); - res *= Math.Pow(2.0, v0); - res /= PositiveGamma(0.5 - halfV0); - res /= PositiveGamma(1.0 - halfV0); - } else if (v0 < 0.001) { - // For values less than or close to zero, just use the reflection formula - res = Math.PI / SinPi(v0); - double v1 = 1.0 - v0; - if (v0 == 1.0 - v1) { - res /= PositiveGamma(v1); - } else { - // Computing v1 has resulted in a loss of precision. To avoid this, use the - // recurrence relation Gamma(x + 1) = x * Gamma(x). - res /= -v0 * PositiveGamma(-v0); - } - } else { - res = PositiveGamma(v0); - } - - return res; - } - - public static double LogGamma(double v0) { - // Calculate the log of the Gamma function using the Lanczos approximation - - if (double.IsInfinity(v0)) { - return double.PositiveInfinity; - } - double a = Math.Abs(v0); - - // Gamma is undefined on non-positive integers - if (v0 <= 0.0 && a % 1.0 == 0.0) { - return double.NaN; - } - - // lim(LGamma(v0)) = -log|v0| as v0 approaches 0.0 - if (a < 1e-50) { - return -Math.Log(a); - } - - double res; - if (v0 < 0.0) { - // For negative values, use the reflection formula: - // Gamma(x) = pi / sin(pi * x) / Gamma(1 - x) - // ==> LGamma(x) = log(pi / |sin(pi * x)|) - LGamma(1 - x) - res = Math.Log(Math.PI / AbsSinPi(v0)); - res -= PositiveLGamma(1.0 - v0); - } else { - res = PositiveLGamma(v0); - } - - return res; - } - - public static double Hypot(double x, double y) { - // - // sqrt(x*x + y*y) == sqrt(x*x * (1 + (y*y)/(x*x))) == - // sqrt(x*x) * sqrt(1 + (y/x)*(y/x)) == - // abs(x) * sqrt(1 + (y/x)*(y/x)) - // - - // Handle infinities - if (double.IsInfinity(x) || double.IsInfinity(y)) { - return double.PositiveInfinity; - } - - // First, get abs - if (x < 0.0) x = -x; - if (y < 0.0) y = -y; - - // Obvious cases - if (x == 0.0) return y; - if (y == 0.0) return x; - - // Divide smaller number by bigger number to safeguard the (y/x)*(y/x) - if (x < y) { - double temp = y; y = x; x = temp; - } - - y /= x; - - // calculate abs(x) * sqrt(1 + (y/x)*(y/x)) - return x * System.Math.Sqrt(1 + y * y); - } - - /// - /// Evaluates a polynomial in v0 where the coefficients are ordered in increasing degree - /// - private static double EvalPolynomial(double v0, double[] coeffs) { - double res = 0.0; - for (int i = coeffs.Length - 1; i >= 0; i--) { - res = checked(res * v0 + coeffs[i]); - } - - return res; - } - - /// - /// Evaluates a polynomial in v0 where the coefficients are ordered in increasing degree - /// if reverse is false, and increasing degree if reverse is true. - /// - private static double EvalPolynomial(double v0, double[] coeffs, bool reverse) { - if (!reverse) { - return EvalPolynomial(v0, coeffs); - } - - double res = 0.0; - for (int i = 0; i < coeffs.Length; i++) { - res = checked(res * v0 + coeffs[i]); - } - - return res; - } - - /// - /// A numerically precise version of sin(v0 * pi) - /// - private static double SinPi(double v0) { - double res = Math.Abs(v0) % 2.0; - - if (res < 0.25) { - res = Math.Sin(res * Math.PI); - } else if (res < 0.75) { - res = Math.Cos((res - 0.5) * Math.PI); - } else if (res < 1.25) { - res = -Math.Sin((res - 1.0) * Math.PI); - } else if (res < 1.75) { - res = -Math.Cos((res - 1.5) * Math.PI); - } else { - res = Math.Sin((res - 2.0) * Math.PI); - } - - return v0 < 0 ? -res : res; - } - - /// - /// A numerically precise version of |sin(v0 * pi)| - /// - private static double AbsSinPi(double v0) { - double res = Math.Abs(v0) % 1.0; - - if (res < 0.25) { - res = Math.Sin(res * Math.PI); - } else if (res < 0.75) { - res = Math.Cos((res - 0.5) * Math.PI); - } else { - res = Math.Sin((res - 1.0) * Math.PI); - } - - return Math.Abs(res); - } - - // polynomial coefficients ordered by increasing degree - private static double[] ErfNumerCoeffs = { - 2.4266795523053175e02, 2.1979261618294152e01, - 6.9963834886191355, -3.5609843701815385e-02 - }; - private static double[] ErfDenomCoeffs = { - 2.1505887586986120e02, 9.1164905404514901e01, - 1.5082797630407787e01, 1.0 - }; - private static double[] ErfcNumerCoeffs = { - 3.004592610201616005e02, 4.519189537118729422e02, - 3.393208167343436870e02, 1.529892850469404039e02, - 4.316222722205673530e01, 7.211758250883093659, - 5.641955174789739711e-01, -1.368648573827167067e-07 - }; - private static double[] ErfcDenomCoeffs = { - 3.004592609569832933e02, 7.909509253278980272e02, - 9.313540948506096211e02, 6.389802644656311665e02, - 2.775854447439876434e02, 7.700015293522947295e01, - 1.278272731962942351e01, 1.0 - }; - private static double[] GammaNumerCoeffs = { - 4.401213842800460895436e13, 4.159045335859320051581e13, - 1.801384278711799677796e13, 4.728736263475388896889e12, - 8.379100836284046470415e11, 1.055837072734299344907e11, - 9.701363618494999493386e09, 6.549143975482052641016e08, - 3.223832294213356530668e07, 1.128514219497091438040e06, - 2.666579378459858944762e04, 3.818801248632926870394e02, - 2.506628274631000502415 - }; - private static double[] GammaDenomCoeffs = { - 0.0, 39916800.0, 120543840.0, 150917976.0, - 105258076.0, 45995730.0, 13339535.0, 2637558.0, - 357423.0, 32670.0, 1925.0, 66.0, 1.0 - }; - - /// - /// Take the quotient of the 2 polynomials forming the Lanczos approximation - /// with N=13 and G=13.144565 - /// - private static double GammaRationalFunc(double v0) { - double numer = 0.0; - double denom = 0.0; - - if (v0 < 1e15) { - numer = EvalPolynomial(v0, GammaNumerCoeffs); - denom = EvalPolynomial(v0, GammaDenomCoeffs); - } else { - double vRecip = 1.0 / v0; - numer = EvalPolynomial(vRecip, GammaNumerCoeffs, true); - denom = EvalPolynomial(vRecip, GammaDenomCoeffs, true); - } - - return numer / denom; - } - - /// - /// Computes the Gamma function on positive values, using the Lanczos approximation. - /// Lanczos parameters are N=13 and G=13.144565. - /// - private static double PositiveGamma(double v0) { - if (v0 > 200.0) { - return Double.PositiveInfinity; - } - - double vg = v0 + 12.644565; // v0 + g - 0.5 - double res = GammaRationalFunc(v0); - res /= Math.Exp(vg); - if (v0 < 120.0) { - res *= Math.Pow(vg, v0 - 0.5); - } else { - // Use a smaller exponent if we're in danger of overflowing Math.Pow - double sqrt = Math.Pow(vg, v0 / 2.0 - 0.25); - res *= sqrt; - res *= sqrt; - } - - return res; - } - - /// - /// Computes the Log-Gamma function on positive values, using the Lanczos approximation. - /// Lanczos parameters are N=13 and G=13.144565. - /// - private static double PositiveLGamma(double v0) { - double vg = v0 + 12.644565; // v0 + g - 0.5 - double res = Math.Log(GammaRationalFunc(v0)) - vg; - res += (v0 - 0.5) * Math.Log(vg); - - return res; - } - - #endregion - - #region BigInteger - - // generated by scripts/radix_generator.py - private static readonly uint[] maxCharsPerDigit = { 0, 0, 31, 20, 15, 13, 12, 11, 10, 10, 9, 9, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6 }; - private static readonly uint[] groupRadixValues = { 0, 0, 2147483648, 3486784401, 1073741824, 1220703125, 2176782336, 1977326743, 1073741824, 3486784401, 1000000000, 2357947691, 429981696, 815730721, 1475789056, 2562890625, 268435456, 410338673, 612220032, 893871739, 1280000000, 1801088541, 2494357888, 3404825447, 191102976, 244140625, 308915776, 387420489, 481890304, 594823321, 729000000, 887503681, 1073741824, 1291467969, 1544804416, 1838265625, 2176782336 }; - - internal static string BigIntegerToString(uint[] d, int sign, int radix, bool lowerCase) { - if (radix < 2) { - throw ExceptionUtils.MakeArgumentOutOfRangeException("radix", radix, "radix must be >= 2"); - } - if (radix > 36) { - throw ExceptionUtils.MakeArgumentOutOfRangeException("radix", radix, "radix must be <= 36"); - } - - int dl = d.Length; - if (dl == 0) { - return "0"; - } - - List digitGroups = new List(); - - uint groupRadix = groupRadixValues[radix]; - while (dl > 0) { - uint rem = div(d, ref dl, groupRadix); - digitGroups.Add(rem); - } - - StringBuilder ret = new StringBuilder(); - if (sign == -1) { - ret.Append("-"); - } - - int digitIndex = digitGroups.Count - 1; - - char[] tmpDigits = new char[maxCharsPerDigit[radix]]; - - AppendRadix((uint)digitGroups[digitIndex--], (uint)radix, tmpDigits, ret, false, lowerCase); - while (digitIndex >= 0) { - AppendRadix((uint)digitGroups[digitIndex--], (uint)radix, tmpDigits, ret, true, lowerCase); - } - return ret.Length == 0 ? "0" : ret.ToString(); - } - - private const int BitsPerDigit = 32; - - private static uint div(uint[] n, ref int nl, uint d) { - ulong rem = 0; - int i = nl; - bool seenNonZero = false; - while (--i >= 0) { - rem <<= BitsPerDigit; - rem |= n[i]; - uint v = (uint)(rem / d); - n[i] = v; - if (v == 0) { - if (!seenNonZero) nl--; - } else { - seenNonZero = true; - } - rem %= d; - } - return (uint)rem; - } - - private static void AppendRadix(uint rem, uint radix, char[] tmp, StringBuilder buf, bool leadingZeros, bool lowerCase) { - string symbols = lowerCase ? "0123456789abcdefghijklmnopqrstuvwxyz" : "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - - int digits = tmp.Length; - int i = digits; - while (i > 0 && (leadingZeros || rem != 0)) { - uint digit = rem % radix; - rem /= radix; - tmp[--i] = symbols[(int)digit]; - } - if (leadingZeros) buf.Append(tmp); - else buf.Append(tmp, i, digits - i); - } - - // Helper for GetRandBits - private static uint GetWord(byte[] bytes, int start, int end) { - uint four = 0; - int bits = end - start; - int shift = 0; - if (bits > 32) { - bits = 32; - } - start /= 8; - while (bits > 0) { - uint value = bytes[start]; - if (bits < 8) { - value &= (1u << bits) - 1u; - } - value <<= shift; - four |= value; - bits -= 8; - shift += 8; - start++; - } - - return four; - } -#if !MONO_INTERPRETER -#if !FEATURE_NUMERICS - public static BigInteger GetRandBits(this Random generator, int bits) { - ContractUtils.Requires(bits > 0); - - // equivalent to (bits + 7) / 8 without possibility of overflow - int count = bits % 8 == 0 ? bits / 8 : bits / 8 + 1; - - // Pad the end (most significant) with zeros if we align to the byte - // to ensure that we end up with a positive value - byte[] bytes = new byte[bits % 8 == 0 ? count + 1 : count]; - generator.NextBytes(bytes); - if (bits % 8 == 0) { - bytes[bytes.Length - 1] = 0; - } else { - bytes[bytes.Length - 1] = (byte)(bytes[bytes.Length - 1] & ((1 << (bits % 8)) - 1)); - } - - if (bits <= 32) { - return (BigInteger)GetWord(bytes, 0, bits); - } else if (bits <= 64) { - ulong a = GetWord(bytes, 0, bits); - ulong b = GetWord(bytes, 32, bits); - return (BigInteger)(a | (b << 32)); - } else { - count = (count + 3) / 4; - uint[] data = new uint[count]; - for (int i = 0; i < count; i++) { - data[i] = GetWord(bytes, i * 32, bits); - } - return new BigInteger(1, data); - } - } - - public static BigInteger Random(this Random generator, BigInteger limit) { - ContractUtils.Requires(limit.Sign > 0, "limit"); - ContractUtils.RequiresNotNull(generator, "generator"); - - // TODO: this doesn't yield a uniform distribution (small numbers will be picked more frequently): - uint[] result = new uint[limit.GetWordCount() + 1]; - for (int i = 0; i < result.Length; i++) { - result[i] = unchecked((uint)generator.Next()); - } - return new BigInteger(1, result) % limit; - } -#else - public static BigInt GetRandBits(this Random generator, int bits) { - ContractUtils.Requires(bits > 0); - - // equivalent to (bits + 7) / 8 without possibility of overflow - int count = bits % 8 == 0 ? bits / 8 : bits / 8 + 1; - - // Pad the end (most significant) with zeros if we align to the byte - // to ensure that we end up with a positive value - byte[] bytes = new byte[bits % 8 == 0 ? count + 1 : count]; - generator.NextBytes(bytes); - if (bits % 8 == 0) { - bytes[bytes.Length - 1] = 0; - } else { - bytes[bytes.Length - 1] = (byte)(bytes[bytes.Length - 1] & ((1 << (bits % 8)) - 1)); - } - - if (bits <= 32) { - return (BigInt)GetWord(bytes, 0, bits); - } else if (bits <= 64) { - ulong a = GetWord(bytes, 0, bits); - ulong b = GetWord(bytes, 32, bits); - return (BigInt)(a | (b << 32)); - } - - return new BigInt(bytes); - } - - public static BigInteger Random(this Random generator, BigInteger limit) { - return new BigInteger(generator.Random(limit.Value)); - } - - public static BigInt Random(this Random generator, BigInt limit) { - ContractUtils.Requires(limit.Sign > 0, "limit"); - ContractUtils.RequiresNotNull(generator, "generator"); - - BigInt res = BigInt.Zero; - - while (true) { - // if we've run out of significant digits, we can return the total - if (limit == BigInt.Zero) { - return res; - } - - // if we're small enough to fit in an int, do so - int iLimit; - if (limit.AsInt32(out iLimit)) { - return res + generator.Next(iLimit); - } - - // get the 3 or 4 uppermost bytes that fit into an int - int hiData; - byte[] data = limit.ToByteArray(); - int index = data.Length; - while (data[--index] == 0) ; - if (data[index] < 0x80) { - hiData = data[index] << 24; - data[index--] = (byte)0; - } else { - hiData = 0; - } - hiData |= data[index] << 16; - data[index--] = (byte)0; - hiData |= data[index] << 8; - data[index--] = (byte)0; - hiData |= data[index]; - data[index--] = (byte)0; - - // get a uniform random number for the uppermost portion of the bigint - byte[] randomData = new byte[index + 2]; - generator.NextBytes(randomData); - randomData[index + 1] = (byte)0; - res += new BigInt(randomData); - res += (BigInt)generator.Next(hiData) << ((index + 1) * 8); - - // sum it with a uniform random number for the remainder of the bigint - limit = new BigInt(data); - } - } - - public static bool TryToFloat64(this BigInt self, out double result) { - return StringUtils.TryParseDouble( - self.ToString(), - System.Globalization.NumberStyles.Number, - System.Globalization.CultureInfo.InvariantCulture.NumberFormat, - out result - ); - } - - public static double ToFloat64(this BigInt self) { - return double.Parse( - self.ToString(), - System.Globalization.NumberStyles.Number, - System.Globalization.CultureInfo.InvariantCulture.NumberFormat - ); - } -#endif - public static bool TryToFloat64(this BigInteger self, out double result) { - return StringUtils.TryParseDouble( - self.ToString(10), - System.Globalization.NumberStyles.Number, - System.Globalization.CultureInfo.InvariantCulture.NumberFormat, - out result - ); - } - - public static double ToFloat64(this BigInteger self) { - return double.Parse( - self.ToString(10), - System.Globalization.NumberStyles.Number, - System.Globalization.CultureInfo.InvariantCulture.NumberFormat - ); - } - - // Like GetBitCount(Abs(x)), except 0 maps to 0 - public static int BitLength(BigInteger x) { - if (x.IsZero()) { - return 0; - } - - return x.Abs().GetBitCount(); - } - -#if FEATURE_NUMERICS - public static int BitLength(BigInt x) { - if (x.IsZero) { - return 0; - } - - byte[] bytes = BigInt.Abs(x).ToByteArray(); - int index = bytes.Length; - while (bytes[--index] == 0) ; - - return index * 8 + BitLength((int)bytes[index]); - } -#endif -#endif - // Like GetBitCount(Abs(x)), except 0 maps to 0 - public static int BitLength(long x) { - if (x == 0) { - return 0; - } - if (x == Int64.MinValue) { - return 64; - } - - x = Math.Abs(x); - int res = 1; - if (x >= 1L << 32) { - x >>= 32; - res += 32; - } - if (x >= 1L << 16) { - x >>= 16; - res += 16; - } - if (x >= 1L << 8) { - x >>= 8; - res += 8; - } - if (x >= 1L << 4) { - x >>= 4; - res += 4; - } - if (x >= 1L << 2) { - x >>= 2; - res += 2; - } - if (x >= 1L << 1) { - res += 1; - } - - return res; - } - - // Like GetBitCount(Abs(x)), except 0 maps to 0 - [CLSCompliant(false)] - public static int BitLengthUnsigned(ulong x) { - if (x >= 1uL << 63) { - return 64; - } - return BitLength((long)x); - } - - // Like GetBitCount(Abs(x)), except 0 maps to 0 - public static int BitLength(int x) { - if (x == 0) { - return 0; - } - if (x == Int32.MinValue) { - return 32; - } - - x = Math.Abs(x); - int res = 1; - if (x >= 1 << 16) { - x >>= 16; - res += 16; - } - if (x >= 1 << 8) { - x >>= 8; - res += 8; - } - if (x >= 1 << 4) { - x >>= 4; - res += 4; - } - if (x >= 1 << 2) { - x >>= 2; - res += 2; - } - if (x >= 1 << 1) { - res += 1; - } - - return res; - } - - // Like GetBitCount(Abs(x)), except 0 maps to 0 - [CLSCompliant(false)] - public static int BitLengthUnsigned(uint x) { - if (x >= 1u << 31) { - return 32; - } - return BitLength((int)x); - } - - #region Extending BigInt with BigInteger API -#if FEATURE_NUMERICS - - public static bool AsInt32(this BigInt self, out int ret) { - if (self >= Int32.MinValue && self <= Int32.MaxValue) { - ret = (Int32)self; - return true; - } - ret = 0; - return false; - } - - public static bool AsInt64(this BigInt self, out long ret) { - if (self >= Int64.MinValue && self <= Int64.MaxValue) { - ret = (long)self; - return true; - } - ret = 0; - return false; - } - - [CLSCompliant(false)] - public static bool AsUInt32(this BigInt self, out uint ret) { - if (self >= UInt32.MinValue && self <= UInt32.MaxValue) { - ret = (UInt32)self; - return true; - } - ret = 0; - return false; - } - - [CLSCompliant(false)] - public static bool AsUInt64(this BigInt self, out ulong ret) { - if (self >= UInt64.MinValue && self <= UInt64.MaxValue) { - ret = (UInt64)self; - return true; - } - ret = 0; - return false; - } - - public static BigInt Abs(this BigInt self) { - return BigInt.Abs(self); - } - - public static bool IsZero(this BigInt self) { - return self.IsZero; - } - - public static bool IsPositive(this BigInt self) { - return self.Sign > 0; - } - - public static bool IsNegative(this BigInt self) { - return self.Sign < 0; - } - - public static double Log(this BigInt self) { - return BigInt.Log(self); - } - - public static double Log(this BigInt self, double baseValue) { - return BigInt.Log(self, baseValue); - } - - public static double Log10(this BigInt self) { - return BigInt.Log10(self); - } - - public static BigInt Power(this BigInt self, int exp) { - return BigInt.Pow(self, exp); - } - - public static BigInt ModPow(this BigInt self, int power, BigInt mod) { - return BigInt.ModPow(self, power, mod); - } - - public static BigInt ModPow(this BigInt self, BigInt power, BigInt mod) { - return BigInt.ModPow(self, power, mod); - } - - public static string ToString(this BigInt self, int radix) { - const string symbols = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - - if (radix < 2) { - throw ExceptionUtils.MakeArgumentOutOfRangeException("radix", radix, "radix must be >= 2"); - } - if (radix > 36) { - throw ExceptionUtils.MakeArgumentOutOfRangeException("radix", radix, "radix must be <= 36"); - } - - bool isNegative = false; - if (self < BigInt.Zero) { - self = -self; - isNegative = true; - } else if (self == BigInt.Zero) { - return "0"; - } - - List digits = new List(); - while (self > 0) { - digits.Add(symbols[(int)(self % radix)]); - self /= radix; - } - - StringBuilder ret = new StringBuilder(); - if (isNegative) { - ret.Append('-'); - } - for (int digitIndex = digits.Count - 1; digitIndex >= 0; digitIndex--) { - ret.Append(digits[digitIndex]); - } - return ret.ToString(); - } -#endif - #endregion - - #region Exposing underlying data -#if FEATURE_NUMERICS - - [CLSCompliant(false)] - public static uint[] GetWords(this BigInt self) { - if (self.IsZero) { - return new uint[] { 0 }; - } - - int hi; - byte[] bytes; - GetHighestByte(self, out hi, out bytes); - - uint[] result = new uint[(hi + 1 + 3) / 4]; - int i = 0; - int j = 0; - uint u = 0; - int shift = 0; - while (i < bytes.Length) { - u |= (uint)bytes[i++] << shift; - if (i % 4 == 0) { - result[j++] = u; - u = 0; - } - shift += 8; - } - if (u != 0) { - result[j] = u; - } - return result; - } - - [CLSCompliant(false)] - public static uint GetWord(this BigInt self, int index) { - return GetWords(self)[index]; - } - - public static int GetWordCount(this BigInt self) { - int index; - byte[] bytes; - GetHighestByte(self, out index, out bytes); - return index / 4 + 1; // return (index + 1 + 3) / 4; - } - - public static int GetByteCount(this BigInt self) { - int index; - byte[] bytes; - GetHighestByte(self, out index, out bytes); - return index + 1; - } - - public static int GetBitCount(this BigInt self) { - if (self.IsZero) { - return 1; - } - byte[] bytes = BigInt.Abs(self).ToByteArray(); - - int index = bytes.Length; - while (bytes[--index] == 0) ; - - int count = index * 8; - for (int hiByte = bytes[index]; hiByte > 0; hiByte >>= 1) { - count++; - } - return count; - } - - private static byte GetHighestByte(BigInt self, out int index, out byte[] byteArray) { - byte[] bytes = BigInt.Abs(self).ToByteArray(); - if (self.IsZero) { - byteArray = bytes; - index = 0; - return 1; - } - - int hi = bytes.Length; - byte b; - do { - b = bytes[--hi]; - } while (b == 0); - index = hi; - byteArray = bytes; - return b; - } - -#endif - #endregion - - #endregion - -#if !MONO_INTERPRETER - #region Complex - -#if !FEATURE_NUMERICS - public static Complex64 MakeReal(double real) { - return new Complex64(real, 0.0); - } - - public static Complex64 MakeImaginary(double imag) { - return new Complex64(0.0, imag); - } - - public static Complex64 MakeComplex(double real, double imag) { - return new Complex64(real, imag); - } - - public static double Imaginary(this Complex64 self) { - return self.Imag; - } - - public static bool IsZero(this Complex64 self) { - return self.IsZero; - } - - public static Complex64 Pow(this Complex64 self, Complex64 power) { - return self.Power(power); - } -#else - public static Complex MakeReal(double real) { - return new Complex(real, 0.0); - } - - public static Complex MakeImaginary(double imag) { - return new Complex(0.0, imag); - } - - public static Complex MakeComplex(double real, double imag) { - return new Complex(real, imag); - } - - public static double Imaginary(this Complex self) { - return self.Imaginary; - } - - public static bool IsZero(this Complex self) { - return self.Equals(Complex.Zero); - } - - public static Complex Conjugate(this Complex self) { - return new Complex(self.Real, -self.Imaginary); - } - - public static double Abs(this Complex self) { - return Complex.Abs(self); - } - - public static Complex Pow(this Complex self, Complex power) { - return Complex.Pow(self, power); - } -#endif - - #endregion -#endif - } - -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ReferenceEqualityComparer.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ReferenceEqualityComparer.cs deleted file mode 100644 index 291a23eec16..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ReferenceEqualityComparer.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections.Generic; -using System.Runtime.CompilerServices; -using System.Linq.Expressions; -using System.Dynamic; - -namespace Microsoft.Scripting.Utils { - public sealed class ReferenceEqualityComparer : IEqualityComparer where T : class { - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public static readonly ReferenceEqualityComparer Instance = new ReferenceEqualityComparer(); - - private ReferenceEqualityComparer() { } - - public bool Equals(T x, T y) { - return object.ReferenceEquals(x, y); - } - -#if WIN8 - private static Expression NullConst = Expression.Constant(null); - private static int H = 536870912 ^ NullConst.GetHashCode(); -#endif - - public int GetHashCode(T obj) { -#if WP75 // CF RH.GetHashCode throws NullReferenceException if the argument is null - return obj != null ? RuntimeHelpers.GetHashCode(obj) : 0; -#elif WIN8 - // TODO: HACK! - return BindingRestrictions.GetInstanceRestriction(NullConst, obj).GetHashCode() ^ H; -#else - return RuntimeHelpers.GetHashCode(obj); -#endif - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ReflectionUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ReflectionUtils.cs deleted file mode 100644 index 342f258a62d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/ReflectionUtils.cs +++ /dev/null @@ -1,1951 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_METADATA_READER -using Microsoft.Scripting.Metadata; -#endif - -#if !WIN8 -using TypeInfo = System.Type; -#endif - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Linq; -using System.Reflection; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif -using System.Runtime.CompilerServices; -using System.Security; -using System.Text; -using System.Runtime.InteropServices; -using System.Dynamic; -using System.Linq.Expressions; - -using Microsoft.Scripting.Generation; -using Microsoft.Scripting.Runtime; -using Microsoft.Scripting.Utils; - -#if WIN8 || WP75 -namespace System.Runtime.CompilerServices { - [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event)] - public sealed class SpecialNameAttribute : Attribute { - public SpecialNameAttribute() { - } - } -} -#endif - -#if WIN8 -namespace System { - public enum TypeCode { - Empty, - Object, - DBNull, - Boolean, - Char, - SByte, - Byte, - Int16, - UInt16, - Int32, - UInt32, - Int64, - UInt64, - Single, - Double, - Decimal, - DateTime, - String = 18 - } -} - -namespace System.Reflection { - [Flags] - public enum BindingFlags { - /// Specifies that instance members are to be included in the search. - Instance = 4, - /// Specifies that static members are to be included in the search. - Static = 8, - /// Specifies that public members are to be included in the search. - Public = 16, - /// Specifies that non-public members are to be included in the search. - NonPublic = 32 - } -} -#elif !CLR45 -namespace System.Reflection { - public static class RuntimeReflectionExtensions { - public static MethodInfo GetRuntimeBaseDefinition(this MethodInfo method) { - return method.GetBaseDefinition(); - } - - public static IEnumerable GetRuntimeMethods(this Type type) { - return type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); - } - } -} -#endif - -namespace Microsoft.Scripting.Utils { - // CF doesn't support DefaultParameterValue attribute. Define our own, but not in System.Runtime.InteropServices namespace as that would - // make C# compiler emit the parameter's default value metadata not the attribute itself. The default value metadata are not accessible on CF. -#if !FEATURE_DEFAULT_PARAMETER_VALUE - /// - /// The Default Parameter Value Attribute. - /// - public sealed class DefaultParameterValueAttribute : Attribute - { - private readonly object _value; - - public object Value - { - get { return _value; } - } - - /// - /// The constructor - /// - /// The value. - public DefaultParameterValueAttribute(object value) - { - _value = value; - } - } - -#if !ANDROID - [AttributeUsage(AttributeTargets.Parameter, Inherited = false), ComVisible(true)] - public sealed class OptionalAttribute : Attribute { - } -#endif -#endif - - public static class ReflectionUtils { - #region Accessibility - - public const BindingFlags AllMembers = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; - - public static bool IsPublic(this PropertyInfo property) { - return property.GetGetMethod(nonPublic: false) != null - || property.GetSetMethod(nonPublic: false) != null; - } - - public static bool IsStatic(this PropertyInfo property) { - var getter = property.GetGetMethod(nonPublic: true); - var setter = property.GetSetMethod(nonPublic: true); - - return getter != null && getter.IsStatic - || setter != null && setter.IsStatic; - } - - public static bool IsStatic(this EventInfo evnt) { - var add = evnt.GetAddMethod(nonPublic: true); - var remove = evnt.GetRemoveMethod(nonPublic: true); - - return add != null && add.IsStatic - || remove != null && remove.IsStatic; - } - - public static bool IsPrivate(this PropertyInfo property) { - var getter = property.GetGetMethod(nonPublic: true); - var setter = property.GetSetMethod(nonPublic: true); - - return (getter == null || getter.IsPrivate) - && (setter == null || setter.IsPrivate); - } - - public static bool IsPrivate(this EventInfo evnt) { - var add = evnt.GetAddMethod(nonPublic: true); - var remove = evnt.GetRemoveMethod(nonPublic: true); - - return (add == null || add.IsPrivate) - && (remove == null || remove.IsPrivate); - } - - private static bool MatchesFlags(ConstructorInfo member, BindingFlags flags) { - return - ((member.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic) & flags) != 0 && - ((member.IsStatic ? BindingFlags.Static : BindingFlags.Instance) & flags) != 0; - } - - private static bool MatchesFlags(MethodInfo member, BindingFlags flags) { - return - ((member.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic) & flags) != 0 && - ((member.IsStatic ? BindingFlags.Static : BindingFlags.Instance) & flags) != 0; - } - - private static bool MatchesFlags(FieldInfo member, BindingFlags flags) { - return - ((member.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic) & flags) != 0 && - ((member.IsStatic ? BindingFlags.Static : BindingFlags.Instance) & flags) != 0; - } - - private static bool MatchesFlags(PropertyInfo member, BindingFlags flags) { - return - ((member.IsPublic() ? BindingFlags.Public : BindingFlags.NonPublic) & flags) != 0 && - ((member.IsStatic() ? BindingFlags.Static : BindingFlags.Instance) & flags) != 0; - } - - private static bool MatchesFlags(EventInfo member, BindingFlags flags) { - var add = member.GetAddMethod(); - var remove = member.GetRemoveMethod(); - var raise = member.GetRaiseMethod(); - - bool isPublic = add != null && add.IsPublic || remove != null && remove.IsPublic || raise != null && raise.IsPublic; - bool isStatic = add != null && add.IsStatic || remove != null && remove.IsStatic || raise != null && raise.IsStatic; - - return - ((isPublic ? BindingFlags.Public : BindingFlags.NonPublic) & flags) != 0 && - ((isStatic ? BindingFlags.Static : BindingFlags.Instance) & flags) != 0; - } - - private static bool MatchesFlags(TypeInfo member, BindingFlags flags) { - // Static/Instance are ignored - return (((member.IsPublic || member.IsNestedPublic) ? BindingFlags.Public : BindingFlags.NonPublic) & flags) != 0; - } - - private static bool MatchesFlags(MemberInfo member, BindingFlags flags) { - ConstructorInfo ctor; - MethodInfo method; - FieldInfo field; - EventInfo evnt; - PropertyInfo property; - - if ((method = member as MethodInfo) != null) { - return MatchesFlags(method, flags); - } - - if ((field = member as FieldInfo) != null) { - return MatchesFlags(field, flags); - } - - if ((ctor = member as ConstructorInfo) != null) { - return MatchesFlags(ctor, flags); - } - - if ((evnt = member as EventInfo) != null) { - return MatchesFlags(evnt, flags); - } - - if ((property = member as PropertyInfo) != null) { - return MatchesFlags(property, flags); - } - - return MatchesFlags((TypeInfo)member, flags); - } - - private static IEnumerable WithBindingFlags(this IEnumerable members, Func matchFlags, BindingFlags flags) - where T : MemberInfo { - return members.Where(member => matchFlags(member, flags)); - } - - public static IEnumerable WithBindingFlags(this IEnumerable members, BindingFlags flags) { - return members.WithBindingFlags(MatchesFlags, flags); - } - - public static IEnumerable WithBindingFlags(this IEnumerable members, BindingFlags flags) { - return members.WithBindingFlags(MatchesFlags, flags); - } - - public static IEnumerable WithBindingFlags(this IEnumerable members, BindingFlags flags) { - return members.WithBindingFlags(MatchesFlags, flags); - } - - public static IEnumerable WithBindingFlags(this IEnumerable members, BindingFlags flags) { - return members.WithBindingFlags(MatchesFlags, flags); - } - - public static IEnumerable WithBindingFlags(this IEnumerable members, BindingFlags flags) { - return members.WithBindingFlags(MatchesFlags, flags); - } - - public static IEnumerable WithBindingFlags(this IEnumerable members, BindingFlags flags) { - return members.WithBindingFlags(MatchesFlags, flags); - } - - public static IEnumerable WithBindingFlags(this IEnumerable members, BindingFlags flags) { - return members.WithBindingFlags(MatchesFlags, flags); - } - - public static MemberInfo WithBindingFlags(this MemberInfo member, BindingFlags flags) { - return member != null && MatchesFlags(member, flags) ? member : null; - } - - public static MethodInfo WithBindingFlags(this MethodInfo member, BindingFlags flags) { - return member != null && MatchesFlags(member, flags) ? member : null; - } - - public static ConstructorInfo WithBindingFlags(this ConstructorInfo member, BindingFlags flags) { - return member != null && MatchesFlags(member, flags) ? member : null; - } - - public static FieldInfo WithBindingFlags(this FieldInfo member, BindingFlags flags) { - return member != null && MatchesFlags(member, flags) ? member : null; - } - - public static PropertyInfo WithBindingFlags(this PropertyInfo member, BindingFlags flags) { - return member != null && MatchesFlags(member, flags) ? member : null; - } - - public static EventInfo WithBindingFlags(this EventInfo member, BindingFlags flags) { - return member != null && MatchesFlags(member, flags) ? member : null; - } - - public static TypeInfo WithBindingFlags(this TypeInfo member, BindingFlags flags) { - return member != null && MatchesFlags(member, flags) ? member : null; - } - - #endregion - - #region Signatures - - public static IEnumerable WithSignature(this IEnumerable members, Type[] parameterTypes) { - return members.Where(c => { - var ps = c.GetParameters(); - if (ps.Length != parameterTypes.Length) { - return false; - } - - for (int i = 0; i < ps.Length; i++) { - if (parameterTypes[i] != ps[i].ParameterType) { - return false; - } - } - - return true; - }); - } - - public static IEnumerable WithSignature(this IEnumerable members, Type[] parameterTypes) { - return members.Where(c => { - var ps = c.GetParameters(); - if (ps.Length != parameterTypes.Length) { - return false; - } - - for (int i = 0; i < ps.Length; i++) { - if (parameterTypes[i] != ps[i].ParameterType) { - return false; - } - } - - return true; - }); - } - - #endregion - - #region Member Inheritance - - // CLI specification, partition I, 8.10.4: Hiding, overriding, and layout - // ---------------------------------------------------------------------- - // While hiding applies to all members of a type, overriding deals with object layout and is applicable only to instance fields - // and virtual methods. The CTS provides two forms of member overriding, new slot and expect existing slot. A member of a derived - // type that is marked as a new slot will always get a new slot in the object’s layout, guaranteeing that the base field or method - // is available in the object by using a qualified reference that combines the name of the base type with the name of the member - // and its type or signature. A member of a derived type that is marked as expect existing slot will re-use (i.e., share or override) - // a slot that corresponds to a member of the same kind (field or method), name, and type if one already exists from the base type; - // if no such slot exists, a new slot is allocated and used. - // - // The general algorithm that is used for determining the names in a type and the layout of objects of the type is roughly as follows: - // - Flatten the inherited names (using the hide by name or hide by name-and-signature rule) ignoring accessibility rules. - // - For each new member that is marked “expect existing slot”, look to see if an exact match on kind (i.e., field or method), - // name, and signature exists and use that slot if it is found, otherwise allocate a new slot. - // - After doing this for all new members, add these new member-kind/name/signatures to the list of members of this type - // - Finally, remove any inherited names that match the new members based on the hide by name or hide by name-and-signature rules. - - // NOTE: Following GetXxx only implement overriding, not hiding specified by hide-by-name or hide-by-name-and-signature flags. - - public static IEnumerable GetInheritedMethods(this Type type, string name = null, bool flattenHierarchy = false) { - while (type.IsGenericParameter) { - type = type.GetBaseType(); - } - - var baseDefinitions = new HashSet(ReferenceEqualityComparer.Instance); - foreach (var ancestor in type.Ancestors()) { - foreach (var declaredMethod in ancestor.GetDeclaredMethods(name)) { - if (declaredMethod != null && IncludeMethod(declaredMethod, type, baseDefinitions, flattenHierarchy)) { - yield return declaredMethod; - } - } - } - } - - private static bool IncludeMethod(MethodInfo member, Type reflectedType, HashSet baseDefinitions, bool flattenHierarchy) { - if (member.IsVirtual) { - if (baseDefinitions.Add(RuntimeReflectionExtensions.GetRuntimeBaseDefinition(member))) { - return true; - } - } else if (member.DeclaringType == reflectedType) { - return true; - } else if (!member.IsPrivate && (!member.IsStatic || flattenHierarchy)) { - return true; - } - - return false; - } - - public static IEnumerable GetInheritedProperties(this Type type, string name = null, bool flattenHierarchy = false) { - while (type.IsGenericParameter) { - type = type.GetBaseType(); - } - - var baseDefinitions = new HashSet(ReferenceEqualityComparer.Instance); - foreach (var ancestor in type.Ancestors()) { - if (name != null) { - var declaredProperty = ancestor.GetDeclaredProperty(name); - if (declaredProperty != null && IncludeProperty(declaredProperty, type, baseDefinitions, flattenHierarchy)) { - yield return declaredProperty; - } - } else { - foreach (var declaredProperty in ancestor.GetDeclaredProperties()) { - if (IncludeProperty(declaredProperty, type, baseDefinitions, flattenHierarchy)) { - yield return declaredProperty; - } - } - } - } - } - - // CLI spec 22.34 Properties - // ------------------------- - // [Note: The CLS (see Partition I) refers to instance, virtual, and static properties. - // The signature of a property (from the Type column) can be used to distinguish a static property, - // since instance and virtual properties will have the “HASTHIS” bit set in the signature (§23.2.1) - // while a static property will not. The distinction between an instance and a virtual property - // depends on the signature of the getter and setter methods, which the CLS requires to be either - // both virtual or both instance. end note] - private static bool IncludeProperty(PropertyInfo member, Type reflectedType, HashSet baseDefinitions, bool flattenHierarchy) { - var getter = member.GetGetMethod(nonPublic: true); - var setter = member.GetSetMethod(nonPublic: true); - - MethodInfo virtualAccessor; - if (getter != null && getter.IsVirtual) { - virtualAccessor = getter; - } else if (setter != null && setter.IsVirtual) { - virtualAccessor = setter; - } else { - virtualAccessor = null; - } - - if (virtualAccessor != null) { - if (baseDefinitions.Add(RuntimeReflectionExtensions.GetRuntimeBaseDefinition(virtualAccessor))) { - return true; - } - } else if (member.DeclaringType == reflectedType) { - return true; - } else if (!member.IsPrivate() && (!member.IsStatic() || flattenHierarchy)) { - return true; - } - - return false; - } - - public static IEnumerable GetInheritedEvents(this Type type, string name = null, bool flattenHierarchy = false) { - while (type.IsGenericParameter) { - type = type.GetBaseType(); - } - - var baseDefinitions = new HashSet(ReferenceEqualityComparer.Instance); - foreach (var ancestor in type.Ancestors()) { - if (name != null) { - var declaredEvent = ancestor.GetDeclaredEvent(name); - if (declaredEvent != null && IncludeEvent(declaredEvent, type, baseDefinitions, flattenHierarchy)) { - yield return declaredEvent; - } - } else { - foreach (var declaredEvent in ancestor.GetDeclaredEvents()) { - if (IncludeEvent(declaredEvent, type, baseDefinitions, flattenHierarchy)) { - yield return declaredEvent; - } - } - } - } - } - - private static bool IncludeEvent(EventInfo member, Type reflectedType, HashSet baseDefinitions, bool flattenHierarchy) { - var add = member.GetAddMethod(nonPublic: true); - var remove = member.GetRemoveMethod(nonPublic: true); - - // TOOD: fire method? - - MethodInfo virtualAccessor; - if (add != null && add.IsVirtual) { - virtualAccessor = add; - } else if (remove != null && remove.IsVirtual) { - virtualAccessor = remove; - } else { - virtualAccessor = null; - } - - if (virtualAccessor != null) { - if (baseDefinitions.Add(RuntimeReflectionExtensions.GetRuntimeBaseDefinition(virtualAccessor))) { - return true; - } - } else if (member.DeclaringType == reflectedType) { - return true; - } else if (!member.IsPrivate() && (!member.IsStatic() || flattenHierarchy)) { - return true; - } - - return false; - } - - public static IEnumerable GetInheritedFields(this Type type, string name = null, bool flattenHierarchy = false) { - while (type.IsGenericParameter) { - type = type.GetBaseType(); - } - - foreach (var ancestor in type.Ancestors()) { - if (name != null) { - var declaredField = ancestor.GetDeclaredField(name); - if (declaredField != null && IncludeField(declaredField, type, flattenHierarchy)) { - yield return declaredField; - } - } else { - foreach (var declaredField in ancestor.GetDeclaredFields()) { - if (IncludeField(declaredField, type, flattenHierarchy)) { - yield return declaredField; - } - } - } - } - } - - private static bool IncludeField(FieldInfo member, Type reflectedType, bool flattenHierarchy) { - if (member.DeclaringType == reflectedType) { - return true; - } else if (!member.IsPrivate && (!member.IsStatic || flattenHierarchy)) { - return true; - } - - return false; - } - - public static IEnumerable GetInheritedMembers(this Type type, string name = null, bool flattenHierarchy = false) { - var result = - type.GetInheritedMethods(name, flattenHierarchy).Cast().Concat( - type.GetInheritedProperties(name, flattenHierarchy).Cast().Concat( - type.GetInheritedEvents(name, flattenHierarchy).Cast().Concat( - type.GetInheritedFields(name, flattenHierarchy).Cast()))); - - if (name == null) { - return result.Concat( - type.GetDeclaredConstructors().Cast().Concat( - type.GetDeclaredNestedTypes().Cast())); - } - - var nestedType = type.GetDeclaredNestedType(name); - return (nestedType != null) ? result.Concat(new[] { nestedType }) : result; - } - - #endregion - - #region Declared Members - - public static IEnumerable GetDeclaredConstructors(this Type type) { -#if WIN8 - return type.GetTypeInfo().DeclaredConstructors; -#else - return type.GetConstructors(BindingFlags.DeclaredOnly | AllMembers); -#endif - } - -#if WIN8 - public static ConstructorInfo GetConstructor(this Type type, Type[] parameterTypes) { - return type.GetDeclaredConstructors().Where(ci => !ci.IsStatic && ci.IsPublic).WithSignature(parameterTypes).SingleOrDefault(); - } -#endif - - public static IEnumerable GetDeclaredMethods(this Type type, string name = null) { -#if WIN8 - if (name == null) { - return type.GetTypeInfo().DeclaredMethods; - } else { - return type.GetTypeInfo().GetDeclaredMethods(name); - } -#else - if (name == null) { - return type.GetMethods(BindingFlags.DeclaredOnly | AllMembers); - } else { - return type.GetMember(name, MemberTypes.Method, BindingFlags.DeclaredOnly | AllMembers).OfType(); - } -#endif - } - - public static IEnumerable GetDeclaredProperties(this Type type) { -#if WIN8 - return type.GetTypeInfo().DeclaredProperties; -#else - return type.GetProperties(BindingFlags.DeclaredOnly | AllMembers); -#endif - } - - public static PropertyInfo GetDeclaredProperty(this Type type, string name) { - Debug.Assert(name != null); -#if WIN8 - return type.GetTypeInfo().GetDeclaredProperty(name); -#else - return type.GetProperty(name, BindingFlags.DeclaredOnly | AllMembers); -#endif - } - - public static IEnumerable GetDeclaredEvents(this Type type) { -#if WIN8 - return type.GetTypeInfo().DeclaredEvents; -#else - return type.GetEvents(BindingFlags.DeclaredOnly | AllMembers); -#endif - } - - public static EventInfo GetDeclaredEvent(this Type type, string name) { - Debug.Assert(name != null); -#if WIN8 - return type.GetTypeInfo().GetDeclaredEvent(name); -#else - return type.GetEvent(name, BindingFlags.DeclaredOnly | AllMembers); -#endif - } - - public static IEnumerable GetDeclaredFields(this Type type) { -#if WIN8 - return type.GetTypeInfo().DeclaredFields; -#else - return type.GetFields(BindingFlags.DeclaredOnly | AllMembers); -#endif - } - - public static FieldInfo GetDeclaredField(this Type type, string name) { - Debug.Assert(name != null); -#if WIN8 - return type.GetTypeInfo().GetDeclaredField(name); -#else - return type.GetField(name, BindingFlags.DeclaredOnly | AllMembers); -#endif - } - - public static IEnumerable GetDeclaredNestedTypes(this Type type) { -#if WIN8 - return type.GetTypeInfo().DeclaredNestedTypes; -#else - return type.GetNestedTypes(BindingFlags.DeclaredOnly | AllMembers); -#endif - } - - public static TypeInfo GetDeclaredNestedType(this Type type, string name) { - Debug.Assert(name != null); -#if WIN8 - return type.GetTypeInfo().GetDeclaredNestedType(name); -#else - return type.GetNestedType(name, BindingFlags.DeclaredOnly | AllMembers); -#endif - } - - public static IEnumerable GetDeclaredMembers(this Type type, string name = null) { -#if WIN8 - var info = type.GetTypeInfo(); - if (name == null) { - return info.DeclaredMembers; - } else { - return GetDeclaredMembersWithName(info, name); - } -#else - if (name == null) { - return type.GetMembers(BindingFlags.DeclaredOnly | AllMembers); - } else { - return type.GetMember(name, BindingFlags.DeclaredOnly | AllMembers); - } -#endif - } - -#if WIN8 - private static IEnumerable GetDeclaredMembersWithName(TypeInfo info, string name) { - MemberInfo member; - - if ((member = info.GetDeclaredMethod(name)) != null) { - yield return member; - } - - if ((member = info.GetDeclaredField(name)) != null) { - yield return member; - } - - if ((member = info.GetDeclaredProperty(name)) != null) { - yield return member; - } - - if ((member = info.GetDeclaredEvent(name)) != null) { - yield return member; - } - - if ((member = info.GetDeclaredNestedType(name)) != null) { - yield return member; - } - } -#endif - - #endregion - - #region Win8 -#if WIN8 || CLR45 - public static TypeCode GetTypeCode(this Enum e) { - return GetTypeCode(Enum.GetUnderlyingType(e.GetType())); - } - - // TODO: reduce to numeric types? - public static TypeCode GetTypeCode(this Type type) { - if (type == typeof(int)) { - return TypeCode.Int32; - } - if (type == typeof(sbyte)) { - return TypeCode.SByte; - } - if (type == typeof(short)) { - return TypeCode.Int16; - } - if (type == typeof(long)) { - return TypeCode.Int64; - } - if (type == typeof(uint)) { - return TypeCode.UInt32; - } - if (type == typeof(byte)) { - return TypeCode.Byte; - } - if (type == typeof(ushort)) { - return TypeCode.UInt16; - } - if (type == typeof(ulong)) { - return TypeCode.UInt64; - } - if (type == typeof(bool)) { - return TypeCode.Boolean; - } - if (type == typeof(char)) { - return TypeCode.Char; - } - - // TODO: do we need this? - if (type == typeof(string)) { - return TypeCode.String; - } - if (type == typeof(bool)) { - return TypeCode.Boolean; - } - if (type == typeof(double)) { - return TypeCode.Double; - } - if (type == typeof(float)) { - return TypeCode.Single; - } - if (type == typeof(decimal)) { - return TypeCode.Decimal; - } - if (type == typeof(DateTime)) { - return TypeCode.DateTime; - } - return TypeCode.Object; - } - - public static IEnumerable GetImplementedInterfaces(this Type type) { - return type.GetTypeInfo().ImplementedInterfaces; - } - - public static MethodInfo GetGetMethod(this PropertyInfo propertyInfo, bool nonPublic = false) { - var accessor = propertyInfo.GetMethod; - return nonPublic || accessor == null || accessor.IsPublic ? accessor : null; - } - - public static MethodInfo GetSetMethod(this PropertyInfo propertyInfo, bool nonPublic = false) { - var accessor = propertyInfo.SetMethod; - return nonPublic || accessor == null || accessor.IsPublic ? accessor : null; - } - - public static MethodInfo GetAddMethod(this EventInfo eventInfo, bool nonPublic = false) { - var accessor = eventInfo.AddMethod; - return nonPublic || accessor == null || accessor.IsPublic ? accessor : null; - } - - public static MethodInfo GetRemoveMethod(this EventInfo eventInfo, bool nonPublic = false) { - var accessor = eventInfo.RemoveMethod; - return nonPublic || accessor == null || accessor.IsPublic ? accessor : null; - } - - public static MethodInfo GetRaiseMethod(this EventInfo eventInfo, bool nonPublic = false) { - var accessor = eventInfo.RaiseMethod; - return nonPublic || accessor == null || accessor.IsPublic ? accessor : null; - } - - public static MethodInfo GetMethod(this Type type, string name) { - return type.GetTypeInfo().GetDeclaredMethod(name); - } - - // TODO: FlattenHierarchy - // TODO: inherited! - public static MethodInfo GetMethod(this Type type, string name, Type[] parameterTypes) { - return type.GetTypeInfo().GetDeclaredMethods(name).WithSignature(parameterTypes).Single(); - } - - public static MethodInfo GetMethod(this Type type, string name, BindingFlags bindingFlags) { - return type.GetMethods(name, bindingFlags).Single(); - } - - private static IEnumerable GetMethods(this Type type, string name, BindingFlags bindingFlags) { - return type.GetTypeInfo().GetDeclaredMethods(name).WithBindingFlags(bindingFlags); - } - - public static MethodInfo GetMethod(this Delegate d) { - return d.GetMethodInfo(); - } - - // TODO: Callers should distinguish parameters from arguments. Stop using this method. - public static Type[] GetGenericArguments(this Type type) { - var info = type.GetTypeInfo(); - return info.IsGenericTypeDefinition ? info.GenericTypeParameters : info.GenericTypeArguments; - } - - public static Type[] GetGenericTypeArguments(this Type type) { - return type.GetTypeInfo().GenericTypeArguments; - } - - public static Type[] GetGenericTypeParameters(this Type type) { - return type.GetTypeInfo().GenericTypeParameters; - } - - public static bool IsAssignableFrom(this Type type, Type other) { - return type.GetTypeInfo().IsAssignableFrom(other.GetTypeInfo()); - } - - public static Type[] GetGenericParameterConstraints(this Type type) { - return type.GetTypeInfo().GetGenericParameterConstraints(); - } - - public static bool IsSubclassOf(this Type type, Type other) { - return type.GetTypeInfo().IsSubclassOf(other); - } - - public static IEnumerable GetInterfaces(this Type type) { - return type.GetTypeInfo().ImplementedInterfaces; - } - - public static Type[] GetRequiredCustomModifiers(this ParameterInfo parameter) { - return EmptyTypes; - } - - public static Type[] GetOptionalCustomModifiers(this ParameterInfo parameter) { - return EmptyTypes; - } - - public static IEnumerable GetModules(this Assembly assembly) { - return assembly.Modules; - } - - private static string GetDefaultMemberName(this Type type) { - foreach (var ancestor in type.Ancestors()) { - var attr = ancestor.GetTypeInfo().GetCustomAttributes().SingleOrDefault(); - if (attr != null) { - return attr.MemberName; - } - } - - return null; - } - - public static IEnumerable GetDefaultMembers(this Type type) { - string defaultMemberName = type.GetDefaultMemberName(); - if (defaultMemberName != null) { - return type.GetInheritedMembers(defaultMemberName).WithBindingFlags(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public); - } - - return Enumerable.Empty(); - } -#else - public static Type[] GetGenericTypeArguments(this Type type) { - return type.IsGenericType && !type.IsGenericTypeDefinition ? type.GetTypeInfo().GetGenericArguments() : null; - } - - public static Type[] GetGenericTypeParameters(this Type type) { - return type.IsGenericTypeDefinition ? type.GetTypeInfo().GetGenericArguments() : null; - } - - public static IEnumerable GetModules(this Assembly assembly) { - return assembly.GetModules(); - } - - public static IEnumerable GetImplementedInterfaces(this Type type) { - return type.GetInterfaces(); - } - - public static TypeCode GetTypeCode(this Type type) { - return Type.GetTypeCode(type); - } - - public static MethodInfo GetMethodInfo(this Delegate d) { - return d.Method; - } - - public static bool IsDefined(this Assembly assembly, Type attributeType) { - return assembly.IsDefined(attributeType, false); - } - - public static T GetCustomAttribute(this Assembly assembly, bool inherit = false) where T : Attribute { - return (T)Attribute.GetCustomAttribute(assembly, typeof(T), inherit); - } - - public static T GetCustomAttribute(this MemberInfo member, bool inherit = false) where T : Attribute { - return (T)Attribute.GetCustomAttribute(member, typeof(T), inherit); - } - - public static IEnumerable GetCustomAttributes(this Assembly assembly, bool inherit = false) where T : Attribute { - return Attribute.GetCustomAttributes(assembly, typeof(T), inherit).Cast(); - } - - public static IEnumerable GetCustomAttributes(this MemberInfo member, bool inherit = false) where T : Attribute { - return Attribute.GetCustomAttributes(member, typeof(T), inherit).Cast(); - } -#endif - - public static bool ContainsGenericParameters(this Type type) { - return type.GetTypeInfo().ContainsGenericParameters; - } - - public static bool IsInterface(this Type type) { - return type.GetTypeInfo().IsInterface; - } - - public static bool IsClass(this Type type) { - return type.GetTypeInfo().IsClass; - } - - public static bool IsGenericType(this Type type) { - return type.GetTypeInfo().IsGenericType; - } - - public static bool IsGenericTypeDefinition(this Type type) { - return type.GetTypeInfo().IsGenericTypeDefinition; - } - - public static bool IsSealed(this Type type) { - return type.GetTypeInfo().IsSealed; - } - - public static bool IsAbstract(this Type type) { - return type.GetTypeInfo().IsAbstract; - } - - public static bool IsPublic(this Type type) { - return type.GetTypeInfo().IsPublic; - } - - public static bool IsVisible(this Type type) { - return type.GetTypeInfo().IsVisible; - } - - public static Type GetBaseType(this Type type) { - return type.GetTypeInfo().BaseType; - } - - public static bool IsValueType(this Type type) { - return type.GetTypeInfo().IsValueType; - } - - public static bool IsEnum(this Type type) { - return type.GetTypeInfo().IsEnum; - } - - public static bool IsPrimitive(this Type type) { - return type.GetTypeInfo().IsPrimitive; - } - - public static GenericParameterAttributes GetGenericParameterAttributes(this Type type) { - return type.GetTypeInfo().GenericParameterAttributes; - } - - public static Type[] EmptyTypes = new Type[0]; - - public static object GetRawConstantValue(this FieldInfo field) { - if (!field.IsLiteral) { - throw new ArgumentException(field + " not a literal."); - } - - object value = field.GetValue(null); - return field.FieldType.IsEnum() ? UnwrapEnumValue(value) : value; - } - - /// - /// Converts a boxed enum value to the underlying integer value. - /// - public static object UnwrapEnumValue(object value) { - if (value == null) { - throw new ArgumentNullException("value"); - } - - switch (value.GetType().GetTypeCode()) { - case TypeCode.Byte: - return System.Convert.ToByte(value); - - case TypeCode.Int16: - return System.Convert.ToInt16(value); - - case TypeCode.Int32: - return System.Convert.ToInt32(value); - - case TypeCode.Int64: - return System.Convert.ToInt64(value); - - case TypeCode.SByte: - return System.Convert.ToSByte(value); - - case TypeCode.UInt16: - return System.Convert.ToUInt16(value); - - case TypeCode.UInt32: - return System.Convert.ToUInt32(value); - - case TypeCode.UInt64: - return System.Convert.ToUInt64(value); - - default: - throw new ArgumentException("Value must be a boxed enum.", "value"); - } - } - - #endregion - -#if FEATURE_REFEMIT -#if FEATURE_ASSEMBLYBUILDER_DEFINEDYNAMICASSEMBLY - public static AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access) { - return AssemblyBuilder.DefineDynamicAssembly(name, access); - } -#else - public static AssemblyBuilder DefineDynamicAssembly(AssemblyName name, AssemblyBuilderAccess access) { - return AppDomain.CurrentDomain.DefineDynamicAssembly(name, access); - } -#endif -#if !FEATURE_PDBEMIT - public static ModuleBuilder DefineDynamicModule(this AssemblyBuilder assembly, string name, bool emitDebugInfo) { - // ignore the flag - return assembly.DefineDynamicModule(name); - } -#endif -#endif - - #region Signature and Type Formatting - - // Generic type names have the arity (number of generic type paramters) appended at the end. - // For eg. the mangled name of System.List is "List`1". This mangling is done to enable multiple - // generic types to exist as long as they have different arities. - public const char GenericArityDelimiter = '`'; - -#if !WIN8 - public static StringBuilder FormatSignature(StringBuilder result, MethodBase method) { - return FormatSignature(result, method, (t) => t.FullName); - } - - public static StringBuilder FormatSignature(StringBuilder result, MethodBase method, Func nameDispenser) { - ContractUtils.RequiresNotNull(result, "result"); - ContractUtils.RequiresNotNull(method, "method"); - ContractUtils.RequiresNotNull(nameDispenser, "nameDispenser"); - - MethodInfo methodInfo = method as MethodInfo; - if (methodInfo != null) { - FormatTypeName(result, methodInfo.ReturnType, nameDispenser); - result.Append(' '); - } - -#if FEATURE_REFEMIT - MethodBuilder builder = method as MethodBuilder; - if (builder != null) { - result.Append(builder.Signature); - return result; - } - - ConstructorBuilder cb = method as ConstructorBuilder; - if (cb != null) { - result.Append(cb.Signature); - return result; - } -#endif - FormatTypeName(result, method.DeclaringType, nameDispenser); - result.Append("::"); - result.Append(method.Name); - - if (!method.IsConstructor) { - FormatTypeArgs(result, method.GetGenericArguments(), nameDispenser); - } - - result.Append("("); - - if (!method.ContainsGenericParameters) { - ParameterInfo[] ps = method.GetParameters(); - for (int i = 0; i < ps.Length; i++) { - if (i > 0) result.Append(", "); - FormatTypeName(result, ps[i].ParameterType, nameDispenser); - if (!System.String.IsNullOrEmpty(ps[i].Name)) { - result.Append(" "); - result.Append(ps[i].Name); - } - } - } else { - result.Append("?"); - } - - result.Append(")"); - return result; - } -#endif - - public static StringBuilder FormatTypeName(StringBuilder result, Type type) { - return FormatTypeName(result, type, (t) => t.FullName); - } - - public static StringBuilder FormatTypeName(StringBuilder result, Type type, Func nameDispenser) { - ContractUtils.RequiresNotNull(result, "result"); - ContractUtils.RequiresNotNull(type, "type"); - ContractUtils.RequiresNotNull(nameDispenser, "nameDispenser"); - - if (type.IsGenericType()) { - Type genType = type.GetGenericTypeDefinition(); - string genericName = nameDispenser(genType).Replace('+', '.'); - int tickIndex = genericName.IndexOf('`'); - result.Append(tickIndex != -1 ? genericName.Substring(0, tickIndex) : genericName); - - Type[] typeArgs = type.GetGenericArguments(); - if (type.IsGenericTypeDefinition()) { - result.Append('<'); - result.Append(',', typeArgs.Length - 1); - result.Append('>'); - } else { - FormatTypeArgs(result, typeArgs, nameDispenser); - } - } else if (type.IsGenericParameter) { - result.Append(type.Name); - } else { - // cut namespace off: - result.Append(nameDispenser(type).Replace('+', '.')); - } - return result; - } - - public static StringBuilder FormatTypeArgs(StringBuilder result, Type[] types) { - return FormatTypeArgs(result, types, (t) => t.FullName); - } - - public static StringBuilder FormatTypeArgs(StringBuilder result, Type[] types, Func nameDispenser) { - ContractUtils.RequiresNotNull(result, "result"); - ContractUtils.RequiresNotNullItems(types, "types"); - ContractUtils.RequiresNotNull(nameDispenser, "nameDispenser"); - - if (types.Length > 0) { - result.Append("<"); - - for (int i = 0; i < types.Length; i++) { - if (i > 0) result.Append(", "); - FormatTypeName(result, types[i], nameDispenser); - } - - result.Append(">"); - } - return result; - } - - internal static string ToValidTypeName(string str) { - if (String.IsNullOrEmpty(str)) { - return "_"; - } - - StringBuilder sb = new StringBuilder(str); - for (int i = 0; i < str.Length; i++) { - if (str[i] == '\0' || str[i] == '.' || str[i] == '*' || str[i] == '+' || str[i] == '[' || str[i] == ']' || str[i] == '\\') { - sb[i] = '_'; - } - } - return sb.ToString(); - } - - public static string GetNormalizedTypeName(Type type) { - string name = type.Name; - if (type.IsGenericType()) { - return GetNormalizedTypeName(name); - } - return name; - } - - public static string GetNormalizedTypeName(string typeName) { - Debug.Assert(typeName.IndexOf('.') == -1); // This is the simple name, not the full name - int backtick = typeName.IndexOf(ReflectionUtils.GenericArityDelimiter); - if (backtick != -1) return typeName.Substring(0, backtick); - return typeName; - } - - #endregion - - #region Delegates and Dynamic Methods - -#if WP75 - /// - /// Creates an open delegate for the given (dynamic)method. - /// - public static Delegate CreateDelegate(this MethodInfo methodInfo, Type delegateType) { - return CreateDelegate(methodInfo, delegateType, null); - } - - /// - /// Creates a closed delegate for the given (dynamic)method. - /// - public static Delegate CreateDelegate(this MethodInfo methodInfo, Type delegateType, object target) { - return Delegate.CreateDelegate(delegateType, target, methodInfo); - } -#elif !WIN8 - /// - /// Creates an open delegate for the given (dynamic)method. - /// - public static Delegate CreateDelegate(this MethodInfo methodInfo, Type delegateType) { - return CreateDelegate(methodInfo, delegateType, null); - } - - /// - /// Creates a closed delegate for the given (dynamic)method. - /// - public static Delegate CreateDelegate(this MethodInfo methodInfo, Type delegateType, object target) { -#if FEATURE_REFEMIT - DynamicMethod dm = methodInfo as DynamicMethod; - if (dm != null) { - return dm.CreateDelegate(delegateType, target); -#endif - return Delegate.CreateDelegate(delegateType, target, methodInfo); - } -#endif - -#if FEATURE_LCG - public static bool IsDynamicMethod(MethodBase method) { - return !PlatformAdaptationLayer.IsCompactFramework && IsDynamicMethodInternal(method); - } - - [MethodImpl(MethodImplOptions.NoInlining)] - private static bool IsDynamicMethodInternal(MethodBase method) { - return method is DynamicMethod; - } -#else - public static bool IsDynamicMethod(MethodBase method) { - return false; - } -#endif - - public static void GetDelegateSignature(Type delegateType, out ParameterInfo[] parameterInfos, out ParameterInfo returnInfo) { - ContractUtils.RequiresNotNull(delegateType, "delegateType"); - - MethodInfo invokeMethod = delegateType.GetMethod("Invoke"); - ContractUtils.Requires(invokeMethod != null, "delegateType", Strings.InvalidDelegate); - - parameterInfos = invokeMethod.GetParameters(); - returnInfo = invokeMethod.ReturnParameter; - } - - /// - /// Gets a Func of CallSite, object * paramCnt, object delegate type - /// that's suitable for use in a non-strongly typed call site. - /// - public static Type GetObjectCallSiteDelegateType(int paramCnt) { - switch (paramCnt) { - case 0: return typeof(Func); - case 1: return typeof(Func); - case 2: return typeof(Func); - case 3: return typeof(Func); - case 4: return typeof(Func); - case 5: return typeof(Func); - case 6: return typeof(Func); - case 7: return typeof(Func); - case 8: return typeof(Func); - case 9: return typeof(Func); - case 10: return typeof(Func); - case 11: return typeof(Func); - case 12: return typeof(Func); - case 13: return typeof(Func); - case 14: return typeof(Func); - default: -#if FEATURE_REFEMIT - Type[] paramTypes = new Type[paramCnt + 2]; - paramTypes[0] = typeof(CallSite); - paramTypes[1] = typeof(object); - for (int i = 0; i < paramCnt; i++) { - paramTypes[i + 2] = typeof(object); - } - return Snippets.Shared.DefineDelegate("InvokeDelegate" + paramCnt, typeof(object), paramTypes); -#else - throw new NotSupportedException("Signature not supported on this platform."); -#endif - } - } - -#if FEATURE_LCG - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Portability", "CA1903:UseOnlyApiFromTargetedFramework")] - internal static DynamicMethod RawCreateDynamicMethod(string name, Type returnType, Type[] parameterTypes) { -#if SILVERLIGHT // Module-hosted DynamicMethod is not available in SILVERLIGHT - return new DynamicMethod(name, returnType, parameterTypes); -#else - // - // WARNING: we set restrictedSkipVisibility == true (last parameter) - // setting this bit will allow accessing nonpublic members - // for more information see http://msdn.microsoft.com/en-us/library/bb348332.aspx - // - return new DynamicMethod(name, returnType, parameterTypes, true); -#endif - } -#endif - - #endregion - - #region Methods and Parameters - - public static MethodBase[] GetMethodInfos(MemberInfo[] members) { - return ArrayUtils.ConvertAll( - members, - delegate(MemberInfo inp) { return (MethodBase)inp; }); - } - - public static Type[] GetParameterTypes(ParameterInfo[] parameterInfos) { - return GetParameterTypes((IList)parameterInfos); - } - - public static Type[] GetParameterTypes(IList parameterInfos) { - Type[] result = new Type[parameterInfos.Count]; - for (int i = 0; i < result.Length; i++) { - result[i] = parameterInfos[i].ParameterType; - } - return result; - } - - public static Type GetReturnType(this MethodBase mi) { - return (mi.IsConstructor) ? mi.DeclaringType : ((MethodInfo)mi).ReturnType; - } - - public static bool SignatureEquals(MethodInfo method, params Type[] requiredSignature) { - ContractUtils.RequiresNotNull(method, "method"); - - Type[] actualTypes = ReflectionUtils.GetParameterTypes(method.GetParameters()); - Debug.Assert(actualTypes.Length == requiredSignature.Length - 1); - int i = 0; - while (i < actualTypes.Length) { - if (actualTypes[i] != requiredSignature[i]) return false; - i++; - } - - return method.ReturnType == requiredSignature[i]; - } - -#if CLR2 && !SILVERLIGHT - private static Type _ExtensionAttributeType; -#endif - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - public static bool IsExtension(this MemberInfo member) { - var dlrExtension = typeof(ExtensionAttribute); - if (member.IsDefined(dlrExtension, false)) { - return true; - } - -#if CLR2 && !SILVERLIGHT - if (_ExtensionAttributeType == null) { - try { - _ExtensionAttributeType = Assembly.Load("System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089") - .GetType("System.Runtime.CompilerServices.ExtensionAttribute"); - } catch { - _ExtensionAttributeType = dlrExtension; - } - } - - if (_ExtensionAttributeType != dlrExtension) { - return member.IsDefined(_ExtensionAttributeType, false); - } -#endif - return false; - } - - public static bool IsOutParameter(this ParameterInfo pi) { - // not using IsIn/IsOut properties as they are not available in Silverlight: - return pi.ParameterType.IsByRef && (pi.Attributes & (ParameterAttributes.Out | ParameterAttributes.In)) == ParameterAttributes.Out; - } - - /// - /// Returns true if the specified parameter is mandatory, i.e. is not optional and doesn't have a default value. - /// - public static bool IsMandatory(this ParameterInfo pi) { - return (pi.Attributes & ParameterAttributes.Optional) == 0 && !pi.HasDefaultValue(); - } - - public static bool HasDefaultValue(this ParameterInfo pi) { -#if !FEATURE_DEFAULT_PARAMETER_VALUE - return pi.IsDefined(typeof(DefaultParameterValueAttribute), false); -#else - return (pi.Attributes & ParameterAttributes.HasDefault) != 0; -#endif - } - - public static bool ProhibitsNull(this ParameterInfo parameter) { - return parameter.IsDefined(typeof(NotNullAttribute), false); - } - - public static bool ProhibitsNullItems(this ParameterInfo parameter) { - return parameter.IsDefined(typeof(NotNullItemsAttribute), false); - } - - public static bool IsParamArray(this ParameterInfo parameter) { - return parameter.IsDefined(typeof(ParamArrayAttribute), false); - } - - public static bool IsParamDictionary(this ParameterInfo parameter) { - return parameter.IsDefined(typeof(ParamDictionaryAttribute), false); - } - - public static bool IsParamsMethod(MethodBase method) { - return IsParamsMethod(method.GetParameters()); - } - - public static bool IsParamsMethod(ParameterInfo[] pis) { - foreach (ParameterInfo pi in pis) { - if (pi.IsParamArray() || pi.IsParamDictionary()) return true; - } - return false; - } - - public static object GetDefaultValue(this ParameterInfo info) { -#if !FEATURE_DEFAULT_PARAMETER_VALUE - if (info.IsOptional) { - return info.ParameterType == typeof(object) ? Missing.Value : ScriptingRuntimeHelpers.GetPrimitiveDefaultValue(info.ParameterType); - } - - var defaultValueAttribute = info.GetCustomAttributes(typeof(DefaultParameterValueAttribute), false); - if (defaultValueAttribute.Length > 0) { - return ((DefaultParameterValueAttribute)defaultValueAttribute[0]).Value; - } - - return null; -#else - return info.DefaultValue; -#endif - } - - #endregion - - #region Types - - /// - /// Yields all ancestors of the given type including the type itself. - /// Does not include implemented interfaces. - /// - public static IEnumerable Ancestors(this Type type) { - do { - yield return type; - type = type.GetTypeInfo().BaseType; - } while (type != null); - } - - /// - /// Like Type.GetInterfaces, but only returns the interfaces implemented by this type - /// and not its parents. - /// - public static List GetDeclaredInterfaces(Type type) { - IEnumerable baseInterfaces = (type.GetBaseType() != null) ? type.GetBaseType().GetInterfaces() : EmptyTypes; - List interfaces = new List(); - foreach (Type iface in type.GetInterfaces()) { - if (!baseInterfaces.Contains(iface)) { - interfaces.Add(iface); - } - } - return interfaces; - } - - internal static IEnumerable GetAllTypesFromAssembly(Assembly asm) { - // TODO: WP7, SL5 -#if SILVERLIGHT // ReflectionTypeLoadException - try { - return asm.GetTypes(); - } catch (Exception) { - return ReflectionUtils.EmptyTypes; - } -#elif WIN8 - return asm.DefinedTypes; -#else - foreach (Module module in asm.GetModules()) { - Type[] moduleTypes; - try { - moduleTypes = module.GetTypes(); - } catch (ReflectionTypeLoadException e) { - moduleTypes = e.Types; - } - - foreach (var type in moduleTypes) { - if (type != null) { - yield return type; - } - } - } -#endif - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")] - internal static IEnumerable GetAllTypesFromAssembly(Assembly assembly, bool includePrivateTypes) { - ContractUtils.RequiresNotNull(assembly, "assembly"); - - if (includePrivateTypes) { - return GetAllTypesFromAssembly(assembly); - } - - try { -#if WIN8 - return assembly.ExportedTypes.Select(t => t.GetTypeInfo()); -#else - return assembly.GetExportedTypes(); -#endif - } catch (NotSupportedException) { - // GetExportedTypes does not work with dynamic assemblies - } catch (Exception) { - // Some type loads may cause exceptions. Unfortunately, there is no way to ask GetExportedTypes - // for just the list of types that we successfully loaded. - } - - return GetAllTypesFromAssembly(assembly).Where(type => type.IsPublic); - } - - #endregion - - #region Type Builder -#if FEATURE_REFEMIT - -#if WIN8 // TODO: what is ReservedMask? - private const MethodAttributes MethodAttributesToEraseInOveride = MethodAttributes.Abstract | (MethodAttributes)0xD000; -#else - private const MethodAttributes MethodAttributesToEraseInOveride = MethodAttributes.Abstract | MethodAttributes.ReservedMask; -#endif - - public static MethodBuilder DefineMethodOverride(TypeBuilder tb, MethodAttributes extra, MethodInfo decl) { - MethodAttributes finalAttrs = (decl.Attributes & ~MethodAttributesToEraseInOveride) | extra; - if (!decl.DeclaringType.GetTypeInfo().IsInterface) { - finalAttrs &= ~MethodAttributes.NewSlot; - } - - if ((extra & MethodAttributes.MemberAccessMask) != 0) { - // remove existing member access, add new member access - finalAttrs &= ~MethodAttributes.MemberAccessMask; - finalAttrs |= extra; - } - - MethodBuilder impl = tb.DefineMethod(decl.Name, finalAttrs, decl.CallingConvention); - CopyMethodSignature(decl, impl, false); - return impl; - } - - public static void CopyMethodSignature(MethodInfo from, MethodBuilder to, bool substituteDeclaringType) { - ParameterInfo[] paramInfos = from.GetParameters(); - Type[] parameterTypes = new Type[paramInfos.Length]; - Type[][] parameterRequiredModifiers = null, parameterOptionalModifiers = null; - Type[] returnRequiredModifiers = null, returnOptionalModifiers = null; - -#if FEATURE_CUSTOM_MODIFIERS - returnRequiredModifiers = from.ReturnParameter.GetRequiredCustomModifiers(); - returnOptionalModifiers = from.ReturnParameter.GetOptionalCustomModifiers(); -#endif - for (int i = 0; i < paramInfos.Length; i++) { - if (substituteDeclaringType && paramInfos[i].ParameterType == from.DeclaringType) { - parameterTypes[i] = to.DeclaringType; - } else { - parameterTypes[i] = paramInfos[i].ParameterType; - } - -#if FEATURE_CUSTOM_MODIFIERS - var mods = paramInfos[i].GetRequiredCustomModifiers(); - if (mods.Length > 0) { - if (parameterRequiredModifiers == null) { - parameterRequiredModifiers = new Type[paramInfos.Length][]; - } - - parameterRequiredModifiers[i] = mods; - } - - mods = paramInfos[i].GetOptionalCustomModifiers(); - if (mods.Length > 0) { - if (parameterOptionalModifiers == null) { - parameterOptionalModifiers = new Type[paramInfos.Length][]; - } - - parameterOptionalModifiers[i] = mods; - } -#endif - } - - to.SetSignature( - from.ReturnType, returnRequiredModifiers, returnOptionalModifiers, - parameterTypes, parameterRequiredModifiers, parameterOptionalModifiers - ); - - CopyGenericMethodAttributes(from, to); - - for (int i = 0; i < paramInfos.Length; i++) { - to.DefineParameter(i + 1, paramInfos[i].Attributes, paramInfos[i].Name); - } - } - - private static void CopyGenericMethodAttributes(MethodInfo from, MethodBuilder to) { - if (from.IsGenericMethodDefinition) { - Type[] args = from.GetGenericArguments(); - string[] names = new string[args.Length]; - for (int i = 0; i < args.Length; i++) { - names[i] = args[i].Name; - } - var builders = to.DefineGenericParameters(names); - for (int i = 0; i < args.Length; i++) { - // Copy template parameter attributes - builders[i].SetGenericParameterAttributes(args[i].GetGenericParameterAttributes()); - - // Copy template parameter constraints - Type[] constraints = args[i].GetGenericParameterConstraints(); - List interfaces = new List(constraints.Length); - foreach (Type constraint in constraints) { - if (constraint.IsInterface()) { - interfaces.Add(constraint); - } else { - builders[i].SetBaseTypeConstraint(constraint); - } - } - if (interfaces.Count > 0) { - builders[i].SetInterfaceConstraints(interfaces.ToArray()); - } - } - } - } -#endif - #endregion - - #region Extension Methods - - public static IEnumerable GetVisibleExtensionMethods(Assembly assembly) { -#if FEATURE_METADATA_READER - if (!assembly.IsDynamic && AppDomain.CurrentDomain.IsFullyTrusted) { - try { - return GetVisibleExtensionMethodsFast(assembly); - } catch (SecurityException) { - // full-demand can still fail if there is a partial trust domain on the stack - } - } -#endif - return GetVisibleExtensionMethodsSlow(assembly); - } - -#if FEATURE_METADATA_READER - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2116:AptcaMethodsShouldOnlyCallAptcaMethods")] - [MethodImpl(MethodImplOptions.NoInlining)] - private static IEnumerable GetVisibleExtensionMethodsFast(Assembly assembly) { - // Security: link demand - return MetadataServices.GetVisibleExtensionMethodInfos(assembly); - } -#endif - - // TODO: make internal - // TODO: handle type load exceptions - public static IEnumerable GetVisibleExtensionMethodsSlow(Assembly assembly) { - var ea = typeof(ExtensionAttribute); - if (assembly.IsDefined(ea)) { - foreach (TypeInfo type in ReflectionUtils.GetAllTypesFromAssembly(assembly)) { - if ((type.IsPublic || type.IsNestedPublic) && - type.IsAbstract && - type.IsSealed && - type.IsDefined(ea, false)) { - - foreach (MethodInfo method in type.AsType().GetDeclaredMethods()) { - if (method.IsPublic && method.IsStatic && method.IsDefined(ea, false)) { - yield return method; - } - } - } - } - } - } - - // Value is null if there are no extension methods in the assembly. - private static Dictionary>> _extensionMethodsCache; - - /// - /// Enumerates extension methods in given assembly. Groups the methods by declaring namespace. - /// Uses a global cache if is true. - /// - public static IEnumerable>> GetVisibleExtensionMethodGroups(Assembly/*!*/ assembly, bool useCache) { -#if !CLR2 && FEATURE_REFEMIT - useCache &= !assembly.IsDynamic; -#endif - if (useCache) { - if (_extensionMethodsCache == null) { - _extensionMethodsCache = new Dictionary>>(); - } - - lock (_extensionMethodsCache) { - Dictionary> existing; - if (_extensionMethodsCache.TryGetValue(assembly, out existing)) { - return EnumerateExtensionMethods(existing); - } - } - } - - Dictionary> result = null; - foreach (MethodInfo method in ReflectionUtils.GetVisibleExtensionMethodsSlow(assembly)) { - if (method.DeclaringType == null || method.DeclaringType.IsGenericTypeDefinition()) { - continue; - } - - var parameters = method.GetParameters(); - if (parameters.Length == 0) { - continue; - } - - Type type = parameters[0].ParameterType; - if (type.IsByRef || type.IsPointer) { - continue; - } - - string ns = method.DeclaringType.Namespace ?? String.Empty; - List extensions = null; - - if (result == null) { - result = new Dictionary>(); - } - - if (!result.TryGetValue(ns, out extensions)) { - result.Add(ns, extensions = new List()); - } - - extensions.Add(new ExtensionMethodInfo(type, method)); - } - - if (useCache) { - lock (_extensionMethodsCache) { - _extensionMethodsCache[assembly] = result; - } - } - - return EnumerateExtensionMethods(result); - } - - // TODO: GetVisibleExtensionMethods(Hashset namespaces, Type type, string methodName) : IEnumerable {} - - private static IEnumerable>> EnumerateExtensionMethods(Dictionary> dict) { - if (dict != null) { - foreach (var entry in dict) { - yield return new KeyValuePair>(entry.Key, new ReadOnlyCollection(entry.Value)); - } - } - } - - #endregion - - #region Generic Types - - internal static Dictionary BindGenericParameters(Type/*!*/ openType, Type/*!*/ closedType, bool ignoreUnboundParameters) { - var binding = new Dictionary(); - BindGenericParameters(openType, closedType, (parameter, type) => { - Type existing; - if (binding.TryGetValue(parameter, out existing)) { - return type == existing; - } - - binding[parameter] = type; - - return true; - }); - - return ConstraintsViolated(binding, ignoreUnboundParameters) ? null : binding; - } - - /// - /// Binds occurances of generic parameters in against corresponding types in . - /// Invokes (parameter, type) for each such binding. - /// Returns false if the is structurally different from or if the binder returns false. - /// - internal static bool BindGenericParameters(Type/*!*/ openType, Type/*!*/ closedType, Func/*!*/ binder) { - if (openType.IsGenericParameter) { - return binder(openType, closedType); - } - - if (openType.IsArray) { - if (!closedType.IsArray) { - return false; - } - return BindGenericParameters(openType.GetElementType(), closedType.GetElementType(), binder); - } - - if (!openType.IsGenericType() || !closedType.IsGenericType()) { - return openType == closedType; - } - - if (openType.GetGenericTypeDefinition() != closedType.GetGenericTypeDefinition()) { - return false; - } - - Type[] closedArgs = closedType.GetGenericArguments(); - Type[] openArgs = openType.GetGenericArguments(); - - for (int i = 0; i < openArgs.Length; i++) { - if (!BindGenericParameters(openArgs[i], closedArgs[i], binder)) { - return false; - } - } - - return true; - } - - internal static bool ConstraintsViolated(Dictionary/*!*/ binding, bool ignoreUnboundParameters) { - foreach (var entry in binding) { - if (ConstraintsViolated(entry.Key, entry.Value, binding, ignoreUnboundParameters)) { - return true; - } - } - - return false; - } - - internal static bool ConstraintsViolated(Type/*!*/ genericParameter, Type/*!*/ closedType, Dictionary/*!*/ binding, bool ignoreUnboundParameters) { - if ((genericParameter.GetGenericParameterAttributes() & GenericParameterAttributes.ReferenceTypeConstraint) != 0 && closedType.IsValueType()) { - // value type to parameter type constrained as class - return true; - } - - if ((genericParameter.GetGenericParameterAttributes() & GenericParameterAttributes.NotNullableValueTypeConstraint) != 0 && - (!closedType.IsValueType() || (closedType.IsGenericType() && closedType.GetGenericTypeDefinition() == typeof(Nullable<>)))) { - // nullable or class/interface to parameter type constrained as struct - return true; - } - - if ((genericParameter.GetGenericParameterAttributes() & GenericParameterAttributes.DefaultConstructorConstraint) != 0 && - (!closedType.IsValueType() && closedType.GetConstructor(ReflectionUtils.EmptyTypes) == null)) { - // reference type w/o a default constructor to type constrianed as new() - return true; - } - - Type[] constraints = genericParameter.GetGenericParameterConstraints(); - for (int i = 0; i < constraints.Length; i++) { - Type instantiation = InstantiateConstraint(constraints[i], binding); - - if (instantiation == null) { - if (ignoreUnboundParameters) { - continue; - } else { - return true; - } - } - - if (!instantiation.IsAssignableFrom(closedType)) { - return true; - } - } - - return false; - } - - internal static Type InstantiateConstraint(Type/*!*/ constraint, Dictionary/*!*/ binding) { - Debug.Assert(!constraint.IsArray && !constraint.IsByRef && !constraint.IsGenericTypeDefinition()); - if (!constraint.ContainsGenericParameters()) { - return constraint; - } - - Type closedType; - if (constraint.IsGenericParameter) { - return binding.TryGetValue(constraint, out closedType) ? closedType : null; - } - - Type[] args = constraint.GetGenericArguments(); - for (int i = 0; i < args.Length; i++) { - if ((args[i] = InstantiateConstraint(args[i], binding)) == null) { - return null; - } - } - - return constraint.GetGenericTypeDefinition().MakeGenericType(args); - } - - #endregion - } - - public struct ExtensionMethodInfo : IEquatable { - private readonly Type/*!*/ _extendedType; // cached type of the first parameter - private readonly MethodInfo/*!*/ _method; - - internal ExtensionMethodInfo(Type/*!*/ extendedType, MethodInfo/*!*/ method) { - Assert.NotNull(extendedType, method); - _extendedType = extendedType; - _method = method; - } - - public Type/*!*/ ExtendedType { - get { return _extendedType; } - } - - public MethodInfo/*!*/ Method { - get { return _method; } - } - - public override bool Equals(object obj) { - return obj is ExtensionMethodInfo && Equals((ExtensionMethodInfo)obj); - } - - public bool Equals(ExtensionMethodInfo other) { - return _method.Equals(other._method); - } - - public static bool operator ==(ExtensionMethodInfo self, ExtensionMethodInfo other) { - return self.Equals(other); - } - - public static bool operator !=(ExtensionMethodInfo self, ExtensionMethodInfo other) { - return !self.Equals(other); - } - - public override int GetHashCode() { - return _method.GetHashCode(); - } - - /// - /// Determines if a given type matches the type that the method extends. - /// The match might be non-trivial if the extended type is an open generic type with constraints. - /// - public bool IsExtensionOf(Type/*!*/ type) { - ContractUtils.RequiresNotNull(type, "type"); -#if FEATURE_TYPE_EQUIVALENCE - if (type.IsEquivalentTo(ExtendedType)) { - return true; - } -#else - if (type == _extendedType) { - return true; - } -#endif - if (!_extendedType.GetTypeInfo().ContainsGenericParameters) { - return false; - } - - // - // Ignores constraints that can't be instantiated given the information we have (type of the first parameter). - // - // For example, - // void Foo(this S x, T y) where S : T; - // - // We make such methods available on all types. - // If they are not called with arguments that satisfy the constraint the overload resolver might fail. - // - return ReflectionUtils.BindGenericParameters(_extendedType, type, true) != null; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/StringUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/StringUtils.cs deleted file mode 100644 index 934021ff69b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/StringUtils.cs +++ /dev/null @@ -1,269 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Globalization; -using System.Text; - -namespace Microsoft.Scripting.Utils { - public static class StringUtils { - - public static Encoding DefaultEncoding { - get { -#if FEATURE_ENCODING - return Encoding.Default; -#else - return Encoding.UTF8; -#endif - } - } - - public static string GetSuffix(string str, char separator, bool includeSeparator) { - ContractUtils.RequiresNotNull(str, "str"); - int last = str.LastIndexOf(separator); - return (last != -1) ? str.Substring(includeSeparator ? last : last + 1) : null; - } - - public static string GetLongestPrefix(string str, char separator, bool includeSeparator) { - ContractUtils.RequiresNotNull(str, "str"); - int last = str.LastIndexOf(separator); - return (last != -1) ? str.Substring(0, (includeSeparator || last == 0) ? last : last - 1) : null; - } - - public static int CountOf(string str, char c) { - if (System.String.IsNullOrEmpty(str)) return 0; - - int result = 0; - for (int i = 0; i < str.Length; i++) { - if (c == str[i]) { - result++; - } - } - return result; - } - - public static string[] Split(string str, string separator, int maxComponents, StringSplitOptions options) { - ContractUtils.RequiresNotNull(str, "str"); -#if SILVERLIGHT || WP75 - if (string.IsNullOrEmpty(separator)) throw new ArgumentNullException("separator"); - - bool keep_empty = (options & StringSplitOptions.RemoveEmptyEntries) != StringSplitOptions.RemoveEmptyEntries; - - List result = new List(maxComponents == Int32.MaxValue ? 1 : maxComponents + 1); - - int i = 0; - int next; - while (maxComponents > 1 && i < str.Length && (next = str.IndexOf(separator, i)) != -1) { - - if (next > i || keep_empty) { - result.Add(str.Substring(i, next - i)); - maxComponents--; - } - - i = next + separator.Length; - } - - if (i < str.Length || keep_empty) { - result.Add(str.Substring(i)); - } - - return result.ToArray(); -#else - return str.Split(new string[] { separator }, maxComponents, options); -#endif - } - - public static string[] Split(string str, char[] separators, int maxComponents, StringSplitOptions options) { - ContractUtils.RequiresNotNull(str, "str"); -#if SILVERLIGHT || WP75 - if (separators == null) return SplitOnWhiteSpace(str, maxComponents, options); - - bool keep_empty = (options & StringSplitOptions.RemoveEmptyEntries) != StringSplitOptions.RemoveEmptyEntries; - - List result = new List(maxComponents == Int32.MaxValue ? 1 : maxComponents + 1); - - int i = 0; - int next; - while (maxComponents > 1 && i < str.Length && (next = str.IndexOfAny(separators, i)) != -1) { - - if (next > i || keep_empty) { - result.Add(str.Substring(i, next - i)); - maxComponents--; - } - - i = next + 1; - } - - if (i < str.Length || keep_empty) { - result.Add(str.Substring(i)); - } - - return result.ToArray(); -#else - return str.Split(separators, maxComponents, options); -#endif - } - -#if SILVERLIGHT|| WP75 - public static string[] SplitOnWhiteSpace(string str, int maxComponents, StringSplitOptions options) { - ContractUtils.RequiresNotNull(str, "str"); - - bool keep_empty = (options & StringSplitOptions.RemoveEmptyEntries) != StringSplitOptions.RemoveEmptyEntries; - - List result = new List(maxComponents == Int32.MaxValue ? 1 : maxComponents + 1); - - int i = 0; - int next; - while (maxComponents > 1 && i < str.Length && (next = IndexOfWhiteSpace(str, i)) != -1) { - - if (next > i || keep_empty) { - result.Add(str.Substring(i, next - i)); - maxComponents--; - } - - i = next + 1; - } - - if (i < str.Length || keep_empty) { - result.Add(str.Substring(i)); - } - - return result.ToArray(); - } - - public static int IndexOfWhiteSpace(string str, int start) { - ContractUtils.RequiresNotNull(str, "str"); - if (start < 0 || start > str.Length) throw new ArgumentOutOfRangeException("start"); - - while (start < str.Length && !Char.IsWhiteSpace(str[start])) start++; - - return (start == str.Length) ? -1 : start; - } -#endif - - /// - /// Splits text and optionally indents first lines - breaks along words, not characters. - /// - public static string SplitWords(string text, bool indentFirst, int lineWidth) { - ContractUtils.RequiresNotNull(text, "text"); - - const string indent = " "; - - if (text.Length <= lineWidth || lineWidth <= 0) { - if (indentFirst) return indent + text; - return text; - } - - StringBuilder res = new StringBuilder(); - int start = 0, len = lineWidth; - while (start != text.Length) { - if (len >= lineWidth) { - // find last space to break on - while (len != 0 && !Char.IsWhiteSpace(text[start + len - 1])) - len--; - } - - if (res.Length != 0) res.Append(' '); - if (indentFirst || res.Length != 0) res.Append(indent); - - if (len == 0) { - int copying = System.Math.Min(lineWidth, text.Length - start); - res.Append(text, start, copying); - start += copying; - } else { - res.Append(text, start, len); - start += len; - } - res.AppendLine(); - len = System.Math.Min(lineWidth, text.Length - start); - } - return res.ToString(); - } - - public static string AddSlashes(string str) { - ContractUtils.RequiresNotNull(str, "str"); - - // TODO: optimize - StringBuilder result = new StringBuilder(str.Length); - for (int i = 0; i < str.Length; i++) { - switch (str[i]) { - case '\a': result.Append("\\a"); break; - case '\b': result.Append("\\b"); break; - case '\f': result.Append("\\f"); break; - case '\n': result.Append("\\n"); break; - case '\r': result.Append("\\r"); break; - case '\t': result.Append("\\t"); break; - case '\v': result.Append("\\v"); break; - default: result.Append(str[i]); break; - } - } - - return result.ToString(); - } - - public static bool TryParseDouble(string s, NumberStyles style, IFormatProvider provider, out double result) { - return Double.TryParse(s, style, provider, out result); - } - - public static bool TryParseInt32(string s, out int result) { - return Int32.TryParse(s, out result); - } - - public static bool TryParseDateTimeExact(string s, string format, IFormatProvider provider, DateTimeStyles style, out DateTime result) { - return DateTime.TryParseExact(s, format, provider, style, out result); - } - - public static bool TryParseDateTimeExact(string s, string[] formats, IFormatProvider provider, DateTimeStyles style, out DateTime result) { - return DateTime.TryParseExact(s, formats, provider, style, out result); - } - - public static bool TryParseDate(string s, IFormatProvider provider, DateTimeStyles style, out DateTime result) { - return DateTime.TryParse(s, provider, style, out result); - } - -#if !WIN8 -#if SILVERLIGHT || WP75 - private static Dictionary _cultureInfoCache = new Dictionary(); -#endif - - // Aims to be equivalent to Culture.GetCultureInfo for Silverlight - public static CultureInfo GetCultureInfo(string name) { -#if SILVERLIGHT || WP75 - lock (_cultureInfoCache) { - CultureInfo result; - if (_cultureInfoCache.TryGetValue(name, out result)) { - return result; - } - _cultureInfoCache[name] = result = new CultureInfo(name); - return result; - } -#else - return CultureInfo.GetCultureInfo(name); -#endif - } -#endif - // Like string.Split, but enumerates - public static IEnumerable Split(string str, string sep) { - int start = 0, end; - while ((end = str.IndexOf(sep, start)) != -1) { - yield return str.Substring(start, end - start); - - start = end + sep.Length; - } - yield return str.Substring(start); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/TypeUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/TypeUtils.cs deleted file mode 100644 index c20371d0f0e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Dynamic/Utils/TypeUtils.cs +++ /dev/null @@ -1,375 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Reflection; -using System.Dynamic; -using Microsoft.Scripting.Generation; -using Microsoft.Scripting.Runtime; - -namespace Microsoft.Scripting.Utils { - public static class TypeUtils { - public static bool IsNested(this Type t) { - return t.DeclaringType != null; - } - - // keep in sync with System.Core version - internal static Type GetNonNullableType(Type type) { - if (IsNullableType(type)) { - return type.GetGenericArguments()[0]; - } - return type; - } - - // keep in sync with System.Core version - internal static bool IsNullableType(Type type) { - return type.IsGenericType() && type.GetGenericTypeDefinition() == typeof(Nullable<>); - } - - // keep in sync with System.Core version - internal static bool IsBool(Type type) { - return GetNonNullableType(type) == typeof(bool); - } - - // keep in sync with System.Core version - internal static bool IsNumeric(Type type) { - type = GetNonNullableType(type); - if (!type.IsEnum()) { - return IsNumeric(type.GetTypeCode()); - } - return false; - } - - internal static bool IsNumeric(TypeCode typeCode) { - switch (typeCode) { - case TypeCode.Char: - case TypeCode.SByte: - case TypeCode.Byte: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.Double: - case TypeCode.Single: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - } - return false; - } - - // keep in sync with System.Core version - internal static bool IsArithmetic(Type type) { - type = GetNonNullableType(type); - if (!type.IsEnum()) { - switch (type.GetTypeCode()) { - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.Double: - case TypeCode.Single: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - } - } - return false; - } - - // keep in sync with System.Core version - internal static bool IsUnsignedInt(Type type) { - type = GetNonNullableType(type); - if (!type.IsEnum()) { - switch (type.GetTypeCode()) { - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - } - } - return false; - } - - // keep in sync with System.Core version - internal static bool IsIntegerOrBool(Type type) { - type = GetNonNullableType(type); - if (!type.IsEnum()) { - switch (type.GetTypeCode()) { - case TypeCode.Int64: - case TypeCode.Int32: - case TypeCode.Int16: - case TypeCode.UInt64: - case TypeCode.UInt32: - case TypeCode.UInt16: - case TypeCode.Boolean: - case TypeCode.SByte: - case TypeCode.Byte: - return true; - } - } - return false; - } - - internal static bool CanAssign(Type to, Expression from) { - if (CanAssign(to, from.Type)) return true; - - if (to.IsValueType() && - to.IsGenericType() && - to.GetGenericTypeDefinition() == typeof(Nullable<>) && - ConstantCheck.Check(from, null)) { - return true; - } - - return false; - } - - internal static bool CanAssign(Type to, Type from) { - if (to == from) { - return true; - } - // Reference types - if (!to.IsValueType() && !from.IsValueType()) { - if (to.IsAssignableFrom(from)) { - return true; - } - // Arrays can be assigned if they have same rank and assignable element types. - if (to.IsArray && from.IsArray && - to.GetArrayRank() == from.GetArrayRank() && - CanAssign(to.GetElementType(), from.GetElementType())) { - return true; - } - } - - return false; - } - - internal static bool IsGeneric(Type type) { - return type.ContainsGenericParameters() || type.IsGenericTypeDefinition(); - } - - internal static bool CanCompareToNull(Type type) { - // This is a bit too conservative. - return !type.IsValueType(); - } - - /// - /// Returns a numerical code of the size of a type. All types get both a horizontal - /// and vertical code. Types that are lower in both dimensions have implicit conversions - /// to types that are higher in both dimensions. - /// - internal static bool GetNumericConversionOrder(TypeCode code, out int x, out int y) { - // implicit conversions: - // 0 1 2 3 4 - // 0: U1 -> U2 -> U4 -> U8 - // | | | - // v v v - // 1: I1 -> I2 -> I4 -> I8 - // | | - // v v - // 2: R4 -> R8 - - switch (code) { - case TypeCode.Byte: x = 0; y = 0; break; - case TypeCode.UInt16: x = 1; y = 0; break; - case TypeCode.UInt32: x = 2; y = 0; break; - case TypeCode.UInt64: x = 3; y = 0; break; - - case TypeCode.SByte: x = 0; y = 1; break; - case TypeCode.Int16: x = 1; y = 1; break; - case TypeCode.Int32: x = 2; y = 1; break; - case TypeCode.Int64: x = 3; y = 1; break; - - case TypeCode.Single: x = 1; y = 2; break; - case TypeCode.Double: x = 2; y = 2; break; - - default: - x = y = 0; - return false; - } - return true; - } - - internal static bool IsImplicitlyConvertible(int fromX, int fromY, int toX, int toY) { - return fromX <= toX && fromY <= toY; - } - - internal static bool HasBuiltinEquality(Type left, Type right) { - // Reference type can be compared to interfaces - if (left.IsInterface() && !right.IsValueType() || - right.IsInterface() && !left.IsValueType()) { - return true; - } - - // Reference types compare if they are assignable - if (!left.IsValueType() && !right.IsValueType()) { - if (CanAssign(left, right) || CanAssign(right, left)) { - return true; - } - } - - // Nullable vs null - if (NullVsNullable(left, right) || NullVsNullable(right, left)) { - return true; - } - - if (left != right) { - return false; - } - - if (left == typeof(bool) || IsNumeric(left) || left.IsEnum()) { - return true; - } - - return false; - } - - private static bool NullVsNullable(Type left, Type right) { - return IsNullableType(left) && right == typeof(DynamicNull); - } - - // keep in sync with System.Core version - internal static bool AreEquivalent(Type t1, Type t2) { -#if FEATURE_TYPE_EQUIVALENCE - return t1 == t2 || t1.IsEquivalentTo(t2); -#else - return t1 == t2; -#endif - } - - // keep in sync with System.Core version - internal static bool AreReferenceAssignable(Type dest, Type src) { - // WARNING: This actually implements "Is this identity assignable and/or reference assignable?" - if (dest == src) { - return true; - } - if (!dest.IsValueType() && !src.IsValueType() && AreAssignable(dest, src)) { - return true; - } - return false; - } - - // keep in sync with System.Core version - internal static bool AreAssignable(Type dest, Type src) { - if (dest == src) { - return true; - } - if (dest.IsAssignableFrom(src)) { - return true; - } - if (dest.IsArray && src.IsArray && dest.GetArrayRank() == src.GetArrayRank() && AreReferenceAssignable(dest.GetElementType(), src.GetElementType())) { - return true; - } - if (src.IsArray && dest.IsGenericType() && - (dest.GetGenericTypeDefinition() == typeof(System.Collections.Generic.IEnumerable<>) - || dest.GetGenericTypeDefinition() == typeof(System.Collections.Generic.IList<>) - || dest.GetGenericTypeDefinition() == typeof(System.Collections.Generic.ICollection<>)) - && dest.GetGenericArguments()[0] == src.GetElementType()) { - return true; - } - return false; - } - - // keep in sync with System.Core version - internal static Type GetConstantType(Type type) { - // If it's a visible type, we're done - if (type.IsVisible()) { - return type; - } - - // Get the visible base type - Type bt = type; - do { - bt = bt.GetBaseType(); - } while (!bt.IsVisible()); - - // If it's one of the known reflection types, - // return the known type. - if (bt == typeof(Type) || - bt == typeof(ConstructorInfo) || - bt == typeof(EventInfo) || - bt == typeof(FieldInfo) || - bt == typeof(MethodInfo) || - bt == typeof(PropertyInfo)) { - return bt; - } - - // else return the original type - return type; - } - - internal static bool IsConvertible(Type type) { - type = GetNonNullableType(type); - if (type.IsEnum()) { - return true; - } - switch (type.GetTypeCode()) { - case TypeCode.Boolean: - case TypeCode.Byte: - case TypeCode.SByte: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Char: - return true; - default: - return false; - } - } - - internal static bool IsFloatingPoint(Type type) { - type = GetNonNullableType(type); - switch (type.GetTypeCode()) { - case TypeCode.Single: - case TypeCode.Double: - return true; - default: - return false; - } - } - -#if FEATURE_COM - public static readonly Type ComObjectType = typeof(object).Assembly.GetType("System.__ComObject"); - - public static bool IsComObjectType(Type/*!*/ type) { - return ComObjectType.IsAssignableFrom(type); - } - - // we can't use System.Runtime.InteropServices.Marshal.IsComObject(obj) since it doesn't work in partial trust - public static bool IsComObject(object obj) { - return obj != null && IsComObjectType(obj.GetType()); - } -#else - public static bool IsComObjectType(Type/*!*/ type) { - return false; - } - - public static bool IsComObject(object obj) { - return false; - } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/BinaryOperationBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/BinaryOperationBinder.cs deleted file mode 100644 index 9260938dfa1..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/BinaryOperationBinder.cs +++ /dev/null @@ -1,148 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif - -using System.Dynamic.Utils; - -namespace System.Dynamic { - /// - /// Represents the binary dynamic operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class BinaryOperationBinder : DynamicMetaObjectBinder { - private ExpressionType _operation; - - /// - /// Initializes a new instance of the class. - /// - /// The binary operation kind. - protected BinaryOperationBinder(ExpressionType operation) { - ContractUtils.Requires(OperationIsValid(operation), "operation"); - _operation = operation; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(object); } - } - - /// - /// The binary operation kind. - /// - public ExpressionType Operation { - get { - return _operation; - } - } - - /// - /// Performs the binding of the binary dynamic operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic binary operation. - /// The right hand side operand of the dynamic binary operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackBinaryOperation(DynamicMetaObject target, DynamicMetaObject arg) { - return FallbackBinaryOperation(target, arg, null); - } - - /// - /// When overridden in the derived class, performs the binding of the binary dynamic operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic binary operation. - /// The right hand side operand of the dynamic binary operation. - /// The binding result in case the binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackBinaryOperation(DynamicMetaObject target, DynamicMetaObject arg, DynamicMetaObject errorSuggestion); - - /// - /// Performs the binding of the dynamic binary operation. - /// - /// The target of the dynamic operation. - /// An array of arguments of the dynamic operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.RequiresNotNull(args, "args"); - ContractUtils.Requires(args.Length == 1, "args"); - - var arg0 = args[0]; - ContractUtils.RequiresNotNull(arg0, "args"); - - return target.BindBinaryOperation(this, arg0); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - internal static bool OperationIsValid(ExpressionType operation) { - switch (operation) { - #region Generated Binary Operation Binder Validator - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_binop_validator from: generate_tree.py - - case ExpressionType.Add: - case ExpressionType.And: - case ExpressionType.Divide: - case ExpressionType.Equal: - case ExpressionType.ExclusiveOr: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - case ExpressionType.LeftShift: - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - case ExpressionType.Modulo: - case ExpressionType.Multiply: - case ExpressionType.NotEqual: - case ExpressionType.Or: - case ExpressionType.Power: - case ExpressionType.RightShift: - case ExpressionType.Subtract: - case ExpressionType.AddAssign: - case ExpressionType.AndAssign: - case ExpressionType.DivideAssign: - case ExpressionType.ExclusiveOrAssign: - case ExpressionType.LeftShiftAssign: - case ExpressionType.ModuloAssign: - case ExpressionType.MultiplyAssign: - case ExpressionType.OrAssign: - case ExpressionType.PowerAssign: - case ExpressionType.RightShiftAssign: - case ExpressionType.SubtractAssign: - - // *** END GENERATED CODE *** - - #endregion - - case ExpressionType.Extension: - return true; - - default: - return false; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/BindingRestrictions.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/BindingRestrictions.cs deleted file mode 100644 index bf395abba53..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/BindingRestrictions.cs +++ /dev/null @@ -1,366 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -namespace System.Dynamic { - - /// - /// Represents a set of binding restrictions on the under which the dynamic binding is valid. - /// - [DebuggerTypeProxy(typeof(BindingRestrictionsProxy)), DebuggerDisplay("{DebugView}")] - public abstract class BindingRestrictions { - /// - /// Represents an empty set of binding restrictions. This field is read only. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public static readonly BindingRestrictions Empty = new CustomRestriction(Expression.Constant(true)); - - private const int TypeRestrictionHash = 0x10000000; - private const int InstanceRestrictionHash = 0x20000000; - private const int CustomRestrictionHash = 0x40000000; - - private BindingRestrictions() { - } - - // Overridden by specialized subclasses - internal abstract Expression GetExpression(); - - /// - /// Merges the set of binding restrictions with the current binding restrictions. - /// - /// The set of restrictions with which to merge the current binding restrictions. - /// The new set of binding restrictions. - public BindingRestrictions Merge(BindingRestrictions restrictions) { - ContractUtils.RequiresNotNull(restrictions, "restrictions"); - if (this == Empty) { - return restrictions; - } - if (restrictions == Empty) { - return this; - } - return new MergedRestriction(this, restrictions); - } - - /// - /// Creates the binding restriction that check the expression for runtime type identity. - /// - /// The expression to test. - /// The exact type to test. - /// The new binding restrictions. - public static BindingRestrictions GetTypeRestriction(Expression expression, Type type) { - ContractUtils.RequiresNotNull(expression, "expression"); - ContractUtils.RequiresNotNull(type, "type"); - - return new TypeRestriction(expression, type); - } - - /// - /// The method takes a DynamicMetaObject, and returns an instance restriction for testing null if the object - /// holds a null value, otherwise returns a type restriction. - /// - internal static BindingRestrictions GetTypeRestriction(DynamicMetaObject obj) { - if (obj.Value == null && obj.HasValue) { - return BindingRestrictions.GetInstanceRestriction(obj.Expression, null); - } else { - return BindingRestrictions.GetTypeRestriction(obj.Expression, obj.LimitType); - } - } - - /// - /// Creates the binding restriction that checks the expression for object instance identity. - /// - /// The expression to test. - /// The exact object instance to test. - /// The new binding restrictions. - public static BindingRestrictions GetInstanceRestriction(Expression expression, object instance) { - ContractUtils.RequiresNotNull(expression, "expression"); - - return new InstanceRestriction(expression, instance); - } - - /// - /// Creates the binding restriction that checks the expression for arbitrary immutable properties. - /// - /// The expression expression the restrictions. - /// The new binding restrictions. - /// - /// By convention, the general restrictions created by this method must only test - /// immutable object properties. - /// - public static BindingRestrictions GetExpressionRestriction(Expression expression) { - ContractUtils.RequiresNotNull(expression, "expression"); - ContractUtils.Requires(expression.Type == typeof(bool), "expression"); - return new CustomRestriction(expression); - } - - /// - /// Combines binding restrictions from the list of instances into one set of restrictions. - /// - /// The list of instances from which to combine restrictions. - /// The new set of binding restrictions. - public static BindingRestrictions Combine(IList contributingObjects) { - BindingRestrictions res = BindingRestrictions.Empty; - if (contributingObjects != null) { - foreach (DynamicMetaObject mo in contributingObjects) { - if (mo != null) { - res = res.Merge(mo.Restrictions); - } - } - } - return res; - } - - /// - /// Builds a balanced tree of AndAlso nodes. - /// We do this so the compiler won't stack overflow if we have many - /// restrictions. - /// - private sealed class TestBuilder { - private readonly Set _unique = new Set(); - private readonly Stack _tests = new Stack(); - - private struct AndNode { - internal int Depth; - internal Expression Node; - } - - internal void Append(BindingRestrictions restrictions) { - if (_unique.Contains(restrictions)) { - return; - } - _unique.Add(restrictions); - - Push(restrictions.GetExpression(), 0); - } - - internal Expression ToExpression() { - Expression result = _tests.Pop().Node; - while (_tests.Count > 0) { - result = Expression.AndAlso(_tests.Pop().Node, result); - } - return result; - } - - private void Push(Expression node, int depth) { - while (_tests.Count > 0 && _tests.Peek().Depth == depth) { - node = Expression.AndAlso(_tests.Pop().Node, node); - depth++; - } - _tests.Push(new AndNode { Node = node, Depth = depth }); - } - } - - /// - /// Creates the representing the binding restrictions. - /// - /// The expression tree representing the restrictions. - public Expression ToExpression() { - // We could optimize this better, e.g. common subexpression elimination - // But for now, it's good enough. - - if (this == Empty) { - return Expression.Constant(true); - } - - var testBuilder = new TestBuilder(); - - // Visit the tree, left to right. - // Use an explicit stack so we don't stack overflow. - // - // Left-most node is on top of the stack, so we always expand the - // left most node each iteration. - var stack = new Stack(); - stack.Push(this); - do { - var top = stack.Pop(); - var m = top as MergedRestriction; - if (m != null) { - stack.Push(m.Right); - stack.Push(m.Left); - } else { - testBuilder.Append(top); - } - } while (stack.Count > 0); - - return testBuilder.ToExpression(); - } - - private sealed class MergedRestriction : BindingRestrictions { - internal readonly BindingRestrictions Left; - internal readonly BindingRestrictions Right; - - internal MergedRestriction(BindingRestrictions left, BindingRestrictions right) { - Left = left; - Right = right; - } - internal override Expression GetExpression() { - throw ContractUtils.Unreachable; - } - } - - private sealed class CustomRestriction : BindingRestrictions { - private readonly Expression _expression; - - internal CustomRestriction(Expression expression) { - _expression = expression; - } - - public override bool Equals(object obj) { - var other = obj as CustomRestriction; - return other != null && other._expression == _expression; - } - - public override int GetHashCode() { - return CustomRestrictionHash ^ _expression.GetHashCode(); - } - - internal override Expression GetExpression() { - return _expression; - } - } - - private sealed class TypeRestriction : BindingRestrictions { - private readonly Expression _expression; - private readonly Type _type; - - internal TypeRestriction(Expression parameter, Type type) { - _expression = parameter; - _type = type; - } - - public override bool Equals(object obj) { - var other = obj as TypeRestriction; - return other != null && TypeUtils.AreEquivalent(other._type, _type) && other._expression == _expression; - } - - public override int GetHashCode() { - return TypeRestrictionHash ^ _expression.GetHashCode() ^ _type.GetHashCode(); - } - - internal override Expression GetExpression() { - return Expression.TypeEqual(_expression, _type); - } - } - - private sealed class InstanceRestriction : BindingRestrictions { - private readonly Expression _expression; - private readonly object _instance; - - internal InstanceRestriction(Expression parameter, object instance) { - _expression = parameter; - _instance = instance; - } - - public override bool Equals(object obj) { - var other = obj as InstanceRestriction; - return other != null && other._instance == _instance && other._expression == _expression; - } - - public override int GetHashCode() { - return InstanceRestrictionHash ^ ReferenceEqualityComparer.Instance.GetHashCode(_instance) ^ _expression.GetHashCode(); - } - - internal override Expression GetExpression() { - if (_instance == null) { - return Expression.Equal( - Expression.Convert(_expression, typeof(object)), - Expression.Constant(null) - ); - } - - ParameterExpression temp = Expression.Parameter(typeof(object), null); - return Expression.Block( - new[] { temp }, - Expression.Assign( - temp, - Expression.Property( - Expression.Constant(new WeakReference(_instance)), - typeof(WeakReference).GetProperty("Target") - ) - ), - Expression.AndAlso( - //check that WeekReference was not collected. - Expression.NotEqual(temp, Expression.Constant(null)), - Expression.Equal( - Expression.Convert(_expression, typeof(object)), - temp - ) - ) - ); - } - } - - private string DebugView { - get { return ToExpression().ToString(); } - } - - private sealed class BindingRestrictionsProxy { - private readonly BindingRestrictions _node; - - public BindingRestrictionsProxy(BindingRestrictions node) { - _node = node; - } - - public bool IsEmpty { - get { return _node == Empty; } - } - - public Expression Test { - get { return _node.ToExpression(); } - } - - public BindingRestrictions[] Restrictions { - get { - var restrictions = new List(); - - // Visit the tree, left to right - // - // Left-most node is on top of the stack, so we always expand the - // left most node each iteration. - var stack = new Stack(); - stack.Push(_node); - do { - var top = stack.Pop(); - var m = top as MergedRestriction; - if (m != null) { - stack.Push(m.Right); - stack.Push(m.Left); - } else { - restrictions.Add(top); - } - } while (stack.Count > 0); - - return restrictions.ToArray(); - } - } - - public override string ToString() { - // To prevent fxcop warning about this field - return _node.DebugView; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallInfo.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallInfo.cs deleted file mode 100644 index 27289d49252..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallInfo.cs +++ /dev/null @@ -1,109 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Dynamic.Utils; - -namespace System.Dynamic { - - /// - /// Describes arguments in the dynamic binding process. - /// - /// - /// ArgumentCount - all inclusive number of arguments. - /// ArgumentNames - names for those arguments that are named. - /// - /// Argument names match to the argument values in left to right order - /// and last name corresponds to the last argument. - /// - /// Example: - /// Foo(arg1, arg2, arg3, name1 = arg4, name2 = arg5, name3 = arg6) - /// - /// will correspond to: - /// ArgumentCount: 6 - /// ArgumentNames: {"name1", "name2", "name3"} - /// - public sealed class CallInfo { - private readonly int _argCount; - private readonly ReadOnlyCollection _argNames; - - /// - /// Creates a new PositionalArgumentInfo. - /// - /// The number of arguments. - /// The argument names. - /// The new CallInfo - public CallInfo(int argCount, params string[] argNames) - : this(argCount, (IEnumerable)argNames) { - } - - /// - /// Creates a new CallInfo that represents arguments in the dynamic binding process. - /// - /// The number of arguments. - /// The argument names. - /// The new CallInfo - public CallInfo(int argCount, IEnumerable argNames) { - ContractUtils.RequiresNotNull(argNames, "argNames"); - - var argNameCol = argNames.ToReadOnly(); - - if (argCount < argNameCol.Count) throw Error.ArgCntMustBeGreaterThanNameCnt(); - ContractUtils.RequiresNotNullItems(argNameCol, "argNames"); - - _argCount = argCount; - _argNames = argNameCol; - } - - /// - /// The number of arguments. - /// - public int ArgumentCount { - get { return _argCount; } - } - - /// - /// The argument names. - /// - public ReadOnlyCollection ArgumentNames { - get { return _argNames; } - } - - /// - /// Serves as a hash function for the current CallInfo. - /// - /// A hash code for the current CallInfo. - public override int GetHashCode() { - return _argCount ^ _argNames.ListHashCode(); - } - - /// - /// Determines whether the specified CallInfo instance is considered equal to the current. - /// - /// The instance of CallInfo to compare with the current instance. - /// true if the specified instance is equal to the current one otherwise, false. - public override bool Equals(object obj) { - var other = obj as CallInfo; - return _argCount == other._argCount && _argNames.ListEquals(other._argNames); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSite.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSite.cs deleted file mode 100644 index 5ec58814184..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSite.cs +++ /dev/null @@ -1,734 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Ast.Compiler; -using Microsoft.Scripting.Utils; -#else -using System.Linq.Expressions; -using System.Linq.Expressions.Compiler; -#endif - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic; -using System.Dynamic.Utils; -using System.Reflection; - -namespace System.Runtime.CompilerServices { - - // - // A CallSite provides a fast mechanism for call-site caching of dynamic dispatch - // behvaior. Each site will hold onto a delegate that provides a fast-path dispatch - // based on previous types that have been seen at the call-site. This delegate will - // call UpdateAndExecute if it is called with types that it hasn't seen before. - // Updating the binding will typically create (or lookup) a new delegate - // that supports fast-paths for both the new type and for any types that - // have been seen previously. - // - // DynamicSites will generate the fast-paths specialized for sets of runtime argument - // types. However, they will generate exactly the right amount of code for the types - // that are seen in the program so that int addition will remain as fast as it would - // be with custom implementation of the addition, and the user-defined types can be - // as fast as ints because they will all have the same optimal dynamically generated - // fast-paths. - // - // DynamicSites don't encode any particular caching policy, but use their - // CallSiteBinding to encode a caching policy. - // - - - /// - /// A Dynamic Call Site base class. This type is used as a parameter type to the - /// dynamic site targets. The first parameter of the delegate (T) below must be - /// of this type. - /// - public class CallSite { - - // Cache of CallSite constructors for a given delegate type - private static CacheDict> _SiteCtors; - - /// - /// The Binder responsible for binding operations at this call site. - /// This binder is invoked by the UpdateAndExecute below if all Level 0, - /// Level 1 and Level 2 caches experience cache miss. - /// - internal readonly CallSiteBinder _binder; - - // only CallSite derives from this - internal CallSite(CallSiteBinder binder) { - _binder = binder; - } - - /// - /// used by Matchmaker sites to indicate rule match. - /// - internal bool _match; - - /// - /// Class responsible for binding dynamic operations on the dynamic site. - /// - public CallSiteBinder Binder { - get { return _binder; } - } - - /// - /// Creates a CallSite with the given delegate type and binder. - /// - /// The CallSite delegate type. - /// The CallSite binder. - /// The new CallSite. - public static CallSite Create(Type delegateType, CallSiteBinder binder) { - ContractUtils.RequiresNotNull(delegateType, "delegateType"); - ContractUtils.RequiresNotNull(binder, "binder"); - if (!delegateType.IsSubclassOf(typeof(MulticastDelegate))) throw Error.TypeMustBeDerivedFromSystemDelegate(); - - if (_SiteCtors == null) { - // It's okay to just set this, worst case we're just throwing away some data - _SiteCtors = new CacheDict>(100); - } - Func ctor; - - MethodInfo method = null; - var ctors = _SiteCtors; - lock (ctors) { - if (!ctors.TryGetValue(delegateType, out ctor)) { - method = typeof(CallSite<>).MakeGenericType(delegateType).GetMethod("Create"); - - if (TypeUtils.CanCache(delegateType)) { - ctor = (Func)Delegate.CreateDelegate(typeof(Func), method); - ctors.Add(delegateType, ctor); - } - } - } - if (ctor != null) { - return ctor(binder); - } - - // slow path - return (CallSite)method.Invoke(null, new object[] { binder }); - } - } - - /// - /// Dynamic site type. - /// - /// The delegate type. - public partial class CallSite : CallSite where T : class { - /// - /// The update delegate. Called when the dynamic site experiences cache miss. - /// - /// The update delegate. - public T Update { - get { - // if this site is set up for match making, then use NoMatch as an Update - if (_match) { - Debug.Assert(_CachedNoMatch != null, "all normal sites should have Update cached once there is an instance."); - return _CachedNoMatch; - } else { - Debug.Assert(_CachedUpdate != null, "all normal sites should have Update cached once there is an instance."); - return _CachedUpdate; - } - } - } - - /// - /// The Level 0 cache - a delegate specialized based on the site history. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] - public T Target; - - - /// - /// The Level 1 cache - a history of the dynamic site. - /// - internal T[] Rules; - - - // Cached update delegate for all sites with a given T - private static T _CachedUpdate; - - // Cached noMatch delegate for all sites with a given T - private static T _CachedNoMatch; - - private CallSite(CallSiteBinder binder) - : base(binder) { - Target = GetUpdateDelegate(); - } - - private CallSite() - : base(null) { - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] - internal CallSite CreateMatchMaker() { - return new CallSite(); - } - - /// - /// Creates an instance of the dynamic call site, initialized with the binder responsible for the - /// runtime binding of the dynamic operations at this call site. - /// - /// The binder responsible for the runtime binding of the dynamic operations at this call site. - /// The new instance of dynamic call site. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1000:DoNotDeclareStaticMembersOnGenericTypes")] - public static CallSite Create(CallSiteBinder binder) { - if (!typeof(T).IsSubclassOf(typeof(MulticastDelegate))) throw Error.TypeMustBeDerivedFromSystemDelegate(); - return new CallSite(binder); - } - - private T GetUpdateDelegate() { - // This is intentionally non-static to speed up creation - in particular MakeUpdateDelegate - // as static generic methods are more expensive than instance methods. We call a ref helper - // so we only access the generic static field once. - return GetUpdateDelegate(ref _CachedUpdate); - } - - private T GetUpdateDelegate(ref T addr) { - if (addr == null) { - // reduce creation cost by not using Interlocked.CompareExchange. Calling I.CE causes - // us to spend 25% of our creation time in JIT_GenericHandle. Instead we'll rarely - // create 2 delegates with no other harm caused. - addr = MakeUpdateDelegate(); - } - return addr; - } - - /// - /// Clears the rule cache ... used by the call site tests. - /// - private void ClearRuleCache() { - // make sure it initialized/atomized etc... - Binder.GetRuleCache(); - - var cache = Binder.Cache; - - if (cache != null) { - lock (cache) { - cache.Clear(); - } - } - } - - const int MaxRules = 10; - internal void AddRule(T newRule) { - T[] rules = Rules; - if (rules == null) { - Rules = new[] { newRule }; - return; - } - - T[] temp; - if (rules.Length < (MaxRules - 1)) { - temp = new T[rules.Length + 1]; - Array.Copy(rules, 0, temp, 1, rules.Length); - } else { - temp = new T[MaxRules]; - Array.Copy(rules, 0, temp, 1, MaxRules - 1); - } - temp[0] = newRule; - Rules = temp; - } - - // moves rule +2 up. - internal void MoveRule(int i) { - var rules = Rules; - var rule = rules[i]; - - rules[i] = rules[i - 1]; - rules[i - 1] = rules[i - 2]; - rules[i - 2] = rule; - } - - internal T MakeUpdateDelegate() { - Type target = typeof(T); - Type[] args; - MethodInfo invoke = target.GetMethod("Invoke"); - - - if (target.IsGenericType && IsSimpleSignature(invoke, out args)) { - MethodInfo method = null; - MethodInfo noMatchMethod = null; - - if (invoke.ReturnType == typeof(void)) { - if (target == DelegateHelpers.GetActionType(args.AddFirst(typeof(CallSite)))) { - method = typeof(UpdateDelegates).GetMethod("UpdateAndExecuteVoid" + args.Length, BindingFlags.NonPublic | BindingFlags.Static); - noMatchMethod = typeof(UpdateDelegates).GetMethod("NoMatchVoid" + args.Length, BindingFlags.NonPublic | BindingFlags.Static); - } - } else { - if (target == DelegateHelpers.GetFuncType(args.AddFirst(typeof(CallSite)))) { - method = typeof(UpdateDelegates).GetMethod("UpdateAndExecute" + (args.Length - 1), BindingFlags.NonPublic | BindingFlags.Static); - noMatchMethod = typeof(UpdateDelegates).GetMethod("NoMatch" + (args.Length - 1), BindingFlags.NonPublic | BindingFlags.Static); - } - } - if (method != null) { - _CachedNoMatch = (T)(object)CreateDelegateHelper(target, noMatchMethod.MakeGenericMethod(args)); - return (T)(object)CreateDelegateHelper(target, method.MakeGenericMethod(args)); - } - } - - _CachedNoMatch = CreateCustomNoMatchDelegate(invoke); - return CreateCustomUpdateDelegate(invoke); - } - - // NEEDS SECURITY REVIEW: - // - // This needs to be SafeCritical on Silverlight to allow access to - // internal types from user code as generic parameters. - // - // It's safe for a few reasons: - // 1. The internal types are coming from a lower trust level (app code) - // 2. We got the internal types from our own generic parameter: T - // 3. The UpdateAndExecute methods don't do anything with the types, - // we just want the CallSite args to be strongly typed to avoid - // casting. - // 4. Works on desktop CLR with AppDomain that has only Execute - // permission. In theory it might require RestrictedMemberAccess, - // but it's unclear because we have tests passing without RMA. - // - // When Silverlight gets RMA we may be able to remove this. -#if SILVERLIGHT - [System.Security.SecuritySafeCritical] -#endif - private static Delegate CreateDelegateHelper(Type delegateType, MethodInfo method) { - return Delegate.CreateDelegate(delegateType, method); - } - - private static bool IsSimpleSignature(MethodInfo invoke, out Type[] sig) { - ParameterInfo[] pis = invoke.GetParametersCached(); - ContractUtils.Requires(pis.Length > 0 && pis[0].ParameterType == typeof(CallSite), "T"); - - Type[] args = new Type[invoke.ReturnType != typeof(void) ? pis.Length : pis.Length - 1]; - bool supported = true; - - for (int i = 1; i < pis.Length; i++) { - ParameterInfo pi = pis[i]; - if (pi.IsByRefParameter()) { - supported = false; - } - args[i - 1] = pi.ParameterType; - } - if (invoke.ReturnType != typeof(void)) { - args[args.Length - 1] = invoke.ReturnType; - } - sig = args; - return supported; - } - - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] - private T CreateCustomNoMatchDelegate(MethodInfo invoke) { - var @params = invoke.GetParametersCached().Map(p => Expression.Parameter(p.ParameterType, p.Name)); - return Expression.Lambda( - Expression.Block( - Expression.Call( - typeof(CallSiteOps).GetMethod("SetNotMatched"), - @params.First() - ), - Expression.Default(invoke.GetReturnType()) - ), - @params - ).Compile(); - } - - // - // WARNING: If you're changing this method, make sure you update the - // pregenerated versions as well, which are generated by - // generate_dynsites.py - // The two implementations *must* be kept functionally equivalent! - // - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] - private T CreateCustomUpdateDelegate(MethodInfo invoke) { - var body = new List(); - var vars = new List(); - var @params = invoke.GetParametersCached().Map(p => Expression.Parameter(p.ParameterType, p.Name)); - var @return = Expression.Label(invoke.GetReturnType()); - var typeArgs = new[] { typeof(T) }; - - var site = @params[0]; - var arguments = @params.RemoveFirst(); - - //var @this = (CallSite)site; - var @this = Expression.Variable(typeof(CallSite), "this"); - vars.Add(@this); - body.Add(Expression.Assign(@this, Expression.Convert(site, @this.Type))); - - //T[] applicable; - var applicable = Expression.Variable(typeof(T[]), "applicable"); - vars.Add(applicable); - - //T rule, originalRule = @this.Target; - var rule = Expression.Variable(typeof(T), "rule"); - vars.Add(rule); - - var originalRule = Expression.Variable(typeof(T), "originalRule"); - vars.Add(originalRule); - body.Add(Expression.Assign(originalRule, Expression.Field(@this, "Target"))); - - //TRet result; - ParameterExpression result = null; - if (@return.Type != typeof(void)) { - vars.Add(result = Expression.Variable(@return.Type, "result")); - } - - //int count, index; - var count = Expression.Variable(typeof(int), "count"); - vars.Add(count); - var index = Expression.Variable(typeof(int), "index"); - vars.Add(index); - - //// - //// Create matchmaker site. We'll need it regardless. - //// - //site = CallSiteOps.CreateMatchmaker(); - body.Add( - Expression.Assign( - site, - Expression.Call( - typeof(CallSiteOps), - "CreateMatchmaker", - typeArgs, - @this - ) - ) - ); - - //// - //// Level 1 cache lookup - //// - //if ((applicable = CallSiteOps.GetRules(@this)) != null) { - // for (index = 0, count = applicable.Length; index < count; index++) { - // @this.Target = rule = applicable[i]; - - // // - // // Execute the rule - // // - // - // // if we've already tried it skip it... - // if ((object)rule != (object)originalRule) { - // %(setResult)s rule(site, %(args)s); - // if (CallSiteOps.GetMatch(site)) { - // CallSiteOps.UpdateRules(@this, i); - // %(returnResult)s; - // } - // - // // Rule didn't match, try the next one - // CallSiteOps.ClearMatch(site); - // } - // } - //} - Expression invokeRule; - - Expression getMatch = Expression.Call( - typeof(CallSiteOps).GetMethod("GetMatch"), - site - ); - - Expression resetMatch = Expression.Call( - typeof(CallSiteOps).GetMethod("ClearMatch"), - site - ); - - var onMatch = Expression.Call( - typeof(CallSiteOps), - "UpdateRules", - typeArgs, - @this, - index - ); - - if (@return.Type == typeof(void)) { - invokeRule = Expression.Block( - Expression.Invoke(rule, new TrueReadOnlyCollection(@params)), - Expression.IfThen( - getMatch, - Expression.Block(onMatch, Expression.Return(@return)) - ) - ); - } else { - invokeRule = Expression.Block( - Expression.Assign(result, Expression.Invoke(rule, new TrueReadOnlyCollection(@params))), - Expression.IfThen( - getMatch, - Expression.Block(onMatch, Expression.Return(@return, result)) - ) - ); - } - - Expression getRule = Expression.Assign(rule, Expression.ArrayAccess(applicable, index)); - - var @break = Expression.Label(); - - var breakIfDone = Expression.IfThen( - Expression.Equal(index, count), - Expression.Break(@break) - ); - - var incrementIndex = Expression.PreIncrementAssign(index); - - body.Add( - Expression.IfThen( - Expression.NotEqual( - Expression.Assign(applicable, Expression.Call(typeof(CallSiteOps), "GetRules", typeArgs, @this)), - Expression.Constant(null, applicable.Type) - ), - Expression.Block( - Expression.Assign(count, Expression.ArrayLength(applicable)), - Expression.Assign(index, Expression.Constant(0)), - Expression.Loop( - Expression.Block( - breakIfDone, - getRule, - Expression.IfThen( - Expression.NotEqual( - Expression.Convert(rule, typeof(object)), - Expression.Convert(originalRule, typeof(object)) - ), - Expression.Block( - Expression.Assign( - Expression.Field(@this, "Target"), - rule - ), - invokeRule, - resetMatch - ) - ), - incrementIndex - ), - @break, - null - ) - ) - ) - ); - - //// - //// Level 2 cache lookup - //// - // - //// - //// Any applicable rules in level 2 cache? - //// - // - // var cache = CallSiteOps.GetRuleCache(@this); - - var cache = Expression.Variable(typeof(RuleCache), "cache"); - vars.Add(cache); - - body.Add( - Expression.Assign( - cache, - Expression.Call(typeof(CallSiteOps), "GetRuleCache", typeArgs, @this) - ) - ); - - // applicable = cache.GetRules(); - - body.Add( - Expression.Assign( - applicable, - Expression.Call(typeof(CallSiteOps), "GetCachedRules", typeArgs, cache) - ) - ); - - // for (int i = 0, count = applicable.Length; i < count; i++) { - // @this.Target = rule = applicable[i]; - // - // // - // // Execute the rule - // // - // - // try { - // result = rule(site, arg0); - // if (match) { - // return result; - // } - // } finally { - // if (CallSiteOps.GetMatch(site)) { - // // - // // Rule worked. Add it to level 1 cache - // // - // - // CallSiteOps.AddRule(@this, rule); - // // and then move it to the front of the L2 cache - // CallSiteOps.MoveRule(cache, rule, index); - // } - // } - // - // // Rule didn't match, try the next one - // CallSiteOps.ClearMatch(site); - // } - // - - - // L2 invokeRule is different (no onMatch) - if (@return.Type == typeof(void)) { - invokeRule = Expression.Block( - Expression.Invoke(rule, new TrueReadOnlyCollection(@params)), - Expression.IfThen( - getMatch, - Expression.Return(@return) - ) - ); - } else { - invokeRule = Expression.Block( - Expression.Assign(result, Expression.Invoke(rule, new TrueReadOnlyCollection(@params))), - Expression.IfThen( - getMatch, - Expression.Return(@return, result) - ) - ); - } - - var tryRule = Expression.TryFinally( - invokeRule, - Expression.IfThen( - getMatch, - Expression.Block( - Expression.Call(typeof(CallSiteOps), "AddRule", typeArgs, @this, rule), - Expression.Call(typeof(CallSiteOps), "MoveRule", typeArgs, cache, rule, index) - ) - ) - ); - - getRule = Expression.Assign( - Expression.Field(@this, "Target"), - Expression.Assign(rule, Expression.ArrayAccess(applicable, index)) - ); - - body.Add(Expression.Assign(index, Expression.Constant(0))); - body.Add(Expression.Assign(count, Expression.ArrayLength(applicable))); - body.Add( - Expression.Loop( - Expression.Block( - breakIfDone, - getRule, - tryRule, - resetMatch, - incrementIndex - ), - @break, - null - ) - ); - - //// - //// Miss on Level 0, 1 and 2 caches. Create new rule - //// - - //rule = null; - body.Add(Expression.Assign(rule, Expression.Constant(null, rule.Type))); - - //var args = new object[] { arg0, arg1, ... }; - var args = Expression.Variable(typeof(object[]), "args"); - vars.Add(args); - body.Add( - Expression.Assign( - args, - Expression.NewArrayInit(typeof(object), arguments.Map(p => Convert(p, typeof(object)))) - ) - ); - - //for (; ; ) { - // @this.Target = originalRule; - // rule = @this.Target = @this.Binder.BindDelegate(@this, args); - - // // - // // Execute the rule on the matchmaker site - // // - - // try { - // %(setResult)s ruleTarget(site, %(args)s); - // if (match) { - // %(returnResult)s; - // } - // } finally { - // if (match) { - // // - // // The rule worked. Add it to level 1 cache. - // // - // CallSiteOps.AddRule(@this, rule); - // } - // } - - // // Rule we got back didn't work, try another one - // match = true; - //} - - Expression setOldTarget = Expression.Assign( - Expression.Field(@this, "Target"), - originalRule - ); - - getRule = Expression.Assign( - Expression.Field(@this, "Target"), - Expression.Assign( - rule, - Expression.Call( - typeof(CallSiteOps), - "Bind", - typeArgs, - Expression.Property(@this, "Binder"), - @this, - args - ) - ) - ); - - tryRule = Expression.TryFinally( - invokeRule, - Expression.IfThen( - getMatch, - Expression.Call(typeof(CallSiteOps), "AddRule", typeArgs, @this, rule) - ) - ); - - body.Add( - Expression.Loop( - Expression.Block(setOldTarget, getRule, tryRule, resetMatch), - null, null - ) - ); - - body.Add(Expression.Default(@return.Type)); - - var lambda = Expression.Lambda( - Expression.Label( - @return, - Expression.Block( - new ReadOnlyCollection(vars), - new ReadOnlyCollection(body) - ) - ), - "CallSite.Target", - true, // always compile the rules with tail call optimization - new ReadOnlyCollection(@params) - ); - - // Need to compile with forceDynamic because T could be invisible, - // or one of the argument types could be invisible - return lambda.Compile(); - } - - private static Expression Convert(Expression arg, Type type) { - if (TypeUtils.AreReferenceAssignable(type, arg.Type)) { - return arg; - } - return Expression.Convert(arg, type); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteBinder.cs deleted file mode 100644 index ccf1134dfa8..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteBinder.cs +++ /dev/null @@ -1,232 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic; -using System.Dynamic.Utils; -using System.Threading; -using System.Reflection; - -namespace System.Runtime.CompilerServices { - /// - /// Class responsible for runtime binding of the dynamic operations on the dynamic call site. - /// - public abstract class CallSiteBinder { - private static readonly LabelTarget _updateLabel = Expression.Label("CallSiteBinder.UpdateLabel"); - - /// - /// The Level 2 cache - all rules produced for the same binder. - /// - internal Dictionary Cache; - - /// - /// Initializes a new instance of the class. - /// - protected CallSiteBinder() { - } - - /// - /// Gets a label that can be used to cause the binding to be updated. It - /// indicates that the expression's binding is no longer valid. - /// This is typically used when the "version" of a dynamic object has - /// changed. - /// - public static LabelTarget UpdateLabel { - get { return _updateLabel; } - } - - private sealed class LambdaSignature where T : class { - internal static readonly LambdaSignature Instance = new LambdaSignature(); - - internal readonly ReadOnlyCollection Parameters; - internal readonly LabelTarget ReturnLabel; - - private LambdaSignature() { - Type target = typeof(T); - if (!target.IsSubclassOf(typeof(MulticastDelegate))) { - throw Error.TypeParameterIsNotDelegate(target); - } - - MethodInfo invoke = target.GetMethod("Invoke"); - ParameterInfo[] pis = invoke.GetParametersCached(); - if (pis[0].ParameterType != typeof(CallSite)) { - throw Error.FirstArgumentMustBeCallSite(); - } - - var @params = new ParameterExpression[pis.Length - 1]; - for (int i = 0; i < @params.Length; i++) { - @params[i] = Expression.Parameter(pis[i + 1].ParameterType, "$arg" + i); - } - - Parameters = new TrueReadOnlyCollection(@params); - ReturnLabel = Expression.Label(invoke.GetReturnType()); - } - } - - /// - /// Performs the runtime binding of the dynamic operation on a set of arguments. - /// - /// An array of arguments to the dynamic operation. - /// The array of instances that represent the parameters of the call site in the binding process. - /// A LabelTarget used to return the result of the dynamic binding. - /// - /// An Expression that performs tests on the dynamic operation arguments, and - /// performs the dynamic operation if hte tests are valid. If the tests fail on - /// subsequent occurrences of the dynamic operation, Bind will be called again - /// to produce a new for the new argument types. - /// - public abstract Expression Bind(object[] args, ReadOnlyCollection parameters, LabelTarget returnLabel); - - /// - /// Provides low-level runtime binding support. Classes can override this and provide a direct - /// delegate for the implementation of rule. This can enable saving rules to disk, having - /// specialized rules available at runtime, or providing a different caching policy. - /// - /// The target type of the CallSite. - /// The CallSite the bind is being performed for. - /// The arguments for the binder. - /// A new delegate which replaces the CallSite Target. - public virtual T BindDelegate(CallSite site, object[] args) where T : class { - return null; - } - - - internal T BindCore(CallSite site, object[] args) where T : class { - // - // Try to find a precompiled delegate, and return it if found. - // - T result = BindDelegate(site, args); - if (result != null) { - return result; - } - - // - // Get the Expression for the binding - // - var signature = LambdaSignature.Instance; - Expression binding = Bind(args, signature.Parameters, signature.ReturnLabel); - - // - // Check the produced rule - // - if (binding == null) { - throw Error.NoOrInvalidRuleProduced(); - } - - // - // finally produce the new rule if we need to - // -#if !CLR2 && !SILVERLIGHT && !ANDROID && !WP75 - // We cannot compile rules in the heterogeneous app domains since they - // may come from less trusted sources - // Silverlight always uses a homogenous appdomain, so we don’t need this check - if (!AppDomain.CurrentDomain.IsHomogenous) { - throw Error.HomogenousAppDomainRequired(); - } -#endif - Expression e = Stitch(binding, signature); - T newRule = e.Compile(); - - CacheTarget(newRule); - - return newRule; - } - - /// - /// Adds a target to the cache of known targets. The cached targets will - /// be scanned before calling BindDelegate to produce the new rule. - /// - /// The type of target being added. - /// The target delegate to be added to the cache. - protected void CacheTarget(T target) where T : class { - GetRuleCache().AddRule(target); - } - - private static Expression Stitch(Expression binding, LambdaSignature signature) where T : class { - Type siteType = typeof(CallSite); - - var body = new ReadOnlyCollectionBuilder(3); - body.Add(binding); - - var site = Expression.Parameter(typeof(CallSite), "$site"); - var @params = signature.Parameters.AddFirst(site); - - Expression updLabel = Expression.Label(CallSiteBinder.UpdateLabel); - -#if DEBUG - // put the AST into the constant pool for debugging purposes - updLabel = Expression.Block( - Expression.Constant(binding, typeof(Expression)), - updLabel - ); -#endif - - body.Add(updLabel); - body.Add( - Expression.Label( - signature.ReturnLabel, - Expression.Condition( - Expression.Call( - typeof(CallSiteOps).GetMethod("SetNotMatched"), - @params.First() - ), - Expression.Default(signature.ReturnLabel.Type), - Expression.Invoke( - Expression.Property( - Expression.Convert(site, siteType), - typeof(CallSite).GetProperty("Update") - ), - new TrueReadOnlyCollection(@params) - ) - ) - ) - ); - - return new Expression( - Expression.Block(body), - "CallSite.Target", - true, // always compile the rules with tail call optimization - new TrueReadOnlyCollection(@params) - ); - } - - internal RuleCache GetRuleCache() where T : class { - // make sure we have cache. - if (Cache == null) { - Interlocked.CompareExchange(ref Cache, new Dictionary(), null); - } - - object ruleCache; - var cache = Cache; - lock (cache) { - if (!cache.TryGetValue(typeof(T), out ruleCache)) { - cache[typeof(T)] = ruleCache = new RuleCache(); - } - } - - RuleCache result = ruleCache as RuleCache; - Debug.Assert(result != null); - return result; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteHelpers.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteHelpers.cs deleted file mode 100644 index 2bb42801830..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteHelpers.cs +++ /dev/null @@ -1,52 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Reflection; -namespace System.Runtime.CompilerServices { - /// - /// Class that contains helper methods for DLR CallSites. - /// - public static class CallSiteHelpers { - private static Type _knownNonDynamicMethodType = typeof(object).GetMethod("ToString").GetType(); - - /// - /// Checks if a is internally used by DLR and should not - /// be displayed on the language code's stack. - /// - /// The input - /// - /// True if the input is internally used by DLR and should not - /// be displayed on the language code's stack. Otherwise, false. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")] - public static bool IsInternalFrame(MethodBase mb) { - //All the dynamic methods created for DLR rules have a special name. - //We also check if the method has a different type than the known - //non-static method. If it does, it is a dynamic method. - //This could be improved if the CLR provides a way to attach some information - //to the dynamic method we create, like CustomAttributes. - if (mb.Name == "CallSite.Target" && mb.GetType() != _knownNonDynamicMethodType) { - return true; - } - - //Filter out the helper methods. - if (mb.DeclaringType == typeof(System.Dynamic.UpdateDelegates)) { - return true; - } - - return false; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteOps.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteOps.cs deleted file mode 100644 index 7b66829d342..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CallSiteOps.cs +++ /dev/null @@ -1,161 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.ComponentModel; -using System.Diagnostics; -using System.Dynamic; -using System.Collections.Generic; - -namespace System.Runtime.CompilerServices { - - // Conceptually these are instance methods on CallSite but - // we don't want users to see them - - /// - /// This API supports the .NET Framework infrastructure and is not intended to be used directly from your code. - /// - [EditorBrowsable(EditorBrowsableState.Never), DebuggerStepThrough] - public static class CallSiteOps { - - /// - /// Creates an instance of a dynamic call site used for cache lookup. - /// - /// The type of the delegate of the . - /// The new call site. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static CallSite CreateMatchmaker(CallSite site) where T : class { - var mm = site.CreateMatchMaker(); - CallSiteOps.ClearMatch(mm); - return mm; - } - - /// - /// Checks if a dynamic site requires an update. - /// - /// An instance of the dynamic call site. - /// true if rule does not need updating, false otherwise. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static bool SetNotMatched(CallSite site) { - var res = site._match; - site._match = false; //avoid branch here to make sure the method is inlined - return res; - } - - /// - /// Checks whether the executed rule matched - /// - /// An instance of the dynamic call site. - /// true if rule matched, false otherwise. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static bool GetMatch(CallSite site) { - return site._match; - } - - /// - /// Clears the match flag on the matchmaker call site. - /// - /// An instance of the dynamic call site. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static void ClearMatch(CallSite site) { - site._match = true; - } - - /// - /// Adds a rule to the cache maintained on the dynamic call site. - /// - /// The type of the delegate of the . - /// An instance of the dynamic call site. - /// An instance of the call site rule. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static void AddRule(CallSite site, T rule) where T : class { - site.AddRule(rule); - } - - /// - /// Updates rules in the cache. - /// - /// The type of the delegate of the . - /// An instance of the dynamic call site. - /// The matched rule index. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static void UpdateRules(CallSite @this, int matched) where T : class { - if (matched > 1) { - @this.MoveRule(matched); - } - } - - /// - /// Gets the dynamic binding rules from the call site. - /// - /// The type of the delegate of the . - /// An instance of the dynamic call site. - /// An array of dynamic binding rules. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static T[] GetRules(CallSite site) where T : class { - return site.Rules; - } - - - /// - /// Retrieves binding rule cache. - /// - /// The type of the delegate of the . - /// An instance of the dynamic call site. - /// The cache. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static RuleCache GetRuleCache(CallSite site) where T : class { - return site.Binder.GetRuleCache(); - } - - - /// - /// Moves the binding rule within the cache. - /// - /// The type of the delegate of the . - /// The call site rule cache. - /// An instance of the call site rule. - /// An index of the call site rule. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static void MoveRule(RuleCache cache, T rule, int i) where T : class { - if (i > 1) { - cache.MoveRule(rule, i); - } - } - - /// - /// Searches the dynamic rule cache for rules applicable to the dynamic operation. - /// - /// The type of the delegate of the . - /// The cache. - /// The collection of applicable rules. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static T[] GetCachedRules(RuleCache cache) where T : class { - return cache.GetRules(); - } - - /// - /// Updates the call site target with a new rule based on the arguments. - /// - /// The type of the delegate of the . - /// The call site binder. - /// An instance of the dynamic call site. - /// Arguments to the call site. - /// The new call site target. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static T Bind(CallSiteBinder binder, CallSite site, object[] args) where T : class { - return binder.BindCore(site, args); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/ConvertBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/ConvertBinder.cs deleted file mode 100644 index af6b2782502..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/ConvertBinder.cs +++ /dev/null @@ -1,101 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - /// - /// Represents the convert dynamic operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class ConvertBinder : DynamicMetaObjectBinder { - private readonly Type _type; - private readonly bool _explicit; - - /// - /// Initializes a new intsance of the . - /// - /// The type to convert to. - /// true if the conversion should consider explicit conversions; otherwise, false. - protected ConvertBinder(Type type, bool @explicit) { - ContractUtils.RequiresNotNull(type, "type"); - - _type = type; - _explicit = @explicit; - } - - /// - /// The type to convert to. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] - public Type Type { - get { - return _type; - } - } - - /// - /// Gets the value indicating if the conversion should consider explicit conversions. - /// - public bool Explicit { - get { - return _explicit; - } - } - - /// - /// Performs the binding of the dynamic convert operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic convert operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackConvert(DynamicMetaObject target) { - return FallbackConvert(target, null); - } - - /// - /// When overridden in the derived class, performs the binding of the dynamic convert operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic convert operation. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackConvert(DynamicMetaObject target, DynamicMetaObject errorSuggestion); - - /// - /// Performs the binding of the dynamic convert operation. - /// - /// The target of the dynamic convert operation. - /// An array of arguments of the dynamic convert operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.Requires(args == null || args.Length == 0, "args"); - - return target.BindConvert(this); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return _type; } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CreateInstanceBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CreateInstanceBinder.cs deleted file mode 100644 index 9edf1b7db0e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/CreateInstanceBinder.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - /// - /// Represents the create dynamic operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class CreateInstanceBinder : DynamicMetaObjectBinder { - private readonly CallInfo _callInfo; - - /// - /// Initializes a new intsance of the . - /// - /// The signature of the arguments at the call site. - protected CreateInstanceBinder(CallInfo callInfo) { - ContractUtils.RequiresNotNull(callInfo, "callInfo"); - _callInfo = callInfo; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(object); } - } - - /// - /// Gets the signature of the arguments at the call site. - /// - public CallInfo CallInfo { - get { return _callInfo; } - } - - /// - /// Performs the binding of the dynamic create operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic create operation. - /// The arguments of the dynamic create operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackCreateInstance(DynamicMetaObject target, DynamicMetaObject[] args) { - return FallbackCreateInstance(target, args, null); - } - - /// - /// When overridden in the derived class, performs the binding of the dynamic create operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic create operation. - /// The arguments of the dynamic create operation. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackCreateInstance(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion); - - /// - /// Performs the binding of the dynamic create operation. - /// - /// The target of the dynamic create operation. - /// An array of arguments of the dynamic create operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.RequiresNotNullItems(args, "args"); - - return target.BindCreateInstance(this, args); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteIndexBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteIndexBinder.cs deleted file mode 100644 index 1cf5abf7498..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteIndexBinder.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - /// - /// Represents the dynamic delete index operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class DeleteIndexBinder : DynamicMetaObjectBinder { - private readonly CallInfo _callInfo; - - /// - /// Initializes a new instance of the . - /// - /// The signature of the arguments at the call site. - protected DeleteIndexBinder(CallInfo callInfo) { - ContractUtils.RequiresNotNull(callInfo, "callInfo"); - _callInfo = callInfo; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(void); } - } - - /// - /// Gets the signature of the arguments at the call site. - /// - public CallInfo CallInfo { - get { return _callInfo; } - } - - /// - /// Performs the binding of the dynamic delete index operation. - /// - /// The target of the dynamic delete index operation. - /// An array of arguments of the dynamic delete index operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.RequiresNotNullItems(args, "args"); - - return target.BindDeleteIndex(this, args); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - - /// - /// Performs the binding of the dynamic delete index operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic delete index operation. - /// The arguments of the dynamic delete index operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackDeleteIndex(DynamicMetaObject target, DynamicMetaObject[] indexes) { - return FallbackDeleteIndex(target, indexes, null); - } - - /// - /// When overridden in the derived class, performs the binding of the dynamic delete index operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic delete index operation. - /// The arguments of the dynamic delete index operation. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackDeleteIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject errorSuggestion); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteMemberBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteMemberBinder.cs deleted file mode 100644 index d01bfcdf00b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DeleteMemberBinder.cs +++ /dev/null @@ -1,102 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - - /// - /// Represents the dynamic delete member operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class DeleteMemberBinder : DynamicMetaObjectBinder { - private readonly string _name; - private readonly bool _ignoreCase; - - /// - /// Initializes a new instance of the . - /// - /// The name of the member to delete. - /// true if the name should be matched ignoring case; false otherwise. - protected DeleteMemberBinder(string name, bool ignoreCase) { - ContractUtils.RequiresNotNull(name, "name"); - - _name = name; - _ignoreCase = ignoreCase; - } - - /// - /// Gets the name of the member to delete. - /// - public string Name { - get { - return _name; - } - } - - /// - /// Gets the value indicating if the string comparison should ignore the case of the member name. - /// - public bool IgnoreCase { - get { - return _ignoreCase; - } - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(void); } - } - - /// - /// Performs the binding of the dynamic delete member operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic delete member operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackDeleteMember(DynamicMetaObject target) { - return FallbackDeleteMember(target, null); - } - - /// - /// When overridden in the derived class, performs the binding of the dynamic delete member operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic delete member operation. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackDeleteMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion); - - /// - /// Performs the binding of the dynamic delete member operation. - /// - /// The target of the dynamic delete member operation. - /// An array of arguments of the dynamic delete member operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.Requires(args == null || args.Length == 0); - - return target.BindDeleteMember(this); - } - - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObject.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObject.cs deleted file mode 100644 index 5db80654ba1..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObject.cs +++ /dev/null @@ -1,332 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif - -#if FEATURE_REMOTING -using System.Runtime.Remoting; -#endif - -using System.Collections.Generic; -using System.Dynamic.Utils; -using System.Reflection; - -namespace System.Dynamic { - /// - /// Represents the dynamic binding and a binding logic of an object participating in the dynamic binding. - /// - public class DynamicMetaObject { - private readonly Expression _expression; - private readonly BindingRestrictions _restrictions; - private readonly object _value; - private readonly bool _hasValue; - - /// - /// Represents an empty array of type . This field is read only. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")] - public static readonly DynamicMetaObject[] EmptyMetaObjects = new DynamicMetaObject[0]; - - /// - /// Initializes a new instance of the class. - /// - /// The expression representing this during the dynamic binding process. - /// The set of binding restrictions under which the binding is valid. - public DynamicMetaObject(Expression expression, BindingRestrictions restrictions) { - ContractUtils.RequiresNotNull(expression, "expression"); - ContractUtils.RequiresNotNull(restrictions, "restrictions"); - - _expression = expression; - _restrictions = restrictions; - } - - /// - /// Initializes a new instance of the class. - /// - /// The expression representing this during the dynamic binding process. - /// The set of binding restrictions under which the binding is valid. - /// The runtime value represented by the . - public DynamicMetaObject(Expression expression, BindingRestrictions restrictions, object value) - : this(expression, restrictions) { - _value = value; - _hasValue = true; - } - - /// - /// The expression representing the during the dynamic binding process. - /// - public Expression Expression { - get { - return _expression; - } - } - - /// - /// The set of binding restrictions under which the binding is valid. - /// - public BindingRestrictions Restrictions { - get { - return _restrictions; - } - } - - /// - /// The runtime value represented by this . - /// - public object Value { - get { - return _value; - } - } - - /// - /// Gets a value indicating whether the has the runtime value. - /// - public bool HasValue { - get { - return _hasValue; - } - } - - - /// - /// Gets the of the runtime value or null if the has no value associated with it. - /// - public Type RuntimeType { - get { - if (_hasValue) { - Type ct = Expression.Type; - // valuetype at compile tyme, type cannot change. - if (ct.IsValueType) { - return ct; - } - if (_value != null) { - return _value.GetType(); - } else { - return null; - } - } else { - return null; - } - } - } - - /// - /// Gets the limit type of the . - /// - /// Represents the most specific type known about the object represented by the . if runtime value is available, a type of the otherwise. - public Type LimitType { - get { - return RuntimeType ?? Expression.Type; - } - } - - /// - /// Performs the binding of the dynamic conversion operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindConvert(ConvertBinder binder) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackConvert(this); - } - - /// - /// Performs the binding of the dynamic get member operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindGetMember(GetMemberBinder binder) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackGetMember(this); - } - - /// - /// Performs the binding of the dynamic set member operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// The representing the value for the set member operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackSetMember(this, value); - } - - /// - /// Performs the binding of the dynamic delete member operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindDeleteMember(DeleteMemberBinder binder) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackDeleteMember(this); - } - - /// - /// Performs the binding of the dynamic get index operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// An array of instances - indexes for the get index operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackGetIndex(this, indexes); - } - - /// - /// Performs the binding of the dynamic set index operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// An array of instances - indexes for the set index operation. - /// The representing the value for the set index operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackSetIndex(this, indexes, value); - } - - /// - /// Performs the binding of the dynamic delete index operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// An array of instances - indexes for the delete index operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindDeleteIndex(DeleteIndexBinder binder, DynamicMetaObject[] indexes) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackDeleteIndex(this, indexes); - } - - /// - /// Performs the binding of the dynamic invoke member operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// An array of instances - arguments to the invoke member operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackInvokeMember(this, args); - } - - /// - /// Performs the binding of the dynamic invoke operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// An array of instances - arguments to the invoke operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindInvoke(InvokeBinder binder, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackInvoke(this, args); - } - - /// - /// Performs the binding of the dynamic create instance operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// An array of instances - arguments to the create instance operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindCreateInstance(CreateInstanceBinder binder, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackCreateInstance(this, args); - } - - /// - /// Performs the binding of the dynamic unary operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackUnaryOperation(this); - } - - /// - /// Performs the binding of the dynamic binary operation. - /// - /// An instance of the that represents the details of the dynamic operation. - /// An instance of the representing the right hand side of the binary operation. - /// The new representing the result of the binding. - public virtual DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { - ContractUtils.RequiresNotNull(binder, "binder"); - return binder.FallbackBinaryOperation(this, arg); - } - - /// - /// Returns the enumeration of all dynamic member names. - /// - /// The list of dynamic member names. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] - public virtual IEnumerable GetDynamicMemberNames() { - return new string[0]; - } - - /// - /// Returns the list of expressions represented by the instances. - /// - /// An array of instances to extract expressions from. - /// The array of expressions. - internal static Expression[] GetExpressions(DynamicMetaObject[] objects) { - ContractUtils.RequiresNotNull(objects, "objects"); - - Expression[] res = new Expression[objects.Length]; - for (int i = 0; i < objects.Length; i++) { - DynamicMetaObject mo = objects[i]; - ContractUtils.RequiresNotNull(mo, "objects"); - Expression expr = mo.Expression; - ContractUtils.RequiresNotNull(expr, "objects"); - res[i] = expr; - } - - return res; - } - - /// - /// Creates a meta-object for the specified object. - /// - /// The object to get a meta-object for. - /// The expression representing this during the dynamic binding process. - /// - /// If the given object implements and is not a remote object from outside the current AppDomain, - /// returns the object's specific meta-object returned by . Otherwise a plain new meta-object - /// with no restrictions is created and returned. - /// - public static DynamicMetaObject Create(object value, Expression expression) { - ContractUtils.RequiresNotNull(expression, "expression"); - - IDynamicMetaObjectProvider ido = value as IDynamicMetaObjectProvider; -#if FEATURE_REMOTING - if (ido != null && !RemotingServices.IsObjectOutOfAppDomain(value)) { -#else - if (ido != null) { -#endif - var idoMetaObject = ido.GetMetaObject(expression); - - if (idoMetaObject == null || - !idoMetaObject.HasValue || - idoMetaObject.Value == null || - (object)idoMetaObject.Expression != (object)expression) { - throw Error.InvalidMetaObjectCreated(ido.GetType()); - } - - return idoMetaObject; - } else { - return new DynamicMetaObject(expression, BindingRestrictions.Empty, value); - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObjectBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObjectBinder.cs deleted file mode 100644 index 899c45338d3..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicMetaObjectBinder.cs +++ /dev/null @@ -1,287 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Ast.Compiler; -#else -using System.Linq.Expressions; -using System.Linq.Expressions.Compiler; -#endif - -#if FEATURE_REMOTING -using System.Runtime.Remoting; -#endif - -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -namespace System.Dynamic { - /// - /// The dynamic call site binder that participates in the binding protocol. - /// - /// - /// The performs the binding of the dynamic operation using the runtime values - /// as input. On the other hand, the participates in the - /// binding protocol. - /// - public abstract class DynamicMetaObjectBinder : CallSiteBinder { - - #region Public APIs - - /// - /// Initializes a new instance of the class. - /// - protected DynamicMetaObjectBinder() { - } - - /// - /// The result type of the operation. - /// - public virtual Type ReturnType { - get { return typeof(object); } - } - - /// - /// Performs the runtime binding of the dynamic operation on a set of arguments. - /// - /// An array of arguments to the dynamic operation. - /// The array of instances that represent the parameters of the call site in the binding process. - /// A LabelTarget used to return the result of the dynamic binding. - /// - /// An Expression that performs tests on the dynamic operation arguments, and - /// performs the dynamic operation if the tests are valid. If the tests fail on - /// subsequent occurrences of the dynamic operation, Bind will be called again - /// to produce a new for the new argument types. - /// - public sealed override Expression Bind(object[] args, ReadOnlyCollection parameters, LabelTarget returnLabel) { - ContractUtils.RequiresNotNull(args, "args"); - ContractUtils.RequiresNotNull(parameters, "parameters"); - ContractUtils.RequiresNotNull(returnLabel, "returnLabel"); - if (args.Length == 0) { - throw Error.OutOfRange("args.Length", 1); - } - if (parameters.Count == 0) { - throw Error.OutOfRange("parameters.Count", 1); - } - if (args.Length != parameters.Count) { - throw new ArgumentOutOfRangeException("args"); - } - - // Ensure that the binder's ReturnType matches CallSite's return - // type. We do this so meta objects and language binders can - // compose trees together without needing to insert converts. - Type expectedResult; - if (IsStandardBinder) { - expectedResult = ReturnType; - - if (returnLabel.Type != typeof(void) && - !TypeUtils.AreReferenceAssignable(returnLabel.Type, expectedResult)) { - throw Error.BinderNotCompatibleWithCallSite(expectedResult, this, returnLabel.Type); - } - } else { - // Even for non-standard binders, we have to at least make sure - // it works with the CallSite's type to build the return. - expectedResult = returnLabel.Type; - } - - DynamicMetaObject target = DynamicMetaObject.Create(args[0], parameters[0]); - DynamicMetaObject[] metaArgs = CreateArgumentMetaObjects(args, parameters); - - DynamicMetaObject binding = Bind(target, metaArgs); - - if (binding == null) { - throw Error.BindingCannotBeNull(); - } - - Expression body = binding.Expression; - BindingRestrictions restrictions = binding.Restrictions; - - // Ensure the result matches the expected result type. - if (expectedResult != typeof(void) && - !TypeUtils.AreReferenceAssignable(expectedResult, body.Type)) { - - // - // Blame the last person that handled the result: assume it's - // the dynamic object (if any), otherwise blame the language. - // - if (target.Value is IDynamicMetaObjectProvider) { - throw Error.DynamicObjectResultNotAssignable(body.Type, target.Value.GetType(), this, expectedResult); - } else { - throw Error.DynamicBinderResultNotAssignable(body.Type, this, expectedResult); - } - } - - // if the target is IDO, standard binders ask it to bind the rule so we may have a target-specific binding. - // it makes sense to restrict on the target's type in such cases. - // ideally IDO metaobjects should do this, but they often miss that type of "this" is significant. - if (IsStandardBinder && args[0] as IDynamicMetaObjectProvider != null) { - if (restrictions == BindingRestrictions.Empty) { - throw Error.DynamicBindingNeedsRestrictions(target.Value.GetType(), this); - } - } - - restrictions = AddRemoteObjectRestrictions(restrictions, args, parameters); - - // Add the return - if (body.NodeType != ExpressionType.Goto) { - body = Expression.Return(returnLabel, body); - } - - // Finally, add restrictions - if (restrictions != BindingRestrictions.Empty) { - body = Expression.IfThen(restrictions.ToExpression(), body); - } - - return body; - } - - private static DynamicMetaObject[] CreateArgumentMetaObjects(object[] args, ReadOnlyCollection parameters) { - DynamicMetaObject[] mos; - if (args.Length != 1) { - mos = new DynamicMetaObject[args.Length - 1]; - for (int i = 1; i < args.Length; i++) { - mos[i - 1] = DynamicMetaObject.Create(args[i], parameters[i]); - } - } else { - mos = DynamicMetaObject.EmptyMetaObjects; - } - return mos; - } - - private static BindingRestrictions AddRemoteObjectRestrictions(BindingRestrictions restrictions, object[] args, ReadOnlyCollection parameters) { -#if FEATURE_REMOTING - for (int i = 0; i < parameters.Count; i++) { - var expr = parameters[i]; - var value = args[i] as MarshalByRefObject; - - // special case for MBR objects. - // when MBR objects are remoted they can have different conversion behavior - // so bindings created for local and remote objects should not be mixed. - if (value != null && !IsComObject(value)) { - BindingRestrictions remotedRestriction; - if (RemotingServices.IsObjectOutOfAppDomain(value)) { - remotedRestriction = BindingRestrictions.GetExpressionRestriction( - Expression.AndAlso( - Expression.NotEqual(expr, Expression.Constant(null)), - Expression.Call( - typeof(RemotingServices).GetMethod("IsObjectOutOfAppDomain"), - expr - ) - ) - ); - } else { - remotedRestriction = BindingRestrictions.GetExpressionRestriction( - Expression.AndAlso( - Expression.NotEqual(expr, Expression.Constant(null)), - Expression.Not( - Expression.Call( - typeof(RemotingServices).GetMethod("IsObjectOutOfAppDomain"), - expr - ) - ) - ) - ); - } - restrictions = restrictions.Merge(remotedRestriction); - } - } -#endif - return restrictions; - } - - /// - /// When overridden in the derived class, performs the binding of the dynamic operation. - /// - /// The target of the dynamic operation. - /// An array of arguments of the dynamic operation. - /// The representing the result of the binding. - public abstract DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args); - - /// - /// Gets an expression that will cause the binding to be updated. It - /// indicates that the expression's binding is no longer valid. - /// This is typically used when the "version" of a dynamic object has - /// changed. - /// - /// The Type property of the resulting expression; any type is allowed. - /// The update expression. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] - public Expression GetUpdateExpression(Type type) { - return Expression.Goto(CallSiteBinder.UpdateLabel, type); - } - - /// - /// Defers the binding of the operation until later time when the runtime values of all dynamic operation arguments have been computed. - /// - /// The target of the dynamic operation. - /// An array of arguments of the dynamic operation. - /// The representing the result of the binding. - public DynamicMetaObject Defer(DynamicMetaObject target, params DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - - if (args == null) { - return MakeDeferred(target.Restrictions, target); - } else { - return MakeDeferred( - target.Restrictions.Merge(BindingRestrictions.Combine(args)), - args.AddFirst(target) - ); - } - } - - /// - /// Defers the binding of the operation until later time when the runtime values of all dynamic operation arguments have been computed. - /// - /// An array of arguments of the dynamic operation. - /// The representing the result of the binding. - public DynamicMetaObject Defer(params DynamicMetaObject[] args) { - return MakeDeferred(BindingRestrictions.Combine(args), args); - } - - private DynamicMetaObject MakeDeferred(BindingRestrictions rs, params DynamicMetaObject[] args) { - var exprs = DynamicMetaObject.GetExpressions(args); - - Type delegateType = DelegateHelpers.MakeDeferredSiteDelegate(args, ReturnType); - - // Because we know the arguments match the delegate type (we just created the argument types) - // we go directly to DynamicExpression.Make to avoid a bunch of unnecessary argument validation - return new DynamicMetaObject( - DynamicExpression.Make(ReturnType, delegateType, this, new TrueReadOnlyCollection(exprs)), - rs - ); - } - - #endregion - - // used to detect standard MetaObjectBinders. - internal virtual bool IsStandardBinder { - get { - return false; - } - } - -#if FEATURE_COM - private static readonly Type ComObjectType = typeof(object).Assembly.GetType("System.__ComObject"); - private static bool IsComObject(object obj) { - // we can't use System.Runtime.InteropServices.Marshal.IsComObject(obj) since it doesn't work in partial trust - return obj != null && ComObjectType.IsAssignableFrom(obj.GetType()); - } -#endif - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs deleted file mode 100644 index 7da7303d755..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/DynamicObject.cs +++ /dev/null @@ -1,803 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif - -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Runtime.CompilerServices; - -namespace System.Dynamic { - /// - /// Provides a simple class that can be inherited from to create an object with dynamic behavior - /// at runtime. Subclasses can override the various binder methods (GetMember, SetMember, Call, etc...) - /// to provide custom behavior that will be invoked at runtime. - /// - /// If a method is not overridden then the DynamicObject does not directly support that behavior and - /// the call site will determine how the binding should be performed. - /// - [Serializable] - public class DynamicObject : IDynamicMetaObjectProvider { - - /// - /// Enables derived types to create a new instance of DynamicObject. DynamicObject instances cannot be - /// directly instantiated because they have no implementation of dynamic behavior. - /// - protected DynamicObject() { - } - - #region Public Virtual APIs - - /// - /// Provides the implementation of getting a member. Derived classes can override - /// this method to customize behavior. When not overridden the call site requesting the - /// binder determines the behavior. - /// - /// The binder provided by the call site. - /// The result of the get operation. - /// true if the operation is complete, false if the call site should determine behavior. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] - public virtual bool TryGetMember(GetMemberBinder binder, out object result) { - result = null; - return false; - } - - /// - /// Provides the implementation of setting a member. Derived classes can override - /// this method to customize behavior. When not overridden the call site requesting the - /// binder determines the behavior. - /// - /// The binder provided by the call site. - /// The value to set. - /// true if the operation is complete, false if the call site should determine behavior. - public virtual bool TrySetMember(SetMemberBinder binder, object value) { - return false; - } - - /// - /// Provides the implementation of deleting a member. Derived classes can override - /// this method to customize behavior. When not overridden the call site requesting the - /// binder determines the behavior. - /// - /// The binder provided by the call site. - /// true if the operation is complete, false if the call site should determine behavior. - public virtual bool TryDeleteMember(DeleteMemberBinder binder) { - return false; - } - - /// - /// Provides the implementation of calling a member. Derived classes can override - /// this method to customize behavior. When not overridden the call site requesting the - /// binder determines the behavior. - /// - /// The binder provided by the call site. - /// The arguments to be used for the invocation. - /// The result of the invocation. - /// true if the operation is complete, false if the call site should determine behavior. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] - public virtual bool TryInvokeMember(InvokeMemberBinder binder, object[] args, out object result) { - result = null; - return false; - } - - /// - /// Provides the implementation of converting the DynamicObject to another type. Derived classes - /// can override this method to customize behavior. When not overridden the call site - /// requesting the binder determines the behavior. - /// - /// The binder provided by the call site. - /// The result of the conversion. - /// true if the operation is complete, false if the call site should determine behavior. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] - public virtual bool TryConvert(ConvertBinder binder, out object result) { - result = null; - return false; - } - - /// - /// Provides the implementation of creating an instance of the DynamicObject. Derived classes - /// can override this method to customize behavior. When not overridden the call site requesting - /// the binder determines the behavior. - /// - /// The binder provided by the call site. - /// The arguments used for creation. - /// The created instance. - /// true if the operation is complete, false if the call site should determine behavior. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] - public virtual bool TryCreateInstance(CreateInstanceBinder binder, object[] args, out object result) { - result = null; - return false; - } - - /// - /// Provides the implementation of invoking the DynamicObject. Derived classes can - /// override this method to customize behavior. When not overridden the call site requesting - /// the binder determines the behavior. - /// - /// The binder provided by the call site. - /// The arguments to be used for the invocation. - /// The result of the invocation. - /// true if the operation is complete, false if the call site should determine behavior. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] - public virtual bool TryInvoke(InvokeBinder binder, object[] args, out object result) { - result = null; - return false; - } - - /// - /// Provides the implementation of performing a binary operation. Derived classes can - /// override this method to customize behavior. When not overridden the call site requesting - /// the binder determines the behavior. - /// - /// The binder provided by the call site. - /// The right operand for the operation. - /// The result of the operation. - /// true if the operation is complete, false if the call site should determine behavior. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] - public virtual bool TryBinaryOperation(BinaryOperationBinder binder, object arg, out object result) { - result = null; - return false; - } - - /// - /// Provides the implementation of performing a unary operation. Derived classes can - /// override this method to customize behavior. When not overridden the call site requesting - /// the binder determines the behavior. - /// - /// The binder provided by the call site. - /// The result of the operation. - /// true if the operation is complete, false if the call site should determine behavior. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] - public virtual bool TryUnaryOperation(UnaryOperationBinder binder, out object result) { - result = null; - return false; - } - - /// - /// Provides the implementation of performing a get index operation. Derived classes can - /// override this method to customize behavior. When not overridden the call site requesting - /// the binder determines the behavior. - /// - /// The binder provided by the call site. - /// The indexes to be used. - /// The result of the operation. - /// true if the operation is complete, false if the call site should determine behavior. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] - public virtual bool TryGetIndex(GetIndexBinder binder, object[] indexes, out object result) { - result = null; - return false; - } - - /// - /// Provides the implementation of performing a set index operation. Derived classes can - /// override this method to custmize behavior. When not overridden the call site requesting - /// the binder determines the behavior. - /// - /// The binder provided by the call site. - /// The indexes to be used. - /// The value to set. - /// true if the operation is complete, false if the call site should determine behavior. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1007:UseGenericsWhereAppropriate")] - public virtual bool TrySetIndex(SetIndexBinder binder, object[] indexes, object value) { - return false; - } - - /// - /// Provides the implementation of performing a delete index operation. Derived classes - /// can override this method to custmize behavior. When not overridden the call site - /// requesting the binder determines the behavior. - /// - /// The binder provided by the call site. - /// The indexes to be deleted. - /// true if the operation is complete, false if the call site should determine behavior. - public virtual bool TryDeleteIndex(DeleteIndexBinder binder, object[] indexes) { - return false; - } - - /// - /// Returns the enumeration of all dynamic member names. - /// - /// The list of dynamic member names. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] - public virtual System.Collections.Generic.IEnumerable GetDynamicMemberNames() { - return new string[0]; - } - #endregion - - #region MetaDynamic - - private sealed class MetaDynamic : DynamicMetaObject { - - internal MetaDynamic(Expression expression, DynamicObject value) - : base(expression, BindingRestrictions.Empty, value) { - } - - public override System.Collections.Generic.IEnumerable GetDynamicMemberNames() - { - return Value.GetDynamicMemberNames(); - } - - public override DynamicMetaObject BindGetMember(GetMemberBinder binder) { - if (IsOverridden("TryGetMember")) { - return CallMethodWithResult("TryGetMember", binder, NoArgs, (e) => binder.FallbackGetMember(this, e)); - } - - return base.BindGetMember(binder); - } - - public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value) { - if (IsOverridden("TrySetMember")) { - return CallMethodReturnLast("TrySetMember", binder, NoArgs, value.Expression, (e) => binder.FallbackSetMember(this, value, e)); - } - - return base.BindSetMember(binder, value); - } - - public override DynamicMetaObject BindDeleteMember(DeleteMemberBinder binder) { - if (IsOverridden("TryDeleteMember")) { - return CallMethodNoResult("TryDeleteMember", binder, NoArgs, (e) => binder.FallbackDeleteMember(this, e)); - } - - return base.BindDeleteMember(binder); - } - - public override DynamicMetaObject BindConvert(ConvertBinder binder) { - if (IsOverridden("TryConvert")) { - return CallMethodWithResult("TryConvert", binder, NoArgs, (e) => binder.FallbackConvert(this, e)); - } - - return base.BindConvert(binder); - } - - public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { - // Generate a tree like: - // - // { - // object result; - // TryInvokeMember(payload, out result) - // ? result - // : TryGetMember(payload, out result) - // ? FallbackInvoke(result) - // : fallbackResult - // } - // - // Then it calls FallbackInvokeMember with this tree as the - // "error", giving the language the option of using this - // tree or doing .NET binding. - // - Fallback fallback = e => binder.FallbackInvokeMember(this, args, e); - - var call = BuildCallMethodWithResult( - "TryInvokeMember", - binder, - DynamicMetaObject.GetExpressions(args), - BuildCallMethodWithResult( - "TryGetMember", - new GetBinderAdapter(binder), - NoArgs, - fallback(null), - (e) => binder.FallbackInvoke(e, args, null) - ), - null - ); - - return fallback(call); - } - - - public override DynamicMetaObject BindCreateInstance(CreateInstanceBinder binder, DynamicMetaObject[] args) { - if (IsOverridden("TryCreateInstance")) { - return CallMethodWithResult("TryCreateInstance", binder, DynamicMetaObject.GetExpressions(args), (e) => binder.FallbackCreateInstance(this, args, e)); - } - - return base.BindCreateInstance(binder, args); - } - - public override DynamicMetaObject BindInvoke(InvokeBinder binder, DynamicMetaObject[] args) { - if (IsOverridden("TryInvoke")) { - return CallMethodWithResult("TryInvoke", binder, DynamicMetaObject.GetExpressions(args), (e) => binder.FallbackInvoke(this, args, e)); - } - - return base.BindInvoke(binder, args); - } - - public override DynamicMetaObject BindBinaryOperation(BinaryOperationBinder binder, DynamicMetaObject arg) { - if (IsOverridden("TryBinaryOperation")) { - return CallMethodWithResult("TryBinaryOperation", binder, DynamicMetaObject.GetExpressions(new DynamicMetaObject[] {arg}), (e) => binder.FallbackBinaryOperation(this, arg, e)); - } - - return base.BindBinaryOperation(binder, arg); - } - - public override DynamicMetaObject BindUnaryOperation(UnaryOperationBinder binder) { - if (IsOverridden("TryUnaryOperation")) { - return CallMethodWithResult("TryUnaryOperation", binder, NoArgs, (e) => binder.FallbackUnaryOperation(this, e)); - } - - return base.BindUnaryOperation(binder); - } - - public override DynamicMetaObject BindGetIndex(GetIndexBinder binder, DynamicMetaObject[] indexes) { - if (IsOverridden("TryGetIndex")) { - return CallMethodWithResult("TryGetIndex", binder, DynamicMetaObject.GetExpressions(indexes), (e) => binder.FallbackGetIndex(this, indexes, e)); - } - - return base.BindGetIndex(binder, indexes); - } - - public override DynamicMetaObject BindSetIndex(SetIndexBinder binder, DynamicMetaObject[] indexes, DynamicMetaObject value) { - if (IsOverridden("TrySetIndex")) { - return CallMethodReturnLast("TrySetIndex", binder, DynamicMetaObject.GetExpressions(indexes), value.Expression, (e) => binder.FallbackSetIndex(this, indexes, value, e)); - } - - return base.BindSetIndex(binder, indexes, value); - } - - public override DynamicMetaObject BindDeleteIndex(DeleteIndexBinder binder, DynamicMetaObject[] indexes) { - if (IsOverridden("TryDeleteIndex")) { - return CallMethodNoResult("TryDeleteIndex", binder, DynamicMetaObject.GetExpressions(indexes), (e) => binder.FallbackDeleteIndex(this, indexes, e)); - } - - return base.BindDeleteIndex(binder, indexes); - } - - private delegate DynamicMetaObject Fallback(DynamicMetaObject errorSuggestion); - - private readonly static Expression[] NoArgs = new Expression[0]; - - private static Expression[] GetConvertedArgs(params Expression[] args) { - ReadOnlyCollectionBuilder paramArgs = new ReadOnlyCollectionBuilder(args.Length); - - for (int i = 0; i < args.Length; i++) { - paramArgs.Add(Expression.Convert(args[i], typeof(object))); - } - - return paramArgs.ToArray(); - } - - /// - /// Helper method for generating expressions that assign byRef call - /// parameters back to their original variables - /// - private static Expression ReferenceArgAssign(Expression callArgs, Expression[] args) { - ReadOnlyCollectionBuilder block = null; - - for (int i = 0; i < args.Length; i++) { - ContractUtils.Requires(args[i] is ParameterExpression); - if (((ParameterExpression)args[i]).IsByRef) { - if (block == null) - block = new ReadOnlyCollectionBuilder(); - - block.Add( - Expression.Assign( - args[i], - Expression.Convert( - Expression.ArrayIndex( - callArgs, - Expression.Constant(i) - ), - args[i].Type - ) - ) - ); - } - } - - if (block != null) - return Expression.Block(block); - else - return Expression.Empty(); - } - - /// - /// Helper method for generating arguments for calling methods - /// on DynamicObject. parameters is either a list of ParameterExpressions - /// to be passed to the method as an object[], or NoArgs to signify that - /// the target method takes no object[] parameter. - /// - private static Expression[] BuildCallArgs(DynamicMetaObjectBinder binder, Expression[] parameters, Expression arg0, Expression arg1) { - if (!object.ReferenceEquals(parameters, NoArgs)) - return arg1 != null ? new Expression[] { Constant(binder), arg0, arg1 } : new Expression[] { Constant(binder), arg0 }; - else - return arg1 != null ? new Expression[] { Constant(binder), arg1 } : new Expression[] { Constant(binder) }; - } - - private static ConstantExpression Constant(DynamicMetaObjectBinder binder) { - Type t = binder.GetType(); - while (!t.IsVisible) { - t = t.BaseType; - } - return Expression.Constant(binder, t); - } - - /// - /// Helper method for generating a MetaObject which calls a - /// specific method on Dynamic that returns a result - /// - private DynamicMetaObject CallMethodWithResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Fallback fallback) { - return CallMethodWithResult(methodName, binder, args, fallback, null); - } - - /// - /// Helper method for generating a MetaObject which calls a - /// specific method on Dynamic that returns a result - /// - private DynamicMetaObject CallMethodWithResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Fallback fallback, Fallback fallbackInvoke) { - // - // First, call fallback to do default binding - // This produces either an error or a call to a .NET member - // - DynamicMetaObject fallbackResult = fallback(null); - - var callDynamic = BuildCallMethodWithResult(methodName, binder, args, fallbackResult, fallbackInvoke); - - // - // Now, call fallback again using our new MO as the error - // When we do this, one of two things can happen: - // 1. Binding will succeed, and it will ignore our call to - // the dynamic method, OR - // 2. Binding will fail, and it will use the MO we created - // above. - // - return fallback(callDynamic); - } - - /// - /// Helper method for generating a MetaObject which calls a - /// specific method on DynamicObject that returns a result. - /// - /// args is either an array of arguments to be passed - /// to the method as an object[] or NoArgs to signify that - /// the target method takes no parameters. - /// - private DynamicMetaObject BuildCallMethodWithResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, DynamicMetaObject fallbackResult, Fallback fallbackInvoke) { - if (!IsOverridden(methodName)) { - return fallbackResult; - } - - // - // Build a new expression like: - // { - // object result; - // TryGetMember(payload, out result) ? fallbackInvoke(result) : fallbackResult - // } - // - var result = Expression.Parameter(typeof(object), null); - ParameterExpression callArgs = methodName != "TryBinaryOperation" ? Expression.Parameter(typeof(object[]), null) : Expression.Parameter(typeof(object), null); - var callArgsValue = GetConvertedArgs(args); - - var resultMO = new DynamicMetaObject(result, BindingRestrictions.Empty); - - // Need to add a conversion if calling TryConvert - if (binder.ReturnType != typeof(object)) { - Debug.Assert(binder is ConvertBinder && fallbackInvoke == null); - - var convert = Expression.Convert(resultMO.Expression, binder.ReturnType); - // will always be a cast or unbox - Debug.Assert(convert.Method == null); - - // Prepare a good exception message in case the convert will fail - string convertFailed = Strings.DynamicObjectResultNotAssignable( - "{0}", - this.Value.GetType(), - binder.GetType(), - binder.ReturnType - ); - -#if MONO // referencesource version - Expression condition; - // If the return type can not be assigned null then just check for type assignablity otherwise allow null. - if (binder.ReturnType.IsValueType && Nullable.GetUnderlyingType(binder.ReturnType) == null) { - condition = Expression.TypeIs(resultMO.Expression, binder.ReturnType); - } - else { - condition = Expression.OrElse( - Expression.Equal(resultMO.Expression, Expression.Constant(null)), - Expression.TypeIs(resultMO.Expression, binder.ReturnType)); - } - - var checkedConvert = Expression.Condition( - condition, - convert, - Expression.Throw( - Expression.New(typeof(InvalidCastException).GetConstructor(new Type[]{typeof(string)}), - Expression.Call( - typeof(string).GetMethod("Format", new Type[] {typeof(string), typeof(object[])}), - Expression.Constant(convertFailed), - Expression.NewArrayInit(typeof(object), - Expression.Condition( - Expression.Equal(resultMO.Expression, Expression.Constant(null)), - Expression.Constant("null"), - Expression.Call( - resultMO.Expression, - typeof(object).GetMethod("GetType") - ), - typeof(object) - ) - ) - ) - ), - binder.ReturnType - ), - binder.ReturnType - ); -#else - var checkedConvert = Expression.Condition( - Expression.TypeIs(resultMO.Expression, binder.ReturnType), - convert, - Expression.Throw( - Expression.New(typeof(InvalidCastException).GetConstructor(new Type[]{typeof(string)}), - Expression.Call( - typeof(string).GetMethod("Format", new Type[] {typeof(string), typeof(object)}), - Expression.Constant(convertFailed), - Expression.Condition( - Expression.Equal(resultMO.Expression, Expression.Constant(null)), - Expression.Constant("null"), - Expression.Call( - resultMO.Expression, - typeof(object).GetMethod("GetType") - ), - typeof(object) - ) - ) - ), - binder.ReturnType - ), - binder.ReturnType - ); -#endif - - resultMO = new DynamicMetaObject(checkedConvert, resultMO.Restrictions); - } - - if (fallbackInvoke != null) { - resultMO = fallbackInvoke(resultMO); - } - - var callDynamic = new DynamicMetaObject( - Expression.Block( - new[] { result, callArgs }, - methodName != "TryBinaryOperation" ? Expression.Assign(callArgs, Expression.NewArrayInit(typeof(object), callArgsValue)) : Expression.Assign(callArgs, callArgsValue[0]), - Expression.Condition( - Expression.Call( - GetLimitedSelf(), - typeof(DynamicObject).GetMethod(methodName), - BuildCallArgs( - binder, - args, - callArgs, - result - ) - ), - Expression.Block( - methodName != "TryBinaryOperation" ? ReferenceArgAssign(callArgs, args) : Expression.Empty(), - resultMO.Expression - ), - fallbackResult.Expression, - binder.ReturnType - ) - ), - GetRestrictions().Merge(resultMO.Restrictions).Merge(fallbackResult.Restrictions) - ); - return callDynamic; - } - - - /// - /// Helper method for generating a MetaObject which calls a - /// specific method on Dynamic, but uses one of the arguments for - /// the result. - /// - /// args is either an array of arguments to be passed - /// to the method as an object[] or NoArgs to signify that - /// the target method takes no parameters. - /// - private DynamicMetaObject CallMethodReturnLast(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Expression value, Fallback fallback) { - // - // First, call fallback to do default binding - // This produces either an error or a call to a .NET member - // - DynamicMetaObject fallbackResult = fallback(null); - - // - // Build a new expression like: - // { - // object result; - // TrySetMember(payload, result = value) ? result : fallbackResult - // } - // - - var result = Expression.Parameter(typeof(object), null); - var callArgs = Expression.Parameter(typeof(object[]), null); - var callArgsValue = GetConvertedArgs(args); - - var callDynamic = new DynamicMetaObject( - Expression.Block( - new[] { result, callArgs }, - Expression.Assign(callArgs, Expression.NewArrayInit(typeof(object), callArgsValue)), - Expression.Condition( - Expression.Call( - GetLimitedSelf(), - typeof(DynamicObject).GetMethod(methodName), - BuildCallArgs( - binder, - args, - callArgs, - Expression.Assign(result, Expression.Convert(value, typeof(object))) - ) - ), - Expression.Block( - ReferenceArgAssign(callArgs, args), - result - ), - fallbackResult.Expression, - typeof(object) - ) - ), - GetRestrictions().Merge(fallbackResult.Restrictions) - ); - - // - // Now, call fallback again using our new MO as the error - // When we do this, one of two things can happen: - // 1. Binding will succeed, and it will ignore our call to - // the dynamic method, OR - // 2. Binding will fail, and it will use the MO we created - // above. - // - return fallback(callDynamic); - } - - - /// - /// Helper method for generating a MetaObject which calls a - /// specific method on Dynamic, but uses one of the arguments for - /// the result. - /// - /// args is either an array of arguments to be passed - /// to the method as an object[] or NoArgs to signify that - /// the target method takes no parameters. - /// - private DynamicMetaObject CallMethodNoResult(string methodName, DynamicMetaObjectBinder binder, Expression[] args, Fallback fallback) { - // - // First, call fallback to do default binding - // This produces either an error or a call to a .NET member - // - DynamicMetaObject fallbackResult = fallback(null); - var callArgs = Expression.Parameter(typeof(object[]), null); - var callArgsValue = GetConvertedArgs(args); - - // - // Build a new expression like: - // if (TryDeleteMember(payload)) { } else { fallbackResult } - // - var callDynamic = new DynamicMetaObject( - Expression.Block( - new[] { callArgs }, - Expression.Assign(callArgs, Expression.NewArrayInit(typeof(object), callArgsValue)), - Expression.Condition( - Expression.Call( - GetLimitedSelf(), - typeof(DynamicObject).GetMethod(methodName), - BuildCallArgs( - binder, - args, - callArgs, - null - ) - ), - Expression.Block( - ReferenceArgAssign(callArgs, args), - Expression.Empty() - ), - fallbackResult.Expression, - typeof(void) - ) - ), - GetRestrictions().Merge(fallbackResult.Restrictions) - ); - - // - // Now, call fallback again using our new MO as the error - // When we do this, one of two things can happen: - // 1. Binding will succeed, and it will ignore our call to - // the dynamic method, OR - // 2. Binding will fail, and it will use the MO we created - // above. - // - return fallback(callDynamic); - } - - /// - /// Checks if the derived type has overridden the specified method. If there is no - /// implementation for the method provided then Dynamic falls back to the base class - /// behavior which lets the call site determine how the binder is performed. - /// - private bool IsOverridden(string method) { - var methods = Value.GetType().GetMember(method, MemberTypes.Method, BindingFlags.Public | BindingFlags.Instance); - - foreach (MethodInfo mi in methods) { - if (mi.DeclaringType != typeof(DynamicObject) && mi.GetBaseDefinition().DeclaringType == typeof(DynamicObject)) { - return true; - } - } - - return false; - } - - /// - /// Returns a Restrictions object which includes our current restrictions merged - /// with a restriction limiting our type - /// - private BindingRestrictions GetRestrictions() { - Debug.Assert(Restrictions == BindingRestrictions.Empty, "We don't merge, restrictions are always empty"); - - return BindingRestrictions.GetTypeRestriction(this); - } - - /// - /// Returns our Expression converted to DynamicObject - /// - private Expression GetLimitedSelf() { - // Convert to DynamicObject rather than LimitType, because - // the limit type might be non-public. - if (TypeUtils.AreEquivalent(Expression.Type, typeof(DynamicObject))) { - return Expression; - } - return Expression.Convert(Expression, typeof(DynamicObject)); - } - - private new DynamicObject Value { - get { - return (DynamicObject)base.Value; - } - } - - // It is okay to throw NotSupported from this binder. This object - // is only used by DynamicObject.GetMember--it is not expected to - // (and cannot) implement binding semantics. It is just so the DO - // can use the Name and IgnoreCase properties. - private sealed class GetBinderAdapter : GetMemberBinder { - internal GetBinderAdapter(InvokeMemberBinder binder) - : base(binder.Name, binder.IgnoreCase) { - } - - public override DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion) { - throw new NotSupportedException(); - } - } - } - - #endregion - - #region IDynamicMetaObjectProvider Members - - /// - /// The provided MetaObject will dispatch to the Dynamic virtual methods. - /// The object can be encapsulated inside of another MetaObject to - /// provide custom behavior for individual actions. - /// - public virtual DynamicMetaObject GetMetaObject(Expression parameter) { - return new MetaDynamic(parameter, this); - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoClass.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoClass.cs deleted file mode 100644 index 927dab7fbf1..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoClass.cs +++ /dev/null @@ -1,183 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Text; - -namespace System.Dynamic { - /// - /// Represents a dynamically assigned class. Expando objects which share the same - /// members will share the same class. Classes are dynamically assigned as the - /// expando object gains members. - /// - internal class ExpandoClass { - private readonly string[] _keys; // list of names associated with each element in the data array, sorted - private readonly int _hashCode; // pre-calculated hash code of all the keys the class contains - private Dictionary> _transitions; // cached transitions - - private const int EmptyHashCode = 6551; // hash code of the empty ExpandoClass. - - internal static ExpandoClass Empty = new ExpandoClass(); // The empty Expando class - all Expando objects start off w/ this class. - - /// - /// Constructs the empty ExpandoClass. This is the class used when an - /// empty Expando object is initially constructed. - /// - internal ExpandoClass() { - _hashCode = EmptyHashCode; - _keys = new string[0]; - } - - /// - /// Constructs a new ExpandoClass that can hold onto the specified keys. The - /// keys must be sorted ordinally. The hash code must be precalculated for - /// the keys. - /// - internal ExpandoClass(string[] keys, int hashCode) { - _hashCode = hashCode; - _keys = keys; - } - - /// - /// Finds or creates a new ExpandoClass given the existing set of keys - /// in this ExpandoClass plus the new key to be added. Members in an - /// ExpandoClass are always stored case sensitively. - /// - internal ExpandoClass FindNewClass(string newKey) { - // just XOR the newKey hash code - int hashCode = _hashCode ^ newKey.GetHashCode(); - - lock (this) { - List infos = GetTransitionList(hashCode); - - for (int i = 0; i < infos.Count; i++) { - ExpandoClass klass = infos[i].Target as ExpandoClass; - if (klass == null) { - infos.RemoveAt(i); - i--; - continue; - } - - if (string.Equals(klass._keys[klass._keys.Length - 1], newKey, StringComparison.Ordinal)) { - // the new key is the key we added in this transition - return klass; - } - } - - // no applicable transition, create a new one - string[] keys = new string[_keys.Length + 1]; - Array.Copy(_keys, keys, _keys.Length); - keys[_keys.Length] = newKey; - ExpandoClass ec = new ExpandoClass(keys, hashCode); - - infos.Add(new WeakReference(ec)); - return ec; - } - } - - /// - /// Gets the lists of transitions that are valid from this ExpandoClass - /// to an ExpandoClass whos keys hash to the apporopriate hash code. - /// - private List GetTransitionList(int hashCode) { - if (_transitions == null) { - _transitions = new Dictionary>(); - } - - List infos; - if (!_transitions.TryGetValue(hashCode, out infos)) { - _transitions[hashCode] = infos = new List(); - } - - return infos; - } - - /// - /// Gets the index at which the value should be stored for the specified name. - /// - internal int GetValueIndex(string name, bool caseInsensitive, ExpandoObject obj) { - if (caseInsensitive) { - return GetValueIndexCaseInsensitive(name, obj); - } else { - return GetValueIndexCaseSensitive(name); - } - } - - /// - /// Gets the index at which the value should be stored for the specified name - /// case sensitively. Returns the index even if the member is marked as deleted. - /// - internal int GetValueIndexCaseSensitive(string name) { - for (int i = 0; i < _keys.Length; i++) { - if (string.Equals( - _keys[i], - name, - StringComparison.Ordinal)) { - return i; - } - } - return ExpandoObject.NoMatch; - } - - /// - /// Gets the index at which the value should be stored for the specified name, - /// the method is only used in the case-insensitive case. - /// - /// the name of the member - /// The ExpandoObject associated with the class - /// that is used to check if a member has been deleted. - /// - /// the exact match if there is one - /// if there is exactly one member with case insensitive match, return it - /// otherwise we throw AmbiguousMatchException. - /// - private int GetValueIndexCaseInsensitive(string name, ExpandoObject obj) { - int caseInsensitiveMatch = ExpandoObject.NoMatch; //the location of the case-insensitive matching member - lock (obj.LockObject) { - for (int i = _keys.Length - 1; i >= 0; i--) { - if (string.Equals( - _keys[i], - name, - StringComparison.OrdinalIgnoreCase)) { - //if the matching member is deleted, continue searching - if (!obj.IsDeletedMember(i)) { - if (caseInsensitiveMatch == ExpandoObject.NoMatch) { - caseInsensitiveMatch = i; - } else { - //Ambigous match, stop searching - return ExpandoObject.AmbiguousMatchFound; - } - } - } - } - } - //There is exactly one member with case insensitive match. - return caseInsensitiveMatch; - } - - /// - /// Gets the names of the keys that can be stored in the Expando class. The - /// list is sorted ordinally. - /// - internal string[] Keys { - get { - return _keys; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoObject.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoObject.cs deleted file mode 100644 index 5f452afc3f4..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/ExpandoObject.cs +++ /dev/null @@ -1,1097 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Utils; -#else -using System.Linq.Expressions; -#endif - -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Dynamic; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -namespace System.Dynamic { - /// - /// Represents an object with members that can be dynamically added and removed at runtime. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] - public sealed class ExpandoObject : IDynamicMetaObjectProvider, IDictionary, INotifyPropertyChanged { - internal readonly object LockObject; // the readonly field is used for locking the Expando object - private ExpandoData _data; // the data currently being held by the Expando object - private int _count; // the count of available members - - internal readonly static object Uninitialized = new object(); // A marker object used to identify that a value is uninitialized. - - internal const int AmbiguousMatchFound = -2; // The value is used to indicate there exists ambiguous match in the Expando object - internal const int NoMatch = -1; // The value is used to indicate there is no matching member - - private PropertyChangedEventHandler _propertyChanged; - - /// - /// Creates a new ExpandoObject with no members. - /// - public ExpandoObject() { - _data = ExpandoData.Empty; - LockObject = new object(); - } - - #region Get/Set/Delete Helpers - - /// - /// Try to get the data stored for the specified class at the specified index. If the - /// class has changed a full lookup for the slot will be performed and the correct - /// value will be retrieved. - /// - internal bool TryGetValue(object indexClass, int index, string name, bool ignoreCase, out object value) { - // read the data now. The data is immutable so we get a consistent view. - // If there's a concurrent writer they will replace data and it just appears - // that we won the race - ExpandoData data = _data; - if (data.Class != indexClass || ignoreCase) { - /* Re-search for the index matching the name here if - * 1) the class has changed, we need to get the correct index and return - * the value there. - * 2) the search is case insensitive: - * a. the member specified by index may be deleted, but there might be other - * members matching the name if the binder is case insensitive. - * b. the member that exactly matches the name didn't exist before and exists now, - * need to find the exact match. - */ - index = data.Class.GetValueIndex(name, ignoreCase, this); - if (index == ExpandoObject.AmbiguousMatchFound) { - throw Error.AmbiguousMatchInExpandoObject(name); - } - } - - if (index == ExpandoObject.NoMatch) { - value = null; - return false; - } - - // Capture the value into a temp, so it doesn't get mutated after we check - // for Uninitialized. - object temp = data[index]; - if (temp == Uninitialized) { - value = null; - return false; - } - - // index is now known to be correct - value = temp; - return true; - } - - /// - /// Sets the data for the specified class at the specified index. If the class has - /// changed then a full look for the slot will be performed. If the new class does - /// not have the provided slot then the Expando's class will change. Only case sensitive - /// setter is supported in ExpandoObject. - /// - internal void TrySetValue(object indexClass, int index, object value, string name, bool ignoreCase, bool add) { - ExpandoData data; - object oldValue; - - lock (LockObject) { - data = _data; - - if (data.Class != indexClass || ignoreCase) { - // The class has changed or we are doing a case-insensitive search, - // we need to get the correct index and set the value there. If we - // don't have the value then we need to promote the class - that - // should only happen when we have multiple concurrent writers. - index = data.Class.GetValueIndex(name, ignoreCase, this); - if (index == ExpandoObject.AmbiguousMatchFound) { - throw Error.AmbiguousMatchInExpandoObject(name); - } - if (index == ExpandoObject.NoMatch) { - // Before creating a new class with the new member, need to check - // if there is the exact same member but is deleted. We should reuse - // the class if there is such a member. - int exactMatch = ignoreCase ? - data.Class.GetValueIndexCaseSensitive(name) : - index; - if (exactMatch != ExpandoObject.NoMatch) { - Debug.Assert(data[exactMatch] == Uninitialized); - index = exactMatch; - } else { - ExpandoClass newClass = data.Class.FindNewClass(name); - data = PromoteClassCore(data.Class, newClass); - // After the class promotion, there must be an exact match, - // so we can do case-sensitive search here. - index = data.Class.GetValueIndexCaseSensitive(name); - Debug.Assert(index != ExpandoObject.NoMatch); - } - } - } - - // Setting an uninitialized member increases the count of available members - oldValue = data[index]; - if (oldValue == Uninitialized) { - _count++; - } else if (add) { - throw Error.SameKeyExistsInExpando(name); - } - - data[index] = value; - } - - // Notify property changed, outside of the lock. - var propertyChanged = _propertyChanged; - if (propertyChanged != null && value != oldValue) { - // Use the canonical case for the key. - propertyChanged(this, new PropertyChangedEventArgs(data.Class.Keys[index])); - } - } - - /// - /// Deletes the data stored for the specified class at the specified index. - /// - internal bool TryDeleteValue(object indexClass, int index, string name, bool ignoreCase, object deleteValue) { - ExpandoData data; - lock (LockObject) { - data = _data; - - if (data.Class != indexClass || ignoreCase) { - // the class has changed or we are doing a case-insensitive search, - // we need to get the correct index. If there is no associated index - // we simply can't have the value and we return false. - index = data.Class.GetValueIndex(name, ignoreCase, this); - if (index == ExpandoObject.AmbiguousMatchFound) { - throw Error.AmbiguousMatchInExpandoObject(name); - } - } - if (index == ExpandoObject.NoMatch) { - return false; - } - - object oldValue = data[index]; - if (oldValue == Uninitialized) { - return false; - } - - // Make sure the value matches, if requested. - // - // It's a shame we have to call Equals with the lock held but - // there doesn't seem to be a good way around that, and - // ConcurrentDictionary in mscorlib does the same thing. - if (deleteValue != Uninitialized && !object.Equals(oldValue, deleteValue)) { - return false; - } - - data[index] = Uninitialized; - - // Deleting an available member decreases the count of available members - _count--; - } - - // Notify property changed, outside of the lock. - var propertyChanged = _propertyChanged; - if (propertyChanged != null) { - // Use the canonical case for the key. - propertyChanged(this, new PropertyChangedEventArgs(data.Class.Keys[index])); - } - - return true; - } - - /// - /// Returns true if the member at the specified index has been deleted, - /// otherwise false. Call this function holding the lock. - /// - internal bool IsDeletedMember(int index) { - Debug.Assert(index >= 0 && index <= _data.Length); - - if (index == _data.Length) { - // The member is a newly added by SetMemberBinder and not in data yet - return false; - } - - return _data[index] == ExpandoObject.Uninitialized; - } - - /// - /// Exposes the ExpandoClass which we've associated with this - /// Expando object. Used for type checks in rules. - /// - internal ExpandoClass Class { - get { - return _data.Class; - } - } - - /// - /// Promotes the class from the old type to the new type and returns the new - /// ExpandoData object. - /// - private ExpandoData PromoteClassCore(ExpandoClass oldClass, ExpandoClass newClass) { - Debug.Assert(oldClass != newClass); - - lock (LockObject) { - if (_data.Class == oldClass) { - _data = _data.UpdateClass(newClass); - } - return _data; - } - } - - /// - /// Internal helper to promote a class. Called from our RuntimeOps helper. This - /// version simply doesn't expose the ExpandoData object which is a private - /// data structure. - /// - internal void PromoteClass(object oldClass, object newClass) { - PromoteClassCore((ExpandoClass)oldClass, (ExpandoClass)newClass); - } - - #endregion - - #region IDynamicMetaObjectProvider Members - - DynamicMetaObject IDynamicMetaObjectProvider.GetMetaObject(Expression parameter) { - return new MetaExpando(parameter, this); - } - #endregion - - #region Helper methods - private void TryAddMember(string key, object value) { - ContractUtils.RequiresNotNull(key, "key"); - // Pass null to the class, which forces lookup. - TrySetValue(null, -1, value, key, false, true); - } - - private bool TryGetValueForKey(string key, out object value) { - // Pass null to the class, which forces lookup. - return TryGetValue(null, -1, key, false, out value); - } - - private bool ExpandoContainsKey(string key) { - return _data.Class.GetValueIndexCaseSensitive(key) >= 0; - } - - // We create a non-generic type for the debug view for each different collection type - // that uses DebuggerTypeProxy, instead of defining a generic debug view type and - // using different instantiations. The reason for this is that support for generics - // with using DebuggerTypeProxy is limited. For C#, DebuggerTypeProxy supports only - // open types (from MSDN http://msdn.microsoft.com/en-us/library/d8eyd8zc.aspx). - private sealed class KeyCollectionDebugView { - private ICollection collection; - public KeyCollectionDebugView(ICollection collection) { - Debug.Assert(collection != null); - this.collection = collection; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public string[] Items { - get { - string[] items = new string[collection.Count]; - collection.CopyTo(items, 0); - return items; - } - } - } - - [DebuggerTypeProxy(typeof(KeyCollectionDebugView))] - [DebuggerDisplay("Count = {Count}")] - private class KeyCollection : ICollection { - private readonly ExpandoObject _expando; - private readonly int _expandoVersion; - private readonly int _expandoCount; - private readonly ExpandoData _expandoData; - - internal KeyCollection(ExpandoObject expando) { - lock (expando.LockObject) { - _expando = expando; - _expandoVersion = expando._data.Version; - _expandoCount = expando._count; - _expandoData = expando._data; - } - } - - private void CheckVersion() { - if (_expando._data.Version != _expandoVersion || _expandoData != _expando._data) { - //the underlying expando object has changed - throw Error.CollectionModifiedWhileEnumerating(); - } - } - - #region ICollection Members - - public void Add(string item) { - throw Error.CollectionReadOnly(); - } - - public void Clear() { - throw Error.CollectionReadOnly(); - } - - public bool Contains(string item) { - lock (_expando.LockObject) { - CheckVersion(); - return _expando.ExpandoContainsKey(item); - } - } - - public void CopyTo(string[] array, int arrayIndex) { - ContractUtils.RequiresNotNull(array, "array"); - ContractUtils.RequiresArrayRange(array, arrayIndex, _expandoCount, "arrayIndex", "Count"); - lock (_expando.LockObject) { - CheckVersion(); - ExpandoData data = _expando._data; - for (int i = 0; i < data.Class.Keys.Length; i++) { - if (data[i] != Uninitialized) { - array[arrayIndex++] = data.Class.Keys[i]; - } - } - } - } - - public int Count { - get { - CheckVersion(); - return _expandoCount; - } - } - - public bool IsReadOnly { - get { return true; } - } - - public bool Remove(string item) { - throw Error.CollectionReadOnly(); - } - - #endregion - - #region IEnumerable Members - - public IEnumerator GetEnumerator() { - for (int i = 0, n = _expandoData.Class.Keys.Length; i < n; i++) { - CheckVersion(); - if (_expandoData[i] != Uninitialized) { - yield return _expandoData.Class.Keys[i]; - } - } - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return GetEnumerator(); - } - - #endregion - } - - // We create a non-generic type for the debug view for each different collection type - // that uses DebuggerTypeProxy, instead of defining a generic debug view type and - // using different instantiations. The reason for this is that support for generics - // with using DebuggerTypeProxy is limited. For C#, DebuggerTypeProxy supports only - // open types (from MSDN http://msdn.microsoft.com/en-us/library/d8eyd8zc.aspx). - private sealed class ValueCollectionDebugView { - private ICollection collection; - public ValueCollectionDebugView(ICollection collection) { - Debug.Assert(collection != null); - this.collection = collection; - } - - [DebuggerBrowsable(DebuggerBrowsableState.RootHidden)] - public object[] Items { - get { - object[] items = new object[collection.Count]; - collection.CopyTo(items, 0); - return items; - } - } - } - - [DebuggerTypeProxy(typeof(ValueCollectionDebugView))] - [DebuggerDisplay("Count = {Count}")] - private class ValueCollection : ICollection { - private readonly ExpandoObject _expando; - private readonly int _expandoVersion; - private readonly int _expandoCount; - private readonly ExpandoData _expandoData; - - internal ValueCollection(ExpandoObject expando) { - lock (expando.LockObject) { - _expando = expando; - _expandoVersion = expando._data.Version; - _expandoCount = expando._count; - _expandoData = expando._data; - } - } - - private void CheckVersion() { - if (_expando._data.Version != _expandoVersion || _expandoData != _expando._data) { - //the underlying expando object has changed - throw Error.CollectionModifiedWhileEnumerating(); - } - } - - #region ICollection Members - - public void Add(object item) { - throw Error.CollectionReadOnly(); - } - - public void Clear() { - throw Error.CollectionReadOnly(); - } - - public bool Contains(object item) { - lock (_expando.LockObject) { - CheckVersion(); - - ExpandoData data = _expando._data; - for (int i = 0; i < data.Class.Keys.Length; i++) { - - // See comment in TryDeleteValue; it's okay to call - // object.Equals with the lock held. - if (object.Equals(data[i], item)) { - return true; - } - } - return false; - } - } - - public void CopyTo(object[] array, int arrayIndex) { - ContractUtils.RequiresNotNull(array, "array"); - ContractUtils.RequiresArrayRange(array, arrayIndex, _expandoCount, "arrayIndex", "Count"); - lock (_expando.LockObject) { - CheckVersion(); - ExpandoData data = _expando._data; - for (int i = 0; i < data.Class.Keys.Length; i++) { - if (data[i] != Uninitialized) { - array[arrayIndex++] = data[i]; - } - } - } - } - - public int Count { - get { - CheckVersion(); - return _expandoCount; - } - } - - public bool IsReadOnly { - get { return true; } - } - - public bool Remove(object item) { - throw Error.CollectionReadOnly(); - } - - #endregion - - #region IEnumerable Members - - public IEnumerator GetEnumerator() { - ExpandoData data = _expando._data; - for (int i = 0; i < data.Class.Keys.Length; i++) { - CheckVersion(); - // Capture the value into a temp so we don't inadvertently - // return Uninitialized. - object temp = data[i]; - if (temp != Uninitialized) { - yield return temp; - } - } - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return GetEnumerator(); - } - - #endregion - } - - #endregion - - #region IDictionary Members - ICollection IDictionary.Keys { - get { - return new KeyCollection(this); - } - } - - ICollection IDictionary.Values { - get { - return new ValueCollection(this); - } - } - - object IDictionary.this[string key] { - get { - object value; - if (!TryGetValueForKey(key, out value)) { - throw Error.KeyDoesNotExistInExpando(key); - } - return value; - } - set { - ContractUtils.RequiresNotNull(key, "key"); - // Pass null to the class, which forces lookup. - TrySetValue(null, -1, value, key, false, false); - } - } - - void IDictionary.Add(string key, object value) { - this.TryAddMember(key, value); - } - - bool IDictionary.ContainsKey(string key) { - ContractUtils.RequiresNotNull(key, "key"); - - ExpandoData data = _data; - int index = data.Class.GetValueIndexCaseSensitive(key); - return index >= 0 && data[index] != Uninitialized; - } - - bool IDictionary.Remove(string key) { - ContractUtils.RequiresNotNull(key, "key"); - // Pass null to the class, which forces lookup. - return TryDeleteValue(null, -1, key, false, Uninitialized); - } - - bool IDictionary.TryGetValue(string key, out object value) { - return TryGetValueForKey(key, out value); - } - - #endregion - - #region ICollection> Members - int ICollection>.Count { - get { - return _count; - } - } - - bool ICollection>.IsReadOnly { - get { return false; } - } - - void ICollection>.Add(KeyValuePair item) { - TryAddMember(item.Key, item.Value); - } - - void ICollection>.Clear() { - // We remove both class and data! - ExpandoData data; - lock (LockObject) { - data = _data; - _data = ExpandoData.Empty; - _count = 0; - } - - // Notify property changed for all properties. - var propertyChanged = _propertyChanged; - if (propertyChanged != null) { - for (int i = 0, n = data.Class.Keys.Length; i < n; i++) { - if (data[i] != Uninitialized) { - propertyChanged(this, new PropertyChangedEventArgs(data.Class.Keys[i])); - } - } - } - } - - bool ICollection>.Contains(KeyValuePair item) { - object value; - if (!TryGetValueForKey(item.Key, out value)) { - return false; - } - - return object.Equals(value, item.Value); - } - - void ICollection>.CopyTo(KeyValuePair[] array, int arrayIndex) { - ContractUtils.RequiresNotNull(array, "array"); - ContractUtils.RequiresArrayRange(array, arrayIndex, _count, "arrayIndex", "Count"); - - // We want this to be atomic and not throw - lock (LockObject) { - foreach (KeyValuePair item in this) { - array[arrayIndex++] = item; - } - } - } - - bool ICollection>.Remove(KeyValuePair item) { - return TryDeleteValue(null, -1, item.Key, false, item.Value); - } - #endregion - - #region IEnumerable> Member - - IEnumerator> IEnumerable>.GetEnumerator() { - ExpandoData data = _data; - return GetExpandoEnumerator(data, data.Version); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - ExpandoData data = _data; - return GetExpandoEnumerator(data, data.Version); - } - - // Note: takes the data and version as parameters so they will be - // captured before the first call to MoveNext(). - private IEnumerator> GetExpandoEnumerator(ExpandoData data, int version) { - for (int i = 0; i < data.Class.Keys.Length; i++) { - if (_data.Version != version || data != _data) { - // The underlying expando object has changed: - // 1) the version of the expando data changed - // 2) the data object is changed - throw Error.CollectionModifiedWhileEnumerating(); - } - // Capture the value into a temp so we don't inadvertently - // return Uninitialized. - object temp = data[i]; - if (temp != Uninitialized) { - yield return new KeyValuePair(data.Class.Keys[i], temp); - } - } - } - #endregion - - #region MetaExpando - - private class MetaExpando : DynamicMetaObject { - public MetaExpando(Expression expression, ExpandoObject value) - : base(expression, BindingRestrictions.Empty, value) { - } - - private DynamicMetaObject BindGetOrInvokeMember(DynamicMetaObjectBinder binder, string name, bool ignoreCase, DynamicMetaObject fallback, Func fallbackInvoke) { - ExpandoClass klass = Value.Class; - - //try to find the member, including the deleted members - int index = klass.GetValueIndex(name, ignoreCase, Value); - - ParameterExpression value = Expression.Parameter(typeof(object), "value"); - - Expression tryGetValue = Expression.Call( - typeof(RuntimeOps).GetMethod("ExpandoTryGetValue"), - GetLimitedSelf(), - Expression.Constant(klass, typeof(object)), - Expression.Constant(index), - Expression.Constant(name), - Expression.Constant(ignoreCase), - value - ); - - var result = new DynamicMetaObject(value, BindingRestrictions.Empty); - if (fallbackInvoke != null) { - result = fallbackInvoke(result); - } - - result = new DynamicMetaObject( - Expression.Block( - new[] { value }, - Expression.Condition( - tryGetValue, - result.Expression, - fallback.Expression, - typeof(object) - ) - ), - result.Restrictions.Merge(fallback.Restrictions) - ); - - return AddDynamicTestAndDefer(binder, Value.Class, null, result); - } - - public override DynamicMetaObject BindGetMember(GetMemberBinder binder) { - ContractUtils.RequiresNotNull(binder, "binder"); - return BindGetOrInvokeMember( - binder, - binder.Name, - binder.IgnoreCase, - binder.FallbackGetMember(this), - null - ); - } - - public override DynamicMetaObject BindInvokeMember(InvokeMemberBinder binder, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(binder, "binder"); - return BindGetOrInvokeMember( - binder, - binder.Name, - binder.IgnoreCase, - binder.FallbackInvokeMember(this, args), - value => binder.FallbackInvoke(value, args, null) - ); - } - - public override DynamicMetaObject BindSetMember(SetMemberBinder binder, DynamicMetaObject value) { - ContractUtils.RequiresNotNull(binder, "binder"); - ContractUtils.RequiresNotNull(value, "value"); - - ExpandoClass klass; - int index; - - ExpandoClass originalClass = GetClassEnsureIndex(binder.Name, binder.IgnoreCase, Value, out klass, out index); - - return AddDynamicTestAndDefer( - binder, - klass, - originalClass, - new DynamicMetaObject( - Expression.Call( - typeof(RuntimeOps).GetMethod("ExpandoTrySetValue"), - GetLimitedSelf(), - Expression.Constant(klass, typeof(object)), - Expression.Constant(index), - Expression.Convert(value.Expression, typeof(object)), - Expression.Constant(binder.Name), - Expression.Constant(binder.IgnoreCase) - ), - BindingRestrictions.Empty - ) - ); - } - - public override DynamicMetaObject BindDeleteMember(DeleteMemberBinder binder) { - ContractUtils.RequiresNotNull(binder, "binder"); - - int index = Value.Class.GetValueIndex(binder.Name, binder.IgnoreCase, Value); - - Expression tryDelete = Expression.Call( - typeof(RuntimeOps).GetMethod("ExpandoTryDeleteValue"), - GetLimitedSelf(), - Expression.Constant(Value.Class, typeof(object)), - Expression.Constant(index), - Expression.Constant(binder.Name), - Expression.Constant(binder.IgnoreCase) - ); - DynamicMetaObject fallback = binder.FallbackDeleteMember(this); - - DynamicMetaObject target = new DynamicMetaObject( - Expression.IfThen(Expression.Not(tryDelete), fallback.Expression), - fallback.Restrictions - ); - - return AddDynamicTestAndDefer(binder, Value.Class, null, target); - } - - public override IEnumerable GetDynamicMemberNames() { - var expandoData = Value._data; - var klass = expandoData.Class; - for (int i = 0; i < klass.Keys.Length; i++) { - object val = expandoData[i]; - if (val != ExpandoObject.Uninitialized) { - yield return klass.Keys[i]; - } - } - } - - /// - /// Adds a dynamic test which checks if the version has changed. The test is only necessary for - /// performance as the methods will do the correct thing if called with an incorrect version. - /// - private DynamicMetaObject AddDynamicTestAndDefer(DynamicMetaObjectBinder binder, ExpandoClass klass, ExpandoClass originalClass, DynamicMetaObject succeeds) { - - Expression ifTestSucceeds = succeeds.Expression; - if (originalClass != null) { - // we are accessing a member which has not yet been defined on this class. - // We force a class promotion after the type check. If the class changes the - // promotion will fail and the set/delete will do a full lookup using the new - // class to discover the name. - Debug.Assert(originalClass != klass); - - ifTestSucceeds = Expression.Block( - Expression.Call( - null, - typeof(RuntimeOps).GetMethod("ExpandoPromoteClass"), - GetLimitedSelf(), - Expression.Constant(originalClass, typeof(object)), - Expression.Constant(klass, typeof(object)) - ), - succeeds.Expression - ); - } - - return new DynamicMetaObject( - Expression.Condition( - Expression.Call( - null, - typeof(RuntimeOps).GetMethod("ExpandoCheckVersion"), - GetLimitedSelf(), - Expression.Constant(originalClass ?? klass, typeof(object)) - ), - ifTestSucceeds, - binder.GetUpdateExpression(ifTestSucceeds.Type) - ), - GetRestrictions().Merge(succeeds.Restrictions) - ); - } - - /// - /// Gets the class and the index associated with the given name. Does not update the expando object. Instead - /// this returns both the original and desired new class. A rule is created which includes the test for the - /// original class, the promotion to the new class, and the set/delete based on the class post-promotion. - /// - private ExpandoClass GetClassEnsureIndex(string name, bool caseInsensitive, ExpandoObject obj, out ExpandoClass klass, out int index) { - ExpandoClass originalClass = Value.Class; - - index = originalClass.GetValueIndex(name, caseInsensitive, obj) ; - if (index == ExpandoObject.AmbiguousMatchFound) { - klass = originalClass; - return null; - } - if (index == ExpandoObject.NoMatch) { - // go ahead and find a new class now... - ExpandoClass newClass = originalClass.FindNewClass(name); - - klass = newClass; - index = newClass.GetValueIndexCaseSensitive(name); - - Debug.Assert(index != ExpandoObject.NoMatch); - return originalClass; - } else { - klass = originalClass; - return null; - } - } - - /// - /// Returns our Expression converted to our known LimitType - /// - private Expression GetLimitedSelf() { - if (TypeUtils.AreEquivalent(Expression.Type, LimitType)) { - return Expression; - } - return Expression.Convert(Expression, LimitType); - } - - /// - /// Returns a Restrictions object which includes our current restrictions merged - /// with a restriction limiting our type - /// - private BindingRestrictions GetRestrictions() { - Debug.Assert(Restrictions == BindingRestrictions.Empty, "We don't merge, restrictions are always empty"); - - return BindingRestrictions.GetTypeRestriction(this); - } - - public new ExpandoObject Value { - get { - return (ExpandoObject)base.Value; - } - } - } - - #endregion - - #region ExpandoData - - /// - /// Stores the class and the data associated with the class as one atomic - /// pair. This enables us to do a class check in a thread safe manner w/o - /// requiring locks. - /// - private class ExpandoData { - internal static ExpandoData Empty = new ExpandoData(); - - /// - /// the dynamically assigned class associated with the Expando object - /// - internal readonly ExpandoClass Class; - - /// - /// data stored in the expando object, key names are stored in the class. - /// - /// Expando._data must be locked when mutating the value. Otherwise a copy of it - /// could be made and lose values. - /// - private readonly object[] _dataArray; - - /// - /// Indexer for getting/setting the data - /// - internal object this[int index] { - get { - return _dataArray[index]; - } - set { - //when the array is updated, version increases, even the new value is the same - //as previous. Dictionary type has the same behavior. - _version++; - _dataArray[index] = value; - } - } - - internal int Version { - get { return _version; } - } - - internal int Length { - get { return _dataArray.Length; } - } - - /// - /// Constructs an empty ExpandoData object with the empty class and no data. - /// - private ExpandoData() { - Class = ExpandoClass.Empty; - _dataArray = new object[0]; - } - - /// - /// the version of the ExpandoObject that tracks set and delete operations - /// - private int _version; - - /// - /// Constructs a new ExpandoData object with the specified class and data. - /// - internal ExpandoData(ExpandoClass klass, object[] data, int version) { - Class = klass; - _dataArray = data; - _version = version; - } - - /// - /// Update the associated class and increases the storage for the data array if needed. - /// - /// - internal ExpandoData UpdateClass(ExpandoClass newClass) { - if (_dataArray.Length >= newClass.Keys.Length) { - // we have extra space in our buffer, just initialize it to Uninitialized. - this[newClass.Keys.Length - 1] = ExpandoObject.Uninitialized; - return new ExpandoData(newClass, this._dataArray, this._version); - } else { - // we've grown too much - we need a new object array - int oldLength = _dataArray.Length; - object[] arr = new object[GetAlignedSize(newClass.Keys.Length)]; - Array.Copy(_dataArray, arr, _dataArray.Length); - ExpandoData newData = new ExpandoData(newClass, arr, this._version); - newData[oldLength] = ExpandoObject.Uninitialized; - return newData; - } - } - - private static int GetAlignedSize(int len) { - // the alignment of the array for storage of values (must be a power of two) - const int DataArrayAlignment = 8; - - // round up and then mask off lower bits - return (len + (DataArrayAlignment - 1)) & (~(DataArrayAlignment - 1)); - } - } - - #endregion - - #region INotifyPropertyChanged Members - - event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged { - add { _propertyChanged += value; } - remove { _propertyChanged -= value; } - } - - #endregion - } -} - -namespace System.Runtime.CompilerServices { - - // - // Note: these helpers are kept as simple wrappers so they have a better - // chance of being inlined. - // - public static partial class RuntimeOps { - - /// - /// Gets the value of an item in an expando object. - /// - /// The expando object. - /// The class of the expando object. - /// The index of the member. - /// The name of the member. - /// true if the name should be matched ignoring case; false otherwise. - /// The out parameter containing the value of the member. - /// True if the member exists in the expando object, otherwise false. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static bool ExpandoTryGetValue(ExpandoObject expando, object indexClass, int index, string name, bool ignoreCase, out object value) { - return expando.TryGetValue(indexClass, index, name, ignoreCase, out value); - } - - /// - /// Sets the value of an item in an expando object. - /// - /// The expando object. - /// The class of the expando object. - /// The index of the member. - /// The value of the member. - /// The name of the member. - /// true if the name should be matched ignoring case; false otherwise. - /// - /// Returns the index for the set member. - /// - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static object ExpandoTrySetValue(ExpandoObject expando, object indexClass, int index, object value, string name, bool ignoreCase) { - expando.TrySetValue(indexClass, index, value, name, ignoreCase, false); - return value; - } - - /// - /// Deletes the value of an item in an expando object. - /// - /// The expando object. - /// The class of the expando object. - /// The index of the member. - /// The name of the member. - /// true if the name should be matched ignoring case; false otherwise. - /// true if the item was successfully removed; otherwise, false. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static bool ExpandoTryDeleteValue(ExpandoObject expando, object indexClass, int index, string name, bool ignoreCase) { - return expando.TryDeleteValue(indexClass, index, name, ignoreCase, ExpandoObject.Uninitialized); - } - - /// - /// Checks the version of the expando object. - /// - /// The expando object. - /// The version to check. - /// true if the version is equal; otherwise, false. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static bool ExpandoCheckVersion(ExpandoObject expando, object version) { - return expando.Class == version; - } - - /// - /// Promotes an expando object from one class to a new class. - /// - /// The expando object. - /// The old class of the expando object. - /// The new class of the expando object. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static void ExpandoPromoteClass(ExpandoObject expando, object oldClass, object newClass) { - expando.PromoteClass(oldClass, newClass); - } - } -} - diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/GetIndexBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/GetIndexBinder.cs deleted file mode 100644 index 56f625968b3..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/GetIndexBinder.cs +++ /dev/null @@ -1,88 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - - /// - /// Represents the dynamic get index operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class GetIndexBinder : DynamicMetaObjectBinder { - private readonly CallInfo _callInfo; - - /// - /// Initializes a new instance of the . - /// - /// The signature of the arguments at the call site. - protected GetIndexBinder(CallInfo callInfo) { - ContractUtils.RequiresNotNull(callInfo, "callInfo"); - _callInfo = callInfo; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(object); } - } - - /// - /// Gets the signature of the arguments at the call site. - /// - public CallInfo CallInfo { - get { return _callInfo; } - } - - /// - /// Performs the binding of the dynamic get index operation. - /// - /// The target of the dynamic get index operation. - /// An array of arguments of the dynamic get index operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.RequiresNotNullItems(args, "args"); - - return target.BindGetIndex(this, args); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - - /// - /// Performs the binding of the dynamic get index operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic get index operation. - /// The arguments of the dynamic get index operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackGetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes) { - return FallbackGetIndex(target, indexes, null); - } - - /// - /// When overridden in the derived class, performs the binding of the dynamic get index operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic get index operation. - /// The arguments of the dynamic get index operation. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackGetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject errorSuggestion); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/GetMemberBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/GetMemberBinder.cs deleted file mode 100644 index f02ca86ab2b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/GetMemberBinder.cs +++ /dev/null @@ -1,100 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - /// - /// Represents the dynamic get member operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class GetMemberBinder : DynamicMetaObjectBinder { - private readonly string _name; - private readonly bool _ignoreCase; - - /// - /// Initializes a new instance of the . - /// - /// The name of the member to get. - /// true if the name should be matched ignoring case; false otherwise. - protected GetMemberBinder(string name, bool ignoreCase) { - ContractUtils.RequiresNotNull(name, "name"); - - _name = name; - _ignoreCase = ignoreCase; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(object); } - } - - /// - /// Gets the name of the member to get. - /// - public string Name { - get { - return _name; - } - } - - /// - /// Gets the value indicating if the string comparison should ignore the case of the member name. - /// - public bool IgnoreCase { - get { - return _ignoreCase; - } - } - - /// - /// Performs the binding of the dynamic get member operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic get member operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackGetMember(DynamicMetaObject target) { - return FallbackGetMember(target, null); - } - - /// - /// When overridden in the derived class, performs the binding of the dynamic get member operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic get member operation. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackGetMember(DynamicMetaObject target, DynamicMetaObject errorSuggestion); - - /// - /// Performs the binding of the dynamic get member operation. - /// - /// The target of the dynamic get member operation. - /// An array of arguments of the dynamic get member operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, params DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.Requires(args == null || args.Length == 0, "args"); - - return target.BindGetMember(this); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/IDynamicMetaObjectProvider.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/IDynamicMetaObjectProvider.cs deleted file mode 100644 index 2977c2cb1bf..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/IDynamicMetaObjectProvider.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -namespace System.Dynamic { - /// - /// Represents a dynamic object, that can have its operations bound at runtime. - /// - /// - /// Objects that want to participate in the binding process should implement an IDynamicMetaObjectProvider interface, - /// and implement to return a . - /// - public interface IDynamicMetaObjectProvider { - /// - /// Returns the responsible for binding operations performed on this object. - /// - /// The expression tree representation of the runtime value. - /// The to bind this object. - DynamicMetaObject GetMetaObject(Expression parameter); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/IInvokeOnGetBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/IInvokeOnGetBinder.cs deleted file mode 100644 index 49d2765be80..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/IInvokeOnGetBinder.cs +++ /dev/null @@ -1,36 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -namespace System.Dynamic { - /// - /// Represents information about a dynamic get member operation, indicating - /// if the get member should invoke properties when performing the get. - /// - public interface IInvokeOnGetBinder { - /// - /// Gets the value indicating if this GetMember should invoke properties - /// when performing the get. The default value when this interface is not present - /// is true. - /// - /// - /// This property is used by some languages to get a better COM interop experience. - /// When the value is set to false, the dynamic COM object won't invoke the object - /// but will instead bind to the name, and return an object that can be invoked or - /// indexed later. This is useful for indexed properties and languages that don't - /// produce InvokeMember call sites. - /// - bool InvokeOnGet { get; } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeBinder.cs deleted file mode 100644 index 248bb542b02..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeBinder.cs +++ /dev/null @@ -1,88 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - - /// - /// Represents the invoke dynamic operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class InvokeBinder : DynamicMetaObjectBinder { - private readonly CallInfo _callInfo; - - /// - /// Initializes a new instance of the . - /// - /// The signature of the arguments at the call site. - protected InvokeBinder(CallInfo callInfo) { - ContractUtils.RequiresNotNull(callInfo, "callInfo"); - _callInfo = callInfo; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(object); } - } - - /// - /// Gets the signature of the arguments at the call site. - /// - public CallInfo CallInfo { - get { return _callInfo; } - } - - /// - /// Performs the binding of the dynamic invoke operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic invoke operation. - /// The arguments of the dynamic invoke operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args) { - return FallbackInvoke(target, args, null); - } - - /// - /// Performs the binding of the dynamic invoke operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic invoke operation. - /// The arguments of the dynamic invoke operation. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion); - - /// - /// Performs the binding of the dynamic invoke operation. - /// - /// The target of the dynamic invoke operation. - /// An array of arguments of the dynamic invoke operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.RequiresNotNullItems(args, "args"); - - return target.BindInvoke(this, args); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeMemberBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeMemberBinder.cs deleted file mode 100644 index 404ff50bbf2..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/InvokeMemberBinder.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - - /// - /// Represents the invoke member dynamic operation at the call site, - /// providing the binding semantic and the details about the operation. - /// - public abstract class InvokeMemberBinder : DynamicMetaObjectBinder { - private readonly string _name; - private readonly bool _ignoreCase; - private readonly CallInfo _callInfo; - - /// - /// Initializes a new instance of the . - /// - /// The name of the member to invoke. - /// true if the name should be matched ignoring case; false otherwise. - /// The signature of the arguments at the call site. - protected InvokeMemberBinder(string name, bool ignoreCase, CallInfo callInfo) { - ContractUtils.RequiresNotNull(name, "name"); - ContractUtils.RequiresNotNull(callInfo, "callInfo"); - - _name = name; - _ignoreCase = ignoreCase; - _callInfo = callInfo; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(object); } - } - - /// - /// Gets the name of the member to invoke. - /// - public string Name { - get { - return _name; - } - } - - /// - /// Gets the value indicating if the string comparison should ignore the case of the member name. - /// - public bool IgnoreCase { - get { - return _ignoreCase; - } - } - - /// - /// Gets the signature of the arguments at the call site. - /// - public CallInfo CallInfo { - get { return _callInfo; } - } - - /// - /// Performs the binding of the dynamic invoke member operation. - /// - /// The target of the dynamic invoke member operation. - /// An array of arguments of the dynamic invoke member operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.RequiresNotNullItems(args, "args"); - - return target.BindInvokeMember(this, args); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - - /// - /// Performs the binding of the dynamic invoke member operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic invoke member operation. - /// The arguments of the dynamic invoke member operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackInvokeMember(DynamicMetaObject target, DynamicMetaObject[] args) { - return FallbackInvokeMember(target, args, null); - } - - /// - /// When overridden in the derived class, performs the binding of the dynamic invoke member operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic invoke member operation. - /// The arguments of the dynamic invoke member operation. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackInvokeMember(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion); - - /// - /// When overridden in the derived class, performs the binding of the dynamic invoke operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic invoke operation. - /// The arguments of the dynamic invoke operation. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - /// - /// This method is called by the target when the target implements the invoke member operation - /// as a sequence of get member, and invoke, to let the - /// request the binding of the invoke operation only. - /// - public abstract DynamicMetaObject FallbackInvoke(DynamicMetaObject target, DynamicMetaObject[] args, DynamicMetaObject errorSuggestion); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/RuleCache.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/RuleCache.cs deleted file mode 100644 index a7865f7e6e1..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/RuleCache.cs +++ /dev/null @@ -1,116 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.ComponentModel; -using System.Diagnostics; -using System.Dynamic.Utils; - -namespace System.Runtime.CompilerServices { - /// - /// This API supports the .NET Framework infrastructure and is not intended to be used directly from your code. - /// Represents a cache of runtime binding rules. - /// - /// The delegate type. - [EditorBrowsable(EditorBrowsableState.Never), DebuggerStepThrough] - public class RuleCache where T : class { - private T[] _rules = new T[0]; - private readonly Object cacheLock = new Object(); - - private const int MaxRules = 128; - - internal RuleCache() { } - - internal T[] GetRules() { - return _rules; - } - - // move the rule +2 up. - // this is called on every successful rule. - internal void MoveRule(T rule, int i) { - // limit search to MaxSearch elements. - // Rule should not get too far unless it has been already moved up. - // need a lock to make sure we are moving the right rule and not loosing any. - lock (cacheLock) { - const int MaxSearch = 8; - int count = _rules.Length - i; - if (count > MaxSearch) { - count = MaxSearch; - } - - int oldIndex = -1; - int max = Math.Min(_rules.Length, i + count); - for (int index = i; index < max; index++) { - if (_rules[index] == rule) { - oldIndex = index; - break; - } - } - if (oldIndex < 0) { - return; - } - T oldRule = _rules[oldIndex]; - _rules[oldIndex] = _rules[oldIndex - 1]; - _rules[oldIndex - 1] = _rules[oldIndex - 2]; - _rules[oldIndex - 2] = oldRule; - } - } - - internal void AddRule(T newRule) { - // need a lock to make sure we are not loosing rules. - lock (cacheLock) { - _rules = AddOrInsert(_rules, newRule); - } - } - - internal void ReplaceRule(T oldRule, T newRule) { - // need a lock to make sure we are replacing the right rule - lock (cacheLock) { - int i = Array.IndexOf(_rules, oldRule); - if (i >= 0) { - _rules[i] = newRule; - return; // DONE - } - - // could not find it. - _rules = AddOrInsert(_rules, newRule); - } - } - - - // Adds to end or or inserts items at InsertPosition - private const int InsertPosition = MaxRules / 2; - - private static T[] AddOrInsert(T[] rules, T item) { - if (rules.Length < InsertPosition) { - return rules.AddLast(item); - } - - T[] newRules; - - int newLength = rules.Length + 1; - if (newLength > MaxRules) { - newLength = MaxRules; - newRules = rules; - } else { - newRules = new T[newLength]; - } - - Array.Copy(rules, 0, newRules, 0, InsertPosition); - newRules[InsertPosition] = item; - Array.Copy(rules, InsertPosition, newRules, InsertPosition + 1, newLength - InsertPosition - 1); - return newRules; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/SetIndexBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/SetIndexBinder.cs deleted file mode 100644 index f1e8952bef3..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/SetIndexBinder.cs +++ /dev/null @@ -1,97 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - - /// - /// Represents the dynamic set index operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class SetIndexBinder : DynamicMetaObjectBinder { - private readonly CallInfo _callInfo; - - /// - /// Initializes a new instance of the . - /// - /// The signature of the arguments at the call site. - protected SetIndexBinder(CallInfo callInfo) { - ContractUtils.RequiresNotNull(callInfo, "callInfo"); - _callInfo = callInfo; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(object); } - } - - /// - /// Gets the signature of the arguments at the call site. - /// - public CallInfo CallInfo { - get { return _callInfo; } - } - - /// - /// Performs the binding of the dynamic set index operation. - /// - /// The target of the dynamic set index operation. - /// An array of arguments of the dynamic set index operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.RequiresNotNull(args, "args"); - ContractUtils.Requires(args.Length >= 2, "args"); - - DynamicMetaObject value = args[args.Length - 1]; - DynamicMetaObject[] indexes = args.RemoveLast(); - - ContractUtils.RequiresNotNull(value, "args"); - ContractUtils.RequiresNotNullItems(indexes, "args"); - - return target.BindSetIndex(this, indexes, value); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - - /// - /// Performs the binding of the dynamic set index operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic set index operation. - /// The arguments of the dynamic set index operation. - /// The value to set to the collection. - /// The representing the result of the binding. - public DynamicMetaObject FallbackSetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject value) { - return FallbackSetIndex(target, indexes, value, null); - } - - /// - /// When overridden in the derived class, performs the binding of the dynamic set index operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic set index operation. - /// The arguments of the dynamic set index operation. - /// The value to set to the collection. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackSetIndex(DynamicMetaObject target, DynamicMetaObject[] indexes, DynamicMetaObject value, DynamicMetaObject errorSuggestion); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/SetMemberBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/SetMemberBinder.cs deleted file mode 100644 index dcda1058803..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/SetMemberBinder.cs +++ /dev/null @@ -1,106 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Dynamic.Utils; - -namespace System.Dynamic { - /// - /// Represents the dynamic set member operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class SetMemberBinder : DynamicMetaObjectBinder { - private readonly string _name; - private readonly bool _ignoreCase; - - /// - /// Initializes a new instance of the . - /// - /// The name of the member to get. - /// true if the name should be matched ignoring case; false otherwise. - protected SetMemberBinder(string name, bool ignoreCase) { - ContractUtils.RequiresNotNull(name, "name"); - - _name = name; - _ignoreCase = ignoreCase; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { return typeof(object); } - } - - /// - /// Gets the name of the member to get. - /// - public string Name { - get { - return _name; - } - } - - /// - /// Gets the value indicating if the string comparison should ignore the case of the member name. - /// - public bool IgnoreCase { - get { - return _ignoreCase; - } - } - - /// - /// Performs the binding of the dynamic set member operation. - /// - /// The target of the dynamic set member operation. - /// An array of arguments of the dynamic set member operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.RequiresNotNull(args, "args"); - ContractUtils.Requires(args.Length == 1, "args"); - - var arg0 = args[0]; - ContractUtils.RequiresNotNull(arg0, "args"); - - return target.BindSetMember(this, arg0); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - - /// - /// Performs the binding of the dynamic set member operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic set member operation. - /// The value to set to the member. - /// The representing the result of the binding. - public DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value) { - return FallbackSetMember(target, value, null); - } - - /// - /// Performs the binding of the dynamic set member operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic set member operation. - /// The value to set to the member. - /// The binding result to use if binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackSetMember(DynamicMetaObject target, DynamicMetaObject value, DynamicMetaObject errorSuggestion); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/UnaryOperationBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/UnaryOperationBinder.cs deleted file mode 100644 index 5d5d45c1a91..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/UnaryOperationBinder.cs +++ /dev/null @@ -1,129 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif - -using System.Dynamic.Utils; - -namespace System.Dynamic { - /// - /// Represents the unary dynamic operation at the call site, providing the binding semantic and the details about the operation. - /// - public abstract class UnaryOperationBinder : DynamicMetaObjectBinder { - private ExpressionType _operation; - - /// - /// Initializes a new instance of the class. - /// - /// The unary operation kind. - protected UnaryOperationBinder(ExpressionType operation) { - ContractUtils.Requires(OperationIsValid(operation), "operation"); - _operation = operation; - } - - /// - /// The result type of the operation. - /// - public override sealed Type ReturnType { - get { - switch(_operation) { - case ExpressionType.IsFalse: - case ExpressionType.IsTrue: - return typeof(bool); - default: - return typeof(object); - } - } - } - - /// - /// The unary operation kind. - /// - public ExpressionType Operation { - get { - return _operation; - } - } - - /// - /// Performs the binding of the unary dynamic operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic unary operation. - /// The representing the result of the binding. - public DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target) { - return FallbackUnaryOperation(target, null); - } - - /// - /// Performs the binding of the unary dynamic operation if the target dynamic object cannot bind. - /// - /// The target of the dynamic unary operation. - /// The binding result in case the binding fails, or null. - /// The representing the result of the binding. - public abstract DynamicMetaObject FallbackUnaryOperation(DynamicMetaObject target, DynamicMetaObject errorSuggestion); - - /// - /// Performs the binding of the dynamic unary operation. - /// - /// The target of the dynamic operation. - /// An array of arguments of the dynamic operation. - /// The representing the result of the binding. - public sealed override DynamicMetaObject Bind(DynamicMetaObject target, DynamicMetaObject[] args) { - ContractUtils.RequiresNotNull(target, "target"); - ContractUtils.Requires(args == null || args.Length == 0, "args"); - - return target.BindUnaryOperation(this); - } - - // this is a standard DynamicMetaObjectBinder - internal override sealed bool IsStandardBinder { - get { - return true; - } - } - - internal static bool OperationIsValid(ExpressionType operation) { - switch (operation) { - #region Generated Unary Operation Binder Validator - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_unop_validator from: generate_tree.py - - case ExpressionType.Negate: - case ExpressionType.UnaryPlus: - case ExpressionType.Not: - case ExpressionType.Decrement: - case ExpressionType.Increment: - case ExpressionType.OnesComplement: - case ExpressionType.IsTrue: - case ExpressionType.IsFalse: - - // *** END GENERATED CODE *** - - #endregion - - case ExpressionType.Extension: - return true; - - default: - return false; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/UpdateDelegates.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/UpdateDelegates.Generated.cs deleted file mode 100644 index 3143d6e4efb..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Actions/UpdateDelegates.Generated.cs +++ /dev/null @@ -1,2658 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Utils; -#endif - -using System.Runtime.CompilerServices; -using System.Threading; - -namespace System.Dynamic { - internal static partial class UpdateDelegates { - - // - // WARNING: do not edit these methods here. The real source code lives - // in two places: generate_dynsites.py, which generates the methods in - // this file, and UpdateDelegates.cs, which dynamically generates - // methods like these at run time. If you want to make a change, edit - // *both* of those files instead - // - - #region Generated UpdateAndExecute Methods - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_update_targets from: generate_dynsites.py - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute0(CallSite site) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch0(CallSite site) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute1(CallSite site, T0 arg0) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch1(CallSite site, T0 arg0) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute2(CallSite site, T0 arg0, T1 arg1) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0, arg1); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0, arg1); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0, arg1); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch2(CallSite site, T0 arg0, T1 arg1) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute3(CallSite site, T0 arg0, T1 arg1, T2 arg2) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0, arg1, arg2); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0, arg1, arg2); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0, arg1, arg2); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch3(CallSite site, T0 arg0, T1 arg1, T2 arg2) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute4(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0, arg1, arg2, arg3); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0, arg1, arg2, arg3); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0, arg1, arg2, arg3); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch4(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute5(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0, arg1, arg2, arg3, arg4); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch5(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute6(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch6(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute7(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5, arg6 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch7(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute8(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch8(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute9(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch9(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static TRet UpdateAndExecute10(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Func[] applicable; - Func rule, originalRule = @this.Target; - TRet result; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return result; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - result = rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - if (CallSiteOps.GetMatch(site)) { - return result; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static TRet NoMatch10(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) { - site._match = false; - return default(TRet); - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid1(CallSite site, T0 arg0) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid1(CallSite site, T0 arg0) { - site._match = false; - return; - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid2(CallSite site, T0 arg0, T1 arg1) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0, arg1); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0, arg1); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0, arg1); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid2(CallSite site, T0 arg0, T1 arg1) { - site._match = false; - return; - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid3(CallSite site, T0 arg0, T1 arg1, T2 arg2) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0, arg1, arg2); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0, arg1, arg2); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0, arg1, arg2); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid3(CallSite site, T0 arg0, T1 arg1, T2 arg2) { - site._match = false; - return; - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid4(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0, arg1, arg2, arg3); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0, arg1, arg2, arg3); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0, arg1, arg2, arg3); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid4(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) { - site._match = false; - return; - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid5(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0, arg1, arg2, arg3, arg4); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0, arg1, arg2, arg3, arg4); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0, arg1, arg2, arg3, arg4); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid5(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4) { - site._match = false; - return; - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid6(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0, arg1, arg2, arg3, arg4, arg5); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid6(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5) { - site._match = false; - return; - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid7(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5, arg6 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid7(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6) { - site._match = false; - return; - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid8(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid8(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7) { - site._match = false; - return; - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid9(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid9(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8) { - site._match = false; - return; - } - - - - [Obsolete("pregenerated CallSite.Update delegate", true)] - internal static void UpdateAndExecuteVoid10(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) { - // - // Declare the locals here upfront. It actually saves JIT stack space. - // - var @this = (CallSite>)site; - Action[] applicable; - Action rule, originalRule = @this.Target; - - - // - // Create matchmaker and its site. We'll need them regardless. - // - site = CallSiteOps.CreateMatchmaker(@this); - - // - // Level 1 cache lookup - // - if ((applicable = CallSiteOps.GetRules(@this)) != null) { - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - - // if we've already tried it skip it... - if ((object)rule != (object)originalRule) { - @this.Target = rule; - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - - if (CallSiteOps.GetMatch(site)) { - CallSiteOps.UpdateRules(@this, i); - return; - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - } - } - - // - // Level 2 cache lookup - // - - // - // Any applicable rules in level 2 cache? - // - - var cache = CallSiteOps.GetRuleCache(@this); - - applicable = cache.GetRules(); - for (int i = 0; i < applicable.Length; i++) { - rule = applicable[i]; - - // - // Execute the rule - // - @this.Target = rule; - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // Rule worked. Add it to level 1 cache - // - CallSiteOps.AddRule(@this, rule); - // and then move it to the front of the L2 cache - CallSiteOps.MoveRule(cache, rule, i); - } - } - - // Rule didn't match, try the next one - CallSiteOps.ClearMatch(site); - } - - // - // Miss on Level 0, 1 and 2 caches. Create new rule - // - - rule = null; - var args = new object[] { arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9 }; - - for (; ; ) { - @this.Target = originalRule; - rule = @this.Target = @this.Binder.BindCore(@this, args); - - // - // Execute the rule on the matchmaker site - // - - try { - rule(site, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); - if (CallSiteOps.GetMatch(site)) { - return; - } - } finally { - if (CallSiteOps.GetMatch(site)) { - // - // The rule worked. Add it to level 1 cache. - // - CallSiteOps.AddRule(@this, rule); - } - } - - // Rule we got back didn't work, try another one - CallSiteOps.ClearMatch(site); - } - } - - [Obsolete("pregenerated CallSite.Update delegate", true)] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")] - internal static void NoMatchVoid10(CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9) { - site._match = false; - return; - } - - - - // *** END GENERATED CODE *** - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/BinaryExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/BinaryExpression.cs deleted file mode 100644 index 28d06baa662..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/BinaryExpression.cs +++ /dev/null @@ -1,2652 +0,0 @@ - -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents an expression that has a binary operator. - /// - [DebuggerTypeProxy(typeof(Expression.BinaryExpressionProxy))] - public class BinaryExpression : Expression { - private readonly Expression _left; - private readonly Expression _right; - - internal BinaryExpression(Expression left, Expression right) { - _left = left; - _right = right; - } - - /// - /// Gets a value that indicates whether the expression tree node can be reduced. - /// - public override bool CanReduce { - get { - // Only OpAssignments are reducible. - return IsOpAssignment(NodeType); - } - } - - private static bool IsOpAssignment(ExpressionType op) { - switch (op) { - case ExpressionType.AddAssign: - case ExpressionType.SubtractAssign: - case ExpressionType.MultiplyAssign: - case ExpressionType.AddAssignChecked: - case ExpressionType.SubtractAssignChecked: - case ExpressionType.MultiplyAssignChecked: - case ExpressionType.DivideAssign: - case ExpressionType.ModuloAssign: - case ExpressionType.PowerAssign: - case ExpressionType.AndAssign: - case ExpressionType.OrAssign: - case ExpressionType.RightShiftAssign: - case ExpressionType.LeftShiftAssign: - case ExpressionType.ExclusiveOrAssign: - return true; - } - return false; - } - - /// - /// Gets the right operand of the binary operation. - /// - public Expression Right { - get { return _right; } - } - - /// - /// Gets the left operand of the binary operation. - /// - public Expression Left { - get { return _left; } - } - - /// - /// Gets the implementing method for the binary operation. - /// - public MethodInfo Method { - get { return GetMethod(); } - } - - internal virtual MethodInfo GetMethod() { - return null; - } - - // Note: takes children in evaluation order, which is also the order - // that ExpressionVisitor visits them. Having them this way reduces the - // chances people will make a mistake and use an inconsistent order in - // derived visitors. - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public BinaryExpression Update(Expression left, LambdaExpression conversion, Expression right) { - if (left == Left && right == Right && conversion == Conversion) { - return this; - } - if (IsReferenceComparison) { - if (NodeType == ExpressionType.Equal) { - return Expression.ReferenceEqual(left, right); - } else { - return Expression.ReferenceNotEqual(left, right); - } - } - return Expression.MakeBinary(NodeType, left, right, IsLiftedToNull, Method, conversion); - } - - /// - /// Reduces the binary expression node to a simpler expression. - /// If CanReduce returns true, this should return a valid expression. - /// This method is allowed to return another node which itself - /// must be reduced. - /// - /// The reduced expression. - public override Expression Reduce() { - // Only reduce OpAssignment expressions. - if (IsOpAssignment(NodeType)) { - switch (_left.NodeType) { - case ExpressionType.MemberAccess: - return ReduceMember(); - - case ExpressionType.Index: - return ReduceIndex(); - - default: - return ReduceVariable(); - } - } - return this; - } - - // Return the corresponding Op of an assignment op. - private static ExpressionType GetBinaryOpFromAssignmentOp(ExpressionType op) { - Debug.Assert(IsOpAssignment(op)); - switch (op) { - case ExpressionType.AddAssign: - return ExpressionType.Add; - case ExpressionType.AddAssignChecked: - return ExpressionType.AddChecked; - case ExpressionType.SubtractAssign: - return ExpressionType.Subtract; - case ExpressionType.SubtractAssignChecked: - return ExpressionType.SubtractChecked; - case ExpressionType.MultiplyAssign: - return ExpressionType.Multiply; - case ExpressionType.MultiplyAssignChecked: - return ExpressionType.MultiplyChecked; - case ExpressionType.DivideAssign: - return ExpressionType.Divide; - case ExpressionType.ModuloAssign: - return ExpressionType.Modulo; - case ExpressionType.PowerAssign: - return ExpressionType.Power; - case ExpressionType.AndAssign: - return ExpressionType.And; - case ExpressionType.OrAssign: - return ExpressionType.Or; - case ExpressionType.RightShiftAssign: - return ExpressionType.RightShift; - case ExpressionType.LeftShiftAssign: - return ExpressionType.LeftShift; - case ExpressionType.ExclusiveOrAssign: - return ExpressionType.ExclusiveOr; - default: - // must be an error - throw Error.InvalidOperation("op"); - } - - } - - private Expression ReduceVariable() { - // v (op)= r - // ... is reduced into ... - // v = v (op) r - ExpressionType op = GetBinaryOpFromAssignmentOp(NodeType); - Expression r = Expression.MakeBinary(op, _left, _right, false, Method); - LambdaExpression conversion = GetConversion(); - if (conversion != null) { - r = Expression.Invoke(conversion, r); - } - return Expression.Assign(_left, r); - } - - private Expression ReduceMember() { - MemberExpression member = (MemberExpression)_left; - - if (member.Expression == null) { - // static member, reduce the same as variable - return ReduceVariable(); - } else { - // left.b (op)= r - // ... is reduced into ... - // temp1 = left - // temp2 = temp1.b (op) r - // temp1.b = temp2 - // temp2 - ParameterExpression temp1 = Variable(member.Expression.Type, "temp1"); - - // 1. temp1 = left - Expression e1 = Expression.Assign(temp1, member.Expression); - - // 2. temp2 = temp1.b (op) r - ExpressionType op = GetBinaryOpFromAssignmentOp(NodeType); - Expression e2 = Expression.MakeBinary(op, Expression.MakeMemberAccess(temp1, member.Member), _right, false, Method); - LambdaExpression conversion = GetConversion(); - if (conversion != null) { - e2 = Expression.Invoke(conversion, e2); - } - ParameterExpression temp2 = Variable(e2.Type, "temp2"); - e2 = Expression.Assign(temp2, e2); - - // 3. temp1.b = temp2 - Expression e3 = Expression.Assign(Expression.MakeMemberAccess(temp1, member.Member), temp2); - - // 3. temp2 - Expression e4 = temp2; - - return Expression.Block( - new ParameterExpression[] { temp1, temp2 }, - e1, e2, e3, e4 - ); - } - } - - private Expression ReduceIndex() { - // left[a0, a1, ... aN] (op)= r - // - // ... is reduced into ... - // - // tempObj = left - // tempArg0 = a0 - // ... - // tempArgN = aN - // tempValue = tempObj[tempArg0, ... tempArgN] (op) r - // tempObj[tempArg0, ... tempArgN] = tempValue - - var index = (IndexExpression)_left; - - var vars = new List(index.Arguments.Count + 2); - var exprs = new List(index.Arguments.Count + 3); - - var tempObj = Expression.Variable(index.Object.Type, "tempObj"); - vars.Add(tempObj); - exprs.Add(Expression.Assign(tempObj, index.Object)); - - var tempArgs = new List(index.Arguments.Count); - foreach (var arg in index.Arguments) { - var tempArg = Expression.Variable(arg.Type, "tempArg" + tempArgs.Count); - vars.Add(tempArg); - tempArgs.Add(tempArg); - exprs.Add(Expression.Assign(tempArg, arg)); - } - - var tempIndex = Expression.MakeIndex(tempObj, index.Indexer, tempArgs); - - // tempValue = tempObj[tempArg0, ... tempArgN] (op) r - ExpressionType binaryOp = GetBinaryOpFromAssignmentOp(NodeType); - Expression op = Expression.MakeBinary(binaryOp, tempIndex, _right, false, Method); - LambdaExpression conversion = GetConversion(); - if (conversion != null) { - op = Expression.Invoke(conversion, op); - } - var tempValue = Expression.Variable(op.Type, "tempValue"); - vars.Add(tempValue); - exprs.Add(Expression.Assign(tempValue, op)); - - // tempObj[tempArg0, ... tempArgN] = tempValue - exprs.Add(Expression.Assign(tempIndex, tempValue)); - - return Expression.Block(vars, exprs); - } - - /// - /// Gets the type conversion function that is used by a coalescing or compound assignment operation. - /// - public LambdaExpression Conversion { - get { return GetConversion(); } - } - - internal virtual LambdaExpression GetConversion() { - return null; - } - - /// - /// Gets a value that indicates whether the expression tree node represents a lifted call to an operator. - /// - public bool IsLifted { - get { - if (NodeType == ExpressionType.Coalesce || NodeType == ExpressionType.Assign) { - return false; - } - if (TypeUtils.IsNullableType(_left.Type)) { - MethodInfo method = GetMethod(); - return method == null || - !TypeUtils.AreEquivalent(method.GetParametersCached()[0].ParameterType.GetNonRefType(), _left.Type); - } - return false; - } - } - /// - /// Gets a value that indicates whether the expression tree node represents a lifted call to an operator whose return type is lifted to a nullable type. - /// - public bool IsLiftedToNull { - get { - return IsLifted && TypeUtils.IsNullableType(Type); - } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitBinary(this); - } - - internal static Expression Create(ExpressionType nodeType, Expression left, Expression right, Type type, MethodInfo method, LambdaExpression conversion) { - if (nodeType == ExpressionType.Assign) { - Debug.Assert(method == null && TypeUtils.AreEquivalent(type, left.Type)); - return new AssignBinaryExpression(left, right); - } - if (conversion != null) { - Debug.Assert(method == null && TypeUtils.AreEquivalent(type, right.Type) && nodeType == ExpressionType.Coalesce); - return new CoalesceConversionBinaryExpression(left, right, conversion); - } - if (method != null) { - return new MethodBinaryExpression(nodeType, left, right, type, method); - } - if (type == typeof(bool)) { - return new LogicalBinaryExpression(nodeType, left, right); - } - return new SimpleBinaryExpression(nodeType, left, right, type); - } - - internal bool IsLiftedLogical { - get { - Type left = _left.Type; - Type right = _right.Type; - MethodInfo method = GetMethod(); - ExpressionType kind = NodeType; - - return - (kind == ExpressionType.AndAlso || kind == ExpressionType.OrElse) && - TypeUtils.AreEquivalent(right, left) && - TypeUtils.IsNullableType(left) && - method != null && - TypeUtils.AreEquivalent(method.ReturnType, TypeUtils.GetNonNullableType(left)); - } - } - - internal bool IsReferenceComparison { - get { - Type left = _left.Type; - Type right = _right.Type; - MethodInfo method = GetMethod(); - ExpressionType kind = NodeType; - - return (kind == ExpressionType.Equal || kind == ExpressionType.NotEqual) && - method == null && !left.IsValueType && !right.IsValueType; - } - } - - // - // For a userdefined type T which has op_False defined and L, R are - // nullable, (L AndAlso R) is computed as: - // - // L.HasValue - // ? T.op_False(L.GetValueOrDefault()) - // ? L - // : R.HasValue - // ? (T?)(T.op_BitwiseAnd(L.GetValueOrDefault(), R.GetValueOrDefault())) - // : null - // : null - // - // For a userdefined type T which has op_True defined and L, R are - // nullable, (L OrElse R) is computed as: - // - // L.HasValue - // ? T.op_True(L.GetValueOrDefault()) - // ? L - // : R.HasValue - // ? (T?)(T.op_BitwiseOr(L.GetValueOrDefault(), R.GetValueOrDefault())) - // : null - // : null - // - // - // This is the same behavior as VB. If you think about it, it makes - // sense: it's combining the normal pattern for short-circuiting - // operators, with the normal pattern for lifted operations: if either - // of the operands is null, the result is also null. - // - internal Expression ReduceUserdefinedLifted() { - Debug.Assert(IsLiftedLogical); - - var left = Parameter(_left.Type, "left"); - var right = Parameter(Right.Type, "right"); - string opName = NodeType == ExpressionType.AndAlso ? "op_False" : "op_True"; - MethodInfo opTrueFalse = TypeUtils.GetBooleanOperator(Method.DeclaringType, opName); - Debug.Assert(opTrueFalse != null); - - return Block( - new[] { left }, - Assign(left, _left), - Condition( - Property(left, "HasValue"), - Condition( - Call(opTrueFalse, Call(left, "GetValueOrDefault", null)), - left, - Block( - new[] { right }, - Assign(right, _right), - Condition( - Property(right, "HasValue"), - Convert( - Call( - Method, - Call(left, "GetValueOrDefault", null), - Call(right, "GetValueOrDefault", null) - ), - Type - ), - Constant(null, Type) - ) - ) - ), - Constant(null, Type) - ) - ); - } - } - - // Optimized representation of simple logical expressions: - // && || == != > < >= <= - internal sealed class LogicalBinaryExpression : BinaryExpression { - private readonly ExpressionType _nodeType; - - internal LogicalBinaryExpression(ExpressionType nodeType, Expression left, Expression right) - : base(left, right) { - _nodeType = nodeType; - } - - public sealed override Type Type { - get { return typeof(bool); } - } - - public sealed override ExpressionType NodeType { - get { return _nodeType; } - } - } - - // Optimized assignment node, only holds onto children - internal sealed class AssignBinaryExpression : BinaryExpression { - internal AssignBinaryExpression(Expression left, Expression right) - : base(left, right) { - } - - public sealed override Type Type { - get { return Left.Type; } - } - - public sealed override ExpressionType NodeType { - get { return ExpressionType.Assign; } - } - } - - // Coalesce with conversion - // This is not a frequently used node, but rather we want to save every - // other BinaryExpression from holding onto the null conversion lambda - internal sealed class CoalesceConversionBinaryExpression : BinaryExpression { - private readonly LambdaExpression _conversion; - - internal CoalesceConversionBinaryExpression(Expression left, Expression right, LambdaExpression conversion) - : base(left, right) { - _conversion = conversion; - } - - internal override LambdaExpression GetConversion() { - return _conversion; - } - - public sealed override ExpressionType NodeType { - get { return ExpressionType.Coalesce; } - } - - public sealed override Type Type { - get { return Right.Type; } - } - } - - // OpAssign with conversion - // This is not a frequently used node, but rather we want to save every - // other BinaryExpression from holding onto the null conversion lambda - internal sealed class OpAssignMethodConversionBinaryExpression : MethodBinaryExpression { - private readonly LambdaExpression _conversion; - - internal OpAssignMethodConversionBinaryExpression(ExpressionType nodeType, Expression left, Expression right, Type type, MethodInfo method, LambdaExpression conversion) - : base(nodeType, left, right, type, method) { - _conversion = conversion; - } - - internal override LambdaExpression GetConversion() { - return _conversion; - } - } - - // Class that handles most binary expressions - // If needed, it can be optimized even more (often Type == left.Type) - internal class SimpleBinaryExpression : BinaryExpression { - private readonly ExpressionType _nodeType; - private readonly Type _type; - - internal SimpleBinaryExpression(ExpressionType nodeType, Expression left, Expression right, Type type) - : base(left, right) { - _nodeType = nodeType; - _type = type; - } - - public sealed override ExpressionType NodeType { - get { return _nodeType; } - } - - public sealed override Type Type { - get { return _type; } - } - } - - // Class that handles binary expressions with a method - // If needed, it can be optimized even more (often Type == method.ReturnType) - internal class MethodBinaryExpression : SimpleBinaryExpression { - private readonly MethodInfo _method; - - internal MethodBinaryExpression(ExpressionType nodeType, Expression left, Expression right, Type type, MethodInfo method) - : base(nodeType, left, right, type) { - _method = method; - } - - internal override MethodInfo GetMethod() { - return _method; - } - } - - public partial class Expression { - - #region Assign - - /// - /// Creates a that represents an assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - /// - public static BinaryExpression Assign(Expression left, Expression right) { - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - TypeUtils.ValidateType(left.Type); - TypeUtils.ValidateType(right.Type); - if (!TypeUtils.AreReferenceAssignable(left.Type, right.Type)) { - throw Error.ExpressionTypeDoesNotMatchAssignment(right.Type, left.Type); - } - return new AssignBinaryExpression(left, right); - } - - #endregion - - - private static BinaryExpression GetUserDefinedBinaryOperator(ExpressionType binaryType, string name, Expression left, Expression right, bool liftToNull) { - // try exact match first - MethodInfo method = GetUserDefinedBinaryOperator(binaryType, left.Type, right.Type, name); - if (method != null) { - return new MethodBinaryExpression(binaryType, left, right, method.ReturnType, method); - } - // try lifted call - if (TypeUtils.IsNullableType(left.Type) && TypeUtils.IsNullableType(right.Type)) { - Type nnLeftType = TypeUtils.GetNonNullableType(left.Type); - Type nnRightType = TypeUtils.GetNonNullableType(right.Type); - method = GetUserDefinedBinaryOperator(binaryType, nnLeftType, nnRightType, name); - if (method != null && method.ReturnType.IsValueType && !TypeUtils.IsNullableType(method.ReturnType)) { - if (method.ReturnType != typeof(bool) || liftToNull) { - return new MethodBinaryExpression(binaryType, left, right, TypeUtils.GetNullableType(method.ReturnType), method); - } else { - return new MethodBinaryExpression(binaryType, left, right, typeof(bool), method); - } - } - } - return null; - } - - - private static BinaryExpression GetMethodBasedBinaryOperator(ExpressionType binaryType, Expression left, Expression right, MethodInfo method, bool liftToNull) { - System.Diagnostics.Debug.Assert(method != null); - ValidateOperator(method); - ParameterInfo[] pms = method.GetParametersCached(); - if (pms.Length != 2) - throw Error.IncorrectNumberOfMethodCallArguments(method); - if (ParameterIsAssignable(pms[0], left.Type) && ParameterIsAssignable(pms[1], right.Type)) { - ValidateParamswithOperandsOrThrow(pms[0].ParameterType, left.Type, binaryType, method.Name); - ValidateParamswithOperandsOrThrow(pms[1].ParameterType, right.Type, binaryType, method.Name); - return new MethodBinaryExpression(binaryType, left, right, method.ReturnType, method); - - } - // check for lifted call - if (TypeUtils.IsNullableType(left.Type) && TypeUtils.IsNullableType(right.Type) && - ParameterIsAssignable(pms[0], TypeUtils.GetNonNullableType(left.Type)) && - ParameterIsAssignable(pms[1], TypeUtils.GetNonNullableType(right.Type)) && - method.ReturnType.IsValueType && !TypeUtils.IsNullableType(method.ReturnType)) { - if (method.ReturnType != typeof(bool) || liftToNull) { - return new MethodBinaryExpression(binaryType, left, right, TypeUtils.GetNullableType(method.ReturnType), method); - } else { - return new MethodBinaryExpression(binaryType, left, right, typeof(bool), method); - } - } - throw Error.OperandTypesDoNotMatchParameters(binaryType, method.Name); - } - - private static BinaryExpression GetMethodBasedAssignOperator(ExpressionType binaryType, Expression left, Expression right, MethodInfo method, LambdaExpression conversion, bool liftToNull) { - BinaryExpression b = GetMethodBasedBinaryOperator(binaryType, left, right, method, liftToNull); - if (conversion == null) { - // return type must be assignable back to the left type - if (!TypeUtils.AreReferenceAssignable(left.Type, b.Type)) { - throw Error.UserDefinedOpMustHaveValidReturnType(binaryType, b.Method.Name); - } - } else { - // add the conversion to the result - ValidateOpAssignConversionLambda(conversion, b.Left, b.Method, b.NodeType); - b = new OpAssignMethodConversionBinaryExpression(b.NodeType, b.Left, b.Right, b.Left.Type, b.Method, conversion); - } - return b; - } - - - private static BinaryExpression GetUserDefinedBinaryOperatorOrThrow(ExpressionType binaryType, string name, Expression left, Expression right, bool liftToNull) { - BinaryExpression b = GetUserDefinedBinaryOperator(binaryType, name, left, right, liftToNull); - if (b != null) { - ParameterInfo[] pis = b.Method.GetParametersCached(); - ValidateParamswithOperandsOrThrow(pis[0].ParameterType, left.Type, binaryType, name); - ValidateParamswithOperandsOrThrow(pis[1].ParameterType, right.Type, binaryType, name); - return b; - } - throw Error.BinaryOperatorNotDefined(binaryType, left.Type, right.Type); - } - - private static BinaryExpression GetUserDefinedAssignOperatorOrThrow(ExpressionType binaryType, string name, Expression left, Expression right, LambdaExpression conversion, bool liftToNull) { - BinaryExpression b = GetUserDefinedBinaryOperatorOrThrow(binaryType, name, left, right, liftToNull); - if (conversion == null) { - // return type must be assignable back to the left type - if (!TypeUtils.AreReferenceAssignable(left.Type, b.Type)) { - throw Error.UserDefinedOpMustHaveValidReturnType(binaryType, b.Method.Name); - } - } else { - // add the conversion to the result - ValidateOpAssignConversionLambda(conversion, b.Left, b.Method, b.NodeType); - b = new OpAssignMethodConversionBinaryExpression(b.NodeType, b.Left, b.Right, b.Left.Type, b.Method, conversion); - } - return b; - } - - - private static MethodInfo GetUserDefinedBinaryOperator(ExpressionType binaryType, Type leftType, Type rightType, string name) { - // UNDONE: This algorithm is wrong, we should be checking for uniqueness and erroring if - // UNDONE: it is defined on both types. - Type[] types = new Type[] { leftType, rightType }; - Type nnLeftType = TypeUtils.GetNonNullableType(leftType); - Type nnRightType = TypeUtils.GetNonNullableType(rightType); - BindingFlags flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; - MethodInfo method = nnLeftType.GetMethodValidated(name, flags, null, types, null); - if (method == null && !TypeUtils.AreEquivalent(leftType, rightType)) { - method = nnRightType.GetMethodValidated(name, flags, null, types, null); - } - - if (IsLiftingConditionalLogicalOperator(leftType, rightType, method, binaryType)) { - method = GetUserDefinedBinaryOperator(binaryType, nnLeftType, nnRightType, name); - } - return method; - } - - - private static bool IsLiftingConditionalLogicalOperator(Type left, Type right, MethodInfo method, ExpressionType binaryType) { - return TypeUtils.IsNullableType(right) && - TypeUtils.IsNullableType(left) && - method == null && - (binaryType == ExpressionType.AndAlso || binaryType == ExpressionType.OrElse); - } - - - internal static bool ParameterIsAssignable(ParameterInfo pi, Type argType) { - Type pType = pi.ParameterType; - if (pType.IsByRef) - pType = pType.GetElementType(); - return TypeUtils.AreReferenceAssignable(pType, argType); - } - - - private static void ValidateParamswithOperandsOrThrow(Type paramType, Type operandType, ExpressionType exprType, string name) { - if (TypeUtils.IsNullableType(paramType) && !TypeUtils.IsNullableType(operandType)) { - throw Error.OperandTypesDoNotMatchParameters(exprType, name); - } - } - - - private static void ValidateOperator(MethodInfo method) { - System.Diagnostics.Debug.Assert(method != null); - ValidateMethodInfo(method); - if (!method.IsStatic) - throw Error.UserDefinedOperatorMustBeStatic(method); - if (method.ReturnType == typeof(void)) - throw Error.UserDefinedOperatorMustNotBeVoid(method); - } - - - private static void ValidateMethodInfo(MethodInfo method) { - if (method.IsGenericMethodDefinition) - throw Error.MethodIsGeneric(method); - if (method.ContainsGenericParameters) - throw Error.MethodContainsGenericParameters(method); - } - - - private static bool IsNullComparison(Expression left, Expression right) { - // If we have x==null, x!=null, null==x or null!=x where x is - // nullable but not null, then this is treated as a call to x.HasValue - // and is legal even if there is no equality operator defined on the - // type of x. - if (IsNullConstant(left) && !IsNullConstant(right) && TypeUtils.IsNullableType(right.Type)) { - return true; - } - if (IsNullConstant(right) && !IsNullConstant(left) && TypeUtils.IsNullableType(left.Type)) { - return true; - } - return false; - } - - - // Note: this has different meaning than ConstantCheck.IsNull - // That function attempts to determine if the result of a tree will be - // null at runtime. This function is used at tree construction time and - // only looks for a ConstantExpression with a null Value. It can't - // become "smarter" or that would break tree construction. - private static bool IsNullConstant(Expression e) { - var c = e as ConstantExpression; - return c != null && c.Value == null; - } - - - private static void ValidateUserDefinedConditionalLogicOperator(ExpressionType nodeType, Type left, Type right, MethodInfo method) { - ValidateOperator(method); - ParameterInfo[] pms = method.GetParametersCached(); - if (pms.Length != 2) - throw Error.IncorrectNumberOfMethodCallArguments(method); - if (!ParameterIsAssignable(pms[0], left)) { - if (!(TypeUtils.IsNullableType(left) && ParameterIsAssignable(pms[0], TypeUtils.GetNonNullableType(left)))) - throw Error.OperandTypesDoNotMatchParameters(nodeType, method.Name); - } - if (!ParameterIsAssignable(pms[1], right)) { - if (!(TypeUtils.IsNullableType(right) && ParameterIsAssignable(pms[1], TypeUtils.GetNonNullableType(right)))) - throw Error.OperandTypesDoNotMatchParameters(nodeType, method.Name); - } - if (pms[0].ParameterType != pms[1].ParameterType) { - throw Error.UserDefinedOpMustHaveConsistentTypes(nodeType, method.Name); - } - if (method.ReturnType != pms[0].ParameterType) { - throw Error.UserDefinedOpMustHaveConsistentTypes(nodeType, method.Name); - } - if (IsValidLiftedConditionalLogicalOperator(left, right, pms)) { - left = TypeUtils.GetNonNullableType(left); - right = TypeUtils.GetNonNullableType(left); - } - MethodInfo opTrue = TypeUtils.GetBooleanOperator(method.DeclaringType, "op_True"); - MethodInfo opFalse = TypeUtils.GetBooleanOperator(method.DeclaringType, "op_False"); - if (opTrue == null || opTrue.ReturnType != typeof(bool) || - opFalse == null || opFalse.ReturnType != typeof(bool)) { - throw Error.LogicalOperatorMustHaveBooleanOperators(nodeType, method.Name); - } - VerifyOpTrueFalse(nodeType, left, opFalse); - VerifyOpTrueFalse(nodeType, left, opTrue); - } - - private static void VerifyOpTrueFalse(ExpressionType nodeType, Type left, MethodInfo opTrue) { - ParameterInfo[] pmsOpTrue = opTrue.GetParametersCached(); - if (pmsOpTrue.Length != 1) - throw Error.IncorrectNumberOfMethodCallArguments(opTrue); - - if (!ParameterIsAssignable(pmsOpTrue[0], left)) { - if (!(TypeUtils.IsNullableType(left) && ParameterIsAssignable(pmsOpTrue[0], TypeUtils.GetNonNullableType(left)))) - throw Error.OperandTypesDoNotMatchParameters(nodeType, opTrue.Name); - } - } - - private static bool IsValidLiftedConditionalLogicalOperator(Type left, Type right, ParameterInfo[] pms) { - return TypeUtils.AreEquivalent(left, right) && - TypeUtils.IsNullableType(right) && - TypeUtils.AreEquivalent(pms[1].ParameterType, TypeUtils.GetNonNullableType(right)); - } - - - /// - /// Creates a BinaryExpression, given the left and right operands, by calling an appropriate factory method. - /// - /// The ExpressionType that specifies the type of binary operation. - /// An Expression that represents the left operand. - /// An Expression that represents the right operand. - /// The BinaryExpression that results from calling the appropriate factory method. - public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right) { - return MakeBinary(binaryType, left, right, false, null, null); - } - - /// - /// Creates a BinaryExpression, given the left and right operands, by calling an appropriate factory method. - /// - /// The ExpressionType that specifies the type of binary operation. - /// An Expression that represents the left operand. - /// An Expression that represents the right operand. - /// true to set IsLiftedToNull to true; false to set IsLiftedToNull to false. - /// A MethodInfo that specifies the implementing method. - /// The BinaryExpression that results from calling the appropriate factory method. - public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method) { - return MakeBinary(binaryType, left, right, liftToNull, method, null); - } - - /// - /// - /// Creates a BinaryExpression, given the left and right operands, by calling an appropriate factory method. - /// - /// The ExpressionType that specifies the type of binary operation. - /// An Expression that represents the left operand. - /// An Expression that represents the right operand. - /// true to set IsLiftedToNull to true; false to set IsLiftedToNull to false. - /// A MethodInfo that specifies the implementing method. - /// A LambdaExpression that represents a type conversion function. This parameter is used if binaryType is Coalesce or compound assignment. - /// The BinaryExpression that results from calling the appropriate factory method. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - public static BinaryExpression MakeBinary(ExpressionType binaryType, Expression left, Expression right, bool liftToNull, MethodInfo method, LambdaExpression conversion) { - switch (binaryType) { - case ExpressionType.Add: - return Add(left, right, method); - case ExpressionType.AddChecked: - return AddChecked(left, right, method); - case ExpressionType.Subtract: - return Subtract(left, right, method); - case ExpressionType.SubtractChecked: - return SubtractChecked(left, right, method); - case ExpressionType.Multiply: - return Multiply(left, right, method); - case ExpressionType.MultiplyChecked: - return MultiplyChecked(left, right, method); - case ExpressionType.Divide: - return Divide(left, right, method); - case ExpressionType.Modulo: - return Modulo(left, right, method); - case ExpressionType.Power: - return Power(left, right, method); - case ExpressionType.And: - return And(left, right, method); - case ExpressionType.AndAlso: - return AndAlso(left, right, method); - case ExpressionType.Or: - return Or(left, right, method); - case ExpressionType.OrElse: - return OrElse(left, right, method); - case ExpressionType.LessThan: - return LessThan(left, right, liftToNull, method); - case ExpressionType.LessThanOrEqual: - return LessThanOrEqual(left, right, liftToNull, method); - case ExpressionType.GreaterThan: - return GreaterThan(left, right, liftToNull, method); - case ExpressionType.GreaterThanOrEqual: - return GreaterThanOrEqual(left, right, liftToNull, method); - case ExpressionType.Equal: - return Equal(left, right, liftToNull, method); - case ExpressionType.NotEqual: - return NotEqual(left, right, liftToNull, method); - case ExpressionType.ExclusiveOr: - return ExclusiveOr(left, right, method); - case ExpressionType.Coalesce: - return Coalesce(left, right, conversion); - case ExpressionType.ArrayIndex: - return ArrayIndex(left, right); - case ExpressionType.RightShift: - return RightShift(left, right, method); - case ExpressionType.LeftShift: - return LeftShift(left, right, method); - case ExpressionType.Assign: - return Assign(left, right); - case ExpressionType.AddAssign: - return AddAssign(left, right, method, conversion); - case ExpressionType.AndAssign: - return AndAssign(left, right, method, conversion); - case ExpressionType.DivideAssign: - return DivideAssign(left, right, method, conversion); - case ExpressionType.ExclusiveOrAssign: - return ExclusiveOrAssign(left, right, method, conversion); - case ExpressionType.LeftShiftAssign: - return LeftShiftAssign(left, right, method, conversion); - case ExpressionType.ModuloAssign: - return ModuloAssign(left, right, method, conversion); - case ExpressionType.MultiplyAssign: - return MultiplyAssign(left, right, method, conversion); - case ExpressionType.OrAssign: - return OrAssign(left, right, method, conversion); - case ExpressionType.PowerAssign: - return PowerAssign(left, right, method, conversion); - case ExpressionType.RightShiftAssign: - return RightShiftAssign(left, right, method, conversion); - case ExpressionType.SubtractAssign: - return SubtractAssign(left, right, method, conversion); - case ExpressionType.AddAssignChecked: - return AddAssignChecked(left, right, method, conversion); - case ExpressionType.SubtractAssignChecked: - return SubtractAssignChecked(left, right, method, conversion); - case ExpressionType.MultiplyAssignChecked: - return MultiplyAssignChecked(left, right, method, conversion); - default: - throw Error.UnhandledBinary(binaryType); - } - } - - #region Equality Operators - - - /// - /// Creates a that represents an equality comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression Equal(Expression left, Expression right) { - return Equal(left, right, false, null); - } - - /// - /// Creates a that represents an equality comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// true to set IsLiftedToNull to true; false to set IsLiftedToNull to false. - /// A that has the property equal to - /// and the , , , and properties set to the specified values. - /// - public static BinaryExpression Equal(Expression left, Expression right, bool liftToNull, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - return GetEqualityComparisonOperator(ExpressionType.Equal, "op_Equality", left, right, liftToNull); - } - return GetMethodBasedBinaryOperator(ExpressionType.Equal, left, right, method, liftToNull); - } - - /// - /// Creates a that represents a reference equality comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - /// - public static BinaryExpression ReferenceEqual(Expression left, Expression right) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (TypeUtils.HasReferenceEquality(left.Type, right.Type)) { - return new LogicalBinaryExpression(ExpressionType.Equal, left, right); - } - throw Error.ReferenceEqualityNotDefined(left.Type, right.Type); - } - - /// - /// Creates a that represents an inequality comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression NotEqual(Expression left, Expression right) { - return NotEqual(left, right, false, null); - } - - /// - /// Creates a that represents an inequality comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// true to set IsLiftedToNull to true; false to set IsLiftedToNull to false. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , and properties set to the specified values. - /// - public static BinaryExpression NotEqual(Expression left, Expression right, bool liftToNull, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - return GetEqualityComparisonOperator(ExpressionType.NotEqual, "op_Inequality", left, right, liftToNull); - } - return GetMethodBasedBinaryOperator(ExpressionType.NotEqual, left, right, method, liftToNull); - } - - /// - /// Creates a that represents a reference inequality comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - /// - public static BinaryExpression ReferenceNotEqual(Expression left, Expression right) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (TypeUtils.HasReferenceEquality(left.Type, right.Type)) { - return new LogicalBinaryExpression(ExpressionType.NotEqual, left, right); - } - throw Error.ReferenceEqualityNotDefined(left.Type, right.Type); - } - - private static BinaryExpression GetEqualityComparisonOperator(ExpressionType binaryType, string opName, Expression left, Expression right, bool liftToNull) { - // known comparison - numeric types, bools, object, enums - if (left.Type == right.Type && (TypeUtils.IsNumeric(left.Type) || - left.Type == typeof(object) || - TypeUtils.IsBool(left.Type) || - TypeUtils.GetNonNullableType(left.Type).IsEnum)) { - if (TypeUtils.IsNullableType(left.Type) && liftToNull) { - return new SimpleBinaryExpression(binaryType, left, right, typeof(bool?)); - } else { - return new LogicalBinaryExpression(binaryType, left, right); - } - } - // look for user defined operator - BinaryExpression b = GetUserDefinedBinaryOperator(binaryType, opName, left, right, liftToNull); - if (b != null) { - return b; - } - if (TypeUtils.HasBuiltInEqualityOperator(left.Type, right.Type) || IsNullComparison(left, right)) { - if (TypeUtils.IsNullableType(left.Type) && liftToNull) { - return new SimpleBinaryExpression(binaryType, left, right, typeof(bool?)); - } else { - return new LogicalBinaryExpression(binaryType, left, right); - } - } - throw Error.BinaryOperatorNotDefined(binaryType, left.Type, right.Type); - } - - #endregion - - #region Comparison Expressions - - - /// - /// Creates a that represents a "greater than" numeric comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression GreaterThan(Expression left, Expression right) { - return GreaterThan(left, right, false, null); - } - - /// - /// Creates a that represents a "greater than" numeric comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// true to set IsLiftedToNull to true; false to set IsLiftedToNull to false. - /// A that has the property equal to - /// and the , , , and properties set to the specified values. - /// - public static BinaryExpression GreaterThan(Expression left, Expression right, bool liftToNull, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - return GetComparisonOperator(ExpressionType.GreaterThan, "op_GreaterThan", left, right, liftToNull); - } - return GetMethodBasedBinaryOperator(ExpressionType.GreaterThan, left, right, method, liftToNull); - } - - /// - /// Creates a that represents a "less than" numeric comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - - public static BinaryExpression LessThan(Expression left, Expression right) { - return LessThan(left, right, false, null); - } - - /// - /// Creates a that represents a "less than" numeric comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// true to set IsLiftedToNull to true; false to set IsLiftedToNull to false. - /// A that has the property equal to - /// and the , , , and properties set to the specified values. - /// - public static BinaryExpression LessThan(Expression left, Expression right, bool liftToNull, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - return GetComparisonOperator(ExpressionType.LessThan, "op_LessThan", left, right, liftToNull); - } - return GetMethodBasedBinaryOperator(ExpressionType.LessThan, left, right, method, liftToNull); - } - - - /// - /// Creates a that represents a "greater than or equal" numeric comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression GreaterThanOrEqual(Expression left, Expression right) { - return GreaterThanOrEqual(left, right, false, null); - } - - /// - /// Creates a that represents a "greater than or equal" numeric comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// true to set IsLiftedToNull to true; false to set IsLiftedToNull to false. - /// A that has the property equal to - /// and the , , , and properties set to the specified values. - /// - public static BinaryExpression GreaterThanOrEqual(Expression left, Expression right, bool liftToNull, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - return GetComparisonOperator(ExpressionType.GreaterThanOrEqual, "op_GreaterThanOrEqual", left, right, liftToNull); - } - return GetMethodBasedBinaryOperator(ExpressionType.GreaterThanOrEqual, left, right, method, liftToNull); - } - - - /// - /// Creates a that represents a "less than or equal" numeric comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression LessThanOrEqual(Expression left, Expression right) { - return LessThanOrEqual(left, right, false, null); - } - - /// - /// Creates a that represents a "less than or equal" numeric comparison. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// true to set IsLiftedToNull to true; false to set IsLiftedToNull to false. - /// A that has the property equal to - /// and the , , , and properties set to the specified values. - /// - public static BinaryExpression LessThanOrEqual(Expression left, Expression right, bool liftToNull, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - return GetComparisonOperator(ExpressionType.LessThanOrEqual, "op_LessThanOrEqual", left, right, liftToNull); - } - return GetMethodBasedBinaryOperator(ExpressionType.LessThanOrEqual, left, right, method, liftToNull); - } - - - private static BinaryExpression GetComparisonOperator(ExpressionType binaryType, string opName, Expression left, Expression right, bool liftToNull) { - if (left.Type == right.Type && TypeUtils.IsNumeric(left.Type)) { - if (TypeUtils.IsNullableType(left.Type) && liftToNull) { - return new SimpleBinaryExpression(binaryType, left, right, typeof(bool?)); - } else { - return new LogicalBinaryExpression(binaryType, left, right); - } - } - return GetUserDefinedBinaryOperatorOrThrow(binaryType, opName, left, right, liftToNull); - } - - #endregion - - #region Boolean Expressions - - - /// - /// Creates a that represents a conditional AND operation that evaluates the second operand only if it has to. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression AndAlso(Expression left, Expression right) { - return AndAlso(left, right, null); - } - - /// - /// Creates a that represents a conditional AND operation that evaluates the second operand only if it has to. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression AndAlso(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - Type returnType; - if (method == null) { - if (left.Type == right.Type) { - if (left.Type == typeof(bool)) { - return new LogicalBinaryExpression(ExpressionType.AndAlso, left, right); - } else if (left.Type == typeof(bool?)) { - return new SimpleBinaryExpression(ExpressionType.AndAlso, left, right, left.Type); - } - } - method = GetUserDefinedBinaryOperator(ExpressionType.AndAlso, left.Type, right.Type, "op_BitwiseAnd"); - if (method != null) { - ValidateUserDefinedConditionalLogicOperator(ExpressionType.AndAlso, left.Type, right.Type, method); - returnType = (TypeUtils.IsNullableType(left.Type) && TypeUtils.AreEquivalent(method.ReturnType, TypeUtils.GetNonNullableType(left.Type))) ? left.Type : method.ReturnType; - return new MethodBinaryExpression(ExpressionType.AndAlso, left, right, returnType, method); - } - throw Error.BinaryOperatorNotDefined(ExpressionType.AndAlso, left.Type, right.Type); - } - ValidateUserDefinedConditionalLogicOperator(ExpressionType.AndAlso, left.Type, right.Type, method); - returnType = (TypeUtils.IsNullableType(left.Type) && TypeUtils.AreEquivalent(method.ReturnType, TypeUtils.GetNonNullableType(left.Type))) ? left.Type : method.ReturnType; - return new MethodBinaryExpression(ExpressionType.AndAlso, left, right, returnType, method); - } - - - /// - /// Creates a that represents a conditional OR operation that evaluates the second operand only if it has to. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression OrElse(Expression left, Expression right) { - return OrElse(left, right, null); - } - - /// - /// Creates a that represents a conditional OR operation that evaluates the second operand only if it has to. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression OrElse(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - Type returnType; - if (method == null) { - if (left.Type == right.Type) { - if (left.Type == typeof(bool)) { - return new LogicalBinaryExpression(ExpressionType.OrElse, left, right); - } else if (left.Type == typeof(bool?)) { - return new SimpleBinaryExpression(ExpressionType.OrElse, left, right, left.Type); - } - } - method = GetUserDefinedBinaryOperator(ExpressionType.OrElse, left.Type, right.Type, "op_BitwiseOr"); - if (method != null) { - ValidateUserDefinedConditionalLogicOperator(ExpressionType.OrElse, left.Type, right.Type, method); - returnType = (TypeUtils.IsNullableType(left.Type) && method.ReturnType == TypeUtils.GetNonNullableType(left.Type)) ? left.Type : method.ReturnType; - return new MethodBinaryExpression(ExpressionType.OrElse, left, right, returnType, method); - } - throw Error.BinaryOperatorNotDefined(ExpressionType.OrElse, left.Type, right.Type); - } - ValidateUserDefinedConditionalLogicOperator(ExpressionType.OrElse, left.Type, right.Type, method); - returnType = (TypeUtils.IsNullableType(left.Type) && method.ReturnType == TypeUtils.GetNonNullableType(left.Type)) ? left.Type : method.ReturnType; - return new MethodBinaryExpression(ExpressionType.OrElse, left, right, returnType, method); - } - - #endregion - - #region Coalescing Expressions - - - /// - /// Creates a BinaryExpression that represents a coalescing operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A BinaryExpression that has the NodeType property equal to Coalesce and the Left and Right properties set to the specified values. - public static BinaryExpression Coalesce(Expression left, Expression right) { - return Coalesce(left, right, null); - } - - - /// - /// Creates a BinaryExpression that represents a coalescing operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A LambdaExpression to set the Conversion property equal to. - /// A BinaryExpression that has the NodeType property equal to Coalesce and the Left, Right and Conversion properties set to the specified values. - /// - public static BinaryExpression Coalesce(Expression left, Expression right, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - - if (conversion == null) { - Type resultType = ValidateCoalesceArgTypes(left.Type, right.Type); - return new SimpleBinaryExpression(ExpressionType.Coalesce, left, right, resultType); - } - - if (left.Type.IsValueType && !TypeUtils.IsNullableType(left.Type)) { - throw Error.CoalesceUsedOnNonNullType(); - } - - Type delegateType = conversion.Type; - Debug.Assert(typeof(System.MulticastDelegate).IsAssignableFrom(delegateType) && delegateType != typeof(System.MulticastDelegate)); - MethodInfo method = delegateType.GetMethod("Invoke"); - if (method.ReturnType == typeof(void)) { - throw Error.UserDefinedOperatorMustNotBeVoid(conversion); - } - ParameterInfo[] pms = method.GetParametersCached(); - Debug.Assert(pms.Length == conversion.Parameters.Count); - if (pms.Length != 1) { - throw Error.IncorrectNumberOfMethodCallArguments(conversion); - } - // The return type must match exactly. - // CONSIDER: We could weaken this restriction and - // CONSIDER: say that the return type must be assignable to from - // CONSIDER: the return type of the lambda. - if (!TypeUtils.AreEquivalent(method.ReturnType, right.Type)) { - throw Error.OperandTypesDoNotMatchParameters(ExpressionType.Coalesce, conversion.ToString()); - } - // The parameter of the conversion lambda must either be assignable - // from the erased or unerased type of the left hand side. - if (!ParameterIsAssignable(pms[0], TypeUtils.GetNonNullableType(left.Type)) && - !ParameterIsAssignable(pms[0], left.Type)) { - throw Error.OperandTypesDoNotMatchParameters(ExpressionType.Coalesce, conversion.ToString()); - } - return new CoalesceConversionBinaryExpression(left, right, conversion); - } - - - private static Type ValidateCoalesceArgTypes(Type left, Type right) { - Type leftStripped = TypeUtils.GetNonNullableType(left); - if (left.IsValueType && !TypeUtils.IsNullableType(left)) { - throw Error.CoalesceUsedOnNonNullType(); - } else if (TypeUtils.IsNullableType(left) && TypeUtils.IsImplicitlyConvertible(right, leftStripped)) { - return leftStripped; - } else if (TypeUtils.IsImplicitlyConvertible(right, left)) { - return left; - } else if (TypeUtils.IsImplicitlyConvertible(leftStripped, right)) { - return right; - } else { - throw Error.ArgumentTypesMustMatch(); - } - } - - - - #endregion - - #region Arithmetic Expressions - - - /// - /// Creates a that represents an arithmetic addition operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression Add(Expression left, Expression right) { - return Add(left, right, null); - } - - /// - /// Creates a that represents an arithmetic addition operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression Add(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.Add, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.Add, "op_Addition", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.Add, left, right, method, true); - } - - - /// - /// Creates a that represents an addition assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression AddAssign(Expression left, Expression right) { - return AddAssign(left, right, null, null); - } - - /// - /// Creates a that represents an addition assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression AddAssign(Expression left, Expression right, MethodInfo method) { - return AddAssign(left, right, method, null); - } - - /// - /// Creates a that represents an addition assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - - public static BinaryExpression AddAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.AddAssign, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.AddAssign, "op_Addition", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.AddAssign, left, right, method, conversion, true); - } - - private static void ValidateOpAssignConversionLambda(LambdaExpression conversion, Expression left, MethodInfo method, ExpressionType nodeType) { - Type delegateType = conversion.Type; - Debug.Assert(typeof(System.MulticastDelegate).IsAssignableFrom(delegateType) && delegateType != typeof(System.MulticastDelegate)); - MethodInfo mi = delegateType.GetMethod("Invoke"); - ParameterInfo[] pms = mi.GetParametersCached(); - Debug.Assert(pms.Length == conversion.Parameters.Count); - if (pms.Length != 1) { - throw Error.IncorrectNumberOfMethodCallArguments(conversion); - } - if (!TypeUtils.AreEquivalent(mi.ReturnType, left.Type)) { - throw Error.OperandTypesDoNotMatchParameters(nodeType, conversion.ToString()); - } - if (method != null) { - // The parameter type of conversion lambda must be the same as the return type of the overload method - if (!TypeUtils.AreEquivalent(pms[0].ParameterType, method.ReturnType)) { - throw Error.OverloadOperatorTypeDoesNotMatchConversionType(nodeType, conversion.ToString()); - } - } - } - - - /// - /// Creates a that represents an addition assignment operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and - /// properties set to the specified values. - /// - public static BinaryExpression AddAssignChecked(Expression left, Expression right) { - return AddAssignChecked(left, right, null); - } - - /// - /// Creates a that represents an addition assignment operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression AddAssignChecked(Expression left, Expression right, MethodInfo method) { - return AddAssignChecked(left, right, method, null); - } - - /// - /// Creates a that represents an addition assignment operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression AddAssignChecked(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.AddAssignChecked, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.AddAssignChecked, "op_Addition", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.AddAssignChecked, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents an arithmetic addition operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression AddChecked(Expression left, Expression right) { - return AddChecked(left, right, null); - } - - /// - /// Creates a that represents an arithmetic addition operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression AddChecked(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.AddChecked, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.AddChecked, "op_Addition", left, right, false); - } - return GetMethodBasedBinaryOperator(ExpressionType.AddChecked, left, right, method, true); - } - - - /// - /// Creates a that represents an arithmetic subtraction operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression Subtract(Expression left, Expression right) { - return Subtract(left, right, null); - } - - /// - /// Creates a that represents an arithmetic subtraction operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression Subtract(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.Subtract, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.Subtract, "op_Subtraction", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.Subtract, left, right, method, true); - } - - - /// - /// Creates a that represents a subtraction assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression SubtractAssign(Expression left, Expression right) { - return SubtractAssign(left, right, null, null); - } - - /// - /// Creates a that represents a subtraction assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression SubtractAssign(Expression left, Expression right, MethodInfo method) { - return SubtractAssign(left, right, method, null); - } - - /// - /// Creates a that represents a subtraction assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression SubtractAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.SubtractAssign, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.SubtractAssign, "op_Subtraction", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.SubtractAssign, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents a subtraction assignment operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression SubtractAssignChecked(Expression left, Expression right) { - return SubtractAssignChecked(left, right, null); - } - - /// - /// Creates a that represents a subtraction assignment operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression SubtractAssignChecked(Expression left, Expression right, MethodInfo method) { - return SubtractAssignChecked(left, right, method, null); - } - - /// - /// Creates a that represents a subtraction assignment operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression SubtractAssignChecked(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.SubtractAssignChecked, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.SubtractAssignChecked, "op_Subtraction", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.SubtractAssignChecked, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents an arithmetic subtraction operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression SubtractChecked(Expression left, Expression right) { - return SubtractChecked(left, right, null); - } - - /// - /// Creates a that represents an arithmetic subtraction operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression SubtractChecked(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.SubtractChecked, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.SubtractChecked, "op_Subtraction", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.SubtractChecked, left, right, method, true); - } - - - /// - /// Creates a that represents an arithmetic division operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression Divide(Expression left, Expression right) { - return Divide(left, right, null); - } - - /// - /// Creates a that represents an arithmetic division operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression Divide(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.Divide, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.Divide, "op_Division", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.Divide, left, right, method, true); - } - - - /// - /// Creates a that represents a division assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression DivideAssign(Expression left, Expression right) { - return DivideAssign(left, right, null, null); - } - - /// - /// Creates a that represents a division assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression DivideAssign(Expression left, Expression right, MethodInfo method) { - return DivideAssign(left, right, method, null); - } - - /// - /// Creates a that represents a division assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression DivideAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.DivideAssign, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.DivideAssign, "op_Division", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.DivideAssign, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents an arithmetic remainder operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression Modulo(Expression left, Expression right) { - return Modulo(left, right, null); - } - - /// - /// Creates a that represents an arithmetic remainder operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression Modulo(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.Modulo, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.Modulo, "op_Modulus", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.Modulo, left, right, method, true); - } - - - /// - /// Creates a that represents a remainder assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression ModuloAssign(Expression left, Expression right) { - return ModuloAssign(left, right, null, null); - } - - /// - /// Creates a that represents a remainder assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression ModuloAssign(Expression left, Expression right, MethodInfo method) { - return ModuloAssign(left, right, method, null); - } - - /// - /// Creates a that represents a remainder assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression ModuloAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.ModuloAssign, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.ModuloAssign, "op_Modulus", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.ModuloAssign, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents an arithmetic multiplication operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression Multiply(Expression left, Expression right) { - return Multiply(left, right, null); - } - - /// - /// Creates a that represents an arithmetic multiplication operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression Multiply(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.Multiply, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.Multiply, "op_Multiply", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.Multiply, left, right, method, true); - } - - - /// - /// Creates a that represents a multiplication assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression MultiplyAssign(Expression left, Expression right) { - return MultiplyAssign(left, right, null, null); - } - - /// - /// Creates a that represents a multiplication assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression MultiplyAssign(Expression left, Expression right, MethodInfo method) { - return MultiplyAssign(left, right, method, null); - } - - /// - /// Creates a that represents a multiplication assignment operation that does not have overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression MultiplyAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.MultiplyAssign, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.MultiplyAssign, "op_Multiply", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.MultiplyAssign, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents a multiplication assignment operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression MultiplyAssignChecked(Expression left, Expression right) { - return MultiplyAssignChecked(left, right, null); - } - - /// - /// Creates a that represents a multiplication assignment operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression MultiplyAssignChecked(Expression left, Expression right, MethodInfo method) { - return MultiplyAssignChecked(left, right, method, null); - } - - /// - /// Creates a that represents a multiplication assignment operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression MultiplyAssignChecked(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.MultiplyAssignChecked, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.MultiplyAssignChecked, "op_Multiply", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.MultiplyAssignChecked, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents an arithmetic multiplication operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression MultiplyChecked(Expression left, Expression right) { - return MultiplyChecked(left, right, null); - } - - /// - /// Creates a that represents an arithmetic multiplication operation that has overflow checking. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression MultiplyChecked(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsArithmetic(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.MultiplyChecked, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.MultiplyChecked, "op_Multiply", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.MultiplyChecked, left, right, method, true); - } - - private static bool IsSimpleShift(Type left, Type right) { - return TypeUtils.IsInteger(left) - && TypeUtils.GetNonNullableType(right) == typeof(int); - } - - private static Type GetResultTypeOfShift(Type left, Type right) { - if (!left.IsNullableType() && right.IsNullableType()) { - // lift the result type to Nullable - return typeof(Nullable<>).MakeGenericType(left); - } - return left; - } - - - /// - /// Creates a that represents an bitwise left-shift operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression LeftShift(Expression left, Expression right) { - return LeftShift(left, right, null); - } - - /// - /// Creates a that represents an bitwise left-shift operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression LeftShift(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (IsSimpleShift(left.Type, right.Type)) { - Type resultType = GetResultTypeOfShift(left.Type, right.Type); - return new SimpleBinaryExpression(ExpressionType.LeftShift, left, right, resultType); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.LeftShift, "op_LeftShift", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.LeftShift, left, right, method, true); - } - - - /// - /// Creates a that represents a bitwise left-shift assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression LeftShiftAssign(Expression left, Expression right) { - return LeftShiftAssign(left, right, null, null); - } - - /// - /// Creates a that represents a bitwise left-shift assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression LeftShiftAssign(Expression left, Expression right, MethodInfo method) { - return LeftShiftAssign(left, right, method, null); - } - - /// - /// Creates a that represents a bitwise left-shift assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression LeftShiftAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (IsSimpleShift(left.Type, right.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - Type resultType = GetResultTypeOfShift(left.Type, right.Type); - return new SimpleBinaryExpression(ExpressionType.LeftShiftAssign, left, right, resultType); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.LeftShiftAssign, "op_LeftShift", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.LeftShiftAssign, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents an bitwise right-shift operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression RightShift(Expression left, Expression right) { - return RightShift(left, right, null); - } - - /// - /// Creates a that represents an bitwise right-shift operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression RightShift(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (IsSimpleShift(left.Type, right.Type)) { - Type resultType = GetResultTypeOfShift(left.Type, right.Type); - return new SimpleBinaryExpression(ExpressionType.RightShift, left, right, resultType); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.RightShift, "op_RightShift", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.RightShift, left, right, method, true); - } - - - /// - /// Creates a that represents a bitwise right-shift assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression RightShiftAssign(Expression left, Expression right) { - return RightShiftAssign(left, right, null, null); - } - - /// - /// Creates a that represents a bitwise right-shift assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression RightShiftAssign(Expression left, Expression right, MethodInfo method) { - return RightShiftAssign(left, right, method, null); - } - - /// - /// Creates a that represents a bitwise right-shift assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression RightShiftAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (IsSimpleShift(left.Type, right.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - Type resultType = GetResultTypeOfShift(left.Type, right.Type); - return new SimpleBinaryExpression(ExpressionType.RightShiftAssign, left, right, resultType); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.RightShiftAssign, "op_RightShift", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.RightShiftAssign, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents an bitwise AND operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression And(Expression left, Expression right) { - return And(left, right, null); - } - - /// - /// Creates a that represents an bitwise AND operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression And(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.And, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.And, "op_BitwiseAnd", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.And, left, right, method, true); - } - - - /// - /// Creates a that represents a bitwise AND assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression AndAssign(Expression left, Expression right) { - return AndAssign(left, right, null, null); - } - - /// - /// Creates a that represents a bitwise AND assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression AndAssign(Expression left, Expression right, MethodInfo method) { - return AndAssign(left, right, method, null); - } - - /// - /// Creates a that represents a bitwise AND assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression AndAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.AndAssign, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.AndAssign, "op_BitwiseAnd", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.AndAssign, left, right, method, conversion, true); - } - - - /// - /// Creates a that represents an bitwise OR operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression Or(Expression left, Expression right) { - return Or(left, right, null); - } - - /// - /// Creates a that represents an bitwise OR operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression Or(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.Or, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.Or, "op_BitwiseOr", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.Or, left, right, method, true); - } - - - /// - /// Creates a that represents a bitwise OR assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression OrAssign(Expression left, Expression right) { - return OrAssign(left, right, null, null); - } - - /// - /// Creates a that represents a bitwise OR assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression OrAssign(Expression left, Expression right, MethodInfo method) { - return OrAssign(left, right, method, null); - } - - /// - /// Creates a that represents a bitwise OR assignment operation. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression OrAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.OrAssign, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.OrAssign, "op_BitwiseOr", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.OrAssign, left, right, method, conversion, true); - } - - /// - /// Creates a that represents a bitwise or logical XOR operation, using op_ExclusiveOr for user-defined types. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression ExclusiveOr(Expression left, Expression right) { - return ExclusiveOr(left, right, null); - } - - /// - /// Creates a that represents a bitwise or logical XOR operation, using op_ExclusiveOr for user-defined types. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression ExclusiveOr(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type)) { - return new SimpleBinaryExpression(ExpressionType.ExclusiveOr, left, right, left.Type); - } - return GetUserDefinedBinaryOperatorOrThrow(ExpressionType.ExclusiveOr, "op_ExclusiveOr", left, right, true); - } - return GetMethodBasedBinaryOperator(ExpressionType.ExclusiveOr, left, right, method, true); - } - - /// - /// Creates a that represents a bitwise or logical XOR assignment operation, using op_ExclusiveOr for user-defined types. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression ExclusiveOrAssign(Expression left, Expression right) { - return ExclusiveOrAssign(left, right, null, null); - } - - /// - /// Creates a that represents a bitwise or logical XOR assignment operation, using op_ExclusiveOr for user-defined types. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression ExclusiveOrAssign(Expression left, Expression right, MethodInfo method) { - return ExclusiveOrAssign(left, right, method, null); - } - - /// - /// Creates a that represents a bitwise or logical XOR assignment operation, using op_ExclusiveOr for user-defined types. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression ExclusiveOrAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - if (left.Type == right.Type && TypeUtils.IsIntegerOrBool(left.Type)) { - // conversion is not supported for binary ops on arithmetic types without operator overloading - if (conversion != null) { - throw Error.ConversionIsNotSupportedForArithmeticTypes(); - } - return new SimpleBinaryExpression(ExpressionType.ExclusiveOrAssign, left, right, left.Type); - } - return GetUserDefinedAssignOperatorOrThrow(ExpressionType.ExclusiveOrAssign, "op_ExclusiveOr", left, right, conversion, true); - } - return GetMethodBasedAssignOperator(ExpressionType.ExclusiveOrAssign, left, right, method, conversion, true); - } - - /// - /// Creates a that represents raising a number to a power. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression Power(Expression left, Expression right) { - return Power(left, right, null); - } - - /// - /// Creates a that represents raising a number to a power. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression Power(Expression left, Expression right, MethodInfo method) { - RequiresCanRead(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - Type mathType = typeof(System.Math); - method = mathType.GetMethod("Pow", BindingFlags.Static | BindingFlags.Public); - if (method == null) { - throw Error.BinaryOperatorNotDefined(ExpressionType.Power, left.Type, right.Type); - } - } - return GetMethodBasedBinaryOperator(ExpressionType.Power, left, right, method, true); - } - - - /// - /// Creates a that represents raising an expression to a power and assigning the result back to the expression. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the and properties set to the specified values. - public static BinaryExpression PowerAssign(Expression left, Expression right) { - return PowerAssign(left, right, null, null); - } - - /// - /// Creates a that represents raising an expression to a power and assigning the result back to the expression. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , and properties set to the specified values. - /// - public static BinaryExpression PowerAssign(Expression left, Expression right, MethodInfo method) { - return PowerAssign(left, right, method, null); - } - - /// - /// Creates a that represents raising an expression to a power and assigning the result back to the expression. - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , , - /// and properties set to the specified values. - /// - public static BinaryExpression PowerAssign(Expression left, Expression right, MethodInfo method, LambdaExpression conversion) { - RequiresCanRead(left, "left"); - RequiresCanWrite(left, "left"); - RequiresCanRead(right, "right"); - if (method == null) { - Type mathType = typeof(System.Math); - method = mathType.GetMethod("Pow", BindingFlags.Static | BindingFlags.Public); - if (method == null) { - throw Error.BinaryOperatorNotDefined(ExpressionType.PowerAssign, left.Type, right.Type); - } - } - return GetMethodBasedAssignOperator(ExpressionType.PowerAssign, left, right, method, conversion, true); - } - - #endregion - - #region ArrayIndex Expression - - - /// - /// Creates a BinaryExpression that represents applying an array index operator to an array of rank one. - /// - /// An Expression to set the Left property equal to. - /// An Expression to set the Right property equal to. - /// A BinaryExpression that has the NodeType property equal to ArrayIndex and the Left and Right properties set to the specified values. - public static BinaryExpression ArrayIndex(Expression array, Expression index) { - RequiresCanRead(array, "array"); - RequiresCanRead(index, "index"); - if (index.Type != typeof(int)) { - throw Error.ArgumentMustBeArrayIndexType(); - } - - Type arrayType = array.Type; - if (!arrayType.IsArray) { - throw Error.ArgumentMustBeArray(); - } - if (arrayType.GetArrayRank() != 1) { - throw Error.IncorrectNumberOfIndexes(); - } - - return new SimpleBinaryExpression(ExpressionType.ArrayIndex, array, index, arrayType.GetElementType()); - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/BlockExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/BlockExpression.cs deleted file mode 100644 index 372b05ec9da..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/BlockExpression.cs +++ /dev/null @@ -1,813 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Threading; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents a block that contains a sequence of expressions where variables can be defined. - /// - [DebuggerTypeProxy(typeof(Expression.BlockExpressionProxy))] - public class BlockExpression : Expression { - /// - /// Gets the expressions in this block. - /// - public ReadOnlyCollection Expressions { - get { return GetOrMakeExpressions(); } - } - - /// - /// Gets the variables defined in this block. - /// - public ReadOnlyCollection Variables { - get { - return GetOrMakeVariables(); - } - } - - /// - /// Gets the last expression in this block. - /// - public Expression Result { - get { - Debug.Assert(ExpressionCount > 0); - return GetExpression(ExpressionCount - 1); - } - } - - internal BlockExpression() { - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitBlock(this); - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Block; } - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public override Type Type { - get { return GetExpression(ExpressionCount - 1).Type; } - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public BlockExpression Update(IEnumerable variables, IEnumerable expressions) { - if (variables == Variables && expressions == Expressions) { - return this; - } - - return Expression.Block(Type, variables, expressions); - } - - internal virtual Expression GetExpression(int index) { - throw ContractUtils.Unreachable; - } - - internal virtual int ExpressionCount { - get { - throw ContractUtils.Unreachable; - } - } - - internal virtual ReadOnlyCollection GetOrMakeExpressions() { - throw ContractUtils.Unreachable; - } - - internal virtual ParameterExpression GetVariable(int index) { - throw ContractUtils.Unreachable; - } - - internal virtual int VariableCount { - get { - return 0; - } - } - - internal virtual ReadOnlyCollection GetOrMakeVariables() { - return EmptyReadOnlyCollection.Instance; - } - - /// - /// Makes a copy of this node replacing the parameters/args with the provided values. The - /// shape of the parameters/args needs to match the shape of the current block - in other - /// words there should be the same # of parameters and args. - /// - /// parameters can be null in which case the existing parameters are used. - /// - /// This helper is provided to allow re-writing of nodes to not depend on the specific optimized - /// subclass of BlockExpression which is being used. - /// - internal virtual BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - throw ContractUtils.Unreachable; - } - - /// - /// Helper used for ensuring we only return 1 instance of a ReadOnlyCollection of T. - /// - /// This is similar to the ReturnReadOnly which only takes a single argument. This version - /// supports nodes which hold onto 5 Expressions and puts all of the arguments into the - /// ReadOnlyCollection. - /// - /// Ultimately this means if we create the readonly collection we will be slightly more wasteful as we'll - /// have a readonly collection + some fields in the type. The DLR internally avoids accessing anything - /// which would force the readonly collection to be created. - /// - /// This is used by BlockExpression5 and MethodCallExpression5. - /// - internal static ReadOnlyCollection ReturnReadOnlyExpressions(BlockExpression provider, ref object collection) { - Expression tObj = collection as Expression; - if (tObj != null) { - // otherwise make sure only one readonly collection ever gets exposed - Interlocked.CompareExchange( - ref collection, - new ReadOnlyCollection(new BlockExpressionList(provider, tObj)), - tObj - ); - } - - // and return what is not guaranteed to be a readonly collection - return (ReadOnlyCollection)collection; - } - } - - #region Specialized Subclasses - - internal sealed class Block2 : BlockExpression { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1; // storage for the 2nd argument. - - internal Block2(Expression arg0, Expression arg1) { - _arg0 = arg0; - _arg1 = arg1; - } - - internal override Expression GetExpression(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - default: throw new InvalidOperationException(); - } - } - - internal override int ExpressionCount { - get { - return 2; - } - } - - internal override ReadOnlyCollection GetOrMakeExpressions() { - return ReturnReadOnlyExpressions(this, ref _arg0); - } - - internal override BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - Debug.Assert(args.Length == 2); - Debug.Assert(variables == null || variables.Count == 0); - - return new Block2(args[0], args[1]); - } - } - - internal sealed class Block3 : BlockExpression { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1, _arg2; // storage for the 2nd and 3rd arguments. - - internal Block3(Expression arg0, Expression arg1, Expression arg2) { - _arg0 = arg0; - _arg1 = arg1; - _arg2 = arg2; - } - - internal override Expression GetExpression(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - case 2: return _arg2; - default: throw new InvalidOperationException(); - } - } - - internal override int ExpressionCount { - get { - return 3; - } - } - - internal override ReadOnlyCollection GetOrMakeExpressions() { - return ReturnReadOnlyExpressions(this, ref _arg0); - } - - internal override BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - Debug.Assert(args.Length == 3); - Debug.Assert(variables == null || variables.Count == 0); - - return new Block3(args[0], args[1], args[2]); - } - } - - internal sealed class Block4 : BlockExpression { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1, _arg2, _arg3; // storarg for the 2nd, 3rd, and 4th arguments. - - internal Block4(Expression arg0, Expression arg1, Expression arg2, Expression arg3) { - _arg0 = arg0; - _arg1 = arg1; - _arg2 = arg2; - _arg3 = arg3; - } - - internal override Expression GetExpression(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - case 2: return _arg2; - case 3: return _arg3; - default: throw new InvalidOperationException(); - } - } - - internal override int ExpressionCount { - get { - return 4; - } - } - - internal override ReadOnlyCollection GetOrMakeExpressions() { - return ReturnReadOnlyExpressions(this, ref _arg0); - } - - internal override BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - Debug.Assert(args.Length == 4); - Debug.Assert(variables == null || variables.Count == 0); - - return new Block4(args[0], args[1], args[2], args[3]); - } - } - - internal sealed class Block5 : BlockExpression { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1, _arg2, _arg3, _arg4; // storage for the 2nd - 5th args. - - internal Block5(Expression arg0, Expression arg1, Expression arg2, Expression arg3, Expression arg4) { - _arg0 = arg0; - _arg1 = arg1; - _arg2 = arg2; - _arg3 = arg3; - _arg4 = arg4; - } - - internal override Expression GetExpression(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - case 2: return _arg2; - case 3: return _arg3; - case 4: return _arg4; - default: throw new InvalidOperationException(); - } - } - - internal override int ExpressionCount { - get { - return 5; - } - } - - internal override ReadOnlyCollection GetOrMakeExpressions() { - return ReturnReadOnlyExpressions(this, ref _arg0); - } - - internal override BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - Debug.Assert(args.Length == 5); - Debug.Assert(variables == null || variables.Count == 0); - - return new Block5(args[0], args[1], args[2], args[3], args[4]); - } - } - - internal class BlockN : BlockExpression { - private IList _expressions; // either the original IList or a ReadOnlyCollection if the user has accessed it. - - internal BlockN(IList expressions) { - Debug.Assert(expressions.Count != 0); - - _expressions = expressions; - } - - internal override Expression GetExpression(int index) { - Debug.Assert(index >= 0 && index < _expressions.Count); - - return _expressions[index]; - } - - internal override int ExpressionCount { - get { - return _expressions.Count; - } - } - - internal override ReadOnlyCollection GetOrMakeExpressions() { - return ReturnReadOnly(ref _expressions); - } - - internal override BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - Debug.Assert(variables == null || variables.Count == 0); - - return new BlockN(args); - } - } - - internal class ScopeExpression : BlockExpression { - private IList _variables; // list of variables or ReadOnlyCollection if the user has accessed the readonly collection - - internal ScopeExpression(IList variables) { - _variables = variables; - } - - internal override int VariableCount { - get { - return _variables.Count; - } - } - - internal override ParameterExpression GetVariable(int index) { - return _variables[index]; - } - - internal override ReadOnlyCollection GetOrMakeVariables() { - return ReturnReadOnly(ref _variables); - } - - protected IList VariablesList { - get { - return _variables; - } - } - - // Used for rewrite of the nodes to either reuse existing set of variables if not rewritten. - internal IList ReuseOrValidateVariables(ReadOnlyCollection variables) { - if (variables != null && variables != VariablesList) { - // Need to validate the new variables (uniqueness, not byref) - ValidateVariables(variables, "variables"); - return variables; - } else { - return VariablesList; - } - } - } - - internal sealed class Scope1 : ScopeExpression { - private object _body; - - internal Scope1(IList variables, Expression body) - : base(variables) { - _body = body; - } - - internal override Expression GetExpression(int index) { - switch (index) { - case 0: return ReturnObject(_body); - default: throw new InvalidOperationException(); - } - } - - internal override int ExpressionCount { - get { - return 1; - } - } - - internal override ReadOnlyCollection GetOrMakeExpressions() { - return ReturnReadOnlyExpressions(this, ref _body); - } - - internal override BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - Debug.Assert(args.Length == 1); - Debug.Assert(variables == null || variables.Count == VariableCount); - - return new Scope1(ReuseOrValidateVariables(variables), args[0]); - } - } - - internal class ScopeN : ScopeExpression { - private IList _body; - - internal ScopeN(IList variables, IList body) - : base(variables) { - _body = body; - } - - internal override Expression GetExpression(int index) { - return _body[index]; - } - - internal override int ExpressionCount { - get { - return _body.Count; - } - } - - internal override ReadOnlyCollection GetOrMakeExpressions() { - return ReturnReadOnly(ref _body); - } - - internal override BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - Debug.Assert(args.Length == ExpressionCount); - Debug.Assert(variables == null || variables.Count == VariableCount); - - return new ScopeN(ReuseOrValidateVariables(variables), args); - } - } - - internal class ScopeWithType : ScopeN { - private readonly Type _type; - - internal ScopeWithType(IList variables, IList expressions, Type type) - : base(variables, expressions) { - _type = type; - } - - public sealed override Type Type { - get { return _type; } - } - - internal override BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - Debug.Assert(args.Length == ExpressionCount); - Debug.Assert(variables == null || variables.Count == VariableCount); - - return new ScopeWithType(ReuseOrValidateVariables(variables), args, _type); - } - } - - #endregion - - #region Block List Classes - - /// - /// Provides a wrapper around an IArgumentProvider which exposes the argument providers - /// members out as an IList of Expression. This is used to avoid allocating an array - /// which needs to be stored inside of a ReadOnlyCollection. Instead this type has - /// the same amount of overhead as an array without duplicating the storage of the - /// elements. This ensures that internally we can avoid creating and copying arrays - /// while users of the Expression trees also don't pay a size penalty for this internal - /// optimization. See IArgumentProvider for more general information on the Expression - /// tree optimizations being used here. - /// - internal class BlockExpressionList : IList { - private readonly BlockExpression _block; - private readonly Expression _arg0; - - internal BlockExpressionList(BlockExpression provider, Expression arg0) { - _block = provider; - _arg0 = arg0; - } - - #region IList Members - - public int IndexOf(Expression item) { - if (_arg0 == item) { - return 0; - } - - for (int i = 1; i < _block.ExpressionCount; i++) { - if (_block.GetExpression(i) == item) { - return i; - } - } - - return -1; - } - - public void Insert(int index, Expression item) { - throw ContractUtils.Unreachable; - } - - public void RemoveAt(int index) { - throw ContractUtils.Unreachable; - } - - public Expression this[int index] { - get { - if (index == 0) { - return _arg0; - } - - return _block.GetExpression(index); - } - set { - throw ContractUtils.Unreachable; - } - } - - #endregion - - #region ICollection Members - - public void Add(Expression item) { - throw ContractUtils.Unreachable; - } - - public void Clear() { - throw ContractUtils.Unreachable; - } - - public bool Contains(Expression item) { - return IndexOf(item) != -1; - } - - public void CopyTo(Expression[] array, int arrayIndex) { - array[arrayIndex++] = _arg0; - for (int i = 1; i < _block.ExpressionCount; i++) { - array[arrayIndex++] = _block.GetExpression(i); - } - } - - public int Count { - get { return _block.ExpressionCount; } - } - - public bool IsReadOnly { - get { return true; } - } - - public bool Remove(Expression item) { - throw ContractUtils.Unreachable; - } - - #endregion - - #region IEnumerable Members - - public IEnumerator GetEnumerator() { - yield return _arg0; - - for (int i = 1; i < _block.ExpressionCount; i++) { - yield return _block.GetExpression(i); - } - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - yield return _arg0; - - for (int i = 1; i < _block.ExpressionCount; i++) { - yield return _block.GetExpression(i); - } - } - - #endregion - } - - #endregion - - public partial class Expression { - - /// - /// Creates a that contains two expressions and has no variables. - /// - /// The first expression in the block. - /// The second expression in the block. - /// The created . - public static BlockExpression Block(Expression arg0, Expression arg1) { - RequiresCanRead(arg0, "arg0"); - RequiresCanRead(arg1, "arg1"); - - return new Block2(arg0, arg1); - } - /// - /// Creates a that contains three expressions and has no variables. - /// - /// The first expression in the block. - /// The second expression in the block. - /// The third expression in the block. - /// The created . - public static BlockExpression Block(Expression arg0, Expression arg1, Expression arg2) { - RequiresCanRead(arg0, "arg0"); - RequiresCanRead(arg1, "arg1"); - RequiresCanRead(arg2, "arg2"); - return new Block3(arg0, arg1, arg2); - } - - /// - /// Creates a that contains four expressions and has no variables. - /// - /// The first expression in the block. - /// The second expression in the block. - /// The third expression in the block. - /// The fourth expression in the block. - /// The created . - public static BlockExpression Block(Expression arg0, Expression arg1, Expression arg2, Expression arg3) { - RequiresCanRead(arg0, "arg0"); - RequiresCanRead(arg1, "arg1"); - RequiresCanRead(arg2, "arg2"); - RequiresCanRead(arg3, "arg3"); - return new Block4(arg0, arg1, arg2, arg3); - } - - /// - /// Creates a that contains five expressions and has no variables. - /// - /// The first expression in the block. - /// The second expression in the block. - /// The third expression in the block. - /// The fourth expression in the block. - /// The fifth expression in the block. - /// The created . - public static BlockExpression Block(Expression arg0, Expression arg1, Expression arg2, Expression arg3, Expression arg4) { - RequiresCanRead(arg0, "arg0"); - RequiresCanRead(arg1, "arg1"); - RequiresCanRead(arg2, "arg2"); - RequiresCanRead(arg3, "arg3"); - RequiresCanRead(arg4, "arg4"); - - return new Block5(arg0, arg1, arg2, arg3, arg4); - } - - /// - /// Creates a that contains the given expressions and has no variables. - /// - /// The expressions in the block. - /// The created . - public static BlockExpression Block(params Expression[] expressions) { - ContractUtils.RequiresNotNull(expressions, "expressions"); - - switch (expressions.Length) { - case 2: return Block(expressions[0], expressions[1]); - case 3: return Block(expressions[0], expressions[1], expressions[2]); - case 4: return Block(expressions[0], expressions[1], expressions[2], expressions[3]); - case 5: return Block(expressions[0], expressions[1], expressions[2], expressions[3], expressions[4]); - default: - ContractUtils.RequiresNotEmpty(expressions, "expressions"); - RequiresCanRead(expressions, "expressions"); - return new BlockN(expressions.Copy()); - } - } - - /// - /// Creates a that contains the given expressions and has no variables. - /// - /// The expressions in the block. - /// The created . - public static BlockExpression Block(IEnumerable expressions) { - return Block(EmptyReadOnlyCollection.Instance, expressions); - } - - /// - /// Creates a that contains the given expressions, has no variables and has specific result type. - /// - /// The result type of the block. - /// The expressions in the block. - /// The created . - public static BlockExpression Block(Type type, params Expression[] expressions) { - ContractUtils.RequiresNotNull(expressions, "expressions"); - return Block(type, (IEnumerable)expressions); - } - - /// - /// Creates a that contains the given expressions, has no variables and has specific result type. - /// - /// The result type of the block. - /// The expressions in the block. - /// The created . - public static BlockExpression Block(Type type, IEnumerable expressions) { - return Block(type, EmptyReadOnlyCollection.Instance, expressions); - } - - /// - /// Creates a that contains the given variables and expressions. - /// - /// The variables in the block. - /// The expressions in the block. - /// The created . - public static BlockExpression Block(IEnumerable variables, params Expression[] expressions) { - return Block(variables, (IEnumerable)expressions); - } - - /// - /// Creates a that contains the given variables and expressions. - /// - /// The result type of the block. - /// The variables in the block. - /// The expressions in the block. - /// The created . - public static BlockExpression Block(Type type, IEnumerable variables, params Expression[] expressions) { - return Block(type, variables, (IEnumerable)expressions); - } - - /// - /// Creates a that contains the given variables and expressions. - /// - /// The variables in the block. - /// The expressions in the block. - /// The created . - public static BlockExpression Block(IEnumerable variables, IEnumerable expressions) { - ContractUtils.RequiresNotNull(expressions, "expressions"); - var expressionList = expressions.ToReadOnly(); - ContractUtils.RequiresNotEmpty(expressionList, "expressions"); - RequiresCanRead(expressionList, "expressions"); - - return Block(expressionList.Last().Type, variables, expressionList); - } - - /// - /// Creates a that contains the given variables and expressions. - /// - /// The result type of the block. - /// The variables in the block. - /// The expressions in the block. - /// The created . - public static BlockExpression Block(Type type, IEnumerable variables, IEnumerable expressions) { - ContractUtils.RequiresNotNull(type, "type"); - ContractUtils.RequiresNotNull(expressions, "expressions"); - - var expressionList = expressions.ToReadOnly(); - var variableList = variables.ToReadOnly(); - - ContractUtils.RequiresNotEmpty(expressionList, "expressions"); - RequiresCanRead(expressionList, "expressions"); - ValidateVariables(variableList, "variables"); - - Expression last = expressionList.Last(); - if (type != typeof(void)) { - if (!TypeUtils.AreReferenceAssignable(type, last.Type)) { - throw Error.ArgumentTypesMustMatch(); - } - } - - if (!TypeUtils.AreEquivalent(type, last.Type)) { - return new ScopeWithType(variableList, expressionList, type); - } else { - if (expressionList.Count == 1) { - return new Scope1(variableList, expressionList[0]); - } else { - return new ScopeN(variableList, expressionList); - } - } - } - - // Checks that all variables are non-null, not byref, and unique. - internal static void ValidateVariables(ReadOnlyCollection varList, string collectionName) { - if (varList.Count == 0) { - return; - } - - int count = varList.Count; - var set = new Set(count); - for (int i = 0; i < count; i++) { - ParameterExpression v = varList[i]; - if (v == null) { - throw new ArgumentNullException(string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0}[{1}]", collectionName, set.Count)); - } - if (v.IsByRef) { - throw Error.VariableMustNotBeByRef(v, v.Type); - } - if (set.Contains(v)) { - throw Error.DuplicateVariable(v); - } - set.Add(v); - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/CatchBlock.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/CatchBlock.cs deleted file mode 100644 index 08e2ab59502..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/CatchBlock.cs +++ /dev/null @@ -1,172 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents a catch statement in a try block. - /// This must have the same return type (i.e., the type of ) as the try block it is associated with. - /// - [DebuggerTypeProxy(typeof(Expression.CatchBlockProxy))] - public sealed class CatchBlock { - private readonly Type _test; - private readonly ParameterExpression _var; - private readonly Expression _body; - private readonly Expression _filter; - - internal CatchBlock(Type test, ParameterExpression variable, Expression body, Expression filter) { - _test = test; - _var = variable; - _body = body; - _filter = filter; - } - - /// - /// Gets a reference to the object caught by this handler. - /// - public ParameterExpression Variable { - get { return _var; } - } - - /// - /// Gets the type of this handler catches. - /// - public Type Test { - get { return _test; } - } - - /// - /// Gets the body of the catch block. - /// - public Expression Body { - get { return _body; } - } - - /// - /// Gets the body of the 's filter. - /// - public Expression Filter { - get { - return _filter; - } - } - - /// - /// Returns a that represents the current . - /// - /// A that represents the current . - public override string ToString() { - return ExpressionStringBuilder.CatchBlockToString(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public CatchBlock Update(ParameterExpression variable, Expression filter, Expression body) { - if (variable == Variable && filter == Filter && body == Body) { - return this; - } - return Expression.MakeCatchBlock(Test, variable, body, filter); - } - } - - public partial class Expression { - /// - /// Creates a representing a catch statement. - /// The of object to be caught can be specified but no reference to the object - /// will be available for use in the . - /// - /// The of this will handle. - /// The body of the catch statement. - /// The created . - public static CatchBlock Catch(Type type, Expression body) { - return MakeCatchBlock(type, null, body, null); - } - - /// - /// Creates a representing a catch statement with a reference to the caught object for use in the handler body. - /// - /// A representing a reference to the object caught by this handler. - /// The body of the catch statement. - /// The created . - public static CatchBlock Catch(ParameterExpression variable, Expression body) { - ContractUtils.RequiresNotNull(variable, "variable"); - return MakeCatchBlock(variable.Type, variable, body, null); - } - - /// - /// Creates a representing a catch statement with - /// an filter but no reference to the caught object. - /// - /// The of this will handle. - /// The body of the catch statement. - /// The body of the filter. - /// The created . - public static CatchBlock Catch(Type type, Expression body, Expression filter) { - return MakeCatchBlock(type, null, body, filter); - } - - /// - /// Creates a representing a catch statement with - /// an filter and a reference to the caught object. - /// - /// A representing a reference to the object caught by this handler. - /// The body of the catch statement. - /// The body of the filter. - /// The created . - public static CatchBlock Catch(ParameterExpression variable, Expression body, Expression filter) { - ContractUtils.RequiresNotNull(variable, "variable"); - return MakeCatchBlock(variable.Type, variable, body, filter); - } - - /// - /// Creates a representing a catch statement with the specified elements. - /// - /// The of this will handle. - /// A representing a reference to the object caught by this handler. - /// The body of the catch statement. - /// The body of the filter. - /// The created . - /// must be non-null and match the type of (if it is supplied). - public static CatchBlock MakeCatchBlock(Type type, ParameterExpression variable, Expression body, Expression filter) { - ContractUtils.RequiresNotNull(type, "type"); - ContractUtils.Requires(variable == null || TypeUtils.AreEquivalent(variable.Type, type), "variable"); - if (variable != null && variable.IsByRef) { - throw Error.VariableMustNotBeByRef(variable, variable.Type); - } - RequiresCanRead(body, "body"); - if (filter != null) { - RequiresCanRead(filter, "filter"); - if (filter.Type != typeof(bool)) throw Error.ArgumentMustBeBoolean(); - } - - return new CatchBlock(type, variable, body, filter); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ConditionalExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ConditionalExpression.cs deleted file mode 100644 index 32d108d08ae..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ConditionalExpression.cs +++ /dev/null @@ -1,226 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Dynamic.Utils; -using System.Diagnostics; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents an expression that has a conditional operator. - /// - [DebuggerTypeProxy(typeof(Expression.ConditionalExpressionProxy))] - public class ConditionalExpression : Expression { - private readonly Expression _test; - private readonly Expression _true; - - internal ConditionalExpression(Expression test, Expression ifTrue) { - _test = test; - _true = ifTrue; - } - - internal static ConditionalExpression Make(Expression test, Expression ifTrue, Expression ifFalse, Type type) { - if (ifTrue.Type != type || ifFalse.Type != type) { - return new FullConditionalExpressionWithType(test, ifTrue, ifFalse, type); - } if (ifFalse is DefaultExpression && ifFalse.Type == typeof(void)) { - return new ConditionalExpression(test, ifTrue); - } else { - return new FullConditionalExpression(test, ifTrue, ifFalse); - } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Conditional; } - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public override Type Type { - get { return IfTrue.Type; } - } - - /// - /// Gets the test of the conditional operation. - /// - public Expression Test { - get { return _test; } - } - /// - /// Gets the expression to execute if the test evaluates to true. - /// - public Expression IfTrue { - get { return _true; } - } - /// - /// Gets the expression to execute if the test evaluates to false. - /// - public Expression IfFalse { - get { return GetFalse(); } - } - - internal virtual Expression GetFalse() { - return Expression.Empty(); - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitConditional(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public ConditionalExpression Update(Expression test, Expression ifTrue, Expression ifFalse) { - if (test == Test && ifTrue == IfTrue && ifFalse == IfFalse) { - return this; - } - return Expression.Condition(test, ifTrue, ifFalse, Type); - } - } - - internal class FullConditionalExpression : ConditionalExpression { - private readonly Expression _false; - - internal FullConditionalExpression(Expression test, Expression ifTrue, Expression ifFalse) - : base(test, ifTrue) { - _false = ifFalse; - } - - internal override Expression GetFalse() { - return _false; - } - } - - internal class FullConditionalExpressionWithType : FullConditionalExpression { - private readonly Type _type; - - internal FullConditionalExpressionWithType(Expression test, Expression ifTrue, Expression ifFalse, Type type) - : base(test, ifTrue, ifFalse) { - _type = type; - } - - public sealed override Type Type { - get { return _type; } - } - } - - public partial class Expression { - - /// - /// Creates a . - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the , , - /// and properties set to the specified values. - public static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse) { - RequiresCanRead(test, "test"); - RequiresCanRead(ifTrue, "ifTrue"); - RequiresCanRead(ifFalse, "ifFalse"); - - if (test.Type != typeof(bool)) { - throw Error.ArgumentMustBeBoolean(); - } - if (!TypeUtils.AreEquivalent(ifTrue.Type, ifFalse.Type)) { - throw Error.ArgumentTypesMustMatch(); - } - - return ConditionalExpression.Make(test, ifTrue, ifFalse, ifTrue.Type); - } - - - /// - /// Creates a . - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to - /// and the , , - /// and properties set to the specified values. - /// This method allows explicitly unifying the result type of the conditional expression in cases where the types of - /// and expressions are not equal. Types of both and must be implicitly - /// reference assignable to the result type. The is allowed to be . - public static ConditionalExpression Condition(Expression test, Expression ifTrue, Expression ifFalse, Type type) { - RequiresCanRead(test, "test"); - RequiresCanRead(ifTrue, "ifTrue"); - RequiresCanRead(ifFalse, "ifFalse"); - ContractUtils.RequiresNotNull(type, "type"); - - if (test.Type != typeof(bool)) { - throw Error.ArgumentMustBeBoolean(); - } - - if (type != typeof(void)) { - if (!TypeUtils.AreReferenceAssignable(type, ifTrue.Type) || - !TypeUtils.AreReferenceAssignable(type, ifFalse.Type)) { - throw Error.ArgumentTypesMustMatch(); - } - } - - return ConditionalExpression.Make(test, ifTrue, ifFalse, type); - } - - /// - /// Creates a . - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the , , - /// properties set to the specified values. The property is set to default expression and - /// the type of the resulting returned by this method is . - public static ConditionalExpression IfThen(Expression test, Expression ifTrue) { - return Condition(test, ifTrue, Expression.Empty(), typeof(void)); - } - - /// - /// Creates a . - /// - /// An to set the property equal to. - /// An to set the property equal to. - /// An to set the property equal to. - /// A that has the property equal to - /// and the , , - /// and properties set to the specified values. The type of the resulting - /// returned by this method is . - public static ConditionalExpression IfThenElse(Expression test, Expression ifTrue, Expression ifFalse) { - return Condition(test, ifTrue, ifFalse, typeof(void)); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ConstantExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ConstantExpression.cs deleted file mode 100644 index b4c3c7b3ceb..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ConstantExpression.cs +++ /dev/null @@ -1,136 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if SILVERLIGHT -using System.Core; -#endif - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents an expression that has a constant value. - /// - [DebuggerTypeProxy(typeof(Expression.ConstantExpressionProxy))] - public class ConstantExpression : Expression { - // Possible optimization: we could have a Constant subclass that - // stores the unboxed value. - private readonly object _value; - - internal ConstantExpression(object value) { - _value = value; - } - - internal static ConstantExpression Make(object value, Type type) { - if ((value == null && type == typeof(object)) || (value != null && value.GetType() == type)) { - return new ConstantExpression(value); - } else { - return new TypedConstantExpression(value, type); - } - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public override Type Type { - get { - if (_value == null) { - return typeof(object); - } - return _value.GetType(); - } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Constant; } - } - /// - /// Gets the value of the constant expression. - /// - public object Value { - get { return _value; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitConstant(this); - } - } - - internal class TypedConstantExpression : ConstantExpression { - private readonly Type _type; - - internal TypedConstantExpression(object value, Type type) - : base(value) { - _type = type; - } - - public sealed override Type Type { - get { return _type; } - } - } - - public partial class Expression { - /// - /// Creates a that has the property set to the specified value. . - /// - /// An to set the property equal to. - /// - /// A that has the property equal to - /// and the property set to the specified value. - /// - public static ConstantExpression Constant(object value) { - return ConstantExpression.Make(value, value == null ? typeof(object) : value.GetType()); - } - - - /// - /// Creates a that has the - /// and properties set to the specified values. . - /// - /// An to set the property equal to. - /// A to set the property equal to. - /// - /// A that has the property equal to - /// and the and - /// properties set to the specified values. - /// - public static ConstantExpression Constant(object value, Type type) { - ContractUtils.RequiresNotNull(type, "type"); - if (value == null && type.IsValueType && !TypeUtils.IsNullableType(type)) { - throw Error.ArgumentTypesMustMatch(); - } - if (value != null && !type.IsAssignableFrom(value.GetType())) { - throw Error.ArgumentTypesMustMatch(); - } - return ConstantExpression.Make(value, type); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugInfoExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugInfoExpression.cs deleted file mode 100644 index dd5121a5246..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugInfoExpression.cs +++ /dev/null @@ -1,243 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Emits or clears a sequence point for debug information. - /// - /// This allows the debugger to highlight the correct source code when - /// debugging. - /// - [DebuggerTypeProxy(typeof(Expression.DebugInfoExpressionProxy))] - public class DebugInfoExpression : Expression { - - private readonly SymbolDocumentInfo _document; - - internal DebugInfoExpression(SymbolDocumentInfo document) { - _document = document; - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return typeof(void); } - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.DebugInfo; } - } - - /// - /// Gets the start line of this . - /// - public virtual int StartLine { - get { throw ContractUtils.Unreachable; } - } - - /// - /// Gets the start column of this . - /// - public virtual int StartColumn { - get { throw ContractUtils.Unreachable; } - } - - /// - /// Gets the end line of this . - /// - public virtual int EndLine { - get { throw ContractUtils.Unreachable; } - } - - /// - /// Gets the end column of this . - /// - public virtual int EndColumn { - get { throw ContractUtils.Unreachable; } - } - - /// - /// Gets the that represents the source file. - /// - public SymbolDocumentInfo Document { - get { return _document; } - } - - /// - /// Gets the value to indicate if the is for clearing a sequence point. - /// - public virtual bool IsClear { - get { throw ContractUtils.Unreachable; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitDebugInfo(this); - } - } - - #region Specialized subclasses - - internal sealed class SpanDebugInfoExpression : DebugInfoExpression { - private readonly int _startLine, _startColumn, _endLine, _endColumn; - - internal SpanDebugInfoExpression(SymbolDocumentInfo document, int startLine, int startColumn, int endLine, int endColumn) - : base(document) { - _startLine = startLine; - _startColumn = startColumn; - _endLine = endLine; - _endColumn = endColumn; - } - - public override int StartLine { - get { - return _startLine; - } - } - - public override int StartColumn { - get { - return _startColumn; - } - } - - public override int EndLine { - get { - return _endLine; - } - } - - public override int EndColumn { - get { - return _endColumn; - } - } - - public override bool IsClear { - get { - return false; - } - } - - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitDebugInfo(this); - } - } - - internal sealed class ClearDebugInfoExpression : DebugInfoExpression { - internal ClearDebugInfoExpression(SymbolDocumentInfo document) - : base(document) { - } - - public override bool IsClear { - get { - return true; - } - } - - public override int StartLine { - get { - return 0xfeefee; - } - } - - public override int StartColumn { - get { - return 0; - } - } - - public override int EndLine { - get { - return 0xfeefee; - } - } - - public override int EndColumn { - get { - return 0; - } - } - } - #endregion - - public partial class Expression { - /// - /// Creates a with the specified span. - /// - /// The that represents the source file. - /// The start line of this . Must be greater than 0. - /// The start column of this . Must be greater than 0. - /// The end line of this . Must be greater or equal than the start line. - /// The end column of this . If the end line is the same as the start line, it must be greater or equal than the start column. In any case, must be greater than 0. - /// An instance of . - public static DebugInfoExpression DebugInfo(SymbolDocumentInfo document, int startLine, int startColumn, int endLine, int endColumn) { - ContractUtils.RequiresNotNull(document, "document"); - if (startLine == 0xfeefee && startColumn == 0 && endLine == 0xfeefee && endColumn == 0) { - return new ClearDebugInfoExpression(document); - } - - ValidateSpan(startLine, startColumn, endLine, endColumn); - return new SpanDebugInfoExpression(document, startLine, startColumn, endLine, endColumn); - } - - /// - /// Creates a for clearing a sequence point. - /// - /// The that represents the source file. - /// An instance of for clearning a sequence point. - public static DebugInfoExpression ClearDebugInfo(SymbolDocumentInfo document) { - ContractUtils.RequiresNotNull(document, "document"); - - return new ClearDebugInfoExpression(document); - } - - private static void ValidateSpan(int startLine, int startColumn, int endLine, int endColumn) { - if (startLine < 1) { - throw Error.OutOfRange("startLine", 1); - } - if (startColumn < 1) { - throw Error.OutOfRange("startColumn", 1); - } - if (endLine < 1) { - throw Error.OutOfRange("endLine", 1); - } - if (endColumn < 1) { - throw Error.OutOfRange("endColumn", 1); - } - if (startLine > endLine) { - throw Error.StartEndMustBeOrdered(); - } - if (startLine == endLine && startColumn > endColumn) { - throw Error.StartEndMustBeOrdered(); - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugViewWriter.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugViewWriter.cs deleted file mode 100644 index 098126a383b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DebugViewWriter.cs +++ /dev/null @@ -1,1179 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic; -using System.Dynamic.Utils; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Collections.ObjectModel; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] - internal sealed class DebugViewWriter : ExpressionVisitor { - [Flags] - private enum Flow { - None, - Space, - NewLine, - - Break = 0x8000 // newline if column > MaxColumn - }; - - private const int Tab = 4; - private const int MaxColumn = 120; - - private TextWriter _out; - private int _column; - - private Stack _stack = new Stack(); - private int _delta; - private Flow _flow; - - // All the unique lambda expressions in the ET, will be used for displaying all - // the lambda definitions. - private Queue _lambdas; - - // Associate every unique anonymous LambdaExpression in the tree with an integer. - // The id is used to create a name for the anonymous lambda. - // - private Dictionary _lambdaIds; - - // Associate every unique anonymous parameter or variable in the tree with an integer. - // The id is used to create a name for the anonymous parameter or variable. - // - private Dictionary _paramIds; - - // Associate every unique anonymous LabelTarget in the tree with an integer. - // The id is used to create a name for the anonymous LabelTarget. - // - private Dictionary _labelIds; - - private DebugViewWriter(TextWriter file) { - _out = file; - } - - private int Base { - get { - return _stack.Count > 0 ? _stack.Peek() : 0; - } - } - - private int Delta { - get { return _delta; } - } - - private int Depth { - get { return Base + Delta; } - } - - private void Indent() { - _delta += Tab; - } - private void Dedent() { - _delta -= Tab; - } - - private void NewLine() { - _flow = Flow.NewLine; - } - - private static int GetId(T e, ref Dictionary ids) { - if (ids == null) { - ids = new Dictionary(); - ids.Add(e, 1); - return 1; - } else { - int id; - if (!ids.TryGetValue(e, out id)) { - // e is met the first time - id = ids.Count + 1; - ids.Add(e, id); - } - return id; - } - } - - private int GetLambdaId(LambdaExpression le) { - Debug.Assert(String.IsNullOrEmpty(le.Name)); - return GetId(le, ref _lambdaIds); - } - - private int GetParamId(ParameterExpression p) { - Debug.Assert(String.IsNullOrEmpty(p.Name)); - return GetId(p, ref _paramIds); - } - - private int GetLabelTargetId(LabelTarget target) { - Debug.Assert(String.IsNullOrEmpty(target.Name)); - return GetId(target, ref _labelIds); - } - - /// - /// Write out the given AST - /// - internal static void WriteTo(Expression node, TextWriter writer) { - Debug.Assert(node != null); - Debug.Assert(writer != null); - - new DebugViewWriter(writer).WriteTo(node); - } - - private void WriteTo(Expression node) { - var lambda = node as LambdaExpression; - if (lambda != null) { - WriteLambda(lambda); - } else { - Visit(node); - Debug.Assert(_stack.Count == 0); - } - - // - // Output all lambda expression definitions. - // in the order of their appearances in the tree. - // - while (_lambdas != null && _lambdas.Count > 0) { - WriteLine(); - WriteLine(); - WriteLambda(_lambdas.Dequeue()); - } - } - - #region The printing code - - private void Out(string s) { - Out(Flow.None, s, Flow.None); - } - - private void Out(Flow before, string s) { - Out(before, s, Flow.None); - } - - private void Out(string s, Flow after) { - Out(Flow.None, s, after); - } - - private void Out(Flow before, string s, Flow after) { - switch (GetFlow(before)) { - case Flow.None: - break; - case Flow.Space: - Write(" "); - break; - case Flow.NewLine: - WriteLine(); - Write(new String(' ', Depth)); - break; - } - Write(s); - _flow = after; - } - - private void WriteLine() { - _out.WriteLine(); - _column = 0; - } - private void Write(string s) { - _out.Write(s); - _column += s.Length; - } - - private Flow GetFlow(Flow flow) { - Flow last; - - last = CheckBreak(_flow); - flow = CheckBreak(flow); - - // Get the biggest flow that is requested None < Space < NewLine - return (Flow)System.Math.Max((int)last, (int)flow); - } - - private Flow CheckBreak(Flow flow) { - if ((flow & Flow.Break) != 0) { - if (_column > (MaxColumn + Depth)) { - flow = Flow.NewLine; - } else { - flow &= ~Flow.Break; - } - } - return flow; - } - - #endregion - - #region The AST Output - - // More proper would be to make this a virtual method on Action - private static string FormatBinder(CallSiteBinder binder) { - ConvertBinder convert; - GetMemberBinder getMember; - SetMemberBinder setMember; - DeleteMemberBinder deleteMember; - InvokeMemberBinder call; - UnaryOperationBinder unary; - BinaryOperationBinder binary; - - if ((convert = binder as ConvertBinder) != null) { - return "Convert " + convert.Type.ToString(); - } else if ((getMember = binder as GetMemberBinder) != null) { - return "GetMember " + getMember.Name; - } else if ((setMember = binder as SetMemberBinder) != null) { - return "SetMember " + setMember.Name; - } else if ((deleteMember = binder as DeleteMemberBinder) != null) { - return "DeleteMember " + deleteMember.Name; - } else if (binder is GetIndexBinder) { - return "GetIndex"; - } else if (binder is SetIndexBinder) { - return "SetIndex"; - } else if (binder is DeleteIndexBinder) { - return "DeleteIndex"; - } else if ((call = binder as InvokeMemberBinder) != null) { - return "Call " + call.Name; - } else if (binder is InvokeBinder) { - return "Invoke"; - } else if (binder is CreateInstanceBinder) { - return "Create"; - } else if ((unary = binder as UnaryOperationBinder) != null) { - return "UnaryOperation " + unary.Operation; - } else if ((binary = binder as BinaryOperationBinder) != null) { - return "BinaryOperation " + binary.Operation; - } else { - return binder.ToString(); - } - } - - private void VisitExpressions(char open, IList expressions) where T : Expression { - VisitExpressions(open, ',', expressions); - } - - private void VisitExpressions(char open, char separator, IList expressions) where T : Expression { - VisitExpressions(open, separator, expressions, e => Visit(e)); - } - - private void VisitDeclarations(IList expressions) { - VisitExpressions('(', ',', expressions, variable => - { - Out(variable.Type.ToString()); - if (variable.IsByRef) { - Out("&"); - } - Out(" "); - VisitParameter(variable); - }); - } - - private void VisitExpressions(char open, char separator, IList expressions, Action visit) { - Out(open.ToString()); - - if (expressions != null) { - Indent(); - bool isFirst = true; - foreach (T e in expressions) { - if (isFirst) { - if (open == '{' || expressions.Count > 1) { - NewLine(); - } - isFirst = false; - } else { - Out(separator.ToString(), Flow.NewLine); - } - visit(e); - } - Dedent(); - } - - char close; - switch (open) { - case '(': close = ')'; break; - case '{': close = '}'; break; - case '[': close = ']'; break; - case '<': close = '>'; break; - default: throw ContractUtils.Unreachable; - } - - if (open == '{') { - NewLine(); - } - Out(close.ToString(), Flow.Break); - } - - protected internal override Expression VisitDynamic(DynamicExpression node) { - Out(".Dynamic", Flow.Space); - Out(FormatBinder(node.Binder)); - VisitExpressions('(', node.Arguments); - return node; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - protected internal override Expression VisitBinary(BinaryExpression node) { - if (node.NodeType == ExpressionType.ArrayIndex) { - ParenthesizedVisit(node, node.Left); - Out("["); - Visit(node.Right); - Out("]"); - } else { - bool parenthesizeLeft = NeedsParentheses(node, node.Left); - bool parenthesizeRight = NeedsParentheses(node, node.Right); - - string op; - bool isChecked = false; - Flow beforeOp = Flow.Space; - switch (node.NodeType) { - case ExpressionType.Assign: op = "="; break; - case ExpressionType.Equal: op = "=="; break; - case ExpressionType.NotEqual: op = "!="; break; - case ExpressionType.AndAlso: op = "&&"; beforeOp = Flow.Break | Flow.Space; break; - case ExpressionType.OrElse: op = "||"; beforeOp = Flow.Break | Flow.Space; break; - case ExpressionType.GreaterThan: op = ">"; break; - case ExpressionType.LessThan: op = "<"; break; - case ExpressionType.GreaterThanOrEqual: op = ">="; break; - case ExpressionType.LessThanOrEqual: op = "<="; break; - case ExpressionType.Add: op = "+"; break; - case ExpressionType.AddAssign: op = "+="; break; - case ExpressionType.AddAssignChecked: op = "+="; isChecked = true; break; - case ExpressionType.AddChecked: op = "+"; isChecked = true; break; - case ExpressionType.Subtract: op = "-"; break; - case ExpressionType.SubtractAssign: op = "-="; break; - case ExpressionType.SubtractAssignChecked: op = "-="; isChecked = true; break; - case ExpressionType.SubtractChecked: op = "-"; isChecked = true; break; - case ExpressionType.Divide: op = "/"; break; - case ExpressionType.DivideAssign: op = "/="; break; - case ExpressionType.Modulo: op = "%"; break; - case ExpressionType.ModuloAssign: op = "%="; break; - case ExpressionType.Multiply: op = "*"; break; - case ExpressionType.MultiplyAssign: op = "*="; break; - case ExpressionType.MultiplyAssignChecked: op = "*="; isChecked = true; break; - case ExpressionType.MultiplyChecked: op = "*"; isChecked = true; break; - case ExpressionType.LeftShift: op = "<<"; break; - case ExpressionType.LeftShiftAssign: op = "<<="; break; - case ExpressionType.RightShift: op = ">>"; break; - case ExpressionType.RightShiftAssign: op = ">>="; break; - case ExpressionType.And: op = "&"; break; - case ExpressionType.AndAssign: op = "&="; break; - case ExpressionType.Or: op = "|"; break; - case ExpressionType.OrAssign: op = "|="; break; - case ExpressionType.ExclusiveOr: op = "^"; break; - case ExpressionType.ExclusiveOrAssign: op = "^="; break; - case ExpressionType.Power: op = "**"; break; - case ExpressionType.PowerAssign: op = "**="; break; - case ExpressionType.Coalesce: op = "??"; break; - - default: - throw new InvalidOperationException(); - } - - if (parenthesizeLeft) { - Out("(", Flow.None); - } - - Visit(node.Left); - if (parenthesizeLeft) { - Out(Flow.None, ")", Flow.Break); - } - - // prepend # to the operator to represent checked op - if (isChecked) { - op = String.Format( - CultureInfo.CurrentCulture, - "#{0}", - op - ); - } - Out(beforeOp, op, Flow.Space | Flow.Break); - - if (parenthesizeRight) { - Out("(", Flow.None); - } - Visit(node.Right); - if (parenthesizeRight) { - Out(Flow.None, ")", Flow.Break); - } - } - return node; - } - - protected internal override Expression VisitParameter(ParameterExpression node) { - // Have '$' for the DebugView of ParameterExpressions - Out("$"); - if (String.IsNullOrEmpty(node.Name)) { - // If no name if provided, generate a name as $var1, $var2. - // No guarantee for not having name conflicts with user provided variable names. - // - int id = GetParamId(node); - Out("var" + id); - } else { - Out(GetDisplayName(node.Name)); - } - return node; - } - - protected internal override Expression VisitLambda(Expression node) { - Out( - String.Format(CultureInfo.CurrentCulture, - "{0} {1}<{2}>", - ".Lambda", - GetLambdaName(node), - node.Type.ToString() - ) - ); - - if (_lambdas == null) { - _lambdas = new Queue(); - } - - // N^2 performance, for keeping the order of the lambdas. - if (!_lambdas.Contains(node)) { - _lambdas.Enqueue(node); - } - - return node; - } - - private static bool IsSimpleExpression(Expression node) { - var binary = node as BinaryExpression; - if (binary != null) { - return !(binary.Left is BinaryExpression || binary.Right is BinaryExpression); - } - - return false; - } - - protected internal override Expression VisitConditional(ConditionalExpression node) { - if (IsSimpleExpression(node.Test)) { - Out(".If ("); - Visit(node.Test); - Out(") {", Flow.NewLine); - } else { - Out(".If (", Flow.NewLine); - Indent(); - Visit(node.Test); - Dedent(); - Out(Flow.NewLine, ") {", Flow.NewLine); - } - Indent(); - Visit(node.IfTrue); - Dedent(); - Out(Flow.NewLine, "} .Else {", Flow.NewLine); - Indent(); - Visit(node.IfFalse); - Dedent(); - Out(Flow.NewLine, "}"); - return node; - } - - protected internal override Expression VisitConstant(ConstantExpression node) { - object value = node.Value; - - if (value == null) { - Out("null"); - } else if ((value is string) && node.Type == typeof(string)) { - Out(String.Format( - CultureInfo.CurrentCulture, - "\"{0}\"", - value)); - } else if ((value is char) && node.Type == typeof(char)) { - Out(String.Format( - CultureInfo.CurrentCulture, - "'{0}'", - value)); - } else if ((value is int) && node.Type == typeof(int) - || (value is bool) && node.Type == typeof(bool)) { - Out(value.ToString()); - } else { - string suffix = GetConstantValueSuffix(node.Type); - if (suffix != null) { - Out(value.ToString()); - Out(suffix); - } else { - Out(String.Format( - CultureInfo.CurrentCulture, - ".Constant<{0}>({1})", - node.Type.ToString(), - value)); - } - } - return node; - } - - private static string GetConstantValueSuffix(Type type) { - if (type == typeof(UInt32)) { - return "U"; - } - if (type == typeof(Int64)) { - return "L"; - } - if (type == typeof(UInt64)) { - return "UL"; - } - if (type == typeof(Double)) { - return "D"; - } - if (type == typeof(Single)) { - return "F"; - } - if (type == typeof(Decimal)) { - return "M"; - } - return null; - } - - protected internal override Expression VisitRuntimeVariables(RuntimeVariablesExpression node) { - Out(".RuntimeVariables"); - VisitExpressions('(', node.Variables); - return node; - } - - // Prints ".instanceField" or "declaringType.staticField" - private void OutMember(Expression node, Expression instance, MemberInfo member) { - if (instance != null) { - ParenthesizedVisit(node, instance); - Out("." + member.Name); - } else { - // For static members, include the type name - Out(member.DeclaringType.ToString() + "." + member.Name); - } - } - - protected internal override Expression VisitMember(MemberExpression node) { - OutMember(node, node.Expression, node.Member); - return node; - } - - protected internal override Expression VisitInvocation(InvocationExpression node) { - Out(".Invoke "); - ParenthesizedVisit(node, node.Expression); - VisitExpressions('(', node.Arguments); - return node; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private static bool NeedsParentheses(Expression parent, Expression child) { - Debug.Assert(parent != null); - if (child == null) { - return false; - } - - // Some nodes always have parentheses because of how they are - // displayed, for example: ".Unbox(obj.Foo)" - switch (parent.NodeType) { - case ExpressionType.Increment: - case ExpressionType.Decrement: - case ExpressionType.IsTrue: - case ExpressionType.IsFalse: - case ExpressionType.Unbox: - return true; - } - - int childOpPrec = GetOperatorPrecedence(child); - int parentOpPrec = GetOperatorPrecedence(parent); - - if (childOpPrec == parentOpPrec) { - // When parent op and child op has the same precedence, - // we want to be a little conservative to have more clarity. - // Parentheses are not needed if - // 1) Both ops are &&, ||, &, |, or ^, all of them are the only - // op that has the precedence. - // 2) Parent op is + or *, e.g. x + (y - z) can be simplified to - // x + y - z. - // 3) Parent op is -, / or %, and the child is the left operand. - // In this case, if left and right operand are the same, we don't - // remove parenthesis, e.g. (x + y) - (x + y) - // - switch (parent.NodeType) { - case ExpressionType.AndAlso: - case ExpressionType.OrElse: - case ExpressionType.And: - case ExpressionType.Or: - case ExpressionType.ExclusiveOr: - // Since these ops are the only ones on their precedence, - // the child op must be the same. - Debug.Assert(child.NodeType == parent.NodeType); - // We remove the parenthesis, e.g. x && y && z - return false; - case ExpressionType.Add: - case ExpressionType.AddChecked: - case ExpressionType.Multiply: - case ExpressionType.MultiplyChecked: - return false; - case ExpressionType.Subtract: - case ExpressionType.SubtractChecked: - case ExpressionType.Divide: - case ExpressionType.Modulo: - BinaryExpression binary = parent as BinaryExpression; - Debug.Assert(binary != null); - // Need to have parenthesis for the right operand. - return child == binary.Right; - } - return true; - } - - // Special case: negate of a constant needs parentheses, to - // disambiguate it from a negative constant. - if (child != null && child.NodeType == ExpressionType.Constant && - (parent.NodeType == ExpressionType.Negate || parent.NodeType == ExpressionType.NegateChecked)) { - return true; - } - - // If the parent op has higher precedence, need parentheses for the child. - return childOpPrec < parentOpPrec; - } - - // the greater the higher - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private static int GetOperatorPrecedence(Expression node) { - - // Roughly matches C# operator precedence, with some additional - // operators. Also things which are not binary/unary expressions, - // such as conditional and type testing, don't use this mechanism. - switch (node.NodeType) { - // Assignment - case ExpressionType.Assign: - case ExpressionType.ExclusiveOrAssign: - case ExpressionType.AddAssign: - case ExpressionType.AddAssignChecked: - case ExpressionType.SubtractAssign: - case ExpressionType.SubtractAssignChecked: - case ExpressionType.DivideAssign: - case ExpressionType.ModuloAssign: - case ExpressionType.MultiplyAssign: - case ExpressionType.MultiplyAssignChecked: - case ExpressionType.LeftShiftAssign: - case ExpressionType.RightShiftAssign: - case ExpressionType.AndAssign: - case ExpressionType.OrAssign: - case ExpressionType.PowerAssign: - case ExpressionType.Coalesce: - return 1; - - // Conditional (?:) would go here - - // Conditional OR - case ExpressionType.OrElse: - return 2; - - // Conditional AND - case ExpressionType.AndAlso: - return 3; - - // Logical OR - case ExpressionType.Or: - return 4; - - // Logical XOR - case ExpressionType.ExclusiveOr: - return 5; - - // Logical AND - case ExpressionType.And: - return 6; - - // Equality - case ExpressionType.Equal: - case ExpressionType.NotEqual: - return 7; - - // Relational, type testing - case ExpressionType.GreaterThan: - case ExpressionType.LessThan: - case ExpressionType.GreaterThanOrEqual: - case ExpressionType.LessThanOrEqual: - case ExpressionType.TypeAs: - case ExpressionType.TypeIs: - case ExpressionType.TypeEqual: - return 8; - - // Shift - case ExpressionType.LeftShift: - case ExpressionType.RightShift: - return 9; - - // Additive - case ExpressionType.Add: - case ExpressionType.AddChecked: - case ExpressionType.Subtract: - case ExpressionType.SubtractChecked: - return 10; - - // Multiplicative - case ExpressionType.Divide: - case ExpressionType.Modulo: - case ExpressionType.Multiply: - case ExpressionType.MultiplyChecked: - return 11; - - // Unary - case ExpressionType.Negate: - case ExpressionType.NegateChecked: - case ExpressionType.UnaryPlus: - case ExpressionType.Not: - case ExpressionType.Convert: - case ExpressionType.ConvertChecked: - case ExpressionType.PreIncrementAssign: - case ExpressionType.PreDecrementAssign: - case ExpressionType.OnesComplement: - case ExpressionType.Increment: - case ExpressionType.Decrement: - case ExpressionType.IsTrue: - case ExpressionType.IsFalse: - case ExpressionType.Unbox: - case ExpressionType.Throw: - return 12; - - // Power, which is not in C# - // But VB/Python/Ruby put it here, above unary. - case ExpressionType.Power: - return 13; - - // Primary, which includes all other node types: - // member access, calls, indexing, new. - case ExpressionType.PostIncrementAssign: - case ExpressionType.PostDecrementAssign: - default: - return 14; - - // These aren't expressions, so never need parentheses: - // constants, variables - case ExpressionType.Constant: - case ExpressionType.Parameter: - return 15; - } - } - - private void ParenthesizedVisit(Expression parent, Expression nodeToVisit) { - if (NeedsParentheses(parent, nodeToVisit)) { - Out("("); - Visit(nodeToVisit); - Out(")"); - } else { - Visit(nodeToVisit); - } - } - - protected internal override Expression VisitMethodCall(MethodCallExpression node) { - Out(".Call "); - if (node.Object != null) { - ParenthesizedVisit(node, node.Object); - } else if (node.Method.DeclaringType != null) { - Out(node.Method.DeclaringType.ToString()); - } else { - Out(""); - } - Out("."); - Out(node.Method.Name); - VisitExpressions('(', node.Arguments); - return node; - } - - protected internal override Expression VisitNewArray(NewArrayExpression node) { - if (node.NodeType == ExpressionType.NewArrayBounds) { - // .NewArray MyType[expr1, expr2] - Out(".NewArray " + node.Type.GetElementType().ToString()); - VisitExpressions('[', node.Expressions); - } else { - // .NewArray MyType {expr1, expr2} - Out(".NewArray " + node.Type.ToString(), Flow.Space); - VisitExpressions('{', node.Expressions); - } - return node; - } - - protected internal override Expression VisitNew(NewExpression node) { - Out(".New " + node.Type.ToString()); - VisitExpressions('(', node.Arguments); - return node; - } - - protected override ElementInit VisitElementInit(ElementInit node) { - if (node.Arguments.Count == 1) { - Visit(node.Arguments[0]); - } else { - VisitExpressions('{', node.Arguments); - } - return node; - } - - protected internal override Expression VisitListInit(ListInitExpression node) { - Visit(node.NewExpression); - VisitExpressions('{', ',', node.Initializers, e => VisitElementInit(e)); - return node; - } - - protected override MemberAssignment VisitMemberAssignment(MemberAssignment assignment) { - Out(assignment.Member.Name); - Out(Flow.Space, "=", Flow.Space); - Visit(assignment.Expression); - return assignment; - } - - protected override MemberListBinding VisitMemberListBinding(MemberListBinding binding) { - Out(binding.Member.Name); - Out(Flow.Space, "=", Flow.Space); - VisitExpressions('{', ',', binding.Initializers, e => VisitElementInit(e)); - return binding; - } - - protected override MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding) { - Out(binding.Member.Name); - Out(Flow.Space, "=", Flow.Space); - VisitExpressions('{', ',', binding.Bindings, e => VisitMemberBinding(e)); - return binding; - } - - protected internal override Expression VisitMemberInit(MemberInitExpression node) { - Visit(node.NewExpression); - VisitExpressions('{', ',', node.Bindings, e => VisitMemberBinding(e)); - return node; - } - - protected internal override Expression VisitTypeBinary(TypeBinaryExpression node) { - ParenthesizedVisit(node, node.Expression); - switch (node.NodeType) { - case ExpressionType.TypeIs: - Out(Flow.Space, ".Is", Flow.Space); - break; - case ExpressionType.TypeEqual: - Out(Flow.Space, ".TypeEqual", Flow.Space); - break; - } - Out(node.TypeOperand.ToString()); - return node; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - protected internal override Expression VisitUnary(UnaryExpression node) { - switch (node.NodeType) { - case ExpressionType.Convert: - Out("(" + node.Type.ToString() + ")"); - break; - case ExpressionType.ConvertChecked: - Out("#(" + node.Type.ToString() + ")"); - break; - case ExpressionType.TypeAs: - break; - case ExpressionType.Not: - Out(node.Type == typeof(bool) ? "!" : "~"); - break; - case ExpressionType.OnesComplement: - Out("~"); - break; - case ExpressionType.Negate: - Out("-"); - break; - case ExpressionType.NegateChecked: - Out("#-"); - break; - case ExpressionType.UnaryPlus: - Out("+"); - break; - case ExpressionType.ArrayLength: - break; - case ExpressionType.Quote: - Out("'"); - break; - case ExpressionType.Throw: - if (node.Operand == null) { - Out(".Rethrow"); - } else { - Out(".Throw", Flow.Space); - } - break; - case ExpressionType.IsFalse: - Out(".IsFalse"); - break; - case ExpressionType.IsTrue: - Out(".IsTrue"); - break; - case ExpressionType.Decrement: - Out(".Decrement"); - break; - case ExpressionType.Increment: - Out(".Increment"); - break; - case ExpressionType.PreDecrementAssign: - Out("--"); - break; - case ExpressionType.PreIncrementAssign: - Out("++"); - break; - case ExpressionType.Unbox: - Out(".Unbox"); - break; - } - - ParenthesizedVisit(node, node.Operand); - - switch (node.NodeType) { - case ExpressionType.TypeAs: - Out(Flow.Space, ".As", Flow.Space | Flow.Break); - Out(node.Type.ToString()); - break; - - case ExpressionType.ArrayLength: - Out(".Length"); - break; - - case ExpressionType.PostDecrementAssign: - Out("--"); - break; - - case ExpressionType.PostIncrementAssign: - Out("++"); - break; - } - return node; - } - - protected internal override Expression VisitBlock(BlockExpression node) { - Out(".Block"); - - // Display if the type of the BlockExpression is different from the - // last expression's type in the block. - if (node.Type != node.GetExpression(node.ExpressionCount - 1).Type) { - Out(String.Format(CultureInfo.CurrentCulture, "<{0}>", node.Type.ToString())); - } - - VisitDeclarations(node.Variables); - Out(" "); - // Use ; to separate expressions in the block - VisitExpressions('{', ';', node.Expressions); - - return node; - } - - protected internal override Expression VisitDefault(DefaultExpression node) { - Out(".Default(" + node.Type.ToString() + ")"); - return node; - } - - protected internal override Expression VisitLabel(LabelExpression node) { - Out(".Label", Flow.NewLine); - Indent(); - Visit(node.DefaultValue); - Dedent(); - NewLine(); - DumpLabel(node.Target); - return node; - } - - protected internal override Expression VisitGoto(GotoExpression node) { - Out("." + node.Kind.ToString(), Flow.Space); - Out(GetLabelTargetName(node.Target), Flow.Space); - Out("{", Flow.Space); - Visit(node.Value); - Out(Flow.Space, "}"); - return node; - } - - protected internal override Expression VisitLoop(LoopExpression node) { - Out(".Loop", Flow.Space); - if (node.ContinueLabel != null) { - DumpLabel(node.ContinueLabel); - } - Out(" {", Flow.NewLine); - Indent(); - Visit(node.Body); - Dedent(); - Out(Flow.NewLine, "}"); - if (node.BreakLabel != null) { - Out("", Flow.NewLine); - DumpLabel(node.BreakLabel); - } - return node; - } - - protected override SwitchCase VisitSwitchCase(SwitchCase node) { - foreach (var test in node.TestValues) { - Out(".Case ("); - Visit(test); - Out("):", Flow.NewLine); - } - Indent(); Indent(); - Visit(node.Body); - Dedent(); Dedent(); - NewLine(); - return node; - } - - protected internal override Expression VisitSwitch(SwitchExpression node) { - Out(".Switch "); - Out("("); - Visit(node.SwitchValue); - Out(") {", Flow.NewLine); - Visit(node.Cases, VisitSwitchCase); - if (node.DefaultBody != null) { - Out(".Default:", Flow.NewLine); - Indent(); Indent(); - Visit(node.DefaultBody); - Dedent(); Dedent(); - NewLine(); - } - Out("}"); - return node; - } - - protected override CatchBlock VisitCatchBlock(CatchBlock node) { - Out(Flow.NewLine, "} .Catch (" + node.Test.ToString()); - if (node.Variable != null) { - Out(Flow.Space, ""); - VisitParameter(node.Variable); - } - if (node.Filter != null) { - Out(") .If (", Flow.Break); - Visit(node.Filter); - } - Out(") {", Flow.NewLine); - Indent(); - Visit(node.Body); - Dedent(); - return node; - } - - protected internal override Expression VisitTry(TryExpression node) { - Out(".Try {", Flow.NewLine); - Indent(); - Visit(node.Body); - Dedent(); - Visit(node.Handlers, VisitCatchBlock); - if (node.Finally != null) { - Out(Flow.NewLine, "} .Finally {", Flow.NewLine); - Indent(); - Visit(node.Finally); - Dedent(); - } else if (node.Fault != null) { - Out(Flow.NewLine, "} .Fault {", Flow.NewLine); - Indent(); - Visit(node.Fault); - Dedent(); - } - - Out(Flow.NewLine, "}"); - return node; - } - - protected internal override Expression VisitIndex(IndexExpression node) { - if (node.Indexer != null) { - OutMember(node, node.Object, node.Indexer); - } else { - ParenthesizedVisit(node, node.Object); - } - - VisitExpressions('[', node.Arguments); - return node; - } - - protected internal override Expression VisitExtension(Expression node) { - Out(String.Format(CultureInfo.CurrentCulture, ".Extension<{0}>", node.GetType().ToString())); - - if (node.CanReduce) { - Out(Flow.Space, "{", Flow.NewLine); - Indent(); - Visit(node.Reduce()); - Dedent(); - Out(Flow.NewLine, "}"); - } - - return node; - } - - protected internal override Expression VisitDebugInfo(DebugInfoExpression node) { - Out(String.Format( - CultureInfo.CurrentCulture, - ".DebugInfo({0}: {1}, {2} - {3}, {4})", - node.Document.FileName, - node.StartLine, - node.StartColumn, - node.EndLine, - node.EndColumn) - ); - return node; - } - - - private void DumpLabel(LabelTarget target) { - Out(String.Format(CultureInfo.CurrentCulture, ".LabelTarget {0}:", GetLabelTargetName(target))); - } - - private string GetLabelTargetName(LabelTarget target) { - if (string.IsNullOrEmpty(target.Name)) { - // Create the label target name as #Label1, #Label2, etc. - return String.Format(CultureInfo.CurrentCulture, "#Label{0}", GetLabelTargetId(target)); - } else { - return GetDisplayName(target.Name); - } - } - - private void WriteLambda(LambdaExpression lambda) { - Out( - String.Format( - CultureInfo.CurrentCulture, - ".Lambda {0}<{1}>", - GetLambdaName(lambda), - lambda.Type.ToString()) - ); - - VisitDeclarations(lambda.Parameters); - - Out(Flow.Space, "{", Flow.NewLine); - Indent(); - Visit(lambda.Body); - Dedent(); - Out(Flow.NewLine, "}"); - Debug.Assert(_stack.Count == 0); - } - - private string GetLambdaName(LambdaExpression lambda) { - if (String.IsNullOrEmpty(lambda.Name)) { - return "#Lambda" + GetLambdaId(lambda); - } - return GetDisplayName(lambda.Name); - } - - /// - /// Return true if the input string contains any whitespace character. - /// Otherwise false. - /// - private static bool ContainsWhiteSpace(string name) { - foreach (char c in name) { - if (Char.IsWhiteSpace(c)) { - return true; - } - } - return false; - } - - private static string QuoteName(string name) { - return String.Format(CultureInfo.CurrentCulture, "'{0}'", name); - } - - private static string GetDisplayName(string name) { - if (ContainsWhiteSpace(name)) { - // if name has whitespaces in it, quote it - return QuoteName(name); - } else { - return name; - } - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DefaultExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DefaultExpression.cs deleted file mode 100644 index 5234bf84465..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DefaultExpression.cs +++ /dev/null @@ -1,87 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents the default value of a type or an empty expression. - /// - [DebuggerTypeProxy(typeof(Expression.DefaultExpressionProxy))] - public sealed class DefaultExpression : Expression { - private readonly Type _type; - - internal DefaultExpression(Type type) { - _type = type; - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _type; } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Default; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitDefault(this); - } - } - - public partial class Expression { - /// - /// Creates an empty expression that has type. - /// - /// - /// A that has the property equal to - /// and the property set to . - /// - public static DefaultExpression Empty() { - return new DefaultExpression(typeof(void)); - } - - /// - /// Creates a that has the property set to the specified type. - /// - /// A to set the property equal to. - /// - /// A that has the property equal to - /// and the property set to the specified type. - /// - public static DefaultExpression Default(Type type) { - if (type == typeof(void)) { - return Empty(); - } - return new DefaultExpression(type); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs deleted file mode 100644 index 14a8d8e5593..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/DynamicExpression.cs +++ /dev/null @@ -1,848 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - using Compiler; - - /// - /// Represents a dynamic operation. - /// - [DebuggerTypeProxy(typeof(Expression.DynamicExpressionProxy))] - public class DynamicExpression : Expression, IArgumentProvider { - private readonly CallSiteBinder _binder; - private readonly Type _delegateType; - - internal DynamicExpression(Type delegateType, CallSiteBinder binder) { - Debug.Assert(delegateType.GetMethod("Invoke").GetReturnType() == typeof(object) || GetType() != typeof(DynamicExpression)); - _delegateType = delegateType; - _binder = binder; - } - - internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, ReadOnlyCollection arguments) { - if (returnType == typeof(object)) { - return new DynamicExpressionN(delegateType, binder, arguments); - } else { - return new TypedDynamicExpressionN(returnType, delegateType, binder, arguments); - } - } - - internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0) { - if (returnType == typeof(object)) { - return new DynamicExpression1(delegateType, binder, arg0); - } else { - return new TypedDynamicExpression1(returnType, delegateType, binder, arg0); - } - } - - internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1) { - if (returnType == typeof(object)) { - return new DynamicExpression2(delegateType, binder, arg0, arg1); - } else { - return new TypedDynamicExpression2(returnType, delegateType, binder, arg0, arg1); - } - } - - internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2) { - if (returnType == typeof(object)) { - return new DynamicExpression3(delegateType, binder, arg0, arg1, arg2); - } else { - return new TypedDynamicExpression3(returnType, delegateType, binder, arg0, arg1, arg2); - } - } - - internal static DynamicExpression Make(Type returnType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3) { - if (returnType == typeof(object)) { - return new DynamicExpression4(delegateType, binder, arg0, arg1, arg2, arg3); - } else { - return new TypedDynamicExpression4(returnType, delegateType, binder, arg0, arg1, arg2, arg3); - } - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public override Type Type { - get { return typeof(object); } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Dynamic; } - } - - /// - /// Gets the , which determines the runtime behavior of the - /// dynamic site. - /// - public CallSiteBinder Binder { - get { return _binder; } - } - - /// - /// Gets the type of the delegate used by the . - /// - public Type DelegateType { - get { return _delegateType; } - } - - /// - /// Gets the arguments to the dynamic operation. - /// - public ReadOnlyCollection Arguments { - get { return GetOrMakeArguments(); } - } - - internal virtual ReadOnlyCollection GetOrMakeArguments() { - throw ContractUtils.Unreachable; - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitDynamic(this); - } - - /// - /// Makes a copy of this node replacing the args with the provided values. The - /// number of the args needs to match the number of the current block. - /// - /// This helper is provided to allow re-writing of nodes to not depend on the specific optimized - /// subclass of DynamicExpression which is being used. - /// - internal virtual DynamicExpression Rewrite(Expression[] args) { - throw ContractUtils.Unreachable; - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public DynamicExpression Update(IEnumerable arguments) { - if (arguments == Arguments) { - return this; - } - - return Expression.MakeDynamic(DelegateType, Binder, arguments); - } - - #region IArgumentProvider Members - - Expression IArgumentProvider.GetArgument(int index) { - throw ContractUtils.Unreachable; - } - - int IArgumentProvider.ArgumentCount { - get { throw ContractUtils.Unreachable; } - } - - #endregion - } - - #region Specialized Subclasses - - internal class DynamicExpressionN : DynamicExpression, IArgumentProvider { - private IList _arguments; // storage for the original IList or readonly collection. See IArgumentProvider for more info. - - internal DynamicExpressionN(Type delegateType, CallSiteBinder binder, IList arguments) - : base(delegateType, binder) { - _arguments = arguments; - } - - Expression IArgumentProvider.GetArgument(int index) { - return _arguments[index]; - } - - int IArgumentProvider.ArgumentCount { - get { - return _arguments.Count; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(ref _arguments); - } - - internal override DynamicExpression Rewrite(Expression[] args) { - Debug.Assert(args.Length == ((IArgumentProvider)this).ArgumentCount); - - return Expression.MakeDynamic(DelegateType, Binder, args); - } - } - - internal class TypedDynamicExpressionN : DynamicExpressionN { - private readonly Type _returnType; - - internal TypedDynamicExpressionN(Type returnType, Type delegateType, CallSiteBinder binder, IList arguments) - : base(delegateType, binder, arguments) { - Debug.Assert(delegateType.GetMethod("Invoke").GetReturnType() == returnType); - _returnType = returnType; - } - - public sealed override Type Type { - get { return _returnType; } - } - } - - internal class DynamicExpression1 : DynamicExpression, IArgumentProvider { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider for more info. - - internal DynamicExpression1(Type delegateType, CallSiteBinder binder, Expression arg0) - : base(delegateType, binder) { - _arg0 = arg0; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 1; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override DynamicExpression Rewrite(Expression[] args) { - Debug.Assert(args.Length == 1); - - return Expression.MakeDynamic(DelegateType, Binder, args[0]); - } - } - - internal sealed class TypedDynamicExpression1 : DynamicExpression1 { - private readonly Type _retType; - - internal TypedDynamicExpression1(Type retType, Type delegateType, CallSiteBinder binder, Expression arg0) - : base(delegateType, binder, arg0) { - _retType = retType; - } - - public sealed override Type Type { - get { return _retType; } - } - } - - internal class DynamicExpression2 : DynamicExpression, IArgumentProvider { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider for more info. - private readonly Expression _arg1; // storage for the 2nd argument - - internal DynamicExpression2(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1) - : base(delegateType, binder) { - _arg0 = arg0; - _arg1 = arg1; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 2; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override DynamicExpression Rewrite(Expression[] args) { - Debug.Assert(args.Length == 2); - - return Expression.MakeDynamic(DelegateType, Binder, args[0], args[1]); - } - } - - internal sealed class TypedDynamicExpression2 : DynamicExpression2 { - private readonly Type _retType; - - internal TypedDynamicExpression2(Type retType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1) - : base(delegateType, binder, arg0, arg1) { - _retType = retType; - } - - public sealed override Type Type { - get { return _retType; } - } - } - - internal class DynamicExpression3 : DynamicExpression, IArgumentProvider { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider for more info. - private readonly Expression _arg1, _arg2; // storage for the 2nd & 3rd arguments - - internal DynamicExpression3(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2) - : base(delegateType, binder) { - _arg0 = arg0; - _arg1 = arg1; - _arg2 = arg2; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - case 2: return _arg2; - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 3; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override DynamicExpression Rewrite(Expression[] args) { - Debug.Assert(args.Length == 3); - - return Expression.MakeDynamic(DelegateType, Binder, args[0], args[1], args[2]); - } - } - - internal sealed class TypedDynamicExpression3 : DynamicExpression3 { - private readonly Type _retType; - - internal TypedDynamicExpression3(Type retType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2) - : base(delegateType, binder, arg0, arg1, arg2) { - _retType = retType; - } - - public sealed override Type Type { - get { return _retType; } - } - } - - internal class DynamicExpression4 : DynamicExpression, IArgumentProvider { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider for more info. - private readonly Expression _arg1, _arg2, _arg3; // storage for the 2nd - 4th arguments - - internal DynamicExpression4(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3) - : base(delegateType, binder) { - _arg0 = arg0; - _arg1 = arg1; - _arg2 = arg2; - _arg3 = arg3; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - case 2: return _arg2; - case 3: return _arg3; - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 4; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override DynamicExpression Rewrite(Expression[] args) { - Debug.Assert(args.Length == 4); - - return Expression.MakeDynamic(DelegateType, Binder, args[0], args[1], args[2], args[3]); - } - } - - internal sealed class TypedDynamicExpression4 : DynamicExpression4 { - private readonly Type _retType; - - internal TypedDynamicExpression4(Type retType, Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3) - : base(delegateType, binder, arg0, arg1, arg2, arg3) { - _retType = retType; - } - - public sealed override Type Type { - get { return _retType; } - } - } - - #endregion - - public partial class Expression { - - /// - /// Creates a that represents a dynamic operation bound by the provided . - /// - /// The type of the delegate used by the . - /// The runtime binder for the dynamic operation. - /// The arguments to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// DelegateType, - /// Binder, and - /// Arguments set to the specified values. - /// - public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, params Expression[] arguments) { - return MakeDynamic(delegateType, binder, (IEnumerable)arguments); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided . - /// - /// The type of the delegate used by the . - /// The runtime binder for the dynamic operation. - /// The arguments to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// DelegateType, - /// Binder, and - /// Arguments set to the specified values. - /// - public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, IEnumerable arguments) { - ContractUtils.RequiresNotNull(delegateType, "delegateType"); - ContractUtils.RequiresNotNull(binder, "binder"); - if (!delegateType.IsSubclassOf(typeof(MulticastDelegate))) throw Error.TypeMustBeDerivedFromSystemDelegate(); - - var method = GetValidMethodForDynamic(delegateType); - - var args = arguments.ToReadOnly(); - ValidateArgumentTypes(method, ExpressionType.Dynamic, ref args); - - return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, args); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided and one argument. - /// - /// The type of the delegate used by the . - /// The runtime binder for the dynamic operation. - /// The argument to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// DelegateType, - /// Binder, and - /// Arguments set to the specified values. - /// - public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0) { - ContractUtils.RequiresNotNull(delegateType, "delegateType"); - ContractUtils.RequiresNotNull(binder, "binder"); - if (!delegateType.IsSubclassOf(typeof(MulticastDelegate))) throw Error.TypeMustBeDerivedFromSystemDelegate(); - - var method = GetValidMethodForDynamic(delegateType); - var parameters = method.GetParametersCached(); - - ValidateArgumentCount(method, ExpressionType.Dynamic, 2, parameters); - ValidateDynamicArgument(arg0); - ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1]); - - return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, arg0); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided and two arguments. - /// - /// The type of the delegate used by the . - /// The runtime binder for the dynamic operation. - /// The first argument to the dynamic operation. - /// The second argument to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// DelegateType, - /// Binder, and - /// Arguments set to the specified values. - /// - public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1) { - ContractUtils.RequiresNotNull(delegateType, "delegateType"); - ContractUtils.RequiresNotNull(binder, "binder"); - if (!delegateType.IsSubclassOf(typeof(MulticastDelegate))) throw Error.TypeMustBeDerivedFromSystemDelegate(); - - var method = GetValidMethodForDynamic(delegateType); - var parameters = method.GetParametersCached(); - - ValidateArgumentCount(method, ExpressionType.Dynamic, 3, parameters); - ValidateDynamicArgument(arg0); - ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1]); - ValidateDynamicArgument(arg1); - ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2]); - - return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, arg0, arg1); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided and three arguments. - /// - /// The type of the delegate used by the . - /// The runtime binder for the dynamic operation. - /// The first argument to the dynamic operation. - /// The second argument to the dynamic operation. - /// The third argument to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// DelegateType, - /// Binder, and - /// Arguments set to the specified values. - /// - public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2) { - ContractUtils.RequiresNotNull(delegateType, "delegateType"); - ContractUtils.RequiresNotNull(binder, "binder"); - if (!delegateType.IsSubclassOf(typeof(MulticastDelegate))) throw Error.TypeMustBeDerivedFromSystemDelegate(); - - var method = GetValidMethodForDynamic(delegateType); - var parameters = method.GetParametersCached(); - - ValidateArgumentCount(method, ExpressionType.Dynamic, 4, parameters); - ValidateDynamicArgument(arg0); - ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1]); - ValidateDynamicArgument(arg1); - ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2]); - ValidateDynamicArgument(arg2); - ValidateOneArgument(method, ExpressionType.Dynamic, arg2, parameters[3]); - - return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, arg0, arg1, arg2); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided and four arguments. - /// - /// The type of the delegate used by the . - /// The runtime binder for the dynamic operation. - /// The first argument to the dynamic operation. - /// The second argument to the dynamic operation. - /// The third argument to the dynamic operation. - /// The fourth argument to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// DelegateType, - /// Binder, and - /// Arguments set to the specified values. - /// - public static DynamicExpression MakeDynamic(Type delegateType, CallSiteBinder binder, Expression arg0, Expression arg1, Expression arg2, Expression arg3) { - ContractUtils.RequiresNotNull(delegateType, "delegateType"); - ContractUtils.RequiresNotNull(binder, "binder"); - if (!delegateType.IsSubclassOf(typeof(MulticastDelegate))) throw Error.TypeMustBeDerivedFromSystemDelegate(); - - var method = GetValidMethodForDynamic(delegateType); - var parameters = method.GetParametersCached(); - - ValidateArgumentCount(method, ExpressionType.Dynamic, 5, parameters); - ValidateDynamicArgument(arg0); - ValidateOneArgument(method, ExpressionType.Dynamic, arg0, parameters[1]); - ValidateDynamicArgument(arg1); - ValidateOneArgument(method, ExpressionType.Dynamic, arg1, parameters[2]); - ValidateDynamicArgument(arg2); - ValidateOneArgument(method, ExpressionType.Dynamic, arg2, parameters[3]); - ValidateDynamicArgument(arg3); - ValidateOneArgument(method, ExpressionType.Dynamic, arg3, parameters[4]); - - return DynamicExpression.Make(method.GetReturnType(), delegateType, binder, arg0, arg1, arg2, arg3); - } - - private static MethodInfo GetValidMethodForDynamic(Type delegateType) { - var method = delegateType.GetMethod("Invoke"); - var pi = method.GetParametersCached(); - if (pi.Length == 0 || pi[0].ParameterType != typeof(CallSite)) throw Error.FirstArgumentMustBeCallSite(); - return method; - } - - /// - /// Creates a that represents a dynamic operation bound by the provided . - /// - /// The runtime binder for the dynamic operation. - /// The result type of the dynamic expression. - /// The arguments to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// Binder and - /// Arguments set to the specified values. - /// - /// - /// The DelegateType property of the - /// result will be inferred from the types of the arguments and the specified return type. - /// - public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, params Expression[] arguments) { - return Dynamic(binder, returnType, (IEnumerable)arguments); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided . - /// - /// The runtime binder for the dynamic operation. - /// The result type of the dynamic expression. - /// The first argument to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// Binder and - /// Arguments set to the specified values. - /// - /// - /// The DelegateType property of the - /// result will be inferred from the types of the arguments and the specified return type. - /// - public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0) { - ContractUtils.RequiresNotNull(binder, "binder"); - ValidateDynamicArgument(arg0); - - DelegateHelpers.TypeInfo info = DelegateHelpers.GetNextTypeInfo( - returnType, - DelegateHelpers.GetNextTypeInfo( - arg0.Type, - DelegateHelpers.NextTypeInfo(typeof(CallSite)) - ) - ); - - Type delegateType = info.DelegateType; - if (delegateType == null) { - delegateType = info.MakeDelegateType(returnType, arg0); - } - - return DynamicExpression.Make(returnType, delegateType, binder, arg0); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided . - /// - /// The runtime binder for the dynamic operation. - /// The result type of the dynamic expression. - /// The first argument to the dynamic operation. - /// The second argument to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// Binder and - /// Arguments set to the specified values. - /// - /// - /// The DelegateType property of the - /// result will be inferred from the types of the arguments and the specified return type. - /// - public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1) { - ContractUtils.RequiresNotNull(binder, "binder"); - ValidateDynamicArgument(arg0); - ValidateDynamicArgument(arg1); - - DelegateHelpers.TypeInfo info = DelegateHelpers.GetNextTypeInfo( - returnType, - DelegateHelpers.GetNextTypeInfo( - arg1.Type, - DelegateHelpers.GetNextTypeInfo( - arg0.Type, - DelegateHelpers.NextTypeInfo(typeof(CallSite)) - ) - ) - ); - - Type delegateType = info.DelegateType; - if (delegateType == null) { - delegateType = info.MakeDelegateType(returnType, arg0, arg1); - } - - return DynamicExpression.Make(returnType, delegateType, binder, arg0, arg1); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided . - /// - /// The runtime binder for the dynamic operation. - /// The result type of the dynamic expression. - /// The first argument to the dynamic operation. - /// The second argument to the dynamic operation. - /// The third argument to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// Binder and - /// Arguments set to the specified values. - /// - /// - /// The DelegateType property of the - /// result will be inferred from the types of the arguments and the specified return type. - /// - public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2) { - ContractUtils.RequiresNotNull(binder, "binder"); - ValidateDynamicArgument(arg0); - ValidateDynamicArgument(arg1); - ValidateDynamicArgument(arg2); - - DelegateHelpers.TypeInfo info = DelegateHelpers.GetNextTypeInfo( - returnType, - DelegateHelpers.GetNextTypeInfo( - arg2.Type, - DelegateHelpers.GetNextTypeInfo( - arg1.Type, - DelegateHelpers.GetNextTypeInfo( - arg0.Type, - DelegateHelpers.NextTypeInfo(typeof(CallSite)) - ) - ) - ) - ); - - Type delegateType = info.DelegateType; - if (delegateType == null) { - delegateType = info.MakeDelegateType(returnType, arg0, arg1, arg2); - } - - return DynamicExpression.Make(returnType, delegateType, binder, arg0, arg1, arg2); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided . - /// - /// The runtime binder for the dynamic operation. - /// The result type of the dynamic expression. - /// The first argument to the dynamic operation. - /// The second argument to the dynamic operation. - /// The third argument to the dynamic operation. - /// The fourth argument to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// Binder and - /// Arguments set to the specified values. - /// - /// - /// The DelegateType property of the - /// result will be inferred from the types of the arguments and the specified return type. - /// - public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, Expression arg0, Expression arg1, Expression arg2, Expression arg3) { - ContractUtils.RequiresNotNull(binder, "binder"); - ValidateDynamicArgument(arg0); - ValidateDynamicArgument(arg1); - ValidateDynamicArgument(arg2); - ValidateDynamicArgument(arg3); - - DelegateHelpers.TypeInfo info = DelegateHelpers.GetNextTypeInfo( - returnType, - DelegateHelpers.GetNextTypeInfo( - arg3.Type, - DelegateHelpers.GetNextTypeInfo( - arg2.Type, - DelegateHelpers.GetNextTypeInfo( - arg1.Type, - DelegateHelpers.GetNextTypeInfo( - arg0.Type, - DelegateHelpers.NextTypeInfo(typeof(CallSite)) - ) - ) - ) - ) - ); - - Type delegateType = info.DelegateType; - if (delegateType == null) { - delegateType = info.MakeDelegateType(returnType, arg0, arg1, arg2, arg3); - } - - return DynamicExpression.Make(returnType, delegateType, binder, arg0, arg1, arg2, arg3); - } - - /// - /// Creates a that represents a dynamic operation bound by the provided . - /// - /// The runtime binder for the dynamic operation. - /// The result type of the dynamic expression. - /// The arguments to the dynamic operation. - /// - /// A that has equal to - /// Dynamic and has the - /// Binder and - /// Arguments set to the specified values. - /// - /// - /// The DelegateType property of the - /// result will be inferred from the types of the arguments and the specified return type. - /// - public static DynamicExpression Dynamic(CallSiteBinder binder, Type returnType, IEnumerable arguments) { - ContractUtils.RequiresNotNull(arguments, "arguments"); - ContractUtils.RequiresNotNull(returnType, "returnType"); - - var args = arguments.ToReadOnly(); - ContractUtils.RequiresNotEmpty(args, "args"); - return MakeDynamic(binder, returnType, args); - } - - private static DynamicExpression MakeDynamic(CallSiteBinder binder, Type returnType, ReadOnlyCollection args) { - ContractUtils.RequiresNotNull(binder, "binder"); - - for (int i = 0; i < args.Count; i++) { - Expression arg = args[i]; - - ValidateDynamicArgument(arg); - } - - Type delegateType = DelegateHelpers.MakeCallSiteDelegate(args, returnType); - - // Since we made a delegate with argument types that exactly match, - // we can skip delegate and argument validation - - switch (args.Count) { - case 1: return DynamicExpression.Make(returnType, delegateType, binder, args[0]); - case 2: return DynamicExpression.Make(returnType, delegateType, binder, args[0], args[1]); - case 3: return DynamicExpression.Make(returnType, delegateType, binder, args[0], args[1], args[2]); - case 4: return DynamicExpression.Make(returnType, delegateType, binder, args[0], args[1], args[2], args[3]); - default: return DynamicExpression.Make(returnType, delegateType, binder, args); - } - } - - private static void ValidateDynamicArgument(Expression arg) { - RequiresCanRead(arg, "arguments"); - var type = arg.Type; - ContractUtils.RequiresNotNull(type, "type"); - TypeUtils.ValidateType(type); - if (type == typeof(void)) throw Error.ArgumentTypeCannotBeVoid(); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ElementInit.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ElementInit.cs deleted file mode 100644 index 21f87689d6a..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ElementInit.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Reflection; -using System.Text; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents the initialization of a list. - /// - public sealed class ElementInit : IArgumentProvider { - private MethodInfo _addMethod; - private ReadOnlyCollection _arguments; - - internal ElementInit(MethodInfo addMethod, ReadOnlyCollection arguments) { - _addMethod = addMethod; - _arguments = arguments; - } - /// - /// Gets the used to add elements to the object. - /// - public MethodInfo AddMethod { - get { return _addMethod; } - } - - /// - /// Gets the list of elements to be added to the object. - /// - public ReadOnlyCollection Arguments { - get { return _arguments; } - } - - Expression IArgumentProvider.GetArgument(int index) { - return _arguments[index]; - } - - int IArgumentProvider.ArgumentCount { - get { - return _arguments.Count; - } - } - - /// - /// Creates a representation of the node. - /// - /// A representation of the node. - public override string ToString() { - return ExpressionStringBuilder.ElementInitBindingToString(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public ElementInit Update(IEnumerable arguments) { - if (arguments == Arguments) { - return this; - } - return Expression.ElementInit(AddMethod, arguments); - } - } - - - public partial class Expression { - /// - /// Creates an ElementInit expression that represents the initialization of a list. - /// - /// The for the list's Add method. - /// An array containing the Expressions to be used to initialize the list. - /// The created ElementInit expression. - public static ElementInit ElementInit(MethodInfo addMethod, params Expression[] arguments) { - return ElementInit(addMethod, arguments as IEnumerable); - } - - /// - /// Creates an ElementInit expression that represents the initialization of a list. - /// - /// The for the list's Add method. - /// An containing elements to initialize the list. - /// The created ElementInit expression. - public static ElementInit ElementInit(MethodInfo addMethod, IEnumerable arguments) { - ContractUtils.RequiresNotNull(addMethod, "addMethod"); - ContractUtils.RequiresNotNull(arguments, "arguments"); - - var argumentsRO = arguments.ToReadOnly(); - - RequiresCanRead(argumentsRO, "arguments"); - ValidateElementInitAddMethodInfo(addMethod); - ValidateArgumentTypes(addMethod, ExpressionType.Call, ref argumentsRO); - return new ElementInit(addMethod, argumentsRO); - } - - private static void ValidateElementInitAddMethodInfo(MethodInfo addMethod) { - ValidateMethodInfo(addMethod); - ParameterInfo[] pis = addMethod.GetParametersCached(); - if (pis.Length == 0) { - throw Error.ElementInitializerMethodWithZeroArgs(); - } - if (!addMethod.Name.Equals("Add", StringComparison.OrdinalIgnoreCase)) { - throw Error.ElementInitializerMethodNotAdd(); - } - if (addMethod.IsStatic) { - throw Error.ElementInitializerMethodStatic(); - } - foreach (ParameterInfo pi in pis) { - if (pi.ParameterType.IsByRef) { - throw Error.ElementInitializerMethodNoRefOutParam(pi.Name, addMethod.Name); - } - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.DebuggerProxy.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.DebuggerProxy.cs deleted file mode 100644 index 3d1d6c9e352..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.DebuggerProxy.cs +++ /dev/null @@ -1,455 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.ObjectModel; -using System.Reflection; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - public partial class Expression { - #region Generated Expression Debugger Proxies - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_debug_proxies from: generate_tree.py - - internal class BinaryExpressionProxy { - private readonly BinaryExpression _node; - - public BinaryExpressionProxy(BinaryExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public LambdaExpression Conversion { get { return _node.Conversion; } } - public String DebugView { get { return _node.DebugView; } } - public Boolean IsLifted { get { return _node.IsLifted; } } - public Boolean IsLiftedToNull { get { return _node.IsLiftedToNull; } } - public Expression Left { get { return _node.Left; } } - public MethodInfo Method { get { return _node.Method; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Expression Right { get { return _node.Right; } } - public Type Type { get { return _node.Type; } } - } - - internal class BlockExpressionProxy { - private readonly BlockExpression _node; - - public BlockExpressionProxy(BlockExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public ReadOnlyCollection Expressions { get { return _node.Expressions; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Expression Result { get { return _node.Result; } } - public Type Type { get { return _node.Type; } } - public ReadOnlyCollection Variables { get { return _node.Variables; } } - } - - internal class CatchBlockProxy { - private readonly CatchBlock _node; - - public CatchBlockProxy(CatchBlock node) { - _node = node; - } - - public Expression Body { get { return _node.Body; } } - public Expression Filter { get { return _node.Filter; } } - public Type Test { get { return _node.Test; } } - public ParameterExpression Variable { get { return _node.Variable; } } - } - - internal class ConditionalExpressionProxy { - private readonly ConditionalExpression _node; - - public ConditionalExpressionProxy(ConditionalExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public Expression IfFalse { get { return _node.IfFalse; } } - public Expression IfTrue { get { return _node.IfTrue; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Expression Test { get { return _node.Test; } } - public Type Type { get { return _node.Type; } } - } - - internal class ConstantExpressionProxy { - private readonly ConstantExpression _node; - - public ConstantExpressionProxy(ConstantExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - public Object Value { get { return _node.Value; } } - } - - internal class DebugInfoExpressionProxy { - private readonly DebugInfoExpression _node; - - public DebugInfoExpressionProxy(DebugInfoExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public SymbolDocumentInfo Document { get { return _node.Document; } } - public Int32 EndColumn { get { return _node.EndColumn; } } - public Int32 EndLine { get { return _node.EndLine; } } - public Boolean IsClear { get { return _node.IsClear; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Int32 StartColumn { get { return _node.StartColumn; } } - public Int32 StartLine { get { return _node.StartLine; } } - public Type Type { get { return _node.Type; } } - } - - internal class DefaultExpressionProxy { - private readonly DefaultExpression _node; - - public DefaultExpressionProxy(DefaultExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class DynamicExpressionProxy { - private readonly DynamicExpression _node; - - public DynamicExpressionProxy(DynamicExpression node) { - _node = node; - } - - public ReadOnlyCollection Arguments { get { return _node.Arguments; } } - public CallSiteBinder Binder { get { return _node.Binder; } } - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public Type DelegateType { get { return _node.DelegateType; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class GotoExpressionProxy { - private readonly GotoExpression _node; - - public GotoExpressionProxy(GotoExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public GotoExpressionKind Kind { get { return _node.Kind; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public LabelTarget Target { get { return _node.Target; } } - public Type Type { get { return _node.Type; } } - public Expression Value { get { return _node.Value; } } - } - - internal class IndexExpressionProxy { - private readonly IndexExpression _node; - - public IndexExpressionProxy(IndexExpression node) { - _node = node; - } - - public ReadOnlyCollection Arguments { get { return _node.Arguments; } } - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public PropertyInfo Indexer { get { return _node.Indexer; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Expression Object { get { return _node.Object; } } - public Type Type { get { return _node.Type; } } - } - - internal class InvocationExpressionProxy { - private readonly InvocationExpression _node; - - public InvocationExpressionProxy(InvocationExpression node) { - _node = node; - } - - public ReadOnlyCollection Arguments { get { return _node.Arguments; } } - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public Expression Expression { get { return _node.Expression; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class LabelExpressionProxy { - private readonly LabelExpression _node; - - public LabelExpressionProxy(LabelExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public Expression DefaultValue { get { return _node.DefaultValue; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public LabelTarget Target { get { return _node.Target; } } - public Type Type { get { return _node.Type; } } - } - - internal class LambdaExpressionProxy { - private readonly LambdaExpression _node; - - public LambdaExpressionProxy(LambdaExpression node) { - _node = node; - } - - public Expression Body { get { return _node.Body; } } - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public String Name { get { return _node.Name; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public ReadOnlyCollection Parameters { get { return _node.Parameters; } } - public Type ReturnType { get { return _node.ReturnType; } } - public Boolean TailCall { get { return _node.TailCall; } } - public Type Type { get { return _node.Type; } } - } - - internal class ListInitExpressionProxy { - private readonly ListInitExpression _node; - - public ListInitExpressionProxy(ListInitExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public ReadOnlyCollection Initializers { get { return _node.Initializers; } } - public NewExpression NewExpression { get { return _node.NewExpression; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class LoopExpressionProxy { - private readonly LoopExpression _node; - - public LoopExpressionProxy(LoopExpression node) { - _node = node; - } - - public Expression Body { get { return _node.Body; } } - public LabelTarget BreakLabel { get { return _node.BreakLabel; } } - public Boolean CanReduce { get { return _node.CanReduce; } } - public LabelTarget ContinueLabel { get { return _node.ContinueLabel; } } - public String DebugView { get { return _node.DebugView; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class MemberExpressionProxy { - private readonly MemberExpression _node; - - public MemberExpressionProxy(MemberExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public Expression Expression { get { return _node.Expression; } } - public MemberInfo Member { get { return _node.Member; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class MemberInitExpressionProxy { - private readonly MemberInitExpression _node; - - public MemberInitExpressionProxy(MemberInitExpression node) { - _node = node; - } - - public ReadOnlyCollection Bindings { get { return _node.Bindings; } } - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public NewExpression NewExpression { get { return _node.NewExpression; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class MethodCallExpressionProxy { - private readonly MethodCallExpression _node; - - public MethodCallExpressionProxy(MethodCallExpression node) { - _node = node; - } - - public ReadOnlyCollection Arguments { get { return _node.Arguments; } } - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public MethodInfo Method { get { return _node.Method; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Expression Object { get { return _node.Object; } } - public Type Type { get { return _node.Type; } } - } - - internal class NewArrayExpressionProxy { - private readonly NewArrayExpression _node; - - public NewArrayExpressionProxy(NewArrayExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public ReadOnlyCollection Expressions { get { return _node.Expressions; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class NewExpressionProxy { - private readonly NewExpression _node; - - public NewExpressionProxy(NewExpression node) { - _node = node; - } - - public ReadOnlyCollection Arguments { get { return _node.Arguments; } } - public Boolean CanReduce { get { return _node.CanReduce; } } - public ConstructorInfo Constructor { get { return _node.Constructor; } } - public String DebugView { get { return _node.DebugView; } } - public ReadOnlyCollection Members { get { return _node.Members; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class ParameterExpressionProxy { - private readonly ParameterExpression _node; - - public ParameterExpressionProxy(ParameterExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public Boolean IsByRef { get { return _node.IsByRef; } } - public String Name { get { return _node.Name; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class RuntimeVariablesExpressionProxy { - private readonly RuntimeVariablesExpression _node; - - public RuntimeVariablesExpressionProxy(RuntimeVariablesExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - public ReadOnlyCollection Variables { get { return _node.Variables; } } - } - - internal class SwitchCaseProxy { - private readonly SwitchCase _node; - - public SwitchCaseProxy(SwitchCase node) { - _node = node; - } - - public Expression Body { get { return _node.Body; } } - public ReadOnlyCollection TestValues { get { return _node.TestValues; } } - } - - internal class SwitchExpressionProxy { - private readonly SwitchExpression _node; - - public SwitchExpressionProxy(SwitchExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public ReadOnlyCollection Cases { get { return _node.Cases; } } - public MethodInfo Comparison { get { return _node.Comparison; } } - public String DebugView { get { return _node.DebugView; } } - public Expression DefaultBody { get { return _node.DefaultBody; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Expression SwitchValue { get { return _node.SwitchValue; } } - public Type Type { get { return _node.Type; } } - } - - internal class TryExpressionProxy { - private readonly TryExpression _node; - - public TryExpressionProxy(TryExpression node) { - _node = node; - } - - public Expression Body { get { return _node.Body; } } - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public Expression Fault { get { return _node.Fault; } } - public Expression Finally { get { return _node.Finally; } } - public ReadOnlyCollection Handlers { get { return _node.Handlers; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - } - - internal class TypeBinaryExpressionProxy { - private readonly TypeBinaryExpression _node; - - public TypeBinaryExpressionProxy(TypeBinaryExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public Expression Expression { get { return _node.Expression; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Type Type { get { return _node.Type; } } - public Type TypeOperand { get { return _node.TypeOperand; } } - } - - internal class UnaryExpressionProxy { - private readonly UnaryExpression _node; - - public UnaryExpressionProxy(UnaryExpression node) { - _node = node; - } - - public Boolean CanReduce { get { return _node.CanReduce; } } - public String DebugView { get { return _node.DebugView; } } - public Boolean IsLifted { get { return _node.IsLifted; } } - public Boolean IsLiftedToNull { get { return _node.IsLiftedToNull; } } - public MethodInfo Method { get { return _node.Method; } } - public ExpressionType NodeType { get { return _node.NodeType; } } - public Expression Operand { get { return _node.Operand; } } - public Type Type { get { return _node.Type; } } - } - - // *** END GENERATED CODE *** - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.cs deleted file mode 100644 index 21005b217c7..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/Expression.cs +++ /dev/null @@ -1,402 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Dynamic.Utils; -using System.Globalization; -using System.IO; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Threading; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { - using Microsoft.Scripting.Utils; -#else -namespace System.Linq.Expressions { -#endif - /// - /// The base type for all nodes in Expression Trees. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] - public abstract partial class Expression { - private delegate LambdaExpression LambdaFactory(Expression body, string name, bool tailCall, ReadOnlyCollection parameters); - - private static readonly CacheDict _LambdaDelegateCache = new CacheDict(40); - private static CacheDict _LambdaFactories; - - // LINQ protected ctor from 3.5 - - // needs ConditionWeakTable in 4.0 - - // For 4.0, many frequently used Expression nodes have had their memory - // footprint reduced by removing the Type and NodeType fields. This has - // large performance benefits to all users of Expression Trees. - // - // To support the 3.5 protected constructor, we store the fields that - // used to be here in a ConditionalWeakTable. - - private class ExtensionInfo { - public ExtensionInfo(ExpressionType nodeType, Type type) { - NodeType = nodeType; - Type = type; - } - - internal readonly ExpressionType NodeType; - internal readonly Type Type; - } - - private static ConditionalWeakTable _legacyCtorSupportTable; - - /// - /// Constructs a new instance of . - /// - /// The of the . - /// The of the . - [Obsolete("use a different constructor that does not take ExpressionType. Then override NodeType and Type properties to provide the values that would be specified to this constructor.")] - protected Expression(ExpressionType nodeType, Type type) { - // Can't enforce anything that V1 didn't - if (_legacyCtorSupportTable == null) { - Interlocked.CompareExchange( - ref _legacyCtorSupportTable, - new ConditionalWeakTable(), - null - ); - } - - _legacyCtorSupportTable.Add(this, new ExtensionInfo(nodeType, type)); - } - - /// - /// Constructs a new instance of . - /// - protected Expression() { - } - - /// - /// The of the . - /// - public virtual ExpressionType NodeType { - get { - ExtensionInfo extInfo; - if (_legacyCtorSupportTable != null && _legacyCtorSupportTable.TryGetValue(this, out extInfo)) { - return extInfo.NodeType; - } - - // the extension expression failed to override NodeType - throw Error.ExtensionNodeMustOverrideProperty("Expression.NodeType"); - } - } - - - /// - /// The of the value represented by this . - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] - public virtual Type Type { - get { - ExtensionInfo extInfo; - if (_legacyCtorSupportTable != null && _legacyCtorSupportTable.TryGetValue(this, out extInfo)) { - return extInfo.Type; - } - - // the extension expression failed to override Type - throw Error.ExtensionNodeMustOverrideProperty("Expression.Type"); - } - } - - /// - /// Indicates that the node can be reduced to a simpler node. If this - /// returns true, Reduce() can be called to produce the reduced form. - /// - public virtual bool CanReduce { - get { return false; } - } - - /// - /// Reduces this node to a simpler expression. If CanReduce returns - /// true, this should return a valid expression. This method is - /// allowed to return another node which itself must be reduced. - /// - /// The reduced expression. - public virtual Expression Reduce() { - if (CanReduce) throw Error.ReducibleMustOverrideReduce(); - return this; - } - - /// - /// Reduces the node and then calls the visitor delegate on the reduced expression. - /// Throws an exception if the node isn't reducible. - /// - /// An instance of . - /// The expression being visited, or an expression which should replace it in the tree. - /// - /// Override this method to provide logic to walk the node's children. - /// A typical implementation will call visitor.Visit on each of its - /// children, and if any of them change, should return a new copy of - /// itself with the modified children. - /// - protected internal virtual Expression VisitChildren(ExpressionVisitor visitor) { - if (!CanReduce) throw Error.MustBeReducible(); - return visitor.Visit(ReduceAndCheck()); - } - - /// - /// Dispatches to the specific visit method for this node type. For - /// example, will call into - /// . - /// - /// The visitor to visit this node with. - /// The result of visiting this node. - /// - /// This default implementation for - /// nodes will call . - /// Override this method to call into a more specific method on a derived - /// visitor class of ExprressionVisitor. However, it should still - /// support unknown visitors by calling VisitExtension. - /// - protected internal virtual Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitExtension(this); - } - - /// - /// Reduces this node to a simpler expression. If CanReduce returns - /// true, this should return a valid expression. This method is - /// allowed to return another node which itself must be reduced. - /// - /// The reduced expression. - /// - /// Unlike Reduce, this method checks that the reduced node satisfies - /// certain invariants. - /// - public Expression ReduceAndCheck() { - if (!CanReduce) throw Error.MustBeReducible(); - - var newNode = Reduce(); - - // 1. Reduction must return a new, non-null node - // 2. Reduction must return a new node whose result type can be assigned to the type of the original node - if (newNode == null || newNode == this) throw Error.MustReduceToDifferent(); - if (!TypeUtils.AreReferenceAssignable(Type, newNode.Type)) throw Error.ReducedNotCompatible(); - return newNode; - } - - /// - /// Reduces the expression to a known node type (i.e. not an Extension node) - /// or simply returns the expression if it is already a known type. - /// - /// The reduced expression. - public Expression ReduceExtensions() { - var node = this; - while (node.NodeType == ExpressionType.Extension) { - node = node.ReduceAndCheck(); - } - return node; - } - - - /// - /// Creates a representation of the Expression. - /// - /// A representation of the Expression. - public override string ToString() { - return ExpressionStringBuilder.ExpressionToString(this); - } - -#if !FEATURE_CORE_DLR - /// - /// Writes a representation of the to a . - /// - /// A that will be used to build the string representation. - public void DumpExpression(TextWriter writer) { - DebugViewWriter.WriteTo(this, writer); - } - - /// - /// Creates a representation of the Expression. - /// - /// A representation of the Expression. - public string DebugView { -#else - private string DebugView { -#endif - get { - using (System.IO.StringWriter writer = new System.IO.StringWriter(CultureInfo.CurrentCulture)) { - DebugViewWriter.WriteTo(this, writer); - return writer.ToString(); - } - } - } - - /// - /// Helper used for ensuring we only return 1 instance of a ReadOnlyCollection of T. - /// - /// This is called from various methods where we internally hold onto an IList of T - /// or a readonly collection of T. We check to see if we've already returned a - /// readonly collection of T and if so simply return the other one. Otherwise we do - /// a thread-safe replacement of the list w/ a readonly collection which wraps it. - /// - /// Ultimately this saves us from having to allocate a ReadOnlyCollection for our - /// data types because the compiler is capable of going directly to the IList of T. - /// - internal static ReadOnlyCollection ReturnReadOnly(ref IList collection) { - IList value = collection; - - // if it's already read-only just return it. - ReadOnlyCollection res = value as ReadOnlyCollection; - if (res != null) { - return res; - } - - // otherwise make sure only readonly collection every gets exposed - Interlocked.CompareExchange>( - ref collection, - value.ToReadOnly(), - value - ); - - // and return it - return (ReadOnlyCollection)collection; - } - - /// - /// Helper used for ensuring we only return 1 instance of a ReadOnlyCollection of T. - /// - /// This is similar to the ReturnReadOnly of T. This version supports nodes which hold - /// onto multiple Expressions where one is typed to object. That object field holds either - /// an expression or a ReadOnlyCollection of Expressions. When it holds a ReadOnlyCollection - /// the IList which backs it is a ListArgumentProvider which uses the Expression which - /// implements IArgumentProvider to get 2nd and additional values. The ListArgumentProvider - /// continues to hold onto the 1st expression. - /// - /// This enables users to get the ReadOnlyCollection w/o it consuming more memory than if - /// it was just an array. Meanwhile The DLR internally avoids accessing which would force - /// the readonly collection to be created resulting in a typical memory savings. - /// - internal static ReadOnlyCollection ReturnReadOnly(IArgumentProvider provider, ref object collection) { - Expression tObj = collection as Expression; - if (tObj != null) { - // otherwise make sure only one readonly collection ever gets exposed - Interlocked.CompareExchange( - ref collection, - new ReadOnlyCollection(new ListArgumentProvider(provider, tObj)), - tObj - ); - } - - // and return what is not guaranteed to be a readonly collection - return (ReadOnlyCollection)collection; - } - - /// - /// Helper which is used for specialized subtypes which use ReturnReadOnly(ref object, ...). - /// This is the reverse version of ReturnReadOnly which takes an IArgumentProvider. - /// - /// This is used to return the 1st argument. The 1st argument is typed as object and either - /// contains a ReadOnlyCollection or the Expression. We check for the Expression and if it's - /// present we return that, otherwise we return the 1st element of the ReadOnlyCollection. - /// - internal static T ReturnObject(object collectionOrT) where T : class { - T t = collectionOrT as T; - if (t != null) { - return t; - } - - return ((ReadOnlyCollection)collectionOrT)[0]; - } - - private static void RequiresCanRead(Expression expression, string paramName) { - if (expression == null) { - throw new ArgumentNullException(paramName); - } - - // validate that we can read the node - switch (expression.NodeType) { - case ExpressionType.Index: - IndexExpression index = (IndexExpression)expression; - if (index.Indexer != null && !index.Indexer.CanRead) { - throw new ArgumentException(Strings.ExpressionMustBeReadable, paramName); - } - break; - case ExpressionType.MemberAccess: - MemberExpression member = (MemberExpression)expression; - MemberInfo memberInfo = member.Member; - if (memberInfo.MemberType == MemberTypes.Property) { - PropertyInfo prop = (PropertyInfo)memberInfo; - if (!prop.CanRead) { - throw new ArgumentException(Strings.ExpressionMustBeReadable, paramName); - } - } - break; - } - } - - private static void RequiresCanRead(IEnumerable items, string paramName) { - if (items != null) { - // this is called a lot, avoid allocating an enumerator if we can... - IList listItems = items as IList; - if (listItems != null) { - for (int i = 0; i < listItems.Count; i++) { - RequiresCanRead(listItems[i], paramName); - } - return; - } - - foreach (var i in items) { - RequiresCanRead(i, paramName); - } - } - } - private static void RequiresCanWrite(Expression expression, string paramName) { - if (expression == null) { - throw new ArgumentNullException(paramName); - } - - bool canWrite = false; - switch (expression.NodeType) { - case ExpressionType.Index: - IndexExpression index = (IndexExpression)expression; - if (index.Indexer != null) { - canWrite = index.Indexer.CanWrite; - } else { - canWrite = true; - } - break; - case ExpressionType.MemberAccess: - MemberExpression member = (MemberExpression)expression; - switch (member.Member.MemberType) { - case MemberTypes.Property: - PropertyInfo prop = (PropertyInfo)member.Member; - canWrite = prop.CanWrite; - break; - case MemberTypes.Field: - FieldInfo field = (FieldInfo)member.Member; - canWrite = !(field.IsInitOnly || field.IsLiteral); - break; - } - break; - case ExpressionType.Parameter: - canWrite = true; - break; - } - - if (!canWrite) { - throw new ArgumentException(Strings.ExpressionMustBeWriteable, paramName); - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionStringBuilder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionStringBuilder.cs deleted file mode 100644 index abfd257c385..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionStringBuilder.cs +++ /dev/null @@ -1,759 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic; -using System.Dynamic.Utils; -using System.Globalization; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Text; -using Microsoft.Scripting.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] - internal sealed class ExpressionStringBuilder : ExpressionVisitor { - private StringBuilder _out; - - // Associate every unique label or anonymous parameter in the tree with an integer. - // The label is displayed as Label_#. - private Dictionary _ids; - - private ExpressionStringBuilder() { - _out = new StringBuilder(); - } - - public override string ToString() { - return _out.ToString(); - } - - private void AddLabel(LabelTarget label) { - if (_ids == null) { - _ids = new Dictionary(); - _ids.Add(label, 0); - } else { - if (!_ids.ContainsKey(label)) { - _ids.Add(label, _ids.Count); - } - } - } - - private int GetLabelId(LabelTarget label) { - if (_ids == null) { - _ids = new Dictionary(); - AddLabel(label); - return 0; - } else { - int id; - if (!_ids.TryGetValue(label, out id)) { - //label is met the first time - id = _ids.Count; - AddLabel(label); - } - return id; - } - } - - private void AddParam(ParameterExpression p) { - if (_ids == null) { - _ids = new Dictionary(); - _ids.Add(_ids, 0); - } else { - if (!_ids.ContainsKey(p)) { - _ids.Add(p, _ids.Count); - } - } - } - - private int GetParamId(ParameterExpression p) { - if (_ids == null) { - _ids = new Dictionary(); - AddParam(p); - return 0; - } else { - int id; - if (!_ids.TryGetValue(p, out id)) { - // p is met the first time - id = _ids.Count; - AddParam(p); - } - return id; - } - } - - #region The printing code - - private void Out(string s) { - _out.Append(s); - } - - private void Out(char c) { - _out.Append(c); - } - - #endregion - - #region Output an expresstion tree to a string - - /// - /// Output a given expression tree to a string. - /// - internal static string ExpressionToString(Expression node) { - Debug.Assert(node != null); - ExpressionStringBuilder esb = new ExpressionStringBuilder(); - esb.Visit(node); - return esb.ToString(); - } - - internal static string CatchBlockToString(CatchBlock node) { - Debug.Assert(node != null); - ExpressionStringBuilder esb = new ExpressionStringBuilder(); - esb.VisitCatchBlock(node); - return esb.ToString(); - } - - internal static string SwitchCaseToString(SwitchCase node) { - Debug.Assert(node != null); - ExpressionStringBuilder esb = new ExpressionStringBuilder(); - esb.VisitSwitchCase(node); - return esb.ToString(); - } - - /// - /// Output a given member binding to a string. - /// - internal static string MemberBindingToString(MemberBinding node) { - Debug.Assert(node != null); - ExpressionStringBuilder esb = new ExpressionStringBuilder(); - esb.VisitMemberBinding(node); - return esb.ToString(); - } - - /// - /// Output a given ElementInit to a string. - /// - internal static string ElementInitBindingToString(ElementInit node) { - Debug.Assert(node != null); - ExpressionStringBuilder esb = new ExpressionStringBuilder(); - esb.VisitElementInit(node); - return esb.ToString(); - } - - // More proper would be to make this a virtual method on Action - private static string FormatBinder(CallSiteBinder binder) { - ConvertBinder convert; - GetMemberBinder getMember; - SetMemberBinder setMember; - DeleteMemberBinder deleteMember; - InvokeMemberBinder call; - UnaryOperationBinder unary; - BinaryOperationBinder binary; - - if ((convert = binder as ConvertBinder) != null) { - return "Convert " + convert.Type; - } else if ((getMember = binder as GetMemberBinder) != null) { - return "GetMember " + getMember.Name; - } else if ((setMember = binder as SetMemberBinder) != null) { - return "SetMember " + setMember.Name; - } else if ((deleteMember = binder as DeleteMemberBinder) != null) { - return "DeleteMember " + deleteMember.Name; - } else if (binder is GetIndexBinder) { - return "GetIndex"; - } else if (binder is SetIndexBinder) { - return "SetIndex"; - } else if (binder is DeleteIndexBinder) { - return "DeleteIndex"; - } else if ((call = binder as InvokeMemberBinder) != null) { - return "Call " + call.Name; - } else if (binder is InvokeBinder) { - return "Invoke"; - } else if (binder is CreateInstanceBinder) { - return "Create"; - } else if ((unary = binder as UnaryOperationBinder) != null) { - return unary.Operation.ToString(); - } else if ((binary = binder as BinaryOperationBinder) != null) { - return binary.Operation.ToString(); - } else { - return "CallSiteBinder"; - } - } - - private void VisitExpressions(char open, IList expressions, char close) where T : Expression { - VisitExpressions(open, expressions, close, ", "); - } - - private void VisitExpressions(char open, IList expressions, char close, string seperator) where T : Expression { - Out(open); - if (expressions != null) { - bool isFirst = true; - foreach (T e in expressions) { - if (isFirst) { - isFirst = false; - } else { - Out(seperator); - } - Visit(e); - } - } - Out(close); - } - - protected internal override Expression VisitDynamic(DynamicExpression node) { - Out(FormatBinder(node.Binder)); - VisitExpressions('(', node.Arguments, ')'); - return node; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - protected internal override Expression VisitBinary(BinaryExpression node) { - if (node.NodeType == ExpressionType.ArrayIndex) { - Visit(node.Left); - Out("["); - Visit(node.Right); - Out("]"); - } else { - string op; - switch (node.NodeType) { - // AndAlso and OrElse were unintentionally changed in - // CLR 4. We changed them to "AndAlso" and "OrElse" to - // be 3.5 compatible, but it turns out 3.5 shipped with - // "&&" and "||". Oops. - case ExpressionType.AndAlso: - op = "AndAlso"; - break; - case ExpressionType.OrElse: - op = "OrElse"; - break; - case ExpressionType.Assign: op = "="; break; - case ExpressionType.Equal: - op = "=="; - break; - case ExpressionType.NotEqual: op = "!="; break; - case ExpressionType.GreaterThan: op = ">"; break; - case ExpressionType.LessThan: op = "<"; break; - case ExpressionType.GreaterThanOrEqual: op = ">="; break; - case ExpressionType.LessThanOrEqual: op = "<="; break; - case ExpressionType.Add: op = "+"; break; - case ExpressionType.AddAssign: op = "+="; break; - case ExpressionType.AddAssignChecked: op = "+="; break; - case ExpressionType.AddChecked: op = "+"; break; - case ExpressionType.Subtract: op = "-"; break; - case ExpressionType.SubtractAssign: op = "-="; break; - case ExpressionType.SubtractAssignChecked: op = "-="; break; - case ExpressionType.SubtractChecked: op = "-"; break; - case ExpressionType.Divide: op = "/"; break; - case ExpressionType.DivideAssign: op = "/="; break; - case ExpressionType.Modulo: op = "%"; break; - case ExpressionType.ModuloAssign: op = "%="; break; - case ExpressionType.Multiply: op = "*"; break; - case ExpressionType.MultiplyAssign: op = "*="; break; - case ExpressionType.MultiplyAssignChecked: op = "*="; break; - case ExpressionType.MultiplyChecked: op = "*"; break; - case ExpressionType.LeftShift: op = "<<"; break; - case ExpressionType.LeftShiftAssign: op = "<<="; break; - case ExpressionType.RightShift: op = ">>"; break; - case ExpressionType.RightShiftAssign: op = ">>="; break; - case ExpressionType.And: - if (node.Type == typeof(bool) || node.Type == typeof(bool?)) { - op = "And"; - } else { - op = "&"; - } - break; - case ExpressionType.AndAssign: - if (node.Type == typeof(bool) || node.Type == typeof(bool?)) { - op = "&&="; - } else { - op = "&="; - } - break; - case ExpressionType.Or: - if (node.Type == typeof(bool) || node.Type == typeof(bool?)) { - op = "Or"; - } else { - op = "|"; - } - break; - case ExpressionType.OrAssign: - if (node.Type == typeof(bool) || node.Type == typeof(bool?)) { - op = "||="; - } else { op = "|="; } - break; - case ExpressionType.ExclusiveOr: op = "^"; break; - case ExpressionType.ExclusiveOrAssign: op = "^="; break; - case ExpressionType.Power: op = "^"; break; - case ExpressionType.PowerAssign: op = "**="; break; - case ExpressionType.Coalesce: op = "??"; break; - - default: - throw new InvalidOperationException(); - } - Out("("); - Visit(node.Left); - Out(' '); - Out(op); - Out(' '); - Visit(node.Right); - Out(")"); - } - return node; - } - - protected internal override Expression VisitParameter(ParameterExpression node) { - if (node.IsByRef) { - Out("ref "); - } - string name = node.Name; - if (String.IsNullOrEmpty(name)) { - Out("Param_" + GetParamId(node)); - } else { - Out(name); - } - return node; - } - - protected internal override Expression VisitLambda(Expression node) { - if (node.Parameters.Count == 1) { - // p => body - Visit(node.Parameters[0]); - } else { - // (p1, p2, ..., pn) => body - VisitExpressions('(', node.Parameters, ')'); - } - Out(" => "); - Visit(node.Body); - return node; - } - - protected internal override Expression VisitListInit(ListInitExpression node) { - Visit(node.NewExpression); - Out(" {"); - for (int i = 0, n = node.Initializers.Count; i < n; i++) { - if (i > 0) { - Out(", "); - } - Out(node.Initializers[i].ToString()); - } - Out("}"); - return node; - } - - protected internal override Expression VisitConditional(ConditionalExpression node) { - Out("IIF("); - Visit(node.Test); - Out(", "); - Visit(node.IfTrue); - Out(", "); - Visit(node.IfFalse); - Out(")"); - return node; - } - - protected internal override Expression VisitConstant(ConstantExpression node) { - if (node.Value != null) { - string sValue = node.Value.ToString(); - if (node.Value is string) { - Out("\""); - Out(sValue); - Out("\""); - } else if (sValue == node.Value.GetType().ToString()) { - Out("value("); - Out(sValue); - Out(")"); - } else { - Out(sValue); - } - } else { - Out("null"); - } - return node; - } - - protected internal override Expression VisitDebugInfo(DebugInfoExpression node) { - string s = String.Format( - CultureInfo.CurrentCulture, - "", - node.Document.FileName, - node.StartLine, - node.StartColumn, - node.EndLine, - node.EndColumn - ); - Out(s); - return node; - } - - protected internal override Expression VisitRuntimeVariables(RuntimeVariablesExpression node) { - VisitExpressions('(', node.Variables, ')'); - return node; - } - - // Prints ".instanceField" or "declaringType.staticField" - private void OutMember(Expression instance, MemberInfo member) { - if (instance != null) { - Visit(instance); - Out("." + member.Name); - } else { - // For static members, include the type name - Out(member.DeclaringType.Name + "." + member.Name); - } - } - - protected internal override Expression VisitMember(MemberExpression node) { - OutMember(node.Expression, node.Member); - return node; - } - - protected internal override Expression VisitMemberInit(MemberInitExpression node) { - if (node.NewExpression.Arguments.Count == 0 && - node.NewExpression.Type.Name.Contains("<")) { - // anonymous type constructor - Out("new"); - } else { - Visit(node.NewExpression); - } - Out(" {"); - for (int i = 0, n = node.Bindings.Count; i < n; i++) { - MemberBinding b = node.Bindings[i]; - if (i > 0) { - Out(", "); - } - VisitMemberBinding(b); - } - Out("}"); - return node; - } - - protected override MemberAssignment VisitMemberAssignment(MemberAssignment assignment) { - Out(assignment.Member.Name); - Out(" = "); - Visit(assignment.Expression); - return assignment; - } - - protected override MemberListBinding VisitMemberListBinding(MemberListBinding binding) { - Out(binding.Member.Name); - Out(" = {"); - for (int i = 0, n = binding.Initializers.Count; i < n; i++) { - if (i > 0) { - Out(", "); - } - VisitElementInit(binding.Initializers[i]); - } - Out("}"); - return binding; - } - - protected override MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding binding) { - Out(binding.Member.Name); - Out(" = {"); - for (int i = 0, n = binding.Bindings.Count; i < n; i++) { - if (i > 0) { - Out(", "); - } - VisitMemberBinding(binding.Bindings[i]); - } - Out("}"); - return binding; - } - - protected override ElementInit VisitElementInit(ElementInit initializer) { - Out(initializer.AddMethod.ToString()); - string sep = ", "; - VisitExpressions('(', initializer.Arguments, ')', sep); - return initializer; - } - - protected internal override Expression VisitInvocation(InvocationExpression node) { - Out("Invoke("); - Visit(node.Expression); - string sep = ", "; - for (int i = 0, n = node.Arguments.Count; i < n; i++) { - Out(sep); - Visit(node.Arguments[i]); - } - Out(")"); - return node; - } - - protected internal override Expression VisitMethodCall(MethodCallExpression node) { - int start = 0; - Expression ob = node.Object; - - if (Attribute.GetCustomAttribute(node.Method, typeof(ExtensionAttribute)) != null) { - start = 1; - ob = node.Arguments[0]; - } - - if (ob != null) { - Visit(ob); - Out("."); - } - Out(node.Method.Name); - Out("("); - for (int i = start, n = node.Arguments.Count; i < n; i++) { - if (i > start) - Out(", "); - Visit(node.Arguments[i]); - } - Out(")"); - return node; - } - - protected internal override Expression VisitNewArray(NewArrayExpression node) { - switch (node.NodeType) { - case ExpressionType.NewArrayBounds: - // new MyType[](expr1, expr2) - Out("new " + node.Type.ToString()); - VisitExpressions('(', node.Expressions, ')'); - break; - case ExpressionType.NewArrayInit: - // new [] {expr1, expr2} - Out("new [] "); - VisitExpressions('{', node.Expressions, '}'); - break; - } - return node; - } - - protected internal override Expression VisitNew(NewExpression node) { - Out("new " + node.Type.Name); - Out("("); - var members = node.Members; - for (int i = 0; i < node.Arguments.Count; i++) { - if (i > 0) { - Out(", "); - } - if (members != null) { - string name = members[i].Name; - Out(name); - Out(" = "); - } - Visit(node.Arguments[i]); - } - Out(")"); - return node; - } - - protected internal override Expression VisitTypeBinary(TypeBinaryExpression node) { - Out("("); - Visit(node.Expression); - switch (node.NodeType) { - case ExpressionType.TypeIs: - Out(" Is "); - break; - case ExpressionType.TypeEqual: - Out(" TypeEqual "); - break; - } - Out(node.TypeOperand.Name); - Out(")"); - return node; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - protected internal override Expression VisitUnary(UnaryExpression node) { - switch (node.NodeType) { - case ExpressionType.TypeAs: - Out("("); - break; - case ExpressionType.Not: - Out("Not("); - break; - case ExpressionType.Negate: - case ExpressionType.NegateChecked: - Out("-"); - break; - case ExpressionType.UnaryPlus: - Out("+"); - break; - case ExpressionType.Quote: - break; - case ExpressionType.Throw: - Out("throw("); - break; - case ExpressionType.Increment: - Out("Increment("); - break; - case ExpressionType.Decrement: - Out("Decrement("); - break; - case ExpressionType.PreIncrementAssign: - Out("++"); - break; - case ExpressionType.PreDecrementAssign: - Out("--"); - break; - case ExpressionType.OnesComplement: - Out("~("); - break; - default: - Out(node.NodeType.ToString()); - Out("("); - break; - } - - Visit(node.Operand); - - switch (node.NodeType) { - case ExpressionType.Negate: - case ExpressionType.NegateChecked: - case ExpressionType.UnaryPlus: - case ExpressionType.PreDecrementAssign: - case ExpressionType.PreIncrementAssign: - case ExpressionType.Quote: - break; - case ExpressionType.TypeAs: - Out(" As "); - Out(node.Type.Name); - Out(")"); - break; - case ExpressionType.PostIncrementAssign: - Out("++"); - break; - case ExpressionType.PostDecrementAssign: - Out("--"); - break; - default: - Out(")"); - break; - } - return node; - } - - protected internal override Expression VisitBlock(BlockExpression node) { - Out("{"); - foreach (var v in node.Variables) { - Out("var "); - Visit(v); - Out(";"); - } - Out(" ... }"); - return node; - } - - protected internal override Expression VisitDefault(DefaultExpression node) { - Out("default("); - Out(node.Type.Name); - Out(")"); - return node; - } - - protected internal override Expression VisitLabel(LabelExpression node) { - Out("{ ... } "); - DumpLabel(node.Target); - Out(":"); - return node; - } - - protected internal override Expression VisitGoto(GotoExpression node) { - Out(node.Kind.ToString().ToLower(CultureInfo.CurrentCulture)); - DumpLabel(node.Target); - if (node.Value != null) { - Out(" ("); - Visit(node.Value); - Out(") "); - } - return node; - } - - protected internal override Expression VisitLoop(LoopExpression node) { - Out("loop { ... }"); - return node; - } - - protected override SwitchCase VisitSwitchCase(SwitchCase node) { - Out("case "); - VisitExpressions('(', node.TestValues, ')'); - Out(": ..."); - return node; - } - - protected internal override Expression VisitSwitch(SwitchExpression node) { - Out("switch "); - Out("("); - Visit(node.SwitchValue); - Out(") { ... }"); - return node; - } - - protected override CatchBlock VisitCatchBlock(CatchBlock node) { - Out("catch (" + node.Test.Name); - if (node.Variable != null) { - Out(node.Variable.Name ?? ""); - } - Out(") { ... }"); - return node; - } - - protected internal override Expression VisitTry(TryExpression node) { - Out("try { ... }"); - return node; - } - - protected internal override Expression VisitIndex(IndexExpression node) { - if (node.Object != null) { - Visit(node.Object); - } else { - Debug.Assert(node.Indexer != null); - Out(node.Indexer.DeclaringType.Name); - } - if (node.Indexer != null) { - Out("."); - Out(node.Indexer.Name); - } - - VisitExpressions('[', node.Arguments, ']'); - return node; - } - - protected internal override Expression VisitExtension(Expression node) { - // Prefer an overriden ToString, if available. - var flags = BindingFlags.Public | BindingFlags.Instance | BindingFlags.ExactBinding; - var toString = node.GetType().GetMethod("ToString", flags, null, ReflectionUtils.EmptyTypes, null); - if (toString.DeclaringType != typeof(Expression)) { - Out(node.ToString()); - return node; - } - - Out("["); - // For 3.5 subclasses, print the NodeType. - // For Extension nodes, print the class name. - if (node.NodeType == ExpressionType.Extension) { - Out(node.GetType().FullName); - } else { - Out(node.NodeType.ToString()); - } - Out("]"); - return node; - } - - private void DumpLabel(LabelTarget target) { - if (!String.IsNullOrEmpty(target.Name)) { - Out(target.Name); - } else { - int labelId = GetLabelId(target); - Out("UnamedLabel_" + labelId); - } - } - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionType.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionType.cs deleted file mode 100644 index 1e3e64cbaa5..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionType.cs +++ /dev/null @@ -1,377 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Describes the node types for the nodes of an expression tree. - /// - public enum ExpressionType { - - #region Generated Expression Tree Node Types - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_tree_nodes from: generate_tree.py - - /// - /// A node that represents arithmetic addition without overflow checking. - /// - Add, - /// - /// A node that represents arithmetic addition with overflow checking. - /// - AddChecked, - /// - /// A node that represents a bitwise AND operation. - /// - And, - /// - /// A node that represents a short-circuiting conditional AND operation. - /// - AndAlso, - /// - /// A node that represents getting the length of a one-dimensional array. - /// - ArrayLength, - /// - /// A node that represents indexing into a one-dimensional array. - /// - ArrayIndex, - /// - /// A node that represents represents a method call. - /// - Call, - /// - /// A node that represents a null coalescing operation. - /// - Coalesce, - /// - /// A node that represents a conditional operation. - /// - Conditional, - /// - /// A node that represents an expression that has a constant value. - /// - Constant, - /// - /// A node that represents a cast or conversion operation. If the operation is a numeric conversion, it overflows silently if the converted value does not fit the target type. - /// - Convert, - /// - /// A node that represents a cast or conversion operation. If the operation is a numeric conversion, an exception is thrown if the converted value does not fit the target type. - /// - ConvertChecked, - /// - /// A node that represents arithmetic division. - /// - Divide, - /// - /// A node that represents an equality comparison. - /// - Equal, - /// - /// A node that represents a bitwise XOR operation. - /// - ExclusiveOr, - /// - /// A node that represents a "greater than" numeric comparison. - /// - GreaterThan, - /// - /// A node that represents a "greater than or equal" numeric comparison. - /// - GreaterThanOrEqual, - /// - /// A node that represents applying a delegate or lambda expression to a list of argument expressions. - /// - Invoke, - /// - /// A node that represents a lambda expression. - /// - Lambda, - /// - /// A node that represents a bitwise left-shift operation. - /// - LeftShift, - /// - /// A node that represents a "less than" numeric comparison. - /// - LessThan, - /// - /// A node that represents a "less than or equal" numeric comparison. - /// - LessThanOrEqual, - /// - /// A node that represents creating a new IEnumerable object and initializing it from a list of elements. - /// - ListInit, - /// - /// A node that represents reading from a field or property. - /// - MemberAccess, - /// - /// A node that represents creating a new object and initializing one or more of its members. - /// - MemberInit, - /// - /// A node that represents an arithmetic remainder operation. - /// - Modulo, - /// - /// A node that represents arithmetic multiplication without overflow checking. - /// - Multiply, - /// - /// A node that represents arithmetic multiplication with overflow checking. - /// - MultiplyChecked, - /// - /// A node that represents an arithmetic negation operation. - /// - Negate, - /// - /// A node that represents a unary plus operation. The result of a predefined unary plus operation is simply the value of the operand, but user-defined implementations may have non-trivial results. - /// - UnaryPlus, - /// - /// A node that represents an arithmetic negation operation that has overflow checking. - /// - NegateChecked, - /// - /// A node that represents calling a constructor to create a new object. - /// - New, - /// - /// A node that represents creating a new one-dimensional array and initializing it from a list of elements. - /// - NewArrayInit, - /// - /// A node that represents creating a new array where the bounds for each dimension are specified. - /// - NewArrayBounds, - /// - /// A node that represents a bitwise complement operation. - /// - Not, - /// - /// A node that represents an inequality comparison. - /// - NotEqual, - /// - /// A node that represents a bitwise OR operation. - /// - Or, - /// - /// A node that represents a short-circuiting conditional OR operation. - /// - OrElse, - /// - /// A node that represents a reference to a parameter or variable defined in the context of the expression. - /// - Parameter, - /// - /// A node that represents raising a number to a power. - /// - Power, - /// - /// A node that represents an expression that has a constant value of type Expression. A Quote node can contain references to parameters defined in the context of the expression it represents. - /// - Quote, - /// - /// A node that represents a bitwise right-shift operation. - /// - RightShift, - /// - /// A node that represents arithmetic subtraction without overflow checking. - /// - Subtract, - /// - /// A node that represents arithmetic subtraction with overflow checking. - /// - SubtractChecked, - /// - /// A node that represents an explicit reference or boxing conversion where null reference (Nothing in Visual Basic) is supplied if the conversion fails. - /// - TypeAs, - /// - /// A node that represents a type test. - /// - TypeIs, - /// - /// A node that represents an assignment. - /// - Assign, - /// - /// A node that represents a block of expressions. - /// - Block, - /// - /// A node that represents a debugging information. - /// - DebugInfo, - /// - /// A node that represents a unary decrement. - /// - Decrement, - /// - /// A node that represents a dynamic operation. - /// - Dynamic, - /// - /// A node that represents a default value. - /// - Default, - /// - /// A node that represents an extension expression. - /// - Extension, - /// - /// A node that represents a goto. - /// - Goto, - /// - /// A node that represents a unary increment. - /// - Increment, - /// - /// A node that represents an index operation. - /// - Index, - /// - /// A node that represents a label. - /// - Label, - /// - /// A node that represents a list of runtime variables. - /// - RuntimeVariables, - /// - /// A node that represents a loop. - /// - Loop, - /// - /// A node that represents a switch operation. - /// - Switch, - /// - /// A node that represents a throwing of an exception. - /// - Throw, - /// - /// A node that represents a try-catch expression. - /// - Try, - /// - /// A node that represents an unbox value type operation. - /// - Unbox, - /// - /// A node that represents an arithmetic addition compound assignment without overflow checking. - /// - AddAssign, - /// - /// A node that represents a bitwise AND compound assignment. - /// - AndAssign, - /// - /// A node that represents an arithmetic division compound assignment . - /// - DivideAssign, - /// - /// A node that represents a bitwise XOR compound assignment. - /// - ExclusiveOrAssign, - /// - /// A node that represents a bitwise left-shift compound assignment. - /// - LeftShiftAssign, - /// - /// A node that represents an arithmetic remainder compound assignment. - /// - ModuloAssign, - /// - /// A node that represents arithmetic multiplication compound assignment without overflow checking. - /// - MultiplyAssign, - /// - /// A node that represents a bitwise OR compound assignment. - /// - OrAssign, - /// - /// A node that represents raising a number to a power compound assignment. - /// - PowerAssign, - /// - /// A node that represents a bitwise right-shift compound assignment. - /// - RightShiftAssign, - /// - /// A node that represents arithmetic subtraction compound assignment without overflow checking. - /// - SubtractAssign, - /// - /// A node that represents an arithmetic addition compound assignment with overflow checking. - /// - AddAssignChecked, - /// - /// A node that represents arithmetic multiplication compound assignment with overflow checking. - /// - MultiplyAssignChecked, - /// - /// A node that represents arithmetic subtraction compound assignment with overflow checking. - /// - SubtractAssignChecked, - /// - /// A node that represents an unary prefix increment. - /// - PreIncrementAssign, - /// - /// A node that represents an unary prefix decrement. - /// - PreDecrementAssign, - /// - /// A node that represents an unary postfix increment. - /// - PostIncrementAssign, - /// - /// A node that represents an unary postfix decrement. - /// - PostDecrementAssign, - /// - /// A node that represents a exact type test. - /// - TypeEqual, - /// - /// A node that represents a ones complement. - /// - OnesComplement, - /// - /// A node that represents a true condition value. - /// - IsTrue, - /// - /// A node that represents a false condition value. - /// - IsFalse, - - // *** END GENERATED CODE *** - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionVisitor.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionVisitor.cs deleted file mode 100644 index 07c1201ddeb..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ExpressionVisitor.cs +++ /dev/null @@ -1,679 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { - using Microsoft.Scripting.Utils; -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents a visitor or rewriter for expression trees. - /// - /// - /// This class is designed to be inherited to create more specialized - /// classes whose functionality requires traversing, examining or copying - /// an expression tree. - /// - public abstract class ExpressionVisitor { - - /// - /// Initializes a new instance of . - /// - protected ExpressionVisitor() { - } - - /// - /// Dispatches the expression to one of the more specialized visit methods in this class. - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - public virtual Expression Visit(Expression node) { - if (node != null) { - return node.Accept(this); - } - return null; - } - - /// - /// Dispatches the list of expressions to one of the more specialized visit methods in this class. - /// - /// The expressions to visit. - /// The modified expression list, if any of the elements were modified; - /// otherwise, returns the original expression list. - public ReadOnlyCollection Visit(ReadOnlyCollection nodes) { - Expression[] newNodes = null; - for (int i = 0, n = nodes.Count; i < n; i++) { - Expression node = Visit(nodes[i]); - - if (newNodes != null) { - newNodes[i] = node; - } else if (!object.ReferenceEquals(node, nodes[i])) { - newNodes = new Expression[n]; - for (int j = 0; j < i; j++) { - newNodes[j] = nodes[j]; - } - newNodes[i] = node; - } - } - if (newNodes == null) { - return nodes; - } - return new TrueReadOnlyCollection(newNodes); - } - - internal Expression[] VisitArguments(IArgumentProvider nodes) { - Expression[] newNodes = null; - for (int i = 0, n = nodes.ArgumentCount; i < n; i++) { - Expression curNode = nodes.GetArgument(i); - Expression node = Visit(curNode); - - if (newNodes != null) { - newNodes[i] = node; - } else if (!object.ReferenceEquals(node, curNode)) { - newNodes = new Expression[n]; - for (int j = 0; j < i; j++) { - newNodes[j] = nodes.GetArgument(j); - } - newNodes[i] = node; - } - } - return newNodes; - } - - /// - /// Visits all nodes in the collection using a specified element visitor. - /// - /// The type of the nodes. - /// The nodes to visit. - /// A delegate that visits a single element, - /// optionally replacing it with a new element. - /// The modified node list, if any of the elements were modified; - /// otherwise, returns the original node list. - public static ReadOnlyCollection Visit(ReadOnlyCollection nodes, Func elementVisitor) { - T[] newNodes = null; - for (int i = 0, n = nodes.Count; i < n; i++) { - T node = elementVisitor(nodes[i]); - if (newNodes != null) { - newNodes[i] = node; - } else if (!object.ReferenceEquals(node, nodes[i])) { - newNodes = new T[n]; - for (int j = 0; j < i; j++) { - newNodes[j] = nodes[j]; - } - newNodes[i] = node; - } - } - if (newNodes == null) { - return nodes; - } - return new TrueReadOnlyCollection(newNodes); - } - - /// - /// Visits an expression, casting the result back to the original expression type. - /// - /// The type of the expression. - /// The expression to visit. - /// The name of the calling method; used to report to report a better error message. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - /// The visit method for this node returned a different type. - public T VisitAndConvert(T node, string callerName) where T : Expression { - if (node == null) { - return null; - } - node = Visit(node) as T; - if (node == null) { - throw Error.MustRewriteToSameNode(callerName, typeof(T), callerName); - } - return node; - } - - /// - /// Visits an expression, casting the result back to the original expression type. - /// - /// The type of the expression. - /// The expression to visit. - /// The name of the calling method; used to report to report a better error message. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - /// The visit method for this node returned a different type. - public ReadOnlyCollection VisitAndConvert(ReadOnlyCollection nodes, string callerName) where T : Expression { - T[] newNodes = null; - for (int i = 0, n = nodes.Count; i < n; i++) { - T node = Visit(nodes[i]) as T; - if (node == null) { - throw Error.MustRewriteToSameNode(callerName, typeof(T), callerName); - } - - if (newNodes != null) { - newNodes[i] = node; - } else if (!object.ReferenceEquals(node, nodes[i])) { - newNodes = new T[n]; - for (int j = 0; j < i; j++) { - newNodes[j] = nodes[j]; - } - newNodes[i] = node; - } - } - if (newNodes == null) { - return nodes; - } - return new TrueReadOnlyCollection(newNodes); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitBinary(BinaryExpression node) { - // Walk children in evaluation order: left, conversion, right - return ValidateBinary( - node, - node.Update( - Visit(node.Left), - VisitAndConvert(node.Conversion, "VisitBinary"), - Visit(node.Right) - ) - ); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitBlock(BlockExpression node) { - int count = node.ExpressionCount; - Expression[] nodes = null; - for (int i = 0; i < count; i++) { - Expression oldNode = node.GetExpression(i); - Expression newNode = Visit(oldNode); - - if (oldNode != newNode) { - if (nodes == null) { - nodes = new Expression[count]; - } - nodes[i] = newNode; - } - } - var v = VisitAndConvert(node.Variables, "VisitBlock"); - - if (v == node.Variables && nodes == null) { - return node; - } else { - for (int i = 0; i < count; i++) { - if (nodes[i] == null) { - nodes[i] = node.GetExpression(i); - } - } - } - - return node.Rewrite(v, nodes); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitConditional(ConditionalExpression node) { - return node.Update(Visit(node.Test), Visit(node.IfTrue), Visit(node.IfFalse)); - } - - /// - /// Visits the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitConstant(ConstantExpression node) { - return node; - } - - /// - /// Visits the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitDebugInfo(DebugInfoExpression node) { - return node; - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitDynamic(DynamicExpression node) { - Expression[] a = VisitArguments((IArgumentProvider)node); - if (a == null) { - return node; - } - - return node.Rewrite(a); - } - - /// - /// Visits the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitDefault(DefaultExpression node) { - return node; - } - - /// - /// Visits the children of the extension expression. - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - /// - /// This can be overridden to visit or rewrite specific extension nodes. - /// If it is not overridden, this method will call , - /// which gives the node a chance to walk its children. By default, - /// will try to reduce the node. - /// - protected internal virtual Expression VisitExtension(Expression node) { - return node.VisitChildren(this); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitGoto(GotoExpression node) { - return node.Update(VisitLabelTarget(node.Target), Visit(node.Value)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitInvocation(InvocationExpression node) { - Expression e = Visit(node.Expression); - Expression[] a = VisitArguments(node); - if (e == node.Expression && a == null) { - return node; - } - - return node.Rewrite(e, a); - } - - /// - /// Visits the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected virtual LabelTarget VisitLabelTarget(LabelTarget node) { - return node; - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitLabel(LabelExpression node) { - return node.Update(VisitLabelTarget(node.Target), Visit(node.DefaultValue)); - } - - /// - /// Visits the children of the . - /// - /// The type of the delegate. - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitLambda(Expression node) { - return node.Update(Visit(node.Body), VisitAndConvert(node.Parameters, "VisitLambda")); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitLoop(LoopExpression node) { - return node.Update(VisitLabelTarget(node.BreakLabel), VisitLabelTarget(node.ContinueLabel), Visit(node.Body)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitMember(MemberExpression node) { - return node.Update(Visit(node.Expression)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitIndex(IndexExpression node) { - Expression o = Visit(node.Object); - Expression[] a = VisitArguments(node); - if (o == node.Object && a == null) { - return node; - } - - return node.Rewrite(o, a); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitMethodCall(MethodCallExpression node) { - Expression o = Visit(node.Object); - Expression[] a = VisitArguments((IArgumentProvider)node); - if (o == node.Object && a == null) { - return node; - } - - return node.Rewrite(o, a); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitNewArray(NewArrayExpression node) { - return node.Update(Visit(node.Expressions)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] - protected internal virtual Expression VisitNew(NewExpression node) { - return node.Update(Visit(node.Arguments)); - } - - /// - /// Visits the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitParameter(ParameterExpression node) { - return node; - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitRuntimeVariables(RuntimeVariablesExpression node) { - return node.Update(VisitAndConvert(node.Variables, "VisitRuntimeVariables")); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected virtual SwitchCase VisitSwitchCase(SwitchCase node) { - return node.Update(Visit(node.TestValues), Visit(node.Body)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitSwitch(SwitchExpression node) { - return ValidateSwitch( - node, - node.Update( - Visit(node.SwitchValue), - Visit(node.Cases, VisitSwitchCase), - Visit(node.DefaultBody) - ) - ); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected virtual CatchBlock VisitCatchBlock(CatchBlock node) { - return node.Update(VisitAndConvert(node.Variable, "VisitCatchBlock"), Visit(node.Filter), Visit(node.Body)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitTry(TryExpression node) { - return node.Update( - Visit(node.Body), - Visit(node.Handlers, VisitCatchBlock), - Visit(node.Finally), - Visit(node.Fault) - ); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitTypeBinary(TypeBinaryExpression node) { - return node.Update(Visit(node.Expression)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitUnary(UnaryExpression node) { - return ValidateUnary(node, node.Update(Visit(node.Operand))); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitMemberInit(MemberInitExpression node) { - return node.Update( - VisitAndConvert(node.NewExpression, "VisitMemberInit"), - Visit(node.Bindings, VisitMemberBinding) - ); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected internal virtual Expression VisitListInit(ListInitExpression node) { - return node.Update( - VisitAndConvert(node.NewExpression, "VisitListInit"), - Visit(node.Initializers, VisitElementInit) - ); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected virtual ElementInit VisitElementInit(ElementInit node) { - return node.Update(Visit(node.Arguments)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected virtual MemberBinding VisitMemberBinding(MemberBinding node) { - switch (node.BindingType) { - case MemberBindingType.Assignment: - return VisitMemberAssignment((MemberAssignment)node); - case MemberBindingType.MemberBinding: - return VisitMemberMemberBinding((MemberMemberBinding)node); - case MemberBindingType.ListBinding: - return VisitMemberListBinding((MemberListBinding)node); - default: - throw Error.UnhandledBindingType(node.BindingType); - } - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected virtual MemberAssignment VisitMemberAssignment(MemberAssignment node) { - return node.Update(Visit(node.Expression)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected virtual MemberMemberBinding VisitMemberMemberBinding(MemberMemberBinding node) { - return node.Update(Visit(node.Bindings, VisitMemberBinding)); - } - - /// - /// Visits the children of the . - /// - /// The expression to visit. - /// The modified expression, if it or any subexpression was modified; - /// otherwise, returns the original expression. - protected virtual MemberListBinding VisitMemberListBinding(MemberListBinding node) { - return node.Update(Visit(node.Initializers, VisitElementInit)); - } - - - // - // Prevent some common cases of invalid rewrites. - // - // Essentially, we don't want the rewritten node to be semantically - // bound by the factory, which may do the wrong thing. Instead we - // require derived classes to be explicit about what they want to do if - // types change. - // - private static UnaryExpression ValidateUnary(UnaryExpression before, UnaryExpression after) { - if (before != after && before.Method == null) { - if (after.Method != null) { - throw Error.MustRewriteWithoutMethod(after.Method, "VisitUnary"); - } - - // rethrow has null operand - if (before.Operand != null && after.Operand != null) { - ValidateChildType(before.Operand.Type, after.Operand.Type, "VisitUnary"); - } - } - return after; - } - - private static BinaryExpression ValidateBinary(BinaryExpression before, BinaryExpression after) { - if (before != after && before.Method == null) { - if (after.Method != null) { - throw Error.MustRewriteWithoutMethod(after.Method, "VisitBinary"); - } - - ValidateChildType(before.Left.Type, after.Left.Type, "VisitBinary"); - ValidateChildType(before.Right.Type, after.Right.Type, "VisitBinary"); - } - return after; - } - - // We wouldn't need this if switch didn't infer the method. - private static SwitchExpression ValidateSwitch(SwitchExpression before, SwitchExpression after) { - // If we did not have a method, we don't want to bind to one, - // it might not be the right thing. - if (before.Comparison == null && after.Comparison != null) { - throw Error.MustRewriteWithoutMethod(after.Comparison, "VisitSwitch"); - } - return after; - } - - // Value types must stay as the same type, otherwise it's now a - // different operation, e.g. adding two doubles vs adding two ints. - private static void ValidateChildType(Type before, Type after, string methodName) { - if (before.IsValueType) { - if (TypeUtils.AreEquivalent(before, after)) { - // types are the same value type - return; - } - } else if (!after.IsValueType) { - // both are reference types - return; - } - - // Otherwise, it's an invalid type change. - throw Error.MustRewriteChildToSameType(before, after, methodName); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/GotoExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/GotoExpression.cs deleted file mode 100644 index 7fa8c9a61b7..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/GotoExpression.cs +++ /dev/null @@ -1,371 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Specifies what kind of jump this represents. - /// - public enum GotoExpressionKind { - /// - /// A that represents a jump to some location. - /// - Goto, - /// - /// A that represents a return statement. - /// - Return, - /// - /// A that represents a break statement. - /// - Break, - /// - /// A that represents a continue statement. - /// - Continue, - } - - /// - /// Represents an unconditional jump. This includes return statements, break and continue statements, and other jumps. - /// - [DebuggerTypeProxy(typeof(Expression.GotoExpressionProxy))] - public sealed class GotoExpression : Expression { - private readonly GotoExpressionKind _kind; - private readonly Expression _value; - private readonly LabelTarget _target; - private readonly Type _type; - - internal GotoExpression(GotoExpressionKind kind, LabelTarget target, Expression value, Type type) { - _kind = kind; - _value = value; - _target = target; - _type = type; - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _type; } - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Goto; } - } - - /// - /// The value passed to the target, or null if the target is of type - /// System.Void. - /// - public Expression Value { - get { return _value; } - } - - /// - /// The target label where this node jumps to. - /// - public LabelTarget Target { - get { return _target; } - } - - /// - /// The kind of the goto. For information purposes only. - /// - public GotoExpressionKind Kind { - get { return _kind; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitGoto(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public GotoExpression Update(LabelTarget target, Expression value) { - if (target == Target && value == Value) { - return this; - } - return Expression.MakeGoto(Kind, target, value, Type); - } - } - - public partial class Expression { - /// - /// Creates a representing a break statement. - /// - /// The that the will jump to. - /// - /// A with equal to Break, - /// the property set to , and a null value to be passed to the target label upon jumping. - /// - public static GotoExpression Break(LabelTarget target) { - return MakeGoto(GotoExpressionKind.Break, target, null, typeof(void)); - } - - /// - /// Creates a representing a break statement. The value passed to the label upon jumping can be specified. - /// - /// The that the will jump to. - /// The value that will be passed to the associated label upon jumping. - /// - /// A with equal to Break, - /// the property set to , - /// and to be passed to the target label upon jumping. - /// - public static GotoExpression Break(LabelTarget target, Expression value) { - return MakeGoto(GotoExpressionKind.Break, target, value, typeof(void)); - } - - /// - /// Creates a representing a break statement with the specified type. - /// - /// The that the will jump to. - /// An to set the property equal to. - /// - /// A with equal to Break, - /// the property set to , - /// and the property set to . - /// - public static GotoExpression Break(LabelTarget target, Type type) { - return MakeGoto(GotoExpressionKind.Break, target, null, type); - } - - /// - /// Creates a representing a break statement with the specified type. - /// The value passed to the label upon jumping can be specified. - /// - /// The that the will jump to. - /// The value that will be passed to the associated label upon jumping. - /// An to set the property equal to. - /// - /// A with equal to Break, - /// the property set to , - /// the property set to , - /// and to be passed to the target label upon jumping. - /// - public static GotoExpression Break(LabelTarget target, Expression value, Type type) { - return MakeGoto(GotoExpressionKind.Break, target, value, type); - } - - /// - /// Creates a representing a continue statement. - /// - /// The that the will jump to. - /// - /// A with equal to Continue, - /// the property set to , - /// and a null value to be passed to the target label upon jumping. - /// - public static GotoExpression Continue(LabelTarget target) { - return MakeGoto(GotoExpressionKind.Continue, target, null, typeof(void)); - } - - /// - /// Creates a representing a continue statement with the specified type. - /// - /// The that the will jump to. - /// An to set the property equal to. - /// - /// A with equal to Continue, - /// the property set to , - /// the property set to , - /// and a null value to be passed to the target label upon jumping. - /// - public static GotoExpression Continue(LabelTarget target, Type type) { - return MakeGoto(GotoExpressionKind.Continue, target, null, type); - } - - /// - /// Creates a representing a return statement. - /// - /// The that the will jump to. - /// - /// A with equal to Return, - /// the property set to , - /// and a null value to be passed to the target label upon jumping. - /// - public static GotoExpression Return(LabelTarget target) { - return MakeGoto(GotoExpressionKind.Return, target, null, typeof(void)); - } - - /// - /// Creates a representing a return statement with the specified type. - /// - /// The that the will jump to. - /// An to set the property equal to. - /// - /// A with equal to Return, - /// the property set to , - /// the property set to , - /// and a null value to be passed to the target label upon jumping. - /// - public static GotoExpression Return(LabelTarget target, Type type) { - return MakeGoto(GotoExpressionKind.Return, target, null, type); - } - - /// - /// Creates a representing a return statement. The value passed to the label upon jumping can be specified. - /// - /// The that the will jump to. - /// The value that will be passed to the associated label upon jumping. - /// - /// A with equal to Continue, - /// the property set to , - /// and to be passed to the target label upon jumping. - /// - public static GotoExpression Return(LabelTarget target, Expression value) { - return MakeGoto(GotoExpressionKind.Return, target, value, typeof(void)); - } - - /// - /// Creates a representing a return statement with the specified type. - /// The value passed to the label upon jumping can be specified. - /// - /// The that the will jump to. - /// The value that will be passed to the associated label upon jumping. - /// An to set the property equal to. - /// - /// A with equal to Continue, - /// the property set to , - /// the property set to , - /// and to be passed to the target label upon jumping. - /// - public static GotoExpression Return(LabelTarget target, Expression value, Type type) { - return MakeGoto(GotoExpressionKind.Return, target, value, type); - } - - /// - /// Creates a representing a goto. - /// - /// The that the will jump to. - /// - /// A with equal to Goto, - /// the property set to the specified value, - /// and a null value to be passed to the target label upon jumping. - /// - public static GotoExpression Goto(LabelTarget target) { - return MakeGoto(GotoExpressionKind.Goto, target, null, typeof(void)); - } - - /// - /// Creates a representing a goto with the specified type. - /// - /// The that the will jump to. - /// An to set the property equal to. - /// - /// A with equal to Goto, - /// the property set to the specified value, - /// the property set to , - /// and a null value to be passed to the target label upon jumping. - /// - public static GotoExpression Goto(LabelTarget target, Type type) { - return MakeGoto(GotoExpressionKind.Goto, target, null, type); - } - - /// - /// Creates a representing a goto. The value passed to the label upon jumping can be specified. - /// - /// The that the will jump to. - /// The value that will be passed to the associated label upon jumping. - /// - /// A with equal to Goto, - /// the property set to , - /// and to be passed to the target label upon jumping. - /// - public static GotoExpression Goto(LabelTarget target, Expression value) { - return MakeGoto(GotoExpressionKind.Goto, target, value, typeof(void)); - } - - /// - /// Creates a representing a goto with the specified type. - /// The value passed to the label upon jumping can be specified. - /// - /// The that the will jump to. - /// The value that will be passed to the associated label upon jumping. - /// An to set the property equal to. - /// - /// A with equal to Goto, - /// the property set to , - /// the property set to , - /// and to be passed to the target label upon jumping. - /// - public static GotoExpression Goto(LabelTarget target, Expression value, Type type) { - return MakeGoto(GotoExpressionKind.Goto, target, value, type); - } - - /// - /// Creates a representing a jump of the specified . - /// The value passed to the label upon jumping can also be specified. - /// - /// The of the . - /// The that the will jump to. - /// The value that will be passed to the associated label upon jumping. - /// An to set the property equal to. - /// - /// A with equal to , - /// the property set to , - /// the property set to , - /// and to be passed to the target label upon jumping. - /// - public static GotoExpression MakeGoto(GotoExpressionKind kind, LabelTarget target, Expression value, Type type) { - ValidateGoto(target, ref value, "target", "value"); - return new GotoExpression(kind, target, value, type); - } - - private static void ValidateGoto(LabelTarget target, ref Expression value, string targetParameter, string valueParameter) { - ContractUtils.RequiresNotNull(target, targetParameter); - if (value == null) { - if (target.Type != typeof(void)) throw Error.LabelMustBeVoidOrHaveExpression(); - } else { - ValidateGotoType(target.Type, ref value, valueParameter); - } - } - - // Standard argument validation, taken from ValidateArgumentTypes - private static void ValidateGotoType(Type expectedType, ref Expression value, string paramName) { - RequiresCanRead(value, paramName); - if (expectedType != typeof(void)) { - if (!TypeUtils.AreReferenceAssignable(expectedType, value.Type)) { - // C# autoquotes return values, so we'll do that here - if (!TryQuote(expectedType, ref value)) { - throw Error.ExpressionTypeDoesNotMatchLabel(value.Type, expectedType); - } - } - } - } - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/IArgumentProvider.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/IArgumentProvider.cs deleted file mode 100644 index af67d2bebb6..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/IArgumentProvider.cs +++ /dev/null @@ -1,77 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Text; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { - using Microsoft.Scripting.Utils; -#else -namespace System.Linq.Expressions { -#endif - /// - /// Provides an internal interface for accessing the arguments that multiple tree - /// nodes (DynamicExpression, ElementInit, MethodCallExpression, InvocationExpression, NewExpression, - /// and InexExpression). - /// - /// This enables two optimizations which reduce the size of the trees. The first is it enables - /// the nodes to hold onto an IList of T instead of a ReadOnlyCollection. This saves the cost - /// of allocating the ReadOnlyCollection for each node. The second is that it enables specialized - /// subclasses to be created which hold onto a specific number of arguments. For example Block2, - /// Block3, Block4. These nodes can therefore avoid allocating both a ReadOnlyCollection and an - /// array for storing their elements saving 32 bytes per node. - /// - /// Meanwhile the nodes can continue to expose the original LINQ properties of ReadOnlyCollections. They - /// do this by re-using 1 field for storing both the array or an element that would normally be stored - /// in the array. - /// - /// For the array case the collection is typed to IList of T instead of ReadOnlyCollection of T. - /// When the node is initially constructed it is an array. When the compiler accesses the members it - /// uses this interface. If a user accesses the members the array is promoted to a ReadOnlyCollection. - /// - /// For the object case we store the 1st argument in a field typed to object and when the node is initially - /// constructed this holds directly onto the Expression. When the compiler accesses the members - /// it again uses this interface and the accessor for the 1st argument uses Expression.ReturnObject to - /// return the object which handles the Expression or ReadOnlyCollection case. When the user accesses - /// the ReadOnlyCollection then the object field is updated to hold directly onto the ReadOnlyCollection. - /// - /// It is important that the Expressions consistently return the same ReadOnlyCollection otherwise the - /// re-writer will be broken and it would be a breaking change from LINQ v1. The problem is that currently - /// users can rely on object identity to tell if the node has changed. Storing the readonly collection in - /// an overloaded field enables us to both reduce memory usage as well as maintain compatibility and an - /// easy to use external API. - /// - internal interface IArgumentProvider { - Expression GetArgument(int index); - int ArgumentCount { - get; - } - } - - static class ArgumentProviderOps { - internal static T[] Map(this IArgumentProvider collection, Func select) { - int count = collection.ArgumentCount; - T[] result = new T[count]; - count = 0; - for (int i = 0; i < count; i++) { - result[i] = select(collection.GetArgument(i)); - } - return result; - } - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/IndexExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/IndexExpression.cs deleted file mode 100644 index b0498c9ebd0..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/IndexExpression.cs +++ /dev/null @@ -1,451 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Text; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents indexing a property or array. - /// - [DebuggerTypeProxy(typeof(Expression.IndexExpressionProxy))] - public sealed class IndexExpression : Expression, IArgumentProvider { - private readonly Expression _instance; - private readonly PropertyInfo _indexer; - private IList _arguments; - - internal IndexExpression( - Expression instance, - PropertyInfo indexer, - IList arguments) { - - if (indexer == null) { - Debug.Assert(instance != null && instance.Type.IsArray); - Debug.Assert(instance.Type.GetArrayRank() == arguments.Count); - } - - _instance = instance; - _indexer = indexer; - _arguments = arguments; - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Index; } - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { - if (_indexer != null) { - return _indexer.PropertyType; - } - return _instance.Type.GetElementType(); - } - } - - /// - /// An object to index. - /// - public Expression Object { - get { return _instance; } - } - - /// - /// Gets the for the property if the expression represents an indexed property, returns null otherwise. - /// - public PropertyInfo Indexer { - get { return _indexer; } - } - - /// - /// Gets the arguments to be used to index the property or array. - /// - public ReadOnlyCollection Arguments { - get { return ReturnReadOnly(ref _arguments); } - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public IndexExpression Update(Expression @object, IEnumerable arguments) { - if (@object == Object && arguments == Arguments) { - return this; - } - return Expression.MakeIndex(@object, Indexer, arguments); - } - - Expression IArgumentProvider.GetArgument(int index) { - return _arguments[index]; - } - - int IArgumentProvider.ArgumentCount { - get { - return _arguments.Count; - } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitIndex(this); - } - - internal Expression Rewrite(Expression instance, Expression[] arguments) { - Debug.Assert(instance != null); - Debug.Assert(arguments == null || arguments.Length == _arguments.Count); - - return Expression.MakeIndex(instance, _indexer, arguments ?? _arguments); - } - } - - public partial class Expression { - - /// - /// Creates an that represents accessing an indexed property in an object. - /// - /// The object to which the property belongs. Should be null if the property is static(shared). - /// An representing the property to index. - /// An IEnumerable{Expression} contaning the arguments to be used to index the property. - /// The created . - public static IndexExpression MakeIndex(Expression instance, PropertyInfo indexer, IEnumerable arguments) { - if (indexer != null) { - return Property(instance, indexer, arguments); - } else { - return ArrayAccess(instance, arguments); - } - } - - #region ArrayAccess - - /// - /// Creates an to access an array. - /// - /// An expression representing the array to index. - /// An array containing expressions used to index the array. - /// The expression representing the array can be obtained by using the MakeMemberAccess method, - /// or through NewArrayBounds or NewArrayInit. - /// The created . - public static IndexExpression ArrayAccess(Expression array, params Expression[] indexes) { - return ArrayAccess(array, (IEnumerable)indexes); - } - - /// - /// Creates an to access an array. - /// - /// An expression representing the array to index. - /// An containing expressions used to index the array. - /// The expression representing the array can be obtained by using the MakeMemberAccess method, - /// or through NewArrayBounds or NewArrayInit. - /// The created . - public static IndexExpression ArrayAccess(Expression array, IEnumerable indexes) { - RequiresCanRead(array, "array"); - - Type arrayType = array.Type; - if (!arrayType.IsArray) { - throw Error.ArgumentMustBeArray(); - } - - var indexList = indexes.ToReadOnly(); - if (arrayType.GetArrayRank() != indexList.Count) { - throw Error.IncorrectNumberOfIndexes(); - } - - foreach (Expression e in indexList) { - RequiresCanRead(e, "indexes"); - if (e.Type != typeof(int)) { - throw Error.ArgumentMustBeArrayIndexType(); - } - } - - return new IndexExpression(array, null, indexList); - } - - #endregion - - #region Property - /// - /// Creates an representing the access to an indexed property. - /// - /// The object to which the property belongs. If the property is static/shared, it must be null. - /// The name of the indexer. - /// An array of objects that are used to index the property. - /// The created . - public static IndexExpression Property(Expression instance, string propertyName, params Expression[] arguments) { - RequiresCanRead(instance, "instance"); - ContractUtils.RequiresNotNull(propertyName, "indexerName"); - PropertyInfo pi = FindInstanceProperty(instance.Type, propertyName, arguments); - return Property(instance, pi, arguments); - } - - #region methods for finding a PropertyInfo by its name - /// - /// The method finds the instance property with the specified name in a type. The property's type signature needs to be compatible with - /// the arguments if it is a indexer. If the arguments is null or empty, we get a normal property. - /// - private static PropertyInfo FindInstanceProperty(Type type, string propertyName, Expression[] arguments) { - // bind to public names first - BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy; - PropertyInfo pi = FindProperty(type, propertyName, arguments, flags); - if (pi == null) { - flags = BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy; - pi = FindProperty(type, propertyName, arguments, flags); - } - if (pi == null) { - if (arguments == null || arguments.Length == 0) { - throw Error.InstancePropertyWithoutParameterNotDefinedForType(propertyName, type); - } else { - throw Error.InstancePropertyWithSpecifiedParametersNotDefinedForType(propertyName, GetArgTypesString(arguments), type); - } - } - return pi; - } - - private static string GetArgTypesString(Expression[] arguments) { - StringBuilder argTypesStr = new StringBuilder(); - var isFirst = true; - argTypesStr.Append("("); - foreach (var t in arguments.Select(arg => arg.Type)) { - if (!isFirst) { - argTypesStr.Append(", "); - } - argTypesStr.Append(t.Name); - isFirst = false; - } - argTypesStr.Append(")"); - return argTypesStr.ToString(); - } - - private static PropertyInfo FindProperty(Type type, string propertyName, Expression[] arguments, BindingFlags flags) { - MemberInfo[] members = type.FindMembers(MemberTypes.Property, flags, Type.FilterNameIgnoreCase, propertyName); - if (members == null || members.Length == 0) - return null; - - PropertyInfo pi; - var propertyInfos = members.Map(t => (PropertyInfo)t); - int count = FindBestProperty(propertyInfos, arguments, out pi); - - if (count == 0) - return null; - if (count > 1) - throw Error.PropertyWithMoreThanOneMatch(propertyName, type); - return pi; - } - - private static int FindBestProperty(IEnumerable properties, Expression[] args, out PropertyInfo property) { - int count = 0; - property = null; - foreach (PropertyInfo pi in properties) { - if (pi != null && IsCompatible(pi, args)) { - if (property == null) { - property = pi; - count = 1; - } - else { - count++; - } - } - } - return count; - } - - private static bool IsCompatible(PropertyInfo pi, Expression[] args) { - MethodInfo mi; - - mi = pi.GetGetMethod(true); - ParameterInfo[] parms; - if (mi != null) { - parms = mi.GetParametersCached(); - } else { - mi = pi.GetSetMethod(true); - //The setter has an additional parameter for the value to set, - //need to remove the last type to match the arguments. - parms = mi.GetParametersCached().RemoveLast(); - } - - if (mi == null) { - return false; - } - if (args == null) { - return parms.Length == 0; - } - - if (parms.Length != args.Length) - return false; - for (int i = 0; i < args.Length; i++) { - if (args[i] == null) return false; - if (!TypeUtils.AreReferenceAssignable(parms[i].ParameterType, args[i].Type)) { - return false; - } - } - return true; - } - #endregion - - /// - /// Creates an representing the access to an indexed property. - /// - /// The object to which the property belongs. If the property is static/shared, it must be null. - /// The that represents the property to index. - /// An array of objects that are used to index the property. - /// The created . - public static IndexExpression Property(Expression instance, PropertyInfo indexer, params Expression[] arguments) { - return Property(instance, indexer, (IEnumerable)arguments); - } - - /// - /// Creates an representing the access to an indexed property. - /// - /// The object to which the property belongs. If the property is static/shared, it must be null. - /// The that represents the property to index. - /// An of objects that are used to index the property. - /// The created . - public static IndexExpression Property(Expression instance, PropertyInfo indexer, IEnumerable arguments) { - var argList = arguments.ToReadOnly(); - ValidateIndexedProperty(instance, indexer, ref argList); - return new IndexExpression(instance, indexer, argList); - } - - // CTS places no restrictions on properties (see ECMA-335 8.11.3), - // so we validate that the property conforms to CLS rules here. - // - // Does reflection help us out at all? Expression.Property skips all of - // these checks, so either it needs more checks or we need less here. - private static void ValidateIndexedProperty(Expression instance, PropertyInfo property, ref ReadOnlyCollection argList) { - - // If both getter and setter specified, all their parameter types - // should match, with exception of the last setter parameter which - // should match the type returned by the get method. - // Accessor parameters cannot be ByRef. - - ContractUtils.RequiresNotNull(property, "property"); - if (property.PropertyType.IsByRef) throw Error.PropertyCannotHaveRefType(); - if (property.PropertyType == typeof(void)) throw Error.PropertyTypeCannotBeVoid(); - - ParameterInfo[] getParameters = null; - MethodInfo getter = property.GetGetMethod(true); - if (getter != null) { - getParameters = getter.GetParametersCached(); - ValidateAccessor(instance, getter, getParameters, ref argList); - } - - MethodInfo setter = property.GetSetMethod(true); - if (setter != null) { - ParameterInfo[] setParameters = setter.GetParametersCached(); - if (setParameters.Length == 0) throw Error.SetterHasNoParams(); - - // valueType is the type of the value passed to the setter (last parameter) - Type valueType = setParameters[setParameters.Length - 1].ParameterType; - if (valueType.IsByRef) throw Error.PropertyCannotHaveRefType(); - if (setter.ReturnType != typeof(void)) throw Error.SetterMustBeVoid(); - if (property.PropertyType != valueType) throw Error.PropertyTyepMustMatchSetter(); - - if (getter != null) { - if (getter.IsStatic ^ setter.IsStatic) throw Error.BothAccessorsMustBeStatic(); - if (getParameters.Length != setParameters.Length - 1) throw Error.IndexesOfSetGetMustMatch(); - - for (int i = 0; i < getParameters.Length; i++) { - if (getParameters[i].ParameterType != setParameters[i].ParameterType) throw Error.IndexesOfSetGetMustMatch(); - } - } else { - ValidateAccessor(instance, setter, setParameters.RemoveLast(), ref argList); - } - } - - if (getter == null && setter == null) { - throw Error.PropertyDoesNotHaveAccessor(property); - } - } - - private static void ValidateAccessor(Expression instance, MethodInfo method, ParameterInfo[] indexes, ref ReadOnlyCollection arguments) { - ContractUtils.RequiresNotNull(arguments, "arguments"); - - ValidateMethodInfo(method); - if ((method.CallingConvention & CallingConventions.VarArgs) != 0) throw Error.AccessorsCannotHaveVarArgs(); - if (method.IsStatic) { - if (instance != null) throw Error.OnlyStaticMethodsHaveNullInstance(); - } else { - if (instance == null) throw Error.OnlyStaticMethodsHaveNullInstance(); - RequiresCanRead(instance, "instance"); - ValidateCallInstanceType(instance.Type, method); - } - - ValidateAccessorArgumentTypes(method, indexes, ref arguments); - } - - private static void ValidateAccessorArgumentTypes(MethodInfo method, ParameterInfo[] indexes, ref ReadOnlyCollection arguments) { - if (indexes.Length > 0) { - if (indexes.Length != arguments.Count) { - throw Error.IncorrectNumberOfMethodCallArguments(method); - } - Expression[] newArgs = null; - for (int i = 0, n = indexes.Length; i < n; i++) { - Expression arg = arguments[i]; - ParameterInfo pi = indexes[i]; - RequiresCanRead(arg, "arguments"); - - Type pType = pi.ParameterType; - if (pType.IsByRef) throw Error.AccessorsCannotHaveByRefArgs(); - TypeUtils.ValidateType(pType); - - if (!TypeUtils.AreReferenceAssignable(pType, arg.Type)) { - if (!TryQuote(pType, ref arg)) { - throw Error.ExpressionTypeDoesNotMatchMethodParameter(arg.Type, pType, method); - } - } - if (newArgs == null && arg != arguments[i]) { - newArgs = new Expression[arguments.Count]; - for (int j = 0; j < i; j++) { - newArgs[j] = arguments[j]; - } - } - if (newArgs != null) { - newArgs[i] = arg; - } - } - if (newArgs != null) { - arguments = new TrueReadOnlyCollection(newArgs); - } - - } else if (arguments.Count > 0) { - throw Error.IncorrectNumberOfMethodCallArguments(method); - } - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/InvocationExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/InvocationExpression.cs deleted file mode 100644 index 2dfdb3a6be7..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/InvocationExpression.cs +++ /dev/null @@ -1,199 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents an expression that applies a delegate or lambda expression to a list of argument expressions. - /// - [DebuggerTypeProxy(typeof(Expression.InvocationExpressionProxy))] - public sealed class InvocationExpression : Expression, IArgumentProvider { - private IList _arguments; - private readonly Expression _lambda; - private readonly Type _returnType; - - internal InvocationExpression(Expression lambda, IList arguments, Type returnType) { - _lambda = lambda; - _arguments = arguments; - _returnType = returnType; - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _returnType; } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Invoke; } - } - - /// - /// Gets the delegate or lambda expression to be applied. - /// - public Expression Expression { - get { return _lambda; } - } - - /// - /// Gets the arguments that the delegate or lambda expression is applied to. - /// - public ReadOnlyCollection Arguments { - get { return ReturnReadOnly(ref _arguments); } - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public InvocationExpression Update(Expression expression, IEnumerable arguments) { - if (expression == Expression && arguments == Arguments) { - return this; - } - - return Expression.Invoke(expression, arguments); - } - - Expression IArgumentProvider.GetArgument(int index) { - return _arguments[index]; - } - - int IArgumentProvider.ArgumentCount { - get { - return _arguments.Count; - } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitInvocation(this); - } - - internal InvocationExpression Rewrite(Expression lambda, Expression[] arguments) { - Debug.Assert(lambda != null); - Debug.Assert(arguments == null || arguments.Length == _arguments.Count); - - return Expression.Invoke(lambda, arguments ?? _arguments); - } - - internal LambdaExpression LambdaOperand { - get { - return (_lambda.NodeType == ExpressionType.Quote) - ? (LambdaExpression)((UnaryExpression)_lambda).Operand - : (_lambda as LambdaExpression); - } - } - } - - public partial class Expression { - - /// - ///Creates an that - ///applies a delegate or lambda expression to a list of argument expressions. - /// - /// - ///An that - ///applies the specified delegate or lambda expression to the provided arguments. - /// - /// - ///An that represents the delegate - ///or lambda expression to be applied. - /// - /// - ///An array of objects - ///that represent the arguments that the delegate or lambda expression is applied to. - /// - /// - /// is null. - /// - ///.Type does not represent a delegate type or an .-or-The property of an element of is not assignable to the type of the corresponding parameter of the delegate represented by . - /// - /// does not contain the same number of elements as the list of parameters for the delegate represented by . - public static InvocationExpression Invoke(Expression expression, params Expression[] arguments) { - return Invoke(expression, (IEnumerable)arguments); - } - - /// - ///Creates an that - ///applies a delegate or lambda expression to a list of argument expressions. - /// - /// - ///An that - ///applies the specified delegate or lambda expression to the provided arguments. - /// - /// - ///An that represents the delegate - ///or lambda expression to be applied. - /// - /// - ///An of objects - ///that represent the arguments that the delegate or lambda expression is applied to. - /// - /// - /// is null. - /// - ///.Type does not represent a delegate type or an .-or-The property of an element of is not assignable to the type of the corresponding parameter of the delegate represented by . - /// - /// does not contain the same number of elements as the list of parameters for the delegate represented by . - public static InvocationExpression Invoke(Expression expression, IEnumerable arguments) { - RequiresCanRead(expression, "expression"); - - var args = arguments.ToReadOnly(); - var mi = GetInvokeMethod(expression); - ValidateArgumentTypes(mi, ExpressionType.Invoke, ref args); - return new InvocationExpression(expression, args, mi.ReturnType); - } - - /// - /// Gets the delegate's Invoke method; used by InvocationExpression. - /// - /// The expression to be invoked. - internal static MethodInfo GetInvokeMethod(Expression expression) { - Type delegateType = expression.Type; - if (!expression.Type.IsSubclassOf(typeof(MulticastDelegate))) { - Type exprType = TypeUtils.FindGenericType(typeof(Expression<>), expression.Type); - if (exprType == null) { - throw Error.ExpressionTypeNotInvocable(expression.Type); - } - delegateType = exprType.GetGenericArguments()[0]; - } - - return delegateType.GetMethod("Invoke"); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelExpression.cs deleted file mode 100644 index 513b0c4df55..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelExpression.cs +++ /dev/null @@ -1,115 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents a label, which can be placed in any context. If - /// it is jumped to, it will get the value provided by the corresponding - /// . Otherwise, it gets the value in . If the - /// equals System.Void, no value should be provided. - /// - [DebuggerTypeProxy(typeof(Expression.LabelExpressionProxy))] - public sealed class LabelExpression : Expression { - private readonly Expression _defaultValue; - private readonly LabelTarget _target; - - internal LabelExpression(LabelTarget label, Expression defaultValue) { - _target = label; - _defaultValue = defaultValue; - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _target.Type; } - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Label; } - } - - /// - /// The which this label is associated with. - /// - public LabelTarget Target { - get { return _target; } - } - - /// - /// The value of the when the label is reached through - /// normal control flow (e.g. is not jumped to). - /// - public Expression DefaultValue { - get { return _defaultValue; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitLabel(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public LabelExpression Update(LabelTarget target, Expression defaultValue) { - if (target == Target && defaultValue == DefaultValue) { - return this; - } - return Expression.Label(target, defaultValue); - } - } - - public partial class Expression { - /// - /// Creates a representing a label with no default value. - /// - /// The which this will be associated with. - /// A with no default value. - public static LabelExpression Label(LabelTarget target) { - return Label(target, null); - } - - /// - /// Creates a representing a label with the given default value. - /// - /// The which this will be associated with. - /// The value of this when the label is reached through normal control flow. - /// A with the given default value. - public static LabelExpression Label(LabelTarget target, Expression defaultValue) { - ValidateGoto(target, ref defaultValue, "label", "defaultValue"); - return new LabelExpression(target, defaultValue); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelTarget.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelTarget.cs deleted file mode 100644 index 3385dbde64d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LabelTarget.cs +++ /dev/null @@ -1,102 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Used to denote the target of a . - /// - public sealed class LabelTarget { - private readonly Type _type; - private readonly string _name; - - internal LabelTarget(Type type, string name) { - _type = type; - _name = name; - } - - /// - /// Gets the name of the label. - /// - /// The label's name is provided for information purposes only. - public string Name { - get { return _name; } - } - - /// - /// The type of value that is passed when jumping to the label - /// (or System.Void if no value should be passed). - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1721:PropertyNamesShouldNotMatchGetMethods")] - public Type Type { - get { return _type; } - } - - /// - /// Returns a that represents the current . - /// - /// A that represents the current . - public override string ToString() { - return String.IsNullOrEmpty(this.Name) ? "UnamedLabel" : this.Name; - } - } - - public partial class Expression { - /// - /// Creates a representing a label with void type and no name. - /// - /// The new . - public static LabelTarget Label() { - return Label(typeof(void), null); - } - - /// - /// Creates a representing a label with void type and the given name. - /// - /// The name of the label. - /// The new . - public static LabelTarget Label(string name) { - return Label(typeof(void), name); - } - - /// - /// Creates a representing a label with the given type. - /// - /// The type of value that is passed when jumping to the label. - /// The new . - public static LabelTarget Label(Type type) { - return Label(type, null); - } - - /// - /// Creates a representing a label with the given type and name. - /// - /// The type of value that is passed when jumping to the label. - /// The name of the label. - /// The new . - public static LabelTarget Label(Type type, string name) { - ContractUtils.RequiresNotNull(type, "type"); - TypeUtils.ValidateType(type); - return new LabelTarget(type, name); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs deleted file mode 100644 index 050330c0b4d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LambdaExpression.cs +++ /dev/null @@ -1,666 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif -using System.Threading; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - using Compiler; - - /// - /// Creates a node. - /// This captures a block of code that is similar to a .NET method body. - /// - /// - /// Lambda expressions take input through parameters and are expected to be fully bound. - /// - [DebuggerTypeProxy(typeof(Expression.LambdaExpressionProxy))] - public abstract class LambdaExpression : Expression { - private readonly string _name; - private readonly Expression _body; - private readonly ReadOnlyCollection _parameters; - private readonly Type _delegateType; - private readonly bool _tailCall; - - internal LambdaExpression( - Type delegateType, - string name, - Expression body, - bool tailCall, - ReadOnlyCollection parameters - ) { - - Debug.Assert(delegateType != null); - - _name = name; - _body = body; - _parameters = parameters; - _delegateType = delegateType; - _tailCall = tailCall; - } -#if FEATURE_REFEMIT - internal abstract LambdaExpression Accept(StackSpiller spiller); -#endif - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _delegateType; } - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Lambda; } - } - - /// - /// Gets the parameters of the lambda expression. - /// - public ReadOnlyCollection Parameters { - get { return _parameters; } - } - - /// - /// Gets the name of the lambda expression. - /// - /// Used for debugging purposes. - public string Name { - get { return _name; } - } - - /// - /// Gets the body of the lambda expression. - /// - public Expression Body { - get { return _body; } - } - - /// - /// Gets the return type of the lambda expression. - /// - public Type ReturnType { - get { return Type.GetMethod("Invoke").ReturnType; } - } - - /// - /// Gets the value that indicates if the lambda expression will be compiled with - /// tail call optimization. - /// - public bool TailCall { - get { return _tailCall; } - } - - /// - /// Produces a delegate that represents the lambda expression. - /// - /// A delegate containing the compiled version of the lambda. - public Delegate Compile() { - return LambdaCompiler.Compile(this, null); - } - - /// - /// Produces a delegate that represents the lambda expression. - /// - /// Debugging information generator used by the compiler to mark sequence points and annotate local variables. - /// A delegate containing the compiled version of the lambda. - public Delegate Compile(DebugInfoGenerator debugInfoGenerator) { - ContractUtils.RequiresNotNull(debugInfoGenerator, "debugInfoGenerator"); - return LambdaCompiler.Compile(this, debugInfoGenerator); - } - -#if NETSTANDARD - public Delegate Compile(bool preferInterpretation) { - // TODO: add logic for preferInterpretation - return Compile(); - } -#endif - -#if FEATURE_REFEMIT - /// - /// Compiles the lambda into a method definition. - /// - /// A which will be used to hold the lambda's IL. - public void CompileToMethod(MethodBuilder method) { - CompileToMethodInternal(method, null); - } - - /// - /// Compiles the lambda into a method definition and custom debug information. - /// - /// A which will be used to hold the lambda's IL. - /// Debugging information generator used by the compiler to mark sequence points and annotate local variables. - public void CompileToMethod(MethodBuilder method, DebugInfoGenerator debugInfoGenerator) { - ContractUtils.RequiresNotNull(debugInfoGenerator, "debugInfoGenerator"); - CompileToMethodInternal(method, debugInfoGenerator); - } - - private void CompileToMethodInternal(MethodBuilder method, DebugInfoGenerator debugInfoGenerator) { - ContractUtils.RequiresNotNull(method, "method"); - ContractUtils.Requires(method.IsStatic, "method"); - var type = method.DeclaringType as TypeBuilder; - if (type == null) throw Error.MethodBuilderDoesNotHaveTypeBuilder(); - - LambdaCompiler.Compile(this, method, debugInfoGenerator); - } -#endif - } - - /// - /// Defines a node. - /// This captures a block of code that is similar to a .NET method body. - /// - /// The type of the delegate. - /// - /// Lambda expressions take input through parameters and are expected to be fully bound. - /// - public sealed class Expression : LambdaExpression { - internal Expression(Expression body, string name, bool tailCall, ReadOnlyCollection parameters) - : base(typeof(TDelegate), name, body, tailCall, parameters) { - } - - /// - /// Produces a delegate that represents the lambda expression. - /// - /// A delegate containing the compiled version of the lambda. - public new TDelegate Compile() { - return (TDelegate)(object)LambdaCompiler.Compile(this, null); - } - - /// - /// Produces a delegate that represents the lambda expression. - /// - /// Debugging information generator used by the compiler to mark sequence points and annotate local variables. - /// A delegate containing the compiled version of the lambda. - public new TDelegate Compile(DebugInfoGenerator debugInfoGenerator) { - ContractUtils.RequiresNotNull(debugInfoGenerator, "debugInfoGenerator"); - return (TDelegate)(object)LambdaCompiler.Compile(this, debugInfoGenerator); - } - -#if NETSTANDARD - public new TDelegate Compile(bool preferInterpretation) { - // TODO: add logic for preferInterpretation - return Compile(); - } -#endif - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The Body property of the result. - /// The Parameters property of the result. - /// This expression if no children changed, or an expression with the updated children. - public Expression Update(Expression body, IEnumerable parameters) { - if (body == Body && parameters == Parameters) { - return this; - } - return Expression.Lambda(body, Name, TailCall, parameters); - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitLambda(this); - } -#if FEATURE_REFEMIT - internal override LambdaExpression Accept(StackSpiller spiller) { - return spiller.Rewrite(this); - } -#endif - internal static LambdaExpression Create(Expression body, string name, bool tailCall, ReadOnlyCollection parameters) { - return new Expression(body, name, tailCall, parameters); - } - } - - - public partial class Expression { - - /// - /// Creates an Expression{T} given the delegate type. Caches the - /// factory method to speed up repeated creations for the same T. - /// - internal static LambdaExpression CreateLambda(Type delegateType, Expression body, string name, bool tailCall, ReadOnlyCollection parameters) { - // Get or create a delegate to the public Expression.Lambda - // method and call that will be used for creating instances of this - // delegate type - LambdaFactory fastPath; - if (_LambdaFactories == null) { - // NOTE: this must be Interlocked assigment since we use _LambdaFactories for locking. - Interlocked.CompareExchange(ref _LambdaFactories, new CacheDict(50), null); - } - - MethodInfo create = null; - lock (_LambdaFactories) { - if (!_LambdaFactories.TryGetValue(delegateType, out fastPath)) { - create = typeof(Expression<>).MakeGenericType(delegateType).GetMethod("Create", BindingFlags.Static | BindingFlags.NonPublic); - if (TypeUtils.CanCache(delegateType)) { - _LambdaFactories[delegateType] = fastPath = (LambdaFactory)Delegate.CreateDelegate(typeof(LambdaFactory), create); - } - } - } - - if (fastPath != null) { - return fastPath(body, name, tailCall, parameters); - } - - Debug.Assert(create != null); - return (LambdaExpression)create.Invoke(null, new object[] { body, name, tailCall, parameters }); - } - - /// - /// Creates an where the delegate type is known at compile time. - /// - /// The delegate type. - /// An to set the property equal to. - /// An array that contains objects to use to populate the collection. - /// An that has the property equal to and the and properties set to the specified values. - public static Expression Lambda(Expression body, params ParameterExpression[] parameters) { - return Lambda(body, false, (IEnumerable)parameters); - } - - /// - /// Creates an where the delegate type is known at compile time. - /// - /// The delegate type. - /// An to set the property equal to. - /// A that indicates if tail call optimization will be applied when compiling the created expression. - /// An array that contains objects to use to populate the collection. - /// An that has the property equal to and the and properties set to the specified values. - public static Expression Lambda(Expression body, bool tailCall, params ParameterExpression[] parameters) { - return Lambda(body, tailCall, (IEnumerable)parameters); - } - - /// - /// Creates an where the delegate type is known at compile time. - /// - /// The delegate type. - /// An to set the property equal to. - /// An that contains objects to use to populate the collection. - /// An that has the property equal to and the and properties set to the specified values. - public static Expression Lambda(Expression body, IEnumerable parameters) { - return Lambda(body, null, false, parameters); - } - - /// - /// Creates an where the delegate type is known at compile time. - /// - /// The delegate type. - /// An to set the property equal to. - /// A that indicates if tail call optimization will be applied when compiling the created expression. - /// An that contains objects to use to populate the collection. - /// An that has the property equal to and the and properties set to the specified values. - public static Expression Lambda(Expression body, bool tailCall, IEnumerable parameters) { - return Lambda(body, null, tailCall, parameters); - } - - /// - /// Creates an where the delegate type is known at compile time. - /// - /// The delegate type. - /// An to set the property equal to. - /// An that contains objects to use to populate the collection. - /// The name of the lambda. Used for generating debugging info. - /// An that has the property equal to and the and properties set to the specified values. - public static Expression Lambda(Expression body, String name, IEnumerable parameters) { - return Lambda(body, name, false, parameters); - } - - /// - /// Creates an where the delegate type is known at compile time. - /// - /// The delegate type. - /// An to set the property equal to. - /// The name of the lambda. Used for generating debugging info. - /// An that contains objects to use to populate the collection. - /// A that indicates if tail call optimization will be applied when compiling the created expression. - /// An that has the property equal to and the and properties set to the specified values. - public static Expression Lambda(Expression body, String name, bool tailCall, IEnumerable parameters) { - var parameterList = parameters.ToReadOnly(); - ValidateLambdaArgs(typeof(TDelegate), ref body, parameterList); - return new Expression(body, name, tailCall, parameterList); - } - - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// An array that contains objects to use to populate the collection. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Expression body, params ParameterExpression[] parameters) { - return Lambda(body, false, (IEnumerable)parameters); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// A that indicates if tail call optimization will be applied when compiling the created expression. - /// An array that contains objects to use to populate the collection. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Expression body, bool tailCall, params ParameterExpression[] parameters) { - return Lambda(body, tailCall, (IEnumerable)parameters); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// An that contains objects to use to populate the collection. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Expression body, IEnumerable parameters) { - return Lambda(body, null, false, parameters); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// A that indicates if tail call optimization will be applied when compiling the created expression. - /// An that contains objects to use to populate the collection. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Expression body, bool tailCall, IEnumerable parameters) { - return Lambda(body, null, tailCall, parameters); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// An array that contains objects to use to populate the collection. - /// A representing the delegate signature for the lambda. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Type delegateType, Expression body, params ParameterExpression[] parameters) { - return Lambda(delegateType, body, null, false, parameters); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// A that indicates if tail call optimization will be applied when compiling the created expression. - /// An array that contains objects to use to populate the collection. - /// A representing the delegate signature for the lambda. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Type delegateType, Expression body, bool tailCall, params ParameterExpression[] parameters) { - return Lambda(delegateType, body, null, tailCall, parameters); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// An that contains objects to use to populate the collection. - /// A representing the delegate signature for the lambda. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Type delegateType, Expression body, IEnumerable parameters) { - return Lambda(delegateType, body, null, false, parameters); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// A that indicates if tail call optimization will be applied when compiling the created expression. - /// An that contains objects to use to populate the collection. - /// A representing the delegate signature for the lambda. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Type delegateType, Expression body, bool tailCall, IEnumerable parameters) { - return Lambda(delegateType, body, null, tailCall, parameters); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// An that contains objects to use to populate the collection. - /// The name for the lambda. Used for emitting debug information. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Expression body, string name, IEnumerable parameters) { - return Lambda(body, name, false, parameters); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// The name for the lambda. Used for emitting debug information. - /// A that indicates if tail call optimization will be applied when compiling the created expression. - /// An that contains objects to use to populate the collection. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Expression body, string name, bool tailCall, IEnumerable parameters) { - ContractUtils.RequiresNotNull(body, "body"); - - var parameterList = parameters.ToReadOnly(); - - int paramCount = parameterList.Count; - Type[] typeArgs = new Type[paramCount + 1]; - if (paramCount > 0) { - var set = new Set(parameterList.Count); - for (int i = 0; i < paramCount; i++) { - var param = parameterList[i]; - ContractUtils.RequiresNotNull(param, "parameter"); - typeArgs[i] = param.IsByRef ? param.Type.MakeByRefType() : param.Type; - if (set.Contains(param)) { - throw Error.DuplicateVariable(param); - } - set.Add(param); - } - } - typeArgs[paramCount] = body.Type; - - Type delegateType = DelegateHelpers.MakeDelegateType(typeArgs); - - return CreateLambda(delegateType, body, name, tailCall, parameterList); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// An to set the property equal to. - /// An that contains objects to use to populate the collection. - /// The name for the lambda. Used for emitting debug information. - /// A representing the delegate signature for the lambda. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Type delegateType, Expression body, string name, IEnumerable parameters) { - var paramList = parameters.ToReadOnly(); - ValidateLambdaArgs(delegateType, ref body, paramList); - - return CreateLambda(delegateType, body, name, false, paramList); - } - - /// - /// Creates a LambdaExpression by first constructing a delegate type. - /// - /// A representing the delegate signature for the lambda. - /// An to set the property equal to. - /// The name for the lambda. Used for emitting debug information. - /// A that indicates if tail call optimization will be applied when compiling the created expression. - /// An that contains objects to use to populate the collection. - /// A that has the property equal to Lambda and the and properties set to the specified values. - public static LambdaExpression Lambda(Type delegateType, Expression body, string name, bool tailCall, IEnumerable parameters) { - var paramList = parameters.ToReadOnly(); - ValidateLambdaArgs(delegateType, ref body, paramList); - - return CreateLambda(delegateType, body, name, tailCall, paramList); - } - - private static void ValidateLambdaArgs(Type delegateType, ref Expression body, ReadOnlyCollection parameters) { - ContractUtils.RequiresNotNull(delegateType, "delegateType"); - RequiresCanRead(body, "body"); - - if (!typeof(MulticastDelegate).IsAssignableFrom(delegateType) || delegateType == typeof(MulticastDelegate)) { - throw Error.LambdaTypeMustBeDerivedFromSystemDelegate(); - } - - MethodInfo mi; - lock (_LambdaDelegateCache) { - if (!_LambdaDelegateCache.TryGetValue(delegateType, out mi)) { - mi = delegateType.GetMethod("Invoke"); - if (TypeUtils.CanCache(delegateType)) { - _LambdaDelegateCache[delegateType] = mi; - } - } - } - - ParameterInfo[] pis = mi.GetParametersCached(); - - if (pis.Length > 0) { - if (pis.Length != parameters.Count) { - throw Error.IncorrectNumberOfLambdaDeclarationParameters(); - } - var set = new Set(pis.Length); - for (int i = 0, n = pis.Length; i < n; i++) { - ParameterExpression pex = parameters[i]; - ParameterInfo pi = pis[i]; - RequiresCanRead(pex, "parameters"); - Type pType = pi.ParameterType; - if (pex.IsByRef) { - if (!pType.IsByRef) { - //We cannot pass a parameter of T& to a delegate that takes T or any non-ByRef type. - throw Error.ParameterExpressionNotValidAsDelegate(pex.Type.MakeByRefType(), pType); - } - pType = pType.GetElementType(); - } - if (!TypeUtils.AreReferenceAssignable(pex.Type, pType)) { - throw Error.ParameterExpressionNotValidAsDelegate(pex.Type, pType); - } - if (set.Contains(pex)) { - throw Error.DuplicateVariable(pex); - } - set.Add(pex); - } - } else if (parameters.Count > 0) { - throw Error.IncorrectNumberOfLambdaDeclarationParameters(); - } - if (mi.ReturnType != typeof(void) && !TypeUtils.AreReferenceAssignable(mi.ReturnType, body.Type)) { - if (!TryQuote(mi.ReturnType, ref body)) { - throw Error.ExpressionTypeDoesNotMatchReturn(body.Type, mi.ReturnType); - } - } - } - - private static bool ValidateTryGetFuncActionArgs(Type[] typeArgs) { - if (typeArgs == null) { - throw new ArgumentNullException("typeArgs"); - } - for (int i = 0, n = typeArgs.Length; i < n; i++) { - var a = typeArgs[i]; - if (a == null) { - throw new ArgumentNullException("typeArgs"); - } - if (a.IsByRef) { - return false; - } - } - return true; - } - - /// - /// Creates a object that represents a generic System.Func delegate type that has specific type arguments. - /// The last type argument specifies the return type of the created delegate. - /// - /// An array of Type objects that specify the type arguments for the System.Func delegate type. - /// The type of a System.Func delegate that has the specified type arguments. - public static Type GetFuncType(params Type[] typeArgs) { - if (!ValidateTryGetFuncActionArgs(typeArgs)) throw Error.TypeMustNotBeByRef(); - - Type result = DelegateHelpers.GetFuncType(typeArgs); - if (result == null) { - throw Error.IncorrectNumberOfTypeArgsForFunc(); - } - return result; - } - - /// - /// Creates a object that represents a generic System.Func delegate type that has specific type arguments. - /// The last type argument specifies the return type of the created delegate. - /// - /// An array of Type objects that specify the type arguments for the System.Func delegate type. - /// When this method returns, contains the generic System.Func delegate type that has specific type arguments. Contains null if there is no generic System.Func delegate that matches the .This parameter is passed uninitialized. - /// true if generic System.Func delegate type was created for specific ; false otherwise. - public static bool TryGetFuncType(Type[] typeArgs, out Type funcType) { - if (ValidateTryGetFuncActionArgs(typeArgs)) { - return (funcType = DelegateHelpers.GetFuncType(typeArgs)) != null; - } - funcType = null; - return false; - } - - /// - /// Creates a object that represents a generic System.Action delegate type that has specific type arguments. - /// - /// An array of Type objects that specify the type arguments for the System.Action delegate type. - /// The type of a System.Action delegate that has the specified type arguments. - public static Type GetActionType(params Type[] typeArgs) { - if (!ValidateTryGetFuncActionArgs(typeArgs)) throw Error.TypeMustNotBeByRef(); - - Type result = DelegateHelpers.GetActionType(typeArgs); - if (result == null) { - throw Error.IncorrectNumberOfTypeArgsForAction(); - } - return result; - } - - /// - /// Creates a object that represents a generic System.Action delegate type that has specific type arguments. - /// - /// An array of Type objects that specify the type arguments for the System.Action delegate type. - /// When this method returns, contains the generic System.Action delegate type that has specific type arguments. Contains null if there is no generic System.Action delegate that matches the .This parameter is passed uninitialized. - /// true if generic System.Action delegate type was created for specific ; false otherwise. - public static bool TryGetActionType(Type[] typeArgs, out Type actionType) { - if (ValidateTryGetFuncActionArgs(typeArgs)) { - return (actionType = DelegateHelpers.GetActionType(typeArgs)) != null; - } - actionType = null; - return false; - } - - /// - /// Gets a object that represents a generic System.Func or System.Action delegate type that has specific type arguments. - /// The last type argument determines the return type of the delegate. If no Func or Action is large enough, it will generate a custom - /// delegate type. - /// - /// The type arguments of the delegate. - /// The delegate type. - /// - /// As with Func, the last argument is the return type. It can be set - /// to System.Void to produce an Action. - public static Type GetDelegateType(params Type[] typeArgs) { - ContractUtils.RequiresNotEmpty(typeArgs, "typeArgs"); - ContractUtils.RequiresNotNullItems(typeArgs, "typeArgs"); - return DelegateHelpers.MakeDelegateType(typeArgs); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ListArgumentProvider.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ListArgumentProvider.cs deleted file mode 100644 index da57959aa6d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ListArgumentProvider.cs +++ /dev/null @@ -1,143 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Text; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Provides a wrapper around an IArgumentProvider which exposes the argument providers - /// members out as an IList of Expression. This is used to avoid allocating an array - /// which needs to be stored inside of a ReadOnlyCollection. Instead this type has - /// the same amount of overhead as an array without duplicating the storage of the - /// elements. This ensures that internally we can avoid creating and copying arrays - /// while users of the Expression trees also don't pay a size penalty for this internal - /// optimization. See IArgumentProvider for more general information on the Expression - /// tree optimizations being used here. - /// - class ListArgumentProvider : IList { - private readonly IArgumentProvider _provider; - private readonly Expression _arg0; - - internal ListArgumentProvider(IArgumentProvider provider, Expression arg0) { - _provider = provider; - _arg0 = arg0; - } - - #region IList Members - - public int IndexOf(Expression item) { - if (_arg0 == item) { - return 0; - } - - for (int i = 1; i < _provider.ArgumentCount; i++) { - if (_provider.GetArgument(i) == item) { - return i; - } - } - - return -1; - } - - public void Insert(int index, Expression item) { - throw ContractUtils.Unreachable; - } - - public void RemoveAt(int index) { - throw ContractUtils.Unreachable; - } - - public Expression this[int index] { - get { - if (index == 0) { - return _arg0; - } - - return _provider.GetArgument(index); - } - set { - throw ContractUtils.Unreachable; - } - } - - #endregion - - #region ICollection Members - - public void Add(Expression item) { - throw ContractUtils.Unreachable; - } - - public void Clear() { - throw ContractUtils.Unreachable; - } - - public bool Contains(Expression item) { - return IndexOf(item) != -1; - } - - public void CopyTo(Expression[] array, int arrayIndex) { - array[arrayIndex++] = _arg0; - for (int i = 1; i < _provider.ArgumentCount; i++) { - array[arrayIndex++] = _provider.GetArgument(i); - } - } - - public int Count { - get { return _provider.ArgumentCount; } - } - - public bool IsReadOnly { - get { return true; } - } - - public bool Remove(Expression item) { - throw ContractUtils.Unreachable; - } - - #endregion - - #region IEnumerable Members - - public IEnumerator GetEnumerator() { - yield return _arg0; - - for (int i = 1; i < _provider.ArgumentCount; i++) { - yield return _provider.GetArgument(i); - } - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - yield return _arg0; - - for (int i = 1; i < _provider.ArgumentCount; i++) { - yield return _provider.GetArgument(i); - } - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ListInitExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ListInitExpression.cs deleted file mode 100644 index 023fd1f3ad9..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ListInitExpression.cs +++ /dev/null @@ -1,231 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents a constructor call that has a collection initializer. - /// - /// - /// Use the factory methods to create a ListInitExpression. - /// The value of the NodeType property of a ListInitExpression is ListInit. - /// - [DebuggerTypeProxy(typeof(Expression.ListInitExpressionProxy))] - public sealed class ListInitExpression : Expression { - private readonly NewExpression _newExpression; - private readonly ReadOnlyCollection _initializers; - - internal ListInitExpression(NewExpression newExpression, ReadOnlyCollection initializers) { - _newExpression = newExpression; - _initializers = initializers; - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.ListInit; } - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _newExpression.Type; } - } - - /// - /// Gets a value that indicates whether the expression tree node can be reduced. - /// - public override bool CanReduce { - get { - return true; - } - } - - /// - /// Gets the expression that contains a call to the constructor of a collection type. - /// - public NewExpression NewExpression { - get { return _newExpression; } - } - - /// - /// Gets the element initializers that are used to initialize a collection. - /// - public ReadOnlyCollection Initializers { - get { return _initializers; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitListInit(this); - } - - /// - /// Reduces the binary expression node to a simpler expression. - /// If CanReduce returns true, this should return a valid expression. - /// This method is allowed to return another node which itself - /// must be reduced. - /// - /// The reduced expression. - public override Expression Reduce() { - return MemberInitExpression.ReduceListInit(_newExpression, _initializers, true); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public ListInitExpression Update(NewExpression newExpression, IEnumerable initializers) { - if (newExpression == NewExpression && initializers == Initializers) { - return this; - } - return Expression.ListInit(newExpression, initializers); - } - } - - - public partial class Expression { - /// - /// Creates a that uses a method named "Add" to add elements to a collection. - /// - /// A to set the property equal to. - /// An array of objects to use to populate the collection. - /// A that has the property equal to ListInit and the property set to the specified value. - public static ListInitExpression ListInit(NewExpression newExpression, params Expression[] initializers) { - ContractUtils.RequiresNotNull(newExpression, "newExpression"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - return ListInit(newExpression, initializers as IEnumerable); - } - - /// - /// Creates a that uses a method named "Add" to add elements to a collection. - /// - /// A to set the property equal to. - /// An that contains objects to use to populate the collection. - /// A that has the property equal to ListInit and the property set to the specified value. - public static ListInitExpression ListInit(NewExpression newExpression, IEnumerable initializers) { - ContractUtils.RequiresNotNull(newExpression, "newExpression"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - - var initializerlist = initializers.ToReadOnly(); - if (initializerlist.Count == 0) { - throw Error.ListInitializerWithZeroMembers(); - } - - MethodInfo addMethod = FindMethod(newExpression.Type, "Add", null, new Expression[] { initializerlist[0] }, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); - return ListInit(newExpression, addMethod, initializers); - } - - /// - /// Creates a that uses a specified method to add elements to a collection. - /// - /// A to set the property equal to. - /// A that represents an instance method named "Add" (case insensitive), that adds an element to a collection. - /// An array of objects to use to populate the collection. - /// A that has the property equal to ListInit and the property set to the specified value. - public static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, params Expression[] initializers) { - if (addMethod == null) { - return ListInit(newExpression, initializers as IEnumerable); - } - ContractUtils.RequiresNotNull(newExpression, "newExpression"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - return ListInit(newExpression, addMethod, initializers as IEnumerable); - } - - /// - /// Creates a that uses a specified method to add elements to a collection. - /// - /// A to set the property equal to. - /// A that represents an instance method named "Add" (case insensitive), that adds an element to a collection. - /// An that contains objects to use to populate the Initializers collection. - /// A that has the property equal to ListInit and the property set to the specified value. - public static ListInitExpression ListInit(NewExpression newExpression, MethodInfo addMethod, IEnumerable initializers) { - if (addMethod == null) { - return ListInit(newExpression, initializers); - } - ContractUtils.RequiresNotNull(newExpression, "newExpression"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - - var initializerlist = initializers.ToReadOnly(); - if (initializerlist.Count == 0) { - throw Error.ListInitializerWithZeroMembers(); - } - ElementInit[] initList = new ElementInit[initializerlist.Count]; - for (int i = 0; i < initializerlist.Count; i++) { - initList[i] = ElementInit(addMethod, initializerlist[i]); - } - return ListInit(newExpression, new TrueReadOnlyCollection(initList)); - } - - /// - /// Creates a that uses specified objects to initialize a collection. - /// - /// A to set the property equal to. - /// An array that contains objects to use to populate the collection. - /// - /// A that has the property equal to ListInit - /// and the and properties set to the specified values. - /// - /// - /// The property of must represent a type that implements . - /// The property of the resulting is equal to newExpression.Type. - /// - public static ListInitExpression ListInit(NewExpression newExpression, params ElementInit[] initializers) { - return ListInit(newExpression, (IEnumerable)initializers); - } - - /// - /// Creates a that uses specified objects to initialize a collection. - /// - /// A to set the property equal to. - /// An that contains objects to use to populate the collection. - /// An that contains objects to use to populate the collection. - /// - /// The property of must represent a type that implements . - /// The property of the resulting is equal to newExpression.Type. - /// - public static ListInitExpression ListInit(NewExpression newExpression, IEnumerable initializers) { - ContractUtils.RequiresNotNull(newExpression, "newExpression"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - var initializerlist = initializers.ToReadOnly(); - if (initializerlist.Count == 0) { - throw Error.ListInitializerWithZeroMembers(); - } - ValidateListInitArgs(newExpression.Type, initializerlist); - return new ListInitExpression(newExpression, initializerlist); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LoopExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LoopExpression.cs deleted file mode 100644 index f9801246150..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/LoopExpression.cs +++ /dev/null @@ -1,135 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents an infinite loop. It can be exited with "break". - /// - [DebuggerTypeProxy(typeof(Expression.LoopExpressionProxy))] - public sealed class LoopExpression : Expression { - private readonly Expression _body; - private readonly LabelTarget _break; - private readonly LabelTarget _continue; - - internal LoopExpression(Expression body, LabelTarget @break, LabelTarget @continue) { - _body = body; - _break = @break; - _continue = @continue; - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _break == null ? typeof(void) : _break.Type; } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Loop; } - } - - /// - /// Gets the that is the body of the loop. - /// - public Expression Body { - get { return _body; } - } - - /// - /// Gets the that is used by the loop body as a break statement target. - /// - public LabelTarget BreakLabel { - get { return _break; } - } - - /// - /// Gets the that is used by the loop body as a continue statement target. - /// - public LabelTarget ContinueLabel { - get { return _continue; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitLoop(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public LoopExpression Update(LabelTarget breakLabel, LabelTarget continueLabel, Expression body) { - if (breakLabel == BreakLabel && continueLabel == ContinueLabel && body == Body) { - return this; - } - return Expression.Loop(body, breakLabel, continueLabel); - } - } - - public partial class Expression { - /// - /// Creates a with the given body. - /// - /// The body of the loop. - /// The created . - public static LoopExpression Loop(Expression body) { - return Loop(body, null); - } - - /// - /// Creates a with the given body and break target. - /// - /// The body of the loop. - /// The break target used by the loop body. - /// The created . - public static LoopExpression Loop(Expression body, LabelTarget @break) { - return Loop(body, @break, null); - } - - /// - /// Creates a with the given body. - /// - /// The body of the loop. - /// The break target used by the loop body. - /// The continue target used by the loop body. - /// The created . - public static LoopExpression Loop(Expression body, LabelTarget @break, LabelTarget @continue) { - RequiresCanRead(body, "body"); - if (@continue != null && @continue.Type != typeof(void)) throw Error.LabelTypeMustBeVoid(); - return new LoopExpression(body, @break, @continue); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberAssignment.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberAssignment.cs deleted file mode 100644 index b5b205444eb..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberAssignment.cs +++ /dev/null @@ -1,107 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Dynamic.Utils; -using System.Reflection; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents assignment to a member of an object. - /// - public sealed class MemberAssignment : MemberBinding { - Expression _expression; - internal MemberAssignment(MemberInfo member, Expression expression) -#pragma warning disable 618 - : base(MemberBindingType.Assignment, member) { -#pragma warning restore 618 - _expression = expression; - } - /// - /// Gets the which represents the object whose member is being assigned to. - /// - public Expression Expression { - get { return _expression; } - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public MemberAssignment Update(Expression expression) { - if (expression == Expression) { - return this; - } - return Expression.Bind(Member, expression); - } - } - - - public partial class Expression { - /// - /// Creates a binding the specified value to the given member. - /// - /// The for the member which is being assigned to. - /// The value to be assigned to . - /// The created . - public static MemberAssignment Bind(MemberInfo member, Expression expression) { - ContractUtils.RequiresNotNull(member, "member"); - RequiresCanRead(expression, "expression"); - Type memberType; - ValidateSettableFieldOrPropertyMember(member, out memberType); - if (!memberType.IsAssignableFrom(expression.Type)) { - throw Error.ArgumentTypesMustMatch(); - } - return new MemberAssignment(member, expression); - } - - /// - /// Creates a binding the specified value to the given property. - /// - /// The for the property which is being assigned to. - /// The value to be assigned to . - /// The created . - public static MemberAssignment Bind(MethodInfo propertyAccessor, Expression expression) { - ContractUtils.RequiresNotNull(propertyAccessor, "propertyAccessor"); - ContractUtils.RequiresNotNull(expression, "expression"); - ValidateMethodInfo(propertyAccessor); - return Bind(GetProperty(propertyAccessor), expression); - } - - - private static void ValidateSettableFieldOrPropertyMember(MemberInfo member, out Type memberType) { - FieldInfo fi = member as FieldInfo; - if (fi == null) { - PropertyInfo pi = member as PropertyInfo; - if (pi == null) { - throw Error.ArgumentMustBeFieldInfoOrPropertInfo(); - } - if (!pi.CanWrite) { - throw Error.PropertyDoesNotHaveSetter(pi); - } - memberType = pi.PropertyType; - } else { - memberType = fi.FieldType; - } - } - } -} \ No newline at end of file diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberBinding.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberBinding.cs deleted file mode 100644 index c9d7ed846a9..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberBinding.cs +++ /dev/null @@ -1,82 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Reflection; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Describes the binding types that are used in MemberInitExpression objects. - /// - public enum MemberBindingType { - /// - /// A binding that represents initializing a member with the value of an expression. - /// - Assignment, - /// - /// A binding that represents recursively initializing members of a member. - /// - MemberBinding, - /// - /// A binding that represents initializing a member of type or from a list of elements. - /// - ListBinding - } - - /// - /// Provides the base class from which the classes that represent bindings that are used to initialize members of a newly created object derive. - /// - public abstract class MemberBinding { - MemberBindingType _type; - MemberInfo _member; - - /// - /// Initializes an instance of class. - /// - /// The type of member binding. - /// The field or property to be initialized. - [Obsolete("Do not use this constructor. It will be removed in future releases.")] - protected MemberBinding(MemberBindingType type, MemberInfo member) { - _type = type; - _member = member; - } - - /// - /// Gets the type of binding that is represented. - /// - public MemberBindingType BindingType { - get { return _type; } - } - - /// - /// Gets the field or property to be initialized. - /// - public MemberInfo Member { - get { return _member; } - } - - /// - /// Returns a that represents the current . - /// - /// A that represents the current . - public override string ToString() { - return ExpressionStringBuilder.MemberBindingToString(this); - } - } -} \ No newline at end of file diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberExpression.cs deleted file mode 100644 index 0c06640e32c..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberExpression.cs +++ /dev/null @@ -1,362 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents accessing a field or property. - /// - [DebuggerTypeProxy(typeof(Expression.MemberExpressionProxy))] - public class MemberExpression : Expression { - private readonly Expression _expression; - - /// - /// Gets the field or property to be accessed. - /// - public MemberInfo Member { - get { return GetMember(); } - } - - /// - /// Gets the containing object of the field or property. - /// - public Expression Expression { - get { return _expression; } - } - - // param order: factories args in order, then other args - internal MemberExpression(Expression expression) { - - _expression = expression; - } - - internal static MemberExpression Make(Expression expression, MemberInfo member) { - if (member.MemberType == MemberTypes.Field) { - FieldInfo fi = (FieldInfo)member; - return new FieldExpression(expression, fi); - } else { - PropertyInfo pi = (PropertyInfo)member; - return new PropertyExpression(expression, pi); - } - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.MemberAccess; } - } - - internal virtual MemberInfo GetMember() { - throw ContractUtils.Unreachable; - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitMember(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public MemberExpression Update(Expression expression) { - if (expression == Expression) { - return this; - } - return Expression.MakeMemberAccess(expression, Member); - } - } - - internal class FieldExpression : MemberExpression { - private readonly FieldInfo _field; - - public FieldExpression(Expression expression, FieldInfo member) - : base(expression) { - _field = member; - } - - internal override MemberInfo GetMember() { - return _field; - } - - public sealed override Type Type { - get { return _field.FieldType; } - } - } - - internal class PropertyExpression : MemberExpression { - private readonly PropertyInfo _property; - public PropertyExpression(Expression expression, PropertyInfo member) - : base(expression) { - _property = member; - } - - internal override MemberInfo GetMember() { - return _property; - } - - public sealed override Type Type { - get { return _property.PropertyType; } - } - } - - public partial class Expression { - - #region Field - - /// - /// Creates a accessing a field. - /// - /// The containing object of the field. This can be null for static fields. - /// The field to be accessed. - /// The created . - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")] - public static MemberExpression Field(Expression expression, FieldInfo field) { - ContractUtils.RequiresNotNull(field, "field"); - - if (field.IsStatic) { - if (expression != null) throw new ArgumentException(Strings.OnlyStaticFieldsHaveNullInstance, "expression"); - } else { - if (expression == null) throw new ArgumentException(Strings.OnlyStaticFieldsHaveNullInstance, "field"); - RequiresCanRead(expression, "expression"); - if (!TypeUtils.AreReferenceAssignable(field.DeclaringType, expression.Type)) { - throw Error.FieldInfoNotDefinedForType(field.DeclaringType, field.Name, expression.Type); - } - } - return MemberExpression.Make(expression, field); - } - - /// - /// Creates a accessing a field. - /// - /// The containing object of the field. This can be null for static fields. - /// The field to be accessed. - /// The created . - public static MemberExpression Field(Expression expression, string fieldName) { - RequiresCanRead(expression, "expression"); - - // bind to public names first - FieldInfo fi = expression.Type.GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - if (fi == null) { - fi = expression.Type.GetField(fieldName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - } - if (fi == null) { - throw Error.InstanceFieldNotDefinedForType(fieldName, expression.Type); - } - return Expression.Field(expression, fi); - } - - - /// - /// Creates a accessing a field. - /// - /// The containing object of the field. This can be null for static fields. - /// The containing the field. - /// The field to be accessed. - /// The created . - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")] - public static MemberExpression Field(Expression expression, Type type, string fieldName) { - ContractUtils.RequiresNotNull(type, "type"); - - // bind to public names first - FieldInfo fi = type.GetField(fieldName, BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - if (fi == null) { - fi = type.GetField(fieldName, BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - } - - if (fi == null) { - throw Error.FieldNotDefinedForType(fieldName, type); - } - return Expression.Field(expression, fi); - } - #endregion - - #region Property - - /// - /// Creates a accessing a property. - /// - /// The containing object of the property. This can be null for static properties. - /// The property to be accessed. - /// The created . - public static MemberExpression Property(Expression expression, string propertyName) { - RequiresCanRead(expression, "expression"); - ContractUtils.RequiresNotNull(propertyName, "propertyName"); - // bind to public names first - PropertyInfo pi = expression.Type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - if (pi == null) { - pi = expression.Type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - } - if (pi == null) { - throw Error.InstancePropertyNotDefinedForType(propertyName, expression.Type); - } - return Property(expression, pi); - } - - /// - /// Creates a accessing a property. - /// - /// The containing object of the property. This can be null for static properties. - /// The containing the property. - /// The property to be accessed. - /// The created . - public static MemberExpression Property(Expression expression, Type type, string propertyName) { - ContractUtils.RequiresNotNull(type, "type"); - ContractUtils.RequiresNotNull(propertyName, "propertyName"); - // bind to public names first - PropertyInfo pi = type.GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - if (pi == null) { - pi = type.GetProperty(propertyName, BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - } - if (pi == null) { - throw Error.PropertyNotDefinedForType(propertyName, type); - } - return Property(expression, pi); - } - - /// - /// Creates a accessing a property. - /// - /// The containing object of the property. This can be null for static properties. - /// The property to be accessed. - /// The created . - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1719:ParameterNamesShouldNotMatchMemberNames")] - public static MemberExpression Property(Expression expression, PropertyInfo property) { - ContractUtils.RequiresNotNull(property, "property"); - - MethodInfo mi = property.GetGetMethod(true) ?? property.GetSetMethod(true); - - if (mi == null) { - throw Error.PropertyDoesNotHaveAccessor(property); - } - - if (mi.IsStatic) { - if (expression != null) throw new ArgumentException(Strings.OnlyStaticPropertiesHaveNullInstance, "expression"); - } else { - if (expression == null) throw new ArgumentException(Strings.OnlyStaticPropertiesHaveNullInstance, "property"); - RequiresCanRead(expression, "expression"); - if (!TypeUtils.IsValidInstanceType(property, expression.Type)) { - throw Error.PropertyNotDefinedForType(property, expression.Type); - } - } - return MemberExpression.Make(expression, property); - } - - /// - /// Creates a accessing a property. - /// - /// The containing object of the property. This can be null for static properties. - /// An accessor method of the property to be accessed. - /// The created . - public static MemberExpression Property(Expression expression, MethodInfo propertyAccessor) { - ContractUtils.RequiresNotNull(propertyAccessor, "propertyAccessor"); - ValidateMethodInfo(propertyAccessor); - return Property(expression, GetProperty(propertyAccessor)); - } - - private static PropertyInfo GetProperty(MethodInfo mi) { - Type type = mi.DeclaringType; - BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic; - flags |= (mi.IsStatic) ? BindingFlags.Static : BindingFlags.Instance; - PropertyInfo[] props = type.GetProperties(flags); - foreach (PropertyInfo pi in props) { - if (pi.CanRead && CheckMethod(mi, pi.GetGetMethod(true))) { - return pi; - } - if (pi.CanWrite && CheckMethod(mi, pi.GetSetMethod(true))) { - return pi; - } - } - throw Error.MethodNotPropertyAccessor(mi.DeclaringType, mi.Name); - } - - private static bool CheckMethod(MethodInfo method, MethodInfo propertyMethod) { - if (method == propertyMethod) { - return true; - } - // If the type is an interface then the handle for the method got by the compiler will not be the - // same as that returned by reflection. - // Check for this condition and try and get the method from reflection. - Type type = method.DeclaringType; - if (type.IsInterface && method.Name == propertyMethod.Name && type.GetMethod(method.Name) == propertyMethod) { - return true; - } - return false; - } - - #endregion - - /// - /// Creates a accessing a property or field. - /// - /// The containing object of the member. This can be null for static members. - /// The member to be accessed. - /// The created . - public static MemberExpression PropertyOrField(Expression expression, string propertyOrFieldName) { - RequiresCanRead(expression, "expression"); - // bind to public names first - PropertyInfo pi = expression.Type.GetProperty(propertyOrFieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - if (pi != null) - return Property(expression, pi); - FieldInfo fi = expression.Type.GetField(propertyOrFieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - if (fi != null) - return Field(expression, fi); - pi = expression.Type.GetProperty(propertyOrFieldName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - if (pi != null) - return Property(expression, pi); - fi = expression.Type.GetField(propertyOrFieldName, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); - if (fi != null) - return Field(expression, fi); - - throw Error.NotAMemberOfType(propertyOrFieldName, expression.Type); - } - - /// - /// Creates a accessing a property or field. - /// - /// The containing object of the member. This can be null for static members. - /// The member to be accessed. - /// The created . - public static MemberExpression MakeMemberAccess(Expression expression, MemberInfo member) { - ContractUtils.RequiresNotNull(member, "member"); - - FieldInfo fi = member as FieldInfo; - if (fi != null) { - return Expression.Field(expression, fi); - } - PropertyInfo pi = member as PropertyInfo; - if (pi != null) { - return Expression.Property(expression, pi); - } - throw Error.MemberNotFieldOrProperty(member); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberInitExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberInitExpression.cs deleted file mode 100644 index 04cdd20785f..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberInitExpression.cs +++ /dev/null @@ -1,178 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents calling a constructor and initializing one or more members of the new object. - /// - [DebuggerTypeProxy(typeof(Expression.MemberInitExpressionProxy))] - public sealed class MemberInitExpression : Expression { - private readonly NewExpression _newExpression; - private readonly ReadOnlyCollection _bindings; - - internal MemberInitExpression(NewExpression newExpression, ReadOnlyCollection bindings) { - _newExpression = newExpression; - _bindings = bindings; - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _newExpression.Type; } - } - - /// - /// Gets a value that indicates whether the expression tree node can be reduced. - /// - public override bool CanReduce { - get { - return true; - } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.MemberInit; } - } - - ///Gets the expression that represents the constructor call. - ///A that represents the constructor call. - public NewExpression NewExpression { - get { return _newExpression; } - } - - ///Gets the bindings that describe how to initialize the members of the newly created object. - ///A of objects which describe how to initialize the members. - public ReadOnlyCollection Bindings { - get { return _bindings; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitMemberInit(this); - } - - /// - /// Reduces the to a simpler expression. - /// If CanReduce returns true, this should return a valid expression. - /// This method is allowed to return another node which itself - /// must be reduced. - /// - /// The reduced expression. - public override Expression Reduce() { - return ReduceMemberInit(_newExpression, _bindings, true); - } - - internal static Expression ReduceMemberInit(Expression objExpression, ReadOnlyCollection bindings, bool keepOnStack) { - var objVar = Expression.Variable(objExpression.Type, null); - int count = bindings.Count; - var block = new Expression[count + 2]; - block[0] = Expression.Assign(objVar, objExpression); - for (int i = 0; i < count; i++) { - block[i + 1] = ReduceMemberBinding(objVar, bindings[i]); - } - block[count + 1] = keepOnStack ? (Expression)objVar : Expression.Empty(); - return Expression.Block(new TrueReadOnlyCollection(block)); - } - - internal static Expression ReduceListInit(Expression listExpression, ReadOnlyCollection initializers, bool keepOnStack) { - var listVar = Expression.Variable(listExpression.Type, null); - int count = initializers.Count; - var block = new Expression[count + 2]; - block[0] = Expression.Assign(listVar, listExpression); - for (int i = 0; i < count; i++) { - ElementInit element = initializers[i]; - block[i + 1] = Expression.Call(listVar, element.AddMethod, element.Arguments); - } - block[count + 1] = keepOnStack ? (Expression)listVar : Expression.Empty(); - return Expression.Block(new TrueReadOnlyCollection(block)); - } - - internal static Expression ReduceMemberBinding(ParameterExpression objVar, MemberBinding binding) { - MemberExpression member = Expression.MakeMemberAccess(objVar, binding.Member); - switch (binding.BindingType) { - case MemberBindingType.Assignment: - return Expression.Assign(member, ((MemberAssignment)binding).Expression); - case MemberBindingType.ListBinding: - return ReduceListInit(member, ((MemberListBinding)binding).Initializers, false); - case MemberBindingType.MemberBinding: - return ReduceMemberInit(member, ((MemberMemberBinding)binding).Bindings, false); - default: throw ContractUtils.Unreachable; - } - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public MemberInitExpression Update(NewExpression newExpression, IEnumerable bindings) { - if (newExpression == NewExpression && bindings == Bindings) { - return this; - } - return Expression.MemberInit(newExpression, bindings); - } - } - - public partial class Expression { - ///Creates a . - ///A that has the property equal to and the and properties set to the specified values. - ///A to set the property equal to. - ///An array of objects to use to populate the collection. - /// - /// or is null. - ///The property of an element of does not represent a member of the type that .Type represents. - public static MemberInitExpression MemberInit(NewExpression newExpression, params MemberBinding[] bindings) { - return MemberInit(newExpression, (IEnumerable)bindings); - } - - ///Creates a . - ///A that has the property equal to and the and properties set to the specified values. - ///A to set the property equal to. - ///An that contains objects to use to populate the collection. - /// - /// or is null. - ///The property of an element of does not represent a member of the type that .Type represents. - public static MemberInitExpression MemberInit(NewExpression newExpression, IEnumerable bindings) { - ContractUtils.RequiresNotNull(newExpression, "newExpression"); - ContractUtils.RequiresNotNull(bindings, "bindings"); - var roBindings = bindings.ToReadOnly(); - ValidateMemberInitArgs(newExpression.Type, roBindings); - return new MemberInitExpression(newExpression, roBindings); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberListBinding.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberListBinding.cs deleted file mode 100644 index 52774f06e4d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberListBinding.cs +++ /dev/null @@ -1,137 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Dynamic.Utils; -using System.Reflection; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents initializing the elements of a collection member of a newly created object. - /// - public sealed class MemberListBinding : MemberBinding { - ReadOnlyCollection _initializers; - internal MemberListBinding(MemberInfo member, ReadOnlyCollection initializers) -#pragma warning disable 618 - : base(MemberBindingType.ListBinding, member) { -#pragma warning restore 618 - _initializers = initializers; - } - - /// - /// Gets the element initializers for initializing a collection member of a newly created object. - /// - public ReadOnlyCollection Initializers { - get { return _initializers; } - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public MemberListBinding Update(IEnumerable initializers) { - if (initializers == Initializers) { - return this; - } - return Expression.ListBind(Member, initializers); - } - } - - - public partial class Expression { - - ///Creates a where the member is a field or property. - ///A that has the property equal to and the and properties set to the specified values. - ///A that represents a field or property to set the property equal to. - ///An array of objects to use to populate the collection. - /// - /// is null. -or-One or more elements of is null. - /// - /// does not represent a field or property.-or-The or of the field or property that represents does not implement . - public static MemberListBinding ListBind(MemberInfo member, params ElementInit[] initializers) { - ContractUtils.RequiresNotNull(member, "member"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - return ListBind(member, (IEnumerable)initializers); - } - - ///Creates a where the member is a field or property. - ///A that has the property equal to and the and properties set to the specified values. - ///A that represents a field or property to set the property equal to. - ///An that contains objects to use to populate the collection. - /// - /// is null. -or-One or more elements of is null. - /// - /// does not represent a field or property.-or-The or of the field or property that represents does not implement . - public static MemberListBinding ListBind(MemberInfo member, IEnumerable initializers) { - ContractUtils.RequiresNotNull(member, "member"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - Type memberType; - ValidateGettableFieldOrPropertyMember(member, out memberType); - var initList = initializers.ToReadOnly(); - ValidateListInitArgs(memberType, initList); - return new MemberListBinding(member, initList); - } - - ///Creates a object based on a specified property accessor method. - ///A that has the property equal to , the property set to the that represents the property accessed in , and populated with the elements of . - ///A that represents a property accessor method. - ///An array of objects to use to populate the collection. - /// - /// is null. -or-One or more elements of is null. - /// - /// does not represent a property accessor method.-or-The of the property that the method represented by accesses does not implement . - public static MemberListBinding ListBind(MethodInfo propertyAccessor, params ElementInit[] initializers) { - ContractUtils.RequiresNotNull(propertyAccessor, "propertyAccessor"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - return ListBind(propertyAccessor, (IEnumerable)initializers); - } - - ///Creates a based on a specified property accessor method. - ///A that has the property equal to , the property set to the that represents the property accessed in , and populated with the elements of . - ///A that represents a property accessor method. - ///An that contains objects to use to populate the collection. - /// - /// is null. -or-One or more elements of are null. - /// - /// does not represent a property accessor method.-or-The of the property that the method represented by accesses does not implement . - public static MemberListBinding ListBind(MethodInfo propertyAccessor, IEnumerable initializers) { - ContractUtils.RequiresNotNull(propertyAccessor, "propertyAccessor"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - return ListBind(GetProperty(propertyAccessor), initializers); - } - - private static void ValidateListInitArgs(Type listType, ReadOnlyCollection initializers) { - if (!typeof(IEnumerable).IsAssignableFrom(listType)) { - throw Error.TypeNotIEnumerable(listType); - } - for (int i = 0, n = initializers.Count; i < n; i++) { - ElementInit element = initializers[i]; - ContractUtils.RequiresNotNull(element, "initializers"); - ValidateCallInstanceType(listType, element.AddMethod); - } - } - } -} \ No newline at end of file diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberMemberBinding.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberMemberBinding.cs deleted file mode 100644 index 6a54633c933..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MemberMemberBinding.cs +++ /dev/null @@ -1,151 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Dynamic.Utils; -using System.Reflection; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents initializing members of a member of a newly created object. - /// - /// - /// Use the factory methods to create a . - /// The value of the property of a object is . - /// - public sealed class MemberMemberBinding : MemberBinding { - ReadOnlyCollection _bindings; - internal MemberMemberBinding(MemberInfo member, ReadOnlyCollection bindings) -#pragma warning disable 618 - : base(MemberBindingType.MemberBinding, member) { -#pragma warning restore 618 - _bindings = bindings; - } - - /// - /// Gets the bindings that describe how to initialize the members of a member. - /// - public ReadOnlyCollection Bindings { - get { return _bindings; } - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public MemberMemberBinding Update(IEnumerable bindings) { - if (bindings == Bindings) { - return this; - } - return Expression.MemberBind(Member, bindings); - } - } - - - public partial class Expression { - /// - /// Creates a that represents the recursive initialization of members of a field or property. - /// - /// The to set the property equal to. - /// An array of objects to use to populate the collection. - /// A that has the property equal to and the and properties set to the specified values. - public static MemberMemberBinding MemberBind(MemberInfo member, params MemberBinding[] bindings) { - ContractUtils.RequiresNotNull(member, "member"); - ContractUtils.RequiresNotNull(bindings, "bindings"); - return MemberBind(member, (IEnumerable)bindings); - } - - /// - /// Creates a that represents the recursive initialization of members of a field or property. - /// - /// The to set the property equal to. - /// An that contains objects to use to populate the collection. - /// A that has the property equal to and the and properties set to the specified values. - public static MemberMemberBinding MemberBind(MemberInfo member, IEnumerable bindings) { - ContractUtils.RequiresNotNull(member, "member"); - ContractUtils.RequiresNotNull(bindings, "bindings"); - ReadOnlyCollection roBindings = bindings.ToReadOnly(); - Type memberType; - ValidateGettableFieldOrPropertyMember(member, out memberType); - ValidateMemberInitArgs(memberType, roBindings); - return new MemberMemberBinding(member, roBindings); - } - - /// - /// Creates a that represents the recursive initialization of members of a member that is accessed by using a property accessor method. - /// - /// The that represents a property accessor method. - /// An that contains objects to use to populate the collection. - /// - /// A that has the property equal to , - /// the Member property set to the that represents the property accessed in , - /// and properties set to the specified values. - /// - public static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, params MemberBinding[] bindings) { - ContractUtils.RequiresNotNull(propertyAccessor, "propertyAccessor"); - return MemberBind(GetProperty(propertyAccessor), bindings); - } - - /// - /// Creates a that represents the recursive initialization of members of a member that is accessed by using a property accessor method. - /// - /// The that represents a property accessor method. - /// An that contains objects to use to populate the collection. - /// - /// A that has the property equal to , - /// the Member property set to the that represents the property accessed in , - /// and properties set to the specified values. - /// - public static MemberMemberBinding MemberBind(MethodInfo propertyAccessor, IEnumerable bindings) { - ContractUtils.RequiresNotNull(propertyAccessor, "propertyAccessor"); - return MemberBind(GetProperty(propertyAccessor), bindings); - } - - private static void ValidateGettableFieldOrPropertyMember(MemberInfo member, out Type memberType) { - FieldInfo fi = member as FieldInfo; - if (fi == null) { - PropertyInfo pi = member as PropertyInfo; - if (pi == null) { - throw Error.ArgumentMustBeFieldInfoOrPropertInfo(); - } - if (!pi.CanRead) { - throw Error.PropertyDoesNotHaveGetter(pi); - } - memberType = pi.PropertyType; - } else { - memberType = fi.FieldType; - } - } - - private static void ValidateMemberInitArgs(Type type, ReadOnlyCollection bindings) { - for (int i = 0, n = bindings.Count; i < n; i++) { - MemberBinding b = bindings[i]; - ContractUtils.RequiresNotNull(b, "bindings"); - if (!b.Member.DeclaringType.IsAssignableFrom(type)) { - throw Error.NotAMemberOfType(b.Member.Name, type); - } - } - } - } -} \ No newline at end of file diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MethodCallExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MethodCallExpression.cs deleted file mode 100644 index 1656811de99..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/MethodCallExpression.cs +++ /dev/null @@ -1,1041 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents a call to either static or an instance method. - /// - [DebuggerTypeProxy(typeof(Expression.MethodCallExpressionProxy))] - public class MethodCallExpression : Expression, IArgumentProvider { - private readonly MethodInfo _method; - - internal MethodCallExpression(MethodInfo method) { - - _method = method; - } - - internal virtual Expression GetInstance() { - return null; - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Call; } - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _method.ReturnType; } - } - - /// - /// Gets the for the method to be called. - /// - public MethodInfo Method { - get { return _method; } - } - - /// - /// Gets the that represents the instance - /// for instance method calls or null for static method cals. - /// - public Expression Object { - get { return GetInstance(); } - } - - /// - /// Gets a collection of expressions that represent arguments to the method call. - /// - public ReadOnlyCollection Arguments { - get { return GetOrMakeArguments(); } - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public MethodCallExpression Update(Expression @object, IEnumerable arguments) { - if (@object == Object && arguments == Arguments) { - return this; - } - return Expression.Call(@object, Method, arguments); - } - - internal virtual ReadOnlyCollection GetOrMakeArguments() { - throw ContractUtils.Unreachable; - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitMethodCall(this); - } - - /// - /// Returns a new MethodCallExpression replacing the existing instance/args with the - /// newly provided instance and args. Arguments can be null to use the existing - /// arguments. - /// - /// This helper is provided to allow re-writing of nodes to not depend on the specific optimized - /// subclass of MethodCallExpression which is being used. - /// - internal virtual MethodCallExpression Rewrite(Expression instance, IList args) { - throw ContractUtils.Unreachable; - } - - #region IArgumentProvider Members - - Expression IArgumentProvider.GetArgument(int index) { - throw ContractUtils.Unreachable; - } - - int IArgumentProvider.ArgumentCount { - get { throw ContractUtils.Unreachable; } - } - - #endregion - } - - #region Specialized Subclasses - - internal class MethodCallExpressionN : MethodCallExpression, IArgumentProvider { - private IList _arguments; - - public MethodCallExpressionN(MethodInfo method, IList args) - : base(method) { - _arguments = args; - } - - Expression IArgumentProvider.GetArgument(int index) { - return _arguments[index]; - } - - int IArgumentProvider.ArgumentCount { - get { - return _arguments.Count; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(ref _arguments); - } - - internal override MethodCallExpression Rewrite(Expression instance, IList args) { - Debug.Assert(instance == null); - Debug.Assert(args == null || args.Count == _arguments.Count); - - return Expression.Call(Method, args ?? _arguments); - } - } - - internal class InstanceMethodCallExpressionN : MethodCallExpression, IArgumentProvider { - private IList _arguments; - private readonly Expression _instance; - - public InstanceMethodCallExpressionN(MethodInfo method, Expression instance, IList args) - : base(method) { - _instance = instance; - _arguments = args; - } - - Expression IArgumentProvider.GetArgument(int index) { - return _arguments[index]; - } - - int IArgumentProvider.ArgumentCount { - get { - return _arguments.Count; - } - } - - internal override Expression GetInstance() { - return _instance; - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(ref _arguments); - } - - internal override MethodCallExpression Rewrite(Expression instance, IList args) { - Debug.Assert(instance != null); - Debug.Assert(args == null || args.Count == _arguments.Count); - - return Expression.Call(instance, Method, args ?? _arguments); - } - } - - internal class MethodCallExpression1 : MethodCallExpression, IArgumentProvider { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - - public MethodCallExpression1(MethodInfo method, Expression arg0) - : base(method) { - _arg0 = arg0; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 1; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override MethodCallExpression Rewrite(Expression instance, IList args) { - Debug.Assert(instance == null); - Debug.Assert(args == null || args.Count == 1); - - if (args != null) { - return Expression.Call(Method, args[0]); - } - - return Expression.Call(Method, ReturnObject(_arg0)); - } - } - - internal class MethodCallExpression2 : MethodCallExpression, IArgumentProvider { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1; // storage for the 2nd arg - - public MethodCallExpression2(MethodInfo method, Expression arg0, Expression arg1) - : base(method) { - _arg0 = arg0; - _arg1 = arg1; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 2; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override MethodCallExpression Rewrite(Expression instance, IList args) { - Debug.Assert(instance == null); - Debug.Assert(args == null || args.Count == 2); - - if (args != null) { - return Expression.Call(Method, args[0], args[1]); - } - return Expression.Call(Method, ReturnObject(_arg0), _arg1); - } - } - - internal class MethodCallExpression3 : MethodCallExpression, IArgumentProvider { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1, _arg2; // storage for the 2nd - 3rd args. - - public MethodCallExpression3(MethodInfo method, Expression arg0, Expression arg1, Expression arg2) - : base(method) { - _arg0 = arg0; - _arg1 = arg1; - _arg2 = arg2; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - case 2: return _arg2; - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 3; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override MethodCallExpression Rewrite(Expression instance, IList args) { - Debug.Assert(instance == null); - Debug.Assert(args == null || args.Count == 3); - - if (args != null) { - return Expression.Call(Method, args[0], args[1], args[2]); - } - return Expression.Call(Method, ReturnObject(_arg0), _arg1, _arg2); - } - } - - internal class MethodCallExpression4 : MethodCallExpression, IArgumentProvider { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1, _arg2, _arg3; // storage for the 2nd - 4th args. - - public MethodCallExpression4(MethodInfo method, Expression arg0, Expression arg1, Expression arg2, Expression arg3) - : base(method) { - _arg0 = arg0; - _arg1 = arg1; - _arg2 = arg2; - _arg3 = arg3; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - case 2: return _arg2; - case 3: return _arg3; - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 4; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override MethodCallExpression Rewrite(Expression instance, IList args) { - Debug.Assert(instance == null); - Debug.Assert(args == null || args.Count == 4); - - if (args != null) { - return Expression.Call(Method, args[0], args[1], args[2], args[3]); - } - return Expression.Call(Method, ReturnObject(_arg0), _arg1, _arg2, _arg3); - } - } - - internal class MethodCallExpression5 : MethodCallExpression, IArgumentProvider { - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1, _arg2, _arg3, _arg4; // storage for the 2nd - 5th args. - - public MethodCallExpression5(MethodInfo method, Expression arg0, Expression arg1, Expression arg2, Expression arg3, Expression arg4) - : base(method) { - _arg0 = arg0; - _arg1 = arg1; - _arg2 = arg2; - _arg3 = arg3; - _arg4 = arg4; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - case 2: return _arg2; - case 3: return _arg3; - case 4: return _arg4; - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 5; - } - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override MethodCallExpression Rewrite(Expression instance, IList args) { - Debug.Assert(instance == null); - Debug.Assert(args == null || args.Count == 5); - - if (args != null) { - return Expression.Call(Method, args[0], args[1], args[2], args[3], args[4]); - } - - return Expression.Call(Method, ReturnObject(_arg0), _arg1, _arg2, _arg3, _arg4); - } - } - - internal class InstanceMethodCallExpression2 : MethodCallExpression, IArgumentProvider { - private readonly Expression _instance; - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1; // storage for the 2nd argument - - public InstanceMethodCallExpression2(MethodInfo method, Expression instance, Expression arg0, Expression arg1) - : base(method) { - Debug.Assert(instance != null); - - _instance = instance; - _arg0 = arg0; - _arg1 = arg1; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 2; - } - } - - internal override Expression GetInstance() { - return _instance; - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override MethodCallExpression Rewrite(Expression instance, IList args) { - Debug.Assert(instance != null); - Debug.Assert(args == null || args.Count == 2); - - if (args != null) { - return Expression.Call(instance, Method, args[0], args[1]); - } - return Expression.Call(instance, Method, ReturnObject(_arg0), _arg1); - } - } - - internal class InstanceMethodCallExpression3 : MethodCallExpression, IArgumentProvider { - private readonly Expression _instance; - private object _arg0; // storage for the 1st argument or a readonly collection. See IArgumentProvider - private readonly Expression _arg1, _arg2; // storage for the 2nd - 3rd argument - - public InstanceMethodCallExpression3(MethodInfo method, Expression instance, Expression arg0, Expression arg1, Expression arg2) - : base(method) { - Debug.Assert(instance != null); - - _instance = instance; - _arg0 = arg0; - _arg1 = arg1; - _arg2 = arg2; - } - - Expression IArgumentProvider.GetArgument(int index) { - switch (index) { - case 0: return ReturnObject(_arg0); - case 1: return _arg1; - case 2: return _arg2; - default: throw new InvalidOperationException(); - } - } - - int IArgumentProvider.ArgumentCount { - get { - return 3; - } - } - - internal override Expression GetInstance() { - return _instance; - } - - internal override ReadOnlyCollection GetOrMakeArguments() { - return ReturnReadOnly(this, ref _arg0); - } - - internal override MethodCallExpression Rewrite(Expression instance, IList args) { - Debug.Assert(instance != null); - Debug.Assert(args == null || args.Count == 3); - - if (args != null) { - return Expression.Call(instance, Method, args[0], args[1], args[2]); - } - return Expression.Call(instance, Method, ReturnObject(_arg0), _arg1, _arg2); - } - } - - #endregion - - public partial class Expression { - - #region Call - - ///Creates a that represents a call to a static method that takes one argument. - ///A that has the property equal to and the and properties set to the specified values. - ///A to set the property equal to. - ///The that represents the first argument. - /// - /// is null. - public static MethodCallExpression Call(MethodInfo method, Expression arg0) { - ContractUtils.RequiresNotNull(method, "method"); - ContractUtils.RequiresNotNull(arg0, "arg0"); - - ParameterInfo[] pis = ValidateMethodAndGetParameters(null, method); - - ValidateArgumentCount(method, ExpressionType.Call, 1, pis); - - arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]); - - return new MethodCallExpression1(method, arg0); - } - - ///Creates a that represents a call to a static method that takes two arguments. - ///A that has the property equal to and the and properties set to the specified values. - ///A to set the property equal to. - ///The that represents the first argument. - ///The that represents the second argument. - /// - /// is null. - public static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1) { - ContractUtils.RequiresNotNull(method, "method"); - ContractUtils.RequiresNotNull(arg0, "arg0"); - ContractUtils.RequiresNotNull(arg1, "arg1"); - - ParameterInfo[] pis = ValidateMethodAndGetParameters(null, method); - - ValidateArgumentCount(method, ExpressionType.Call, 2, pis); - - arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]); - arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]); - - return new MethodCallExpression2(method, arg0, arg1); - } - - ///Creates a that represents a call to a static method that takes three arguments. - ///A that has the property equal to and the and properties set to the specified values. - ///A to set the property equal to. - ///The that represents the first argument. - ///The that represents the second argument. - ///The that represents the third argument. - /// - /// is null. - public static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1, Expression arg2) { - ContractUtils.RequiresNotNull(method, "method"); - ContractUtils.RequiresNotNull(arg0, "arg0"); - ContractUtils.RequiresNotNull(arg1, "arg1"); - ContractUtils.RequiresNotNull(arg2, "arg2"); - - ParameterInfo[] pis = ValidateMethodAndGetParameters(null, method); - - ValidateArgumentCount(method, ExpressionType.Call, 3, pis); - - arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]); - arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]); - arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2]); - - return new MethodCallExpression3(method, arg0, arg1, arg2); - } - - ///Creates a that represents a call to a static method that takes four arguments. - ///A that has the property equal to and the and properties set to the specified values. - ///A to set the property equal to. - ///The that represents the first argument. - ///The that represents the second argument. - ///The that represents the third argument. - ///The that represents the fourth argument. - /// - /// is null. - public static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1, Expression arg2, Expression arg3) { - ContractUtils.RequiresNotNull(method, "method"); - ContractUtils.RequiresNotNull(arg0, "arg0"); - ContractUtils.RequiresNotNull(arg1, "arg1"); - ContractUtils.RequiresNotNull(arg2, "arg2"); - ContractUtils.RequiresNotNull(arg3, "arg3"); - - ParameterInfo[] pis = ValidateMethodAndGetParameters(null, method); - - ValidateArgumentCount(method, ExpressionType.Call, 4, pis); - - arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]); - arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]); - arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2]); - arg3 = ValidateOneArgument(method, ExpressionType.Call, arg3, pis[3]); - - return new MethodCallExpression4(method, arg0, arg1, arg2, arg3); - } - - ///Creates a that represents a call to a static method that takes five arguments. - ///A that has the property equal to and the and properties set to the specified values. - ///A to set the property equal to. - ///The that represents the first argument. - ///The that represents the second argument. - ///The that represents the third argument. - ///The that represents the fourth argument. - ///The that represents the fifth argument. - /// - /// is null. - ///A that has the property equal to and the and properties set to the specified values. - public static MethodCallExpression Call(MethodInfo method, Expression arg0, Expression arg1, Expression arg2, Expression arg3, Expression arg4) { - ContractUtils.RequiresNotNull(method, "method"); - ContractUtils.RequiresNotNull(arg0, "arg0"); - ContractUtils.RequiresNotNull(arg1, "arg1"); - ContractUtils.RequiresNotNull(arg2, "arg2"); - ContractUtils.RequiresNotNull(arg3, "arg3"); - ContractUtils.RequiresNotNull(arg4, "arg4"); - - ParameterInfo[] pis = ValidateMethodAndGetParameters(null, method); - - ValidateArgumentCount(method, ExpressionType.Call, 5, pis); - - arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]); - arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]); - arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2]); - arg3 = ValidateOneArgument(method, ExpressionType.Call, arg3, pis[3]); - arg4 = ValidateOneArgument(method, ExpressionType.Call, arg4, pis[4]); - - return new MethodCallExpression5(method, arg0, arg1, arg2, arg3, arg4); - } - - /// - /// Creates a that represents a call to a static (Shared in Visual Basic) method. - /// - /// The that represents the target method. - /// The array of one or more of that represents the call arguments. - ///A that has the property equal to and the and properties set to the specified values. - public static MethodCallExpression Call(MethodInfo method, params Expression[] arguments) { - return Call(null, method, arguments); - } - - /// - /// Creates a that represents a call to a static (Shared in Visual Basic) method. - /// - /// The that represents the target method. - /// A collection of that represents the call arguments. - ///A that has the property equal to and the and properties set to the specified values. - public static MethodCallExpression Call(MethodInfo method, IEnumerable arguments) { - return Call(null, method, arguments); - } - - /// - /// Creates a that represents a call to a method that takes no arguments. - /// - /// An that specifies the instance for an instance call. (pass null for a static (Shared in Visual Basic) method). - /// The that represents the target method. - ///A that has the property equal to and the and properties set to the specified values. - public static MethodCallExpression Call(Expression instance, MethodInfo method) { - return Call(instance, method, EmptyReadOnlyCollection.Instance); - } - - /// - /// Creates a that represents a method call. - /// - /// An that specifies the instance for an instance call. (pass null for a static (Shared in Visual Basic) method). - /// The that represents the target method. - /// An array of one or more of that represents the call arguments. - ///A that has the property equal to and the and properties set to the specified values. - public static MethodCallExpression Call(Expression instance, MethodInfo method, params Expression[] arguments) { - return Call(instance, method, (IEnumerable)arguments); - } - - /// - /// Creates a that represents a call to a method that takes two arguments. - /// - /// An that specifies the instance for an instance call. (pass null for a static (Shared in Visual Basic) method). - /// The that represents the target method. - /// The that represents the first argument. - /// The that represents the second argument. - ///A that has the property equal to and the and properties set to the specified values. - public static MethodCallExpression Call(Expression instance, MethodInfo method, Expression arg0, Expression arg1) { - ContractUtils.RequiresNotNull(method, "method"); - ContractUtils.RequiresNotNull(arg0, "arg0"); - ContractUtils.RequiresNotNull(arg1, "arg1"); - - ParameterInfo[] pis = ValidateMethodAndGetParameters(instance, method); - - ValidateArgumentCount(method, ExpressionType.Call, 2, pis); - - arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]); - arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]); - - if (instance != null) { - return new InstanceMethodCallExpression2(method, instance, arg0, arg1); - } - - return new MethodCallExpression2(method, arg0, arg1); - } - - /// - /// Creates a that represents a call to a method that takes three arguments. - /// - /// An that specifies the instance for an instance call. (pass null for a static (Shared in Visual Basic) method). - /// The that represents the target method. - /// The that represents the first argument. - /// The that represents the second argument. - /// The that represents the third argument. - ///A that has the property equal to and the and properties set to the specified values. - public static MethodCallExpression Call(Expression instance, MethodInfo method, Expression arg0, Expression arg1, Expression arg2) { - ContractUtils.RequiresNotNull(method, "method"); - ContractUtils.RequiresNotNull(arg0, "arg0"); - ContractUtils.RequiresNotNull(arg1, "arg1"); - ContractUtils.RequiresNotNull(arg2, "arg2"); - - ParameterInfo[] pis = ValidateMethodAndGetParameters(instance, method); - - ValidateArgumentCount(method, ExpressionType.Call, 3, pis); - - arg0 = ValidateOneArgument(method, ExpressionType.Call, arg0, pis[0]); - arg1 = ValidateOneArgument(method, ExpressionType.Call, arg1, pis[1]); - arg2 = ValidateOneArgument(method, ExpressionType.Call, arg2, pis[2]); - - if (instance != null) { - return new InstanceMethodCallExpression3(method, instance, arg0, arg1, arg2); - } - return new MethodCallExpression3(method, arg0, arg1, arg2); - } - - ///Creates a that represents a call to an instance method by calling the appropriate factory method. - ///A that has the property equal to , the property equal to , set to the that represents the specified instance method, and set to the specified arguments. - ///An whose property value will be searched for a specific method. - ///The name of the method. - /// - ///An array of objects that specify the type parameters of the generic method. - ///This argument should be null when specifies a non-generic method. - /// - ///An array of objects that represents the arguments to the method. - /// - /// or is null. - ///No method whose name is , whose type parameters match , and whose parameter types match is found in .Type or its base types.-or-More than one method whose name is , whose type parameters match , and whose parameter types match is found in .Type or its base types. - public static MethodCallExpression Call(Expression instance, string methodName, Type[] typeArguments, params Expression[] arguments) { - ContractUtils.RequiresNotNull(instance, "instance"); - ContractUtils.RequiresNotNull(methodName, "methodName"); - if (arguments == null) { - arguments = new Expression[0]; - } - - BindingFlags flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; - return Expression.Call(instance, FindMethod(instance.Type, methodName, typeArguments, arguments, flags), arguments); - } - - ///Creates a that represents a call to a static (Shared in Visual Basic) method by calling the appropriate factory method. - ///A that has the property equal to , the property set to the that represents the specified static (Shared in Visual Basic) method, and the property set to the specified arguments. - ///The that specifies the type that contains the specified static (Shared in Visual Basic) method. - ///The name of the method. - /// - ///An array of objects that specify the type parameters of the generic method. - ///This argument should be null when specifies a non-generic method. - /// - ///An array of objects that represent the arguments to the method. - /// - /// or is null. - ///No method whose name is , whose type parameters match , and whose parameter types match is found in or its base types.-or-More than one method whose name is , whose type parameters match , and whose parameter types match is found in or its base types. - public static MethodCallExpression Call(Type type, string methodName, Type[] typeArguments, params Expression[] arguments) { - ContractUtils.RequiresNotNull(type, "type"); - ContractUtils.RequiresNotNull(methodName, "methodName"); - - if (arguments == null) arguments = new Expression[] { }; - BindingFlags flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy; - return Expression.Call(null, FindMethod(type, methodName, typeArguments, arguments, flags), arguments); - } - - ///Creates a that represents a method call. - ///A that has the property equal to and the , , and properties set to the specified values. - ///An to set the property equal to (pass null for a static (Shared in Visual Basic) method). - ///A to set the property equal to. - ///An that contains objects to use to populate the collection. - /// - /// is null.-or- is null and represents an instance method. - /// - ///.Type is not assignable to the declaring type of the method represented by .-or-The number of elements in does not equal the number of parameters for the method represented by .-or-One or more of the elements of is not assignable to the corresponding parameter for the method represented by . - public static MethodCallExpression Call(Expression instance, MethodInfo method, IEnumerable arguments) { - ContractUtils.RequiresNotNull(method, "method"); - - ReadOnlyCollection argList = arguments.ToReadOnly(); - - ValidateMethodInfo(method); - ValidateStaticOrInstanceMethod(instance, method); - ValidateArgumentTypes(method, ExpressionType.Call, ref argList); - - if (instance == null) { - return new MethodCallExpressionN(method, argList); - } else { - return new InstanceMethodCallExpressionN(method, instance, argList); - } - } - - private static ParameterInfo[] ValidateMethodAndGetParameters(Expression instance, MethodInfo method) { - ValidateMethodInfo(method); - ValidateStaticOrInstanceMethod(instance, method); - - return GetParametersForValidation(method, ExpressionType.Call); - } - - private static void ValidateStaticOrInstanceMethod(Expression instance, MethodInfo method) { - if (method.IsStatic) { - if (instance != null) throw new ArgumentException(Strings.OnlyStaticMethodsHaveNullInstance, "instance"); - } else { - if (instance == null) throw new ArgumentException(Strings.OnlyStaticMethodsHaveNullInstance, "method"); - RequiresCanRead(instance, "instance"); - ValidateCallInstanceType(instance.Type, method); - } - } - - private static void ValidateCallInstanceType(Type instanceType, MethodInfo method) { - if (!TypeUtils.IsValidInstanceType(method, instanceType)) { - throw Error.InstanceAndMethodTypeMismatch(method, method.DeclaringType, instanceType); - } - } - - private static void ValidateArgumentTypes(MethodBase method, ExpressionType nodeKind, ref ReadOnlyCollection arguments) { - Debug.Assert(nodeKind == ExpressionType.Invoke || nodeKind == ExpressionType.Call || nodeKind == ExpressionType.Dynamic || nodeKind == ExpressionType.New); - - ParameterInfo[] pis = GetParametersForValidation(method, nodeKind); - - ValidateArgumentCount(method, nodeKind, arguments.Count, pis); - - Expression[] newArgs = null; - for (int i = 0, n = pis.Length; i < n; i++) { - Expression arg = arguments[i]; - ParameterInfo pi = pis[i]; - arg = ValidateOneArgument(method, nodeKind, arg, pi); - - if (newArgs == null && arg != arguments[i]) { - newArgs = new Expression[arguments.Count]; - for (int j = 0; j < i; j++) { - newArgs[j] = arguments[j]; - } - } - if (newArgs != null) { - newArgs[i] = arg; - } - } - if (newArgs != null) { - arguments = new TrueReadOnlyCollection(newArgs); - } - } - - private static ParameterInfo[] GetParametersForValidation(MethodBase method, ExpressionType nodeKind) { - ParameterInfo[] pis = method.GetParametersCached(); - - if (nodeKind == ExpressionType.Dynamic) { - pis = pis.RemoveFirst(); // ignore CallSite argument - } - return pis; - } - - private static void ValidateArgumentCount(MethodBase method, ExpressionType nodeKind, int count, ParameterInfo[] pis) { - if (pis.Length != count) { - // Throw the right error for the node we were given - switch (nodeKind) { - case ExpressionType.New: - throw Error.IncorrectNumberOfConstructorArguments(); - case ExpressionType.Invoke: - throw Error.IncorrectNumberOfLambdaArguments(); - case ExpressionType.Dynamic: - case ExpressionType.Call: - throw Error.IncorrectNumberOfMethodCallArguments(method); - default: - throw ContractUtils.Unreachable; - } - } - } - - private static Expression ValidateOneArgument(MethodBase method, ExpressionType nodeKind, Expression arg, ParameterInfo pi) { - RequiresCanRead(arg, "arguments"); - Type pType = pi.ParameterType; - if (pType.IsByRef) { - pType = pType.GetElementType(); - } - TypeUtils.ValidateType(pType); - if (!TypeUtils.AreReferenceAssignable(pType, arg.Type)) { - if (!TryQuote(pType, ref arg)) { - // Throw the right error for the node we were given - switch (nodeKind) { - case ExpressionType.New: - throw Error.ExpressionTypeDoesNotMatchConstructorParameter(arg.Type, pType); - case ExpressionType.Invoke: - throw Error.ExpressionTypeDoesNotMatchParameter(arg.Type, pType); - case ExpressionType.Dynamic: - case ExpressionType.Call: - throw Error.ExpressionTypeDoesNotMatchMethodParameter(arg.Type, pType, method); - default: - throw ContractUtils.Unreachable; - } - } - } - return arg; - } - - // Attempts to auto-quote the expression tree. Returns true if it succeeded, false otherwise. - private static bool TryQuote(Type parameterType, ref Expression argument) { - // We used to allow quoting of any expression, but the behavior of - // quote (produce a new tree closed over parameter values), only - // works consistently for lambdas - Type quoteable = typeof(LambdaExpression); - if (TypeUtils.IsSameOrSubclass(quoteable, parameterType) && - parameterType.IsAssignableFrom(argument.GetType())) { - argument = Expression.Quote(argument); - return true; - } - return false; - } - - private static MethodInfo FindMethod(Type type, string methodName, Type[] typeArgs, Expression[] args, BindingFlags flags) { - MemberInfo[] members = type.FindMembers(MemberTypes.Method, flags, Type.FilterNameIgnoreCase, methodName); - if (members == null || members.Length == 0) - throw Error.MethodDoesNotExistOnType(methodName, type); - - MethodInfo method; - - var methodInfos = members.Map(t => (MethodInfo)t); - int count = FindBestMethod(methodInfos, typeArgs, args, out method); - - if (count == 0) { - if (typeArgs != null && typeArgs.Length > 0) { - throw Error.GenericMethodWithArgsDoesNotExistOnType(methodName, type); - } else { - throw Error.MethodWithArgsDoesNotExistOnType(methodName, type); - } - } - if (count > 1) - throw Error.MethodWithMoreThanOneMatch(methodName, type); - return method; - } - - private static int FindBestMethod(IEnumerable methods, Type[] typeArgs, Expression[] args, out MethodInfo method) { - int count = 0; - method = null; - foreach (MethodInfo mi in methods) { - MethodInfo moo = ApplyTypeArgs(mi, typeArgs); - if (moo != null && IsCompatible(moo, args)) { - // favor public over non-public methods - if (method == null || (!method.IsPublic && moo.IsPublic)) { - method = moo; - count = 1; - } - // only count it as additional method if they both public or both non-public - else if (method.IsPublic == moo.IsPublic) { - count++; - } - } - } - return count; - } - - private static bool IsCompatible(MethodBase m, Expression[] args) { - ParameterInfo[] parms = m.GetParametersCached(); - if (parms.Length != args.Length) - return false; - for (int i = 0; i < args.Length; i++) { - Expression arg = args[i]; - ContractUtils.RequiresNotNull(arg, "argument"); - Type argType = arg.Type; - Type pType = parms[i].ParameterType; - if (pType.IsByRef) { - pType = pType.GetElementType(); - } - if (!TypeUtils.AreReferenceAssignable(pType, argType) && - !(TypeUtils.IsSameOrSubclass(typeof(LambdaExpression), pType) && pType.IsAssignableFrom(arg.GetType()))) { - return false; - } - } - return true; - } - - private static MethodInfo ApplyTypeArgs(MethodInfo m, Type[] typeArgs) { - if (typeArgs == null || typeArgs.Length == 0) { - if (!m.IsGenericMethodDefinition) - return m; - } else { - if (m.IsGenericMethodDefinition && m.GetGenericArguments().Length == typeArgs.Length) - return m.MakeGenericMethod(typeArgs); - } - return null; - } - - - #endregion - - #region ArrayIndex - - ///Creates a that represents applying an array index operator to a multi-dimensional array. - ///A that has the property equal to and the and properties set to the specified values. - ///An array of instances - indexes for the array index operation. - ///An array that contains objects to use to populate the collection. - public static MethodCallExpression ArrayIndex(Expression array, params Expression[] indexes) { - return ArrayIndex(array, (IEnumerable)indexes); - } - - ///Creates a that represents applying an array index operator to an array of rank more than one. - ///A that has the property equal to and the and properties set to the specified values. - ///An to set the property equal to. - ///An that contains objects to use to populate the collection. - /// - /// or is null. - /// - ///.Type does not represent an array type.-or-The rank of .Type does not match the number of elements in .-or-The property of one or more elements of does not represent the type. - public static MethodCallExpression ArrayIndex(Expression array, IEnumerable indexes) { - RequiresCanRead(array, "array"); - ContractUtils.RequiresNotNull(indexes, "indexes"); - - Type arrayType = array.Type; - if (!arrayType.IsArray) { - throw Error.ArgumentMustBeArray(); - } - - ReadOnlyCollection indexList = indexes.ToReadOnly(); - if (arrayType.GetArrayRank() != indexList.Count) { - throw Error.IncorrectNumberOfIndexes(); - } - - foreach (Expression e in indexList) { - RequiresCanRead(e, "indexes"); - if (e.Type != typeof(int)) { - throw Error.ArgumentMustBeArrayIndexType(); - } - } - - MethodInfo mi = array.Type.GetMethod("Get", BindingFlags.Public | BindingFlags.Instance); - return Call(array, mi, indexList); - } - - #endregion - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewArrayExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewArrayExpression.cs deleted file mode 100644 index d8bf56adea8..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewArrayExpression.cs +++ /dev/null @@ -1,234 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents creating a new array and possibly initializing the elements of the new array. - /// - [DebuggerTypeProxy(typeof(Expression.NewArrayExpressionProxy))] - public class NewArrayExpression : Expression { - private readonly ReadOnlyCollection _expressions; - private readonly Type _type; - - internal NewArrayExpression(Type type, ReadOnlyCollection expressions) { - _expressions = expressions; - _type = type; - } - - internal static NewArrayExpression Make(ExpressionType nodeType, Type type, ReadOnlyCollection expressions) { - if (nodeType == ExpressionType.NewArrayInit) { - return new NewArrayInitExpression(type, expressions); - } else { - return new NewArrayBoundsExpression(type, expressions); - } - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _type; } - } - - /// - /// Gets the bounds of the array if the value of the property is NewArrayBounds, or the values to initialize the elements of the new array if the value of the property is NewArrayInit. - /// - public ReadOnlyCollection Expressions { - get { return _expressions; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitNewArray(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public NewArrayExpression Update(IEnumerable expressions) { - if (expressions == Expressions) { - return this; - } - if (NodeType == ExpressionType.NewArrayInit) { - return Expression.NewArrayInit(Type.GetElementType(), expressions); - } - return Expression.NewArrayBounds(Type.GetElementType(), expressions); - } - } - - internal sealed class NewArrayInitExpression : NewArrayExpression { - internal NewArrayInitExpression(Type type, ReadOnlyCollection expressions) - : base(type, expressions) { - } - - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.NewArrayInit; } - } - } - - internal sealed class NewArrayBoundsExpression : NewArrayExpression { - internal NewArrayBoundsExpression(Type type, ReadOnlyCollection expressions) - : base(type, expressions) { - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.NewArrayBounds; } - } - } - - public partial class Expression { - - #region NewArrayInit - - - /// - /// Creates a new array expression of the specified type from the provided initializers. - /// - /// A Type that represents the element type of the array. - /// The expressions used to create the array elements. - /// An instance of the . - public static NewArrayExpression NewArrayInit(Type type, params Expression[] initializers) { - return NewArrayInit(type, (IEnumerable)initializers); - } - - /// - /// Creates a new array expression of the specified type from the provided initializers. - /// - /// A Type that represents the element type of the array. - /// The expressions used to create the array elements. - /// An instance of the . - public static NewArrayExpression NewArrayInit(Type type, IEnumerable initializers) { - ContractUtils.RequiresNotNull(type, "type"); - ContractUtils.RequiresNotNull(initializers, "initializers"); - if (type.Equals(typeof(void))) { - throw Error.ArgumentCannotBeOfTypeVoid(); - } - - ReadOnlyCollection initializerList = initializers.ToReadOnly(); - - Expression[] newList = null; - for (int i = 0, n = initializerList.Count; i < n; i++) { - Expression expr = initializerList[i]; - RequiresCanRead(expr, "initializers"); - - if (!TypeUtils.AreReferenceAssignable(type, expr.Type)) { - if (!TryQuote(type, ref expr)){ - throw Error.ExpressionTypeCannotInitializeArrayType(expr.Type, type); - } - if (newList == null) { - newList = new Expression[initializerList.Count]; - for (int j = 0; j < i; j++) { - newList[j] = initializerList[j]; - } - } - } - if (newList != null) { - newList[i] = expr; - } - } - if (newList != null) { - initializerList = new TrueReadOnlyCollection(newList); - } - - return NewArrayExpression.Make(ExpressionType.NewArrayInit, type.MakeArrayType(), initializerList); - } - - #endregion - - #region NewArrayBounds - - - /// - /// Creates a that represents creating an array that has a specified rank. - /// - /// A that represents the element type of the array. - /// An array that contains Expression objects to use to populate the Expressions collection. - /// A that has the property equal to type and the property set to the specified value. - public static NewArrayExpression NewArrayBounds(Type type, params Expression[] bounds) { - return NewArrayBounds(type, (IEnumerable)bounds); - } - - - /// - /// Creates a that represents creating an array that has a specified rank. - /// - /// A that represents the element type of the array. - /// An IEnumerable{T} that contains Expression objects to use to populate the Expressions collection. - /// A that has the property equal to type and the property set to the specified value. - public static NewArrayExpression NewArrayBounds(Type type, IEnumerable bounds) { - ContractUtils.RequiresNotNull(type, "type"); - ContractUtils.RequiresNotNull(bounds, "bounds"); - - if (type.Equals(typeof(void))) { - throw Error.ArgumentCannotBeOfTypeVoid(); - } - - ReadOnlyCollection boundsList = bounds.ToReadOnly(); - - int dimensions = boundsList.Count; - if (dimensions <= 0) throw Error.BoundsCannotBeLessThanOne(); - - for (int i = 0; i < dimensions; i++) { - Expression expr = boundsList[i]; - RequiresCanRead(expr, "bounds"); - if (!TypeUtils.IsInteger(expr.Type)) { - throw Error.ArgumentMustBeInteger(); - } - } - - Type arrayType; - if (dimensions == 1) { - //To get a vector, need call Type.MakeArrayType(). - //Type.MakeArrayType(1) gives a non-vector array, which will cause type check error. - arrayType = type.MakeArrayType(); - } else { - arrayType = type.MakeArrayType(dimensions); - } - - return NewArrayExpression.Make(ExpressionType.NewArrayBounds, arrayType, bounds.ToReadOnly()); - } - - #endregion - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs deleted file mode 100644 index 9a60fa44285..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/NewExpression.cs +++ /dev/null @@ -1,326 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Runtime.CompilerServices; -//using Microsoft.Scripting.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents a constructor call. - /// - [DebuggerTypeProxy(typeof(Expression.NewExpressionProxy))] - public class NewExpression : Expression, IArgumentProvider { - private readonly ConstructorInfo _constructor; - private IList _arguments; - private readonly ReadOnlyCollection _members; - - internal NewExpression(ConstructorInfo constructor, IList arguments, ReadOnlyCollection members) { - _constructor = constructor; - _arguments = arguments; - _members = members; - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public override Type Type { - get { return _constructor.DeclaringType; } - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.New; } - } - - /// - /// Gets the called constructor. - /// - public ConstructorInfo Constructor { - get { return _constructor; } - } - - /// - /// Gets the arguments to the constructor. - /// - public ReadOnlyCollection Arguments { - get { return ReturnReadOnly(ref _arguments); } - } - - Expression IArgumentProvider.GetArgument(int index) { - return _arguments[index]; - } - - int IArgumentProvider.ArgumentCount { - get { - return _arguments.Count; - } - } - - /// - /// Gets the members that can retrieve the values of the fields that were initialized with constructor arguments. - /// - public ReadOnlyCollection Members { - get { return _members; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitNew(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public NewExpression Update(IEnumerable arguments) { - if (arguments == Arguments) { - return this; - } - if (Members != null) { - return Expression.New(Constructor, arguments, Members); - } - return Expression.New(Constructor, arguments); - } - } - - internal class NewValueTypeExpression : NewExpression { - private readonly Type _valueType; - - internal NewValueTypeExpression(Type type, ReadOnlyCollection arguments, ReadOnlyCollection members) - : base(null, arguments, members) { - _valueType = type; - } - - public sealed override Type Type { - get { return _valueType; } - } - } - - public partial class Expression { - - /// - /// Creates a new that represents calling the specified constructor that takes no arguments. - /// - /// The to set the property equal to. - /// A that has the property equal to and the property set to the specified value. - public static NewExpression New(ConstructorInfo constructor) { - return New(constructor, (IEnumerable)null); - } - - - /// - /// Creates a new that represents calling the specified constructor that takes no arguments. - /// - /// The to set the property equal to. - /// An array of objects to use to populate the Arguments collection. - /// A that has the property equal to and the and properties set to the specified value. - public static NewExpression New(ConstructorInfo constructor, params Expression[] arguments) { - return New(constructor, (IEnumerable)arguments); - } - - - /// - /// Creates a new that represents calling the specified constructor that takes no arguments. - /// - /// The to set the property equal to. - /// An of objects to use to populate the Arguments collection. - /// A that has the property equal to and the and properties set to the specified value. - public static NewExpression New(ConstructorInfo constructor, IEnumerable arguments) { - ContractUtils.RequiresNotNull(constructor, "constructor"); - ContractUtils.RequiresNotNull(constructor.DeclaringType, "constructor.DeclaringType"); - TypeUtils.ValidateType(constructor.DeclaringType); - var argList = arguments.ToReadOnly(); - ValidateArgumentTypes(constructor, ExpressionType.New, ref argList); - - return new NewExpression(constructor, argList, null); - } - - - /// - /// Creates a new that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified. - /// - /// The to set the property equal to. - /// An of objects to use to populate the Arguments collection. - /// An of objects to use to populate the Members collection. - /// A that has the property equal to and the , and properties set to the specified value. - public static NewExpression New(ConstructorInfo constructor, IEnumerable arguments, IEnumerable members) { - ContractUtils.RequiresNotNull(constructor, "constructor"); - var memberList = members.ToReadOnly(); - var argList = arguments.ToReadOnly(); - ValidateNewArgs(constructor, ref argList, ref memberList); - return new NewExpression(constructor, argList, memberList); - } - - - /// - /// Creates a new that represents calling the specified constructor with the specified arguments. The members that access the constructor initialized fields are specified. - /// - /// The to set the property equal to. - /// An of objects to use to populate the Arguments collection. - /// An Array of objects to use to populate the Members collection. - /// A that has the property equal to and the , and properties set to the specified value. - public static NewExpression New(ConstructorInfo constructor, IEnumerable arguments, params MemberInfo[] members) { - return New(constructor, arguments, (IEnumerable)members); - } - - - /// - /// Creates a that represents calling the parameterless constructor of the specified type. - /// - /// A that has a constructor that takes no arguments. - /// A that has the property equal to New and the Constructor property set to the ConstructorInfo that represents the parameterless constructor of the specified type. - public static NewExpression New(Type type) { - ContractUtils.RequiresNotNull(type, "type"); - if (type == typeof(void)) { - throw Error.ArgumentCannotBeOfTypeVoid(); - } - ConstructorInfo ci = null; - if (!type.IsValueType) { - ci = type.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, Microsoft.Scripting.Utils.ReflectionUtils.EmptyTypes, null); - if (ci == null) { - throw Error.TypeMissingDefaultConstructor(type); - } - return New(ci); - } - return new NewValueTypeExpression(type, EmptyReadOnlyCollection.Instance, null); - } - - - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private static void ValidateNewArgs(ConstructorInfo constructor, ref ReadOnlyCollection arguments, ref ReadOnlyCollection members) { - ParameterInfo[] pis; - if ((pis = constructor.GetParametersCached()).Length > 0) { - if (arguments.Count != pis.Length) { - throw Error.IncorrectNumberOfConstructorArguments(); - } - if (arguments.Count != members.Count) { - throw Error.IncorrectNumberOfArgumentsForMembers(); - } - Expression[] newArguments = null; - MemberInfo[] newMembers = null; - for (int i = 0, n = arguments.Count; i < n; i++) { - Expression arg = arguments[i]; - RequiresCanRead(arg, "argument"); - MemberInfo member = members[i]; - ContractUtils.RequiresNotNull(member, "member"); - if (!TypeUtils.AreEquivalent(member.DeclaringType, constructor.DeclaringType)) { - throw Error.ArgumentMemberNotDeclOnType(member.Name, constructor.DeclaringType.Name); - } - Type memberType; - ValidateAnonymousTypeMember(ref member, out memberType); - if (!TypeUtils.AreReferenceAssignable(memberType, arg.Type)) { - if (!TryQuote(memberType, ref arg)) { - throw Error.ArgumentTypeDoesNotMatchMember(arg.Type, memberType); - } - } - ParameterInfo pi = pis[i]; - Type pType = pi.ParameterType; - if (pType.IsByRef) { - pType = pType.GetElementType(); - } - if (!TypeUtils.AreReferenceAssignable(pType, arg.Type)) { - if (!TryQuote(pType, ref arg)) { - throw Error.ExpressionTypeDoesNotMatchConstructorParameter(arg.Type, pType); - } - } - if (newArguments == null && arg != arguments[i]) { - newArguments = new Expression[arguments.Count]; - for (int j = 0; j < i; j++) { - newArguments[j] = arguments[j]; - } - } - if (newArguments != null) { - newArguments[i] = arg; - } - - if (newMembers == null && member != members[i]) { - newMembers = new MemberInfo[members.Count]; - for (int j = 0; j < i; j++) { - newMembers[j] = members[j]; - } - } - if (newMembers != null) { - newMembers[i] = member; - } - } - if (newArguments != null) { - arguments = new TrueReadOnlyCollection(newArguments); - } - if (newMembers != null) { - members = new TrueReadOnlyCollection(newMembers); - } - } else if (arguments != null && arguments.Count > 0) { - throw Error.IncorrectNumberOfConstructorArguments(); - } else if (members != null && members.Count > 0) { - throw Error.IncorrectNumberOfMembersForGivenConstructor(); - } - } - - - private static void ValidateAnonymousTypeMember(ref MemberInfo member, out Type memberType) { - switch (member.MemberType) { - case MemberTypes.Field: - FieldInfo field = member as FieldInfo; - if (field.IsStatic) { - throw Error.ArgumentMustBeInstanceMember(); - } - memberType = field.FieldType; - return; - case MemberTypes.Property: - PropertyInfo pi = member as PropertyInfo; - if (!pi.CanRead) { - throw Error.PropertyDoesNotHaveGetter(pi); - } - if (pi.GetGetMethod().IsStatic) { - throw Error.ArgumentMustBeInstanceMember(); - } - memberType = pi.PropertyType; - return; - case MemberTypes.Method: - MethodInfo method = member as MethodInfo; - if (method.IsStatic) { - throw Error.ArgumentMustBeInstanceMember(); - } - PropertyInfo prop = GetProperty(method); - member = prop; - memberType = prop.PropertyType; - return; - default: - throw Error.ArgumentMustBeFieldInfoOrPropertInfoOrMethod(); - } - // don't add code here, we've already returned - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ParameterExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ParameterExpression.cs deleted file mode 100644 index 42a8628181a..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/ParameterExpression.cs +++ /dev/null @@ -1,222 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents a named parameter expression. - /// - [DebuggerTypeProxy(typeof(Expression.ParameterExpressionProxy))] - public class ParameterExpression : Expression { - private readonly string _name; - - internal ParameterExpression(string name) { - _name = name; - } - - internal static ParameterExpression Make(Type type, string name, bool isByRef) { - if (isByRef) { - return new ByRefParameterExpression(type, name); - } else { - if (!type.IsEnum) { - switch (Type.GetTypeCode(type)) { - case TypeCode.Boolean: return new PrimitiveParameterExpression(name); - case TypeCode.Byte: return new PrimitiveParameterExpression(name); - case TypeCode.Char: return new PrimitiveParameterExpression(name); - case TypeCode.DateTime: return new PrimitiveParameterExpression(name); - case TypeCode.DBNull: return new PrimitiveParameterExpression(name); - case TypeCode.Decimal: return new PrimitiveParameterExpression(name); - case TypeCode.Double: return new PrimitiveParameterExpression(name); - case TypeCode.Int16: return new PrimitiveParameterExpression(name); - case TypeCode.Int32: return new PrimitiveParameterExpression(name); - case TypeCode.Int64: return new PrimitiveParameterExpression(name); - case TypeCode.Object: - // common reference types which we optimize go here. Of course object is in - // the list, the others are driven by profiling of various workloads. This list - // should be kept short. - if (type == typeof(object)) { - return new ParameterExpression(name); - } else if (type == typeof(Exception)) { - return new PrimitiveParameterExpression(name); - } else if (type == typeof(object[])) { - return new PrimitiveParameterExpression(name); - } - break; - case TypeCode.SByte: return new PrimitiveParameterExpression(name); - case TypeCode.Single: return new PrimitiveParameterExpression(name); - case TypeCode.String: return new PrimitiveParameterExpression(name); - case TypeCode.UInt16: return new PrimitiveParameterExpression(name); - case TypeCode.UInt32: return new PrimitiveParameterExpression(name); - case TypeCode.UInt64: return new PrimitiveParameterExpression(name); - } - } - } - - return new TypedParameterExpression(type, name); - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public override Type Type { - get { return typeof(object); } - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Parameter; } - } - - /// - /// The Name of the parameter or variable. - /// - public string Name { - get { return _name; } - } - - /// - /// Indicates that this ParameterExpression is to be treated as a ByRef parameter. - /// - public bool IsByRef { - get { - return GetIsByRef(); - } - } - - internal virtual bool GetIsByRef() { - return false; - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitParameter(this); - } - } - - /// - /// Specialized subclass to avoid holding onto the byref flag in a - /// parameter expression. This version always holds onto the expression - /// type explicitly and therefore derives from TypedParameterExpression. - /// - internal sealed class ByRefParameterExpression : TypedParameterExpression { - internal ByRefParameterExpression(Type type, string name) - : base(type, name) { - } - - internal override bool GetIsByRef() { - return true; - } - } - - /// - /// Specialized subclass which holds onto the type of the expression for - /// uncommon types. - /// - internal class TypedParameterExpression : ParameterExpression { - private readonly Type _paramType; - - internal TypedParameterExpression(Type type, string name) - : base(name) { - _paramType = type; - } - - public sealed override Type Type { - get { return _paramType; } - } - } - - /// - /// Generic type to avoid needing explicit storage for primitive data types - /// which are commonly used. - /// - internal sealed class PrimitiveParameterExpression : ParameterExpression { - internal PrimitiveParameterExpression(string name) - : base(name) { - } - - public sealed override Type Type { - get { return typeof(T); } - } - } - - public partial class Expression { - - /// - /// Creates a node that can be used to identify a parameter or a variable in an expression tree. - /// - /// The type of the parameter or variable. - /// A node with the specified name and type. - public static ParameterExpression Parameter(Type type) { - return Parameter(type, null); - } - - /// - /// Creates a node that can be used to identify a parameter or a variable in an expression tree. - /// - /// The type of the parameter or variable. - /// A node with the specified name and type. - public static ParameterExpression Variable(Type type) { - return Variable(type, null); - } - - /// - /// Creates a node that can be used to identify a parameter or a variable in an expression tree. - /// - /// The type of the parameter or variable. - /// The name of the parameter or variable, used for debugging or pretty printing purpose only. - /// A node with the specified name and type. - public static ParameterExpression Parameter(Type type, string name) { - ContractUtils.RequiresNotNull(type, "type"); - - if (type == typeof(void)) { - throw Error.ArgumentCannotBeOfTypeVoid(); - } - - bool byref = type.IsByRef; - if (byref) { - type = type.GetElementType(); - } - - return ParameterExpression.Make(type, name, byref); - } - - /// - /// Creates a node that can be used to identify a parameter or a variable in an expression tree. - /// - /// The type of the parameter or variable. - /// The name of the parameter or variable, used for debugging or pretty printing purpose only. - /// A node with the specified name and type. - public static ParameterExpression Variable(Type type, string name) { - ContractUtils.RequiresNotNull(type, "type"); - if (type == typeof(void)) throw Error.ArgumentCannotBeOfTypeVoid(); - if (type.IsByRef) throw Error.TypeMustNotBeByRef(); - return ParameterExpression.Make(type, name, false); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/RuntimeVariablesExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/RuntimeVariablesExpression.cs deleted file mode 100644 index a79b12657e3..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/RuntimeVariablesExpression.cs +++ /dev/null @@ -1,117 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// An expression that provides runtime read/write access to variables. - /// Needed to implement "eval" in some dynamic languages. - /// Evaluates to an instance of when executed. - /// - [DebuggerTypeProxy(typeof(Expression.RuntimeVariablesExpressionProxy))] - public sealed class RuntimeVariablesExpression : Expression { - private readonly ReadOnlyCollection _variables; - - internal RuntimeVariablesExpression(ReadOnlyCollection variables) { - _variables = variables; - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return typeof(IRuntimeVariables); } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.RuntimeVariables; } - } - - /// - /// The variables or parameters to which to provide runtime access. - /// - public ReadOnlyCollection Variables { - get { return _variables; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitRuntimeVariables(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public RuntimeVariablesExpression Update(IEnumerable variables) { - if (variables == Variables) { - return this; - } - return Expression.RuntimeVariables(variables); - } - } - - public partial class Expression { - - /// - /// Creates an instance of . - /// - /// An array of objects to use to populate the collection. - /// An instance of that has the property equal to and the property set to the specified value. - public static RuntimeVariablesExpression RuntimeVariables(params ParameterExpression[] variables) { - return RuntimeVariables((IEnumerable)variables); - } - - /// - /// Creates an instance of . - /// - /// A collection of objects to use to populate the collection. - /// An instance of that has the property equal to and the property set to the specified value. - public static RuntimeVariablesExpression RuntimeVariables(IEnumerable variables) { - ContractUtils.RequiresNotNull(variables, "variables"); - - var vars = variables.ToReadOnly(); - for (int i = 0; i < vars.Count; i++) { - Expression v = vars[i]; - if (v == null) { - throw new ArgumentNullException("variables[" + i + "]"); - } - } - - return new RuntimeVariablesExpression(vars); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchCase.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchCase.cs deleted file mode 100644 index ed080daa52c..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchCase.cs +++ /dev/null @@ -1,105 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents one case of a . - /// - [DebuggerTypeProxy(typeof(Expression.SwitchCaseProxy))] - public sealed class SwitchCase { - private readonly ReadOnlyCollection _testValues; - private readonly Expression _body; - - internal SwitchCase(Expression body, ReadOnlyCollection testValues) { - _body = body; - _testValues = testValues; - } - - /// - /// Gets the values of this case. This case is selected for execution when the matches any of these values. - /// - public ReadOnlyCollection TestValues { - get { return _testValues; } - } - - /// - /// Gets the body of this case. - /// - public Expression Body { - get { return _body; } - } - - /// - /// Returns a that represents the current . - /// - /// A that represents the current . - public override string ToString() { - return ExpressionStringBuilder.SwitchCaseToString(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public SwitchCase Update(IEnumerable testValues, Expression body) { - if (testValues == TestValues && body == Body) { - return this; - } - return Expression.SwitchCase(body, testValues); - } - } - - public partial class Expression { - /// - /// Creates a SwitchCase for use in a . - /// - /// The body of the case. - /// The test values of the case. - /// The created SwitchCase. - public static SwitchCase SwitchCase(Expression body, params Expression[] testValues) { - return SwitchCase(body, (IEnumerable)testValues); - } - - /// - /// Creates a SwitchCase for use in a . - /// - /// The body of the case. - /// The test values of the case. - /// The created SwitchCase. - public static SwitchCase SwitchCase(Expression body, IEnumerable testValues) { - RequiresCanRead(body, "body"); - - var values = testValues.ToReadOnly(); - RequiresCanRead(values, "testValues"); - ContractUtils.RequiresNotEmpty(values, "testValues"); - - return new SwitchCase(body, values); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchExpression.cs deleted file mode 100644 index 2bc10185b43..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/SwitchExpression.cs +++ /dev/null @@ -1,298 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents a control expression that handles multiple selections by passing control to a . - /// - [DebuggerTypeProxy(typeof(Expression.SwitchExpressionProxy))] - public sealed class SwitchExpression : Expression { - private readonly Type _type; - private readonly Expression _switchValue; - private readonly ReadOnlyCollection _cases; - private readonly Expression _defaultBody; - private readonly MethodInfo _comparison; - - internal SwitchExpression(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, ReadOnlyCollection cases) { - _type = type; - _switchValue = switchValue; - _defaultBody = defaultBody; - _comparison = comparison; - _cases = cases; - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _type; } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Switch; } - } - - /// - /// Gets the test for the switch. - /// - public Expression SwitchValue { - get { return _switchValue; } - } - - /// - /// Gets the collection of objects for the switch. - /// - public ReadOnlyCollection Cases { - get { return _cases; } - } - - /// - /// Gets the test for the switch. - /// - public Expression DefaultBody { - get { return _defaultBody; } - } - - /// - /// Gets the equality comparison method, if any. - /// - public MethodInfo Comparison { - get { return _comparison; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitSwitch(this); - } - - internal bool IsLifted { - get { - if (_switchValue.Type.IsNullableType()) { - return (_comparison == null) || - !TypeUtils.AreEquivalent(_switchValue.Type, _comparison.GetParametersCached()[0].ParameterType.GetNonRefType()); - } - return false; - } - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public SwitchExpression Update(Expression switchValue, IEnumerable cases, Expression defaultBody) { - if (switchValue == SwitchValue && cases == Cases && defaultBody == DefaultBody) { - return this; - } - return Expression.Switch(Type, switchValue, defaultBody, Comparison, cases); - } - } - - public partial class Expression { - /// - /// Creates a . - /// - /// The value to be tested against each case. - /// The valid cases for this switch. - /// The created . - public static SwitchExpression Switch(Expression switchValue, params SwitchCase[] cases) { - return Switch(switchValue, null, null, (IEnumerable)cases); - } - - /// - /// Creates a . - /// - /// The value to be tested against each case. - /// The result of the switch if no cases are matched. - /// The valid cases for this switch. - /// The created . - public static SwitchExpression Switch(Expression switchValue, Expression defaultBody, params SwitchCase[] cases) { - return Switch(switchValue, defaultBody, null, (IEnumerable)cases); - } - - /// - /// Creates a . - /// - /// The value to be tested against each case. - /// The result of the switch if no cases are matched. - /// The equality comparison method to use. - /// The valid cases for this switch. - /// The created . - public static SwitchExpression Switch(Expression switchValue, Expression defaultBody, MethodInfo comparison, params SwitchCase[] cases) { - return Switch(switchValue, defaultBody, comparison, (IEnumerable)cases); - } - - /// - /// Creates a . - /// - /// The result type of the switch. - /// The value to be tested against each case. - /// The result of the switch if no cases are matched. - /// The equality comparison method to use. - /// The valid cases for this switch. - /// The created . - public static SwitchExpression Switch(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, params SwitchCase[] cases) { - return Switch(type, switchValue, defaultBody, comparison, (IEnumerable)cases); - } - - /// - /// Creates a . - /// - /// The value to be tested against each case. - /// The result of the switch if no cases are matched. - /// The equality comparison method to use. - /// The valid cases for this switch. - /// The created . - public static SwitchExpression Switch(Expression switchValue, Expression defaultBody, MethodInfo comparison, IEnumerable cases) { - return Switch(null, switchValue, defaultBody, comparison, cases); - } - - /// - /// Creates a . - /// - /// The result type of the switch. - /// The value to be tested against each case. - /// The result of the switch if no cases are matched. - /// The equality comparison method to use. - /// The valid cases for this switch. - /// The created . - public static SwitchExpression Switch(Type type, Expression switchValue, Expression defaultBody, MethodInfo comparison, IEnumerable cases) { - RequiresCanRead(switchValue, "switchValue"); - if (switchValue.Type == typeof(void)) throw Error.ArgumentCannotBeOfTypeVoid(); - - var caseList = cases.ToReadOnly(); - ContractUtils.RequiresNotEmpty(caseList, "cases"); - ContractUtils.RequiresNotNullItems(caseList, "cases"); - - // Type of the result. Either provided, or it is type of the branches. - Type resultType = type ?? caseList[0].Body.Type; - bool customType = type != null; - - if (comparison != null) { - var pms = comparison.GetParametersCached(); - if (pms.Length != 2) { - throw Error.IncorrectNumberOfMethodCallArguments(comparison); - } - // Validate that the switch value's type matches the comparison method's - // left hand side parameter type. - var leftParam = pms[0]; - bool liftedCall = false; - if (!ParameterIsAssignable(leftParam, switchValue.Type)) { - liftedCall = ParameterIsAssignable(leftParam, switchValue.Type.GetNonNullableType()); - if (!liftedCall) { - throw Error.SwitchValueTypeDoesNotMatchComparisonMethodParameter(switchValue.Type, leftParam.ParameterType); - } - } - - var rightParam = pms[1]; - foreach (var c in caseList) { - ContractUtils.RequiresNotNull(c, "cases"); - ValidateSwitchCaseType(c.Body, customType, resultType, "cases"); - for (int i = 0; i < c.TestValues.Count; i++) { - // When a comparison method is provided, test values can have different type but have to - // be reference assignable to the right hand side parameter of the method. - Type rightOperandType = c.TestValues[i].Type; - if (liftedCall) { - if (!rightOperandType.IsNullableType()) { - throw Error.TestValueTypeDoesNotMatchComparisonMethodParameter(rightOperandType, rightParam.ParameterType); - } - rightOperandType = rightOperandType.GetNonNullableType(); - } - if (!ParameterIsAssignable(rightParam, rightOperandType)) { - throw Error.TestValueTypeDoesNotMatchComparisonMethodParameter(rightOperandType, rightParam.ParameterType); - } - } - } - } else { - // When comparison method is not present, all the test values must have - // the same type. Use the first test value's type as the baseline. - var firstTestValue = caseList[0].TestValues[0]; - foreach (var c in caseList) { - ContractUtils.RequiresNotNull(c, "cases"); - ValidateSwitchCaseType(c.Body, customType, resultType, "cases"); - // When no comparison method is provided, require all test values to have the same type. - for (int i = 0; i < c.TestValues.Count; i++) { - if (!TypeUtils.AreEquivalent(firstTestValue.Type, c.TestValues[i].Type)) { - throw new ArgumentException(Strings.AllTestValuesMustHaveSameType, "cases"); - } - } - } - - // Now we need to validate that switchValue.Type and testValueType - // make sense in an Equal node. Fortunately, Equal throws a - // reasonable error, so just call it. - var equal = Equal(switchValue, firstTestValue, false, comparison); - - // Get the comparison function from equals node. - comparison = equal.Method; - } - - if (defaultBody == null) { - if (resultType != typeof(void)) throw Error.DefaultBodyMustBeSupplied(); - } else { - ValidateSwitchCaseType(defaultBody, customType, resultType, "defaultBody"); - } - - // if we have a non-boolean userdefined equals, we don't want it. - if (comparison != null && comparison.ReturnType != typeof(bool)) { - throw Error.EqualityMustReturnBoolean(comparison); - } - - return new SwitchExpression(resultType, switchValue, defaultBody, comparison, caseList); - } - - - /// - /// If custom type is provided, all branches must be reference assignable to the result type. - /// If no custom type is provided, all branches must have the same type - resultType. - /// - private static void ValidateSwitchCaseType(Expression @case, bool customType, Type resultType, string parameterName) { - if (customType) { - if (resultType != typeof(void)) { - if (!TypeUtils.AreReferenceAssignable(resultType, @case.Type)) { - throw new ArgumentException(Strings.ArgumentTypesMustMatch, parameterName); - } - } - } else { - if (!TypeUtils.AreEquivalent(resultType, @case.Type)) { - throw new ArgumentException(Strings.AllCaseBodiesMustHaveSameType, parameterName); - } - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/SymbolDocumentInfo.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/SymbolDocumentInfo.cs deleted file mode 100644 index 1bb206e63dc..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/SymbolDocumentInfo.cs +++ /dev/null @@ -1,153 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Stores information needed to emit debugging symbol information for a - /// source file, in particular the file name and unique language identifier. - /// - public class SymbolDocumentInfo { - private readonly string _fileName; - - internal SymbolDocumentInfo(string fileName) { - ContractUtils.RequiresNotNull(fileName, "fileName"); - _fileName = fileName; - } - - /// - /// The source file name. - /// - public string FileName { - get { return _fileName; } - } - - /// - /// Returns the language's unique identifier, if any. - /// - public virtual Guid Language { - get { return Guid.Empty; } - } - - /// - /// Returns the language vendor's unique identifier, if any. - /// - public virtual Guid LanguageVendor { - get { return Guid.Empty; } - } - - /// - /// Returns the document type's unique identifier, if any. - /// Defaults to the guid for a text file. - /// - public virtual Guid DocumentType { - get { return Compiler.SymbolGuids.DocumentType_Text; } - } - } - - internal sealed class SymbolDocumentWithGuids : SymbolDocumentInfo { - private readonly Guid _language; - private readonly Guid _vendor; - private readonly Guid _documentType; - - internal SymbolDocumentWithGuids(string fileName, ref Guid language) - : base(fileName) { - _language = language; - _documentType = Compiler.SymbolGuids.DocumentType_Text; - } - - internal SymbolDocumentWithGuids(string fileName, ref Guid language, ref Guid vendor) - : base(fileName) { - _language = language; - _vendor = vendor; - _documentType = Compiler.SymbolGuids.DocumentType_Text; - } - - internal SymbolDocumentWithGuids(string fileName, ref Guid language, ref Guid vendor, ref Guid documentType) - : base(fileName) { - _language = language; - _vendor = vendor; - _documentType = documentType; - } - - public override Guid Language { - get { return _language; } - } - - public override Guid LanguageVendor { - get { return _vendor; } - } - - public override Guid DocumentType { - get { return _documentType; } - } - } - - public partial class Expression { - /// - /// Creates an instance of . - /// - /// A to set the equal to. - /// A that has the property set to the specified value. - public static SymbolDocumentInfo SymbolDocument(string fileName) { - return new SymbolDocumentInfo(fileName); - } - - /// - /// Creates an instance of . - /// - /// A to set the equal to. - /// A to set the equal to. - /// A that has the - /// and properties set to the specified value. - public static SymbolDocumentInfo SymbolDocument(string fileName, Guid language) { - return new SymbolDocumentWithGuids(fileName, ref language); - } - - /// - /// Creates an instance of . - /// - /// A to set the equal to. - /// A to set the equal to. - /// A to set the equal to. - /// A that has the - /// and - /// and properties set to the specified value. - public static SymbolDocumentInfo SymbolDocument(string fileName, Guid language, Guid languageVendor) { - return new SymbolDocumentWithGuids(fileName, ref language, ref languageVendor); - } - - /// - /// Creates an instance of . - /// - /// A to set the equal to. - /// A to set the equal to. - /// A to set the equal to. - /// A to set the equal to. - /// A that has the - /// and - /// and - /// and properties set to the specified value. - public static SymbolDocumentInfo SymbolDocument(string fileName, Guid language, Guid languageVendor, Guid documentType) { - return new SymbolDocumentWithGuids(fileName, ref language, ref languageVendor, ref documentType); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/TryExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/TryExpression.cs deleted file mode 100644 index 9d19f67a981..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/TryExpression.cs +++ /dev/null @@ -1,228 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents a try/catch/finally/fault block. - /// - /// The body is protected by the try block. - /// The handlers consist of a set of s that can either be catch or filters. - /// The fault runs if an exception is thrown. - /// The finally runs regardless of how control exits the body. - /// Only one of fault or finally can be supplied. - /// The return type of the try block must match the return type of any associated catch statements. - /// - [DebuggerTypeProxy(typeof(Expression.TryExpressionProxy))] - public sealed class TryExpression : Expression { - private readonly Type _type; - private readonly Expression _body; - private readonly ReadOnlyCollection _handlers; - private readonly Expression _finally; - private readonly Expression _fault; - - internal TryExpression(Type type, Expression body, Expression @finally, Expression fault, ReadOnlyCollection handlers) { - _type = type; - _body = body; - _handlers = handlers; - _finally = @finally; - _fault = fault; - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _type; } - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return ExpressionType.Try; } - } - - /// - /// Gets the representing the body of the try block. - /// - public Expression Body { - get { return _body; } - } - - /// - /// Gets the collection of s associated with the try block. - /// - public ReadOnlyCollection Handlers { - get { return _handlers; } - } - - /// - /// Gets the representing the finally block. - /// - public Expression Finally { - get { return _finally; } - } - - /// - /// Gets the representing the fault block. - /// - public Expression Fault { - get { return _fault; } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitTry(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// The property of the result. - /// The property of the result. - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public TryExpression Update(Expression body, IEnumerable handlers, Expression @finally, Expression fault) { - if (body == Body && handlers == Handlers && @finally == Finally && fault == Fault) { - return this; - } - return Expression.MakeTry(Type, body, @finally, fault, handlers); - } - } - - public partial class Expression { - - /// - /// Creates a representing a try block with a fault block and no catch statements. - /// - /// The body of the try block. - /// The body of the fault block. - /// The created . - public static TryExpression TryFault(Expression body, Expression fault) { - return MakeTry(null, body, null, fault, null); - } - - /// - /// Creates a representing a try block with a finally block and no catch statements. - /// - /// The body of the try block. - /// The body of the finally block. - /// The created . - public static TryExpression TryFinally(Expression body, Expression @finally) { - return MakeTry(null, body, @finally, null, null); - } - - /// - /// Creates a representing a try block with any number of catch statements and neither a fault nor finally block. - /// - /// The body of the try block. - /// The array of zero or more s representing the catch statements to be associated with the try block. - /// The created . - public static TryExpression TryCatch(Expression body, params CatchBlock[] handlers) { - return MakeTry(null, body, null, null, handlers); - } - - /// - /// Creates a representing a try block with any number of catch statements and a finally block. - /// - /// The body of the try block. - /// The body of the finally block. - /// The array of zero or more s representing the catch statements to be associated with the try block. - /// The created . - public static TryExpression TryCatchFinally(Expression body, Expression @finally, params CatchBlock[] handlers) { - return MakeTry(null, body, @finally, null, handlers); - } - - /// - /// Creates a representing a try block with the specified elements. - /// - /// The result type of the try expression. If null, bodh and all handlers must have identical type. - /// The body of the try block. - /// The body of the finally block. Pass null if the try block has no finally block associated with it. - /// The body of the t block. Pass null if the try block has no fault block associated with it. - /// A collection of s representing the catch statements to be associated with the try block. - /// The created . - public static TryExpression MakeTry(Type type, Expression body, Expression @finally, Expression fault, IEnumerable handlers) { - RequiresCanRead(body, "body"); - - var @catch = handlers.ToReadOnly(); - ContractUtils.RequiresNotNullItems(@catch, "handlers"); - ValidateTryAndCatchHaveSameType(type, body, @catch); - - if (fault != null) { - if (@finally != null || @catch.Count > 0) { - throw Error.FaultCannotHaveCatchOrFinally(); - } - RequiresCanRead(fault, "fault"); - } else if (@finally != null) { - RequiresCanRead(@finally, "finally"); - } else if (@catch.Count == 0) { - throw Error.TryMustHaveCatchFinallyOrFault(); - } - - return new TryExpression(type ?? body.Type, body, @finally, fault, @catch); - } - - //Validate that the body of the try expression must have the same type as the body of every try block. - private static void ValidateTryAndCatchHaveSameType(Type type, Expression tryBody, ReadOnlyCollection handlers) { - // Type unification ... all parts must be reference assignable to "type" - if (type != null) { - if (type != typeof(void)) { - if (!TypeUtils.AreReferenceAssignable(type, tryBody.Type)) { - throw Error.ArgumentTypesMustMatch(); - } - foreach (var cb in handlers) { - if (!TypeUtils.AreReferenceAssignable(type, cb.Body.Type)) { - throw Error.ArgumentTypesMustMatch(); - } - } - } - } else if (tryBody == null || tryBody.Type == typeof(void)) { - //The body of every try block must be null or have void type. - foreach (CatchBlock cb in handlers) { - if (cb.Body != null && cb.Body.Type != typeof(void)) { - throw Error.BodyOfCatchMustHaveSameTypeAsBodyOfTry(); - } - } - } else { - //Body of every catch must have the same type of body of try. - type = tryBody.Type; - foreach (CatchBlock cb in handlers) { - if (cb.Body == null || !TypeUtils.AreEquivalent(cb.Body.Type, type)) { - throw Error.BodyOfCatchMustHaveSameTypeAsBodyOfTry(); - } - } - } - } - } - -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeBinaryExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeBinaryExpression.cs deleted file mode 100644 index 0e3b2eee7a5..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeBinaryExpression.cs +++ /dev/null @@ -1,211 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - /// - /// Represents an operation between an expression and a type. - /// - [DebuggerTypeProxy(typeof(Expression.TypeBinaryExpressionProxy))] - public sealed class TypeBinaryExpression : Expression { - private readonly Expression _expression; - private readonly Type _typeOperand; - private readonly ExpressionType _nodeKind; - - internal TypeBinaryExpression(Expression expression, Type typeOperand, ExpressionType nodeKind) { - _expression = expression; - _typeOperand = typeOperand; - _nodeKind = nodeKind; - } - - /// - /// Gets the static type of the expression that this represents. - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return typeof(bool); } - } - - /// - /// Returns the node type of this Expression. Extension nodes should return - /// ExpressionType.Extension when overriding this method. - /// - /// The of the expression. - public sealed override ExpressionType NodeType { - get { return _nodeKind; } - } - - /// - /// Gets the expression operand of a type test operation. - /// - public Expression Expression { - get { return _expression; } - } - - /// - /// Gets the type operand of a type test operation. - /// - public Type TypeOperand { - get { return _typeOperand; } - } - - #region Reduce TypeEqual - - internal Expression ReduceTypeEqual() { - Type cType = Expression.Type; - - // For value types (including Void, but not nullables), we can - // determine the result now - if (cType.IsValueType && !cType.IsNullableType()) { - return Expression.Block(Expression, Expression.Constant(cType == _typeOperand.GetNonNullableType())); - } - - // Can check the value right now for constants. - if (Expression.NodeType == ExpressionType.Constant) { - return ReduceConstantTypeEqual(); - } - - // If the operand type is a sealed reference type or a nullable - // type, it will match if value is not null - if (cType.IsSealed && (cType == _typeOperand)) { - if (cType.IsNullableType()) { - return Expression.NotEqual(Expression, Expression.Constant(null, Expression.Type)); - } else { - return Expression.ReferenceNotEqual(Expression, Expression.Constant(null, Expression.Type)); - } - } - - // expression is a ByVal parameter. Can safely reevaluate. - var parameter = Expression as ParameterExpression; - if (parameter != null && !parameter.IsByRef) { - return ByValParameterTypeEqual(parameter); - } - - // Create a temp so we only evaluate the left side once - parameter = Expression.Parameter(typeof(object)); - - // Convert to object if necessary - var expression = Expression; - if (!TypeUtils.AreReferenceAssignable(typeof(object), expression.Type)) { - expression = Expression.Convert(expression, typeof(object)); - } - - return Expression.Block( - new[] { parameter }, - Expression.Assign(parameter, expression), - ByValParameterTypeEqual(parameter) - ); - } - - // Helper that is used when re-eval of LHS is safe. - private Expression ByValParameterTypeEqual(ParameterExpression value) { - Expression getType = Expression.Call(value, typeof(object).GetMethod("GetType")); - - // In remoting scenarios, obj.GetType() can return an interface. - // But there's a bug in the JIT32's optimized "obj.GetType() == - // typeof(ISomething)" codegen, causing it to always return false. - // We workaround the bug by generating different, less optimal IL - // if TypeOperand is an interface. - if (_typeOperand.IsInterface) { - var temp = Expression.Parameter(typeof(Type)); - getType = Expression.Block(new[] { temp }, Expression.Assign(temp, getType), temp); - } - - // We use reference equality when comparing to null for correctness - // (don't invoke a user defined operator), and reference equality - // on types for performance (so the JIT can optimize the IL). - return Expression.AndAlso( - Expression.ReferenceNotEqual(value, Expression.Constant(null)), - Expression.ReferenceEqual( - getType, - Expression.Constant(_typeOperand.GetNonNullableType(), typeof(Type)) - ) - ); - } - - private Expression ReduceConstantTypeEqual() { - ConstantExpression ce = Expression as ConstantExpression; - //TypeEqual(null, T) always returns false. - if (ce.Value == null) { - return Expression.Constant(false); - } else { - return Expression.Constant(_typeOperand.GetNonNullableType() == ce.Value.GetType()); - } - } - - #endregion - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitTypeBinary(this); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public TypeBinaryExpression Update(Expression expression) { - if (expression == Expression) { - return this; - } - if (NodeType == ExpressionType.TypeIs) { - return Expression.TypeIs(expression, TypeOperand); - } - return Expression.TypeEqual(expression, TypeOperand); - } - } - - public partial class Expression { - /// - /// Creates a . - /// - /// An to set the property equal to. - /// A to set the property equal to. - /// A for which the property is equal to and for which the and properties are set to the specified values. - public static TypeBinaryExpression TypeIs(Expression expression, Type type) { - RequiresCanRead(expression, "expression"); - ContractUtils.RequiresNotNull(type, "type"); - if (type.IsByRef) throw Error.TypeMustNotBeByRef(); - - return new TypeBinaryExpression(expression, type, ExpressionType.TypeIs); - } - - /// - /// Creates a that compares run-time type identity. - /// - /// An to set the property equal to. - /// A to set the property equal to. - /// A for which the property is equal to and for which the and properties are set to the specified values. - public static TypeBinaryExpression TypeEqual(Expression expression, Type type) { - RequiresCanRead(expression, "expression"); - ContractUtils.RequiresNotNull(type, "type"); - if (type.IsByRef) throw Error.TypeMustNotBeByRef(); - - return new TypeBinaryExpression(expression, type, ExpressionType.TypeEqual); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeUtils.cs deleted file mode 100644 index 41a30c1007d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/TypeUtils.cs +++ /dev/null @@ -1,715 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif - -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; - -namespace System.Dynamic.Utils { - - internal static class TypeUtils { - private const BindingFlags AnyStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; - internal const MethodAttributes PublicStatic = MethodAttributes.Public | MethodAttributes.Static; - - internal static Type GetNonNullableType(this Type type) { - if (IsNullableType(type)) { - return type.GetGenericArguments()[0]; - } - return type; - } - - internal static Type GetNullableType(Type type) { - Debug.Assert(type != null, "type cannot be null"); - if (type.IsValueType && !IsNullableType(type)) { - return typeof(Nullable<>).MakeGenericType(type); - } - return type; - } - - internal static bool IsNullableType(this Type type) { - return type.IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>); - } - - internal static bool IsBool(Type type) { - return GetNonNullableType(type) == typeof(bool); - } - - internal static bool IsNumeric(Type type) { - type = GetNonNullableType(type); - if (!type.IsEnum) { - switch (Type.GetTypeCode(type)) { - case TypeCode.Char: - case TypeCode.SByte: - case TypeCode.Byte: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.Double: - case TypeCode.Single: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - } - } - return false; - } - - internal static bool IsInteger(Type type) { - type = GetNonNullableType(type); - if (type.IsEnum) { - return false; - } - switch (Type.GetTypeCode(type)) { - case TypeCode.Byte: - case TypeCode.SByte: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - default: - return false; - } - } - - - internal static bool IsArithmetic(Type type) { - type = GetNonNullableType(type); - if (!type.IsEnum) { - switch (Type.GetTypeCode(type)) { - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.Double: - case TypeCode.Single: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - } - } - return false; - } - - internal static bool IsUnsignedInt(Type type) { - type = GetNonNullableType(type); - if (!type.IsEnum) { - switch (Type.GetTypeCode(type)) { - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - } - } - return false; - } - - internal static bool IsIntegerOrBool(Type type) { - type = GetNonNullableType(type); - if (!type.IsEnum) { - switch (Type.GetTypeCode(type)) { - case TypeCode.Int64: - case TypeCode.Int32: - case TypeCode.Int16: - case TypeCode.UInt64: - case TypeCode.UInt32: - case TypeCode.UInt16: - case TypeCode.Boolean: - case TypeCode.SByte: - case TypeCode.Byte: - return true; - } - } - return false; - } - - internal static bool AreEquivalent(Type t1, Type t2) { -#if FEATURE_TYPE_EQUIVALENCE - return t1 == t2 || t1.IsEquivalentTo(t2); -#else - return t1 == t2; -#endif - } - - internal static bool AreReferenceAssignable(Type dest, Type src) { - // WARNING: This actually implements "Is this identity assignable and/or reference assignable?" - if (AreEquivalent(dest, src)) { - return true; - } - if (!dest.IsValueType && !src.IsValueType && dest.IsAssignableFrom(src)) { - return true; - } - return false; - } - - // Checks if the type is a valid target for an instance call - internal static bool IsValidInstanceType(MemberInfo member, Type instanceType) { - Type targetType = member.DeclaringType; - if (AreReferenceAssignable(targetType, instanceType)) { - return true; - } - if (instanceType.IsValueType) { - if (AreReferenceAssignable(targetType, typeof(System.Object))) { - return true; - } - if (AreReferenceAssignable(targetType, typeof(System.ValueType))) { - return true; - } - if (instanceType.IsEnum && AreReferenceAssignable(targetType, typeof(System.Enum))) { - return true; - } - // A call to an interface implemented by a struct is legal whether the struct has - // been boxed or not. - if (targetType.IsInterface) { - foreach (Type interfaceType in instanceType.GetInterfaces()) { - if (AreReferenceAssignable(targetType, interfaceType)) { - return true; - } - } - } - } - return false; - } - - internal static bool HasIdentityPrimitiveOrNullableConversion(Type source, Type dest) { - Debug.Assert(source != null && dest != null); - - // Identity conversion - if (AreEquivalent(source, dest)) { - return true; - } - - // Nullable conversions - if (IsNullableType(source) && AreEquivalent(dest, GetNonNullableType(source))) { - return true; - } - if (IsNullableType(dest) && AreEquivalent(source, GetNonNullableType(dest))) { - return true; - } - // Primitive runtime conversions - // All conversions amongst enum, bool, char, integer and float types - // (and their corresponding nullable types) are legal except for - // nonbool==>bool and nonbool==>bool? - // Since we have already covered bool==>bool, bool==>bool?, etc, above, - // we can just disallow having a bool or bool? destination type here. - if (IsConvertible(source) && IsConvertible(dest) && GetNonNullableType(dest) != typeof(bool)) { - return true; - } - return false; - } - - internal static bool HasReferenceConversion(Type source, Type dest) { - Debug.Assert(source != null && dest != null); - - // void -> void conversion is handled elsewhere - // (it's an identity conversion) - // All other void conversions are disallowed. - if (source == typeof(void) || dest == typeof(void)) { - return false; - } - - Type nnSourceType = TypeUtils.GetNonNullableType(source); - Type nnDestType = TypeUtils.GetNonNullableType(dest); - - // Down conversion - if (nnSourceType.IsAssignableFrom(nnDestType)) { - return true; - } - // Up conversion - if (nnDestType.IsAssignableFrom(nnSourceType)) { - return true; - } - // Interface conversion - if (source.IsInterface || dest.IsInterface) { - return true; - } - // Variant delegate conversion - if (IsLegalExplicitVariantDelegateConversion(source, dest)) - return true; - - // Object conversion - if (source == typeof(object) || dest == typeof(object)) { - return true; - } - return false; - } - - private static bool IsCovariant(Type t) - { - Debug.Assert(t != null); - return 0 != (t.GenericParameterAttributes & GenericParameterAttributes.Covariant); - } - - private static bool IsContravariant(Type t) - { - Debug.Assert(t != null); - return 0 != (t.GenericParameterAttributes & GenericParameterAttributes.Contravariant); - } - - private static bool IsInvariant(Type t) - { - Debug.Assert(t != null); - return 0 == (t.GenericParameterAttributes & GenericParameterAttributes.VarianceMask); - } - - private static bool IsDelegate(Type t) - { - Debug.Assert(t != null); - return t.IsSubclassOf(typeof(System.MulticastDelegate)); - } - - internal static bool IsLegalExplicitVariantDelegateConversion(Type source, Type dest) - { - Debug.Assert(source != null && dest != null); - - // There *might* be a legal conversion from a generic delegate type S to generic delegate type T, - // provided all of the follow are true: - // o Both types are constructed generic types of the same generic delegate type, D. - // That is, S = D, T = D. - // o If type parameter Xi is declared to be invariant then Si must be identical to Ti. - // o If type parameter Xi is declared to be covariant ("out") then Si must be convertible - // to Ti via an identify conversion, implicit reference conversion, or explicit reference conversion. - // o If type parameter Xi is declared to be contravariant ("in") then either Si must be identical to Ti, - // or Si and Ti must both be reference types. - - if (!IsDelegate(source) || !IsDelegate(dest) || !source.IsGenericType || !dest.IsGenericType) - return false; - - Type genericDelegate = source.GetGenericTypeDefinition(); - - if (dest.GetGenericTypeDefinition() != genericDelegate) - return false; - - Type[] genericParameters = genericDelegate.GetGenericArguments(); - Type[] sourceArguments = source.GetGenericArguments(); - Type[] destArguments = dest.GetGenericArguments(); - - Debug.Assert(genericParameters != null); - Debug.Assert(sourceArguments != null); - Debug.Assert(destArguments != null); - Debug.Assert(genericParameters.Length == sourceArguments.Length); - Debug.Assert(genericParameters.Length == destArguments.Length); - - for (int iParam = 0; iParam < genericParameters.Length; ++iParam) - { - Type sourceArgument = sourceArguments[iParam]; - Type destArgument = destArguments[iParam]; - - Debug.Assert(sourceArgument != null && destArgument != null); - - // If the arguments are identical then this one is automatically good, so skip it. - if (AreEquivalent(sourceArgument, destArgument)) - { - continue; - } - - Type genericParameter = genericParameters[iParam]; - - Debug.Assert(genericParameter != null); - - if (IsInvariant(genericParameter)) - { - return false; - } - - if (IsCovariant(genericParameter)) - { - if (!HasReferenceConversion(sourceArgument, destArgument)) - { - return false; - } - } - else if (IsContravariant(genericParameter)) - { - if (sourceArgument.IsValueType || destArgument.IsValueType) - { - return false; - } - } - } - return true; - } - - internal static bool IsConvertible(Type type) { - type = GetNonNullableType(type); - if (type.IsEnum) { - return true; - } - switch (Type.GetTypeCode(type)) { - case TypeCode.Boolean: - case TypeCode.Byte: - case TypeCode.SByte: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Char: - return true; - default: - return false; - } - } - - internal static bool HasReferenceEquality(Type left, Type right) { - if (left.IsValueType || right.IsValueType) { - return false; - } - - // If we have an interface and a reference type then we can do - // reference equality. - - // If we have two reference types and one is assignable to the - // other then we can do reference equality. - - return left.IsInterface || right.IsInterface || - AreReferenceAssignable(left, right) || - AreReferenceAssignable(right, left); - } - - internal static bool HasBuiltInEqualityOperator(Type left, Type right) { - // If we have an interface and a reference type then we can do - // reference equality. - if (left.IsInterface && !right.IsValueType) { - return true; - } - if (right.IsInterface && !left.IsValueType) { - return true; - } - // If we have two reference types and one is assignable to the - // other then we can do reference equality. - if (!left.IsValueType && !right.IsValueType) { - if (AreReferenceAssignable(left, right) || AreReferenceAssignable(right, left)) { - return true; - } - } - // Otherwise, if the types are not the same then we definitely - // do not have a built-in equality operator. - if (!AreEquivalent(left, right)) { - return false; - } - // We have two identical value types, modulo nullability. (If they were both the - // same reference type then we would have returned true earlier.) - Debug.Assert(left.IsValueType); - // Equality between struct types is only defined for numerics, bools, enums, - // and their nullable equivalents. - Type nnType = GetNonNullableType(left); - if (nnType == typeof(bool) || IsNumeric(nnType) || nnType.IsEnum) { - return true; - } - return false; - } - - internal static bool IsImplicitlyConvertible(Type source, Type destination) { - return AreEquivalent(source, destination) || // identity conversion - IsImplicitNumericConversion(source, destination) || - IsImplicitReferenceConversion(source, destination) || - IsImplicitBoxingConversion(source, destination) || - IsImplicitNullableConversion(source, destination); - } - - - internal static MethodInfo GetUserDefinedCoercionMethod(Type convertFrom, Type convertToType, bool implicitOnly) { - // check for implicit coercions first - Type nnExprType = TypeUtils.GetNonNullableType(convertFrom); - Type nnConvType = TypeUtils.GetNonNullableType(convertToType); - // try exact match on types - MethodInfo[] eMethods = nnExprType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); - MethodInfo method = FindConversionOperator(eMethods, convertFrom, convertToType, implicitOnly); - if (method != null) { - return method; - } - MethodInfo[] cMethods = nnConvType.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); - method = FindConversionOperator(cMethods, convertFrom, convertToType, implicitOnly); - if (method != null) { - return method; - } - // try lifted conversion - if (!TypeUtils.AreEquivalent(nnExprType, convertFrom) || - !TypeUtils.AreEquivalent(nnConvType, convertToType)) { - method = FindConversionOperator(eMethods, nnExprType, nnConvType, implicitOnly); - if (method == null) { - method = FindConversionOperator(cMethods, nnExprType, nnConvType, implicitOnly); - } - if (method != null) { - return method; - } - } - return null; - } - - internal static MethodInfo FindConversionOperator(MethodInfo[] methods, Type typeFrom, Type typeTo, bool implicitOnly) { - foreach (MethodInfo mi in methods) { - if (mi.Name != "op_Implicit" && (implicitOnly || mi.Name != "op_Explicit")) { - continue; - } - if (!TypeUtils.AreEquivalent(mi.ReturnType, typeTo)) { - continue; - } - ParameterInfo[] pis = mi.GetParametersCached(); - if (!TypeUtils.AreEquivalent(pis[0].ParameterType, typeFrom)) { - continue; - } - return mi; - } - return null; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private static bool IsImplicitNumericConversion(Type source, Type destination) { - TypeCode tcSource = Type.GetTypeCode(source); - TypeCode tcDest = Type.GetTypeCode(destination); - - switch (tcSource) { - case TypeCode.SByte: - switch (tcDest) { - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Decimal: - return true; - } - return false; - case TypeCode.Byte: - switch (tcDest) { - case TypeCode.Int16: - case TypeCode.UInt16: - case TypeCode.Int32: - case TypeCode.UInt32: - case TypeCode.Int64: - case TypeCode.UInt64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Decimal: - return true; - } - return false; - case TypeCode.Int16: - switch (tcDest) { - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Decimal: - return true; - } - return false; - case TypeCode.UInt16: - switch (tcDest) { - case TypeCode.Int32: - case TypeCode.UInt32: - case TypeCode.Int64: - case TypeCode.UInt64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Decimal: - return true; - } - return false; - case TypeCode.Int32: - switch (tcDest) { - case TypeCode.Int64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Decimal: - return true; - } - return false; - case TypeCode.UInt32: - switch (tcDest) { - case TypeCode.UInt32: - case TypeCode.UInt64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Decimal: - return true; - } - return false; - case TypeCode.Int64: - case TypeCode.UInt64: - switch (tcDest) { - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Decimal: - return true; - } - return false; - case TypeCode.Char: - switch (tcDest) { - case TypeCode.UInt16: - case TypeCode.Int32: - case TypeCode.UInt32: - case TypeCode.Int64: - case TypeCode.UInt64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Decimal: - return true; - } - return false; - case TypeCode.Single: - return (tcDest == TypeCode.Double); - } - return false; - } - - private static bool IsImplicitReferenceConversion(Type source, Type destination) { - return destination.IsAssignableFrom(source); - } - - private static bool IsImplicitBoxingConversion(Type source, Type destination) { - if (source.IsValueType && (destination == typeof(object) || destination == typeof(System.ValueType))) - return true; - if (source.IsEnum && destination == typeof(System.Enum)) - return true; - return false; - } - - private static bool IsImplicitNullableConversion(Type source, Type destination) { - if (IsNullableType(destination)) - return IsImplicitlyConvertible(GetNonNullableType(source), GetNonNullableType(destination)); - return false; - } - - internal static bool IsSameOrSubclass(Type type, Type subType) { - return AreEquivalent(type, subType) || subType.IsSubclassOf(type); - } - - internal static void ValidateType(Type type) { - if (type.IsGenericTypeDefinition) { - throw Error.TypeIsGeneric(type); - } - if (type.ContainsGenericParameters) { - throw Error.TypeContainsGenericParameters(type); - } - } - - //from TypeHelper - internal static Type FindGenericType(Type definition, Type type) { - while (type != null && type != typeof(object)) { - if (type.IsGenericType && AreEquivalent(type.GetGenericTypeDefinition(), definition)) { - return type; - } - if (definition.IsInterface) { - foreach (Type itype in type.GetInterfaces()) { - Type found = FindGenericType(definition, itype); - if (found != null) - return found; - } - } - type = type.BaseType; - } - return null; - } - - internal static bool IsUnsigned(Type type) { - type = GetNonNullableType(type); - switch (Type.GetTypeCode(type)) { - case TypeCode.Byte: - case TypeCode.UInt16: - case TypeCode.Char: - case TypeCode.UInt32: - case TypeCode.UInt64: - return true; - default: - return false; - } - } - - internal static bool IsFloatingPoint(Type type) { - type = GetNonNullableType(type); - switch (Type.GetTypeCode(type)) { - case TypeCode.Single: - case TypeCode.Double: - return true; - default: - return false; - } - } - - /// - /// Searches for an operator method on the type. The method must have - /// the specified signature, no generic arguments, and have the - /// SpecialName bit set. Also searches inherited operator methods. - /// - /// NOTE: This was designed to satisfy the needs of op_True and - /// op_False, because we have to do runtime lookup for those. It may - /// not work right for unary operators in general. - /// - internal static MethodInfo GetBooleanOperator(Type type, string name) { - do { - MethodInfo result = type.GetMethodValidated(name, AnyStatic, null, new Type[] { type }, null); - if (result != null && result.IsSpecialName && !result.ContainsGenericParameters) { - return result; - } - type = type.BaseType; - } while (type != null); - return null; - } - - internal static Type GetNonRefType(this Type type) { - return type.IsByRef ? type.GetElementType() : type; - } - - private static readonly Assembly _mscorlib = typeof(object).Assembly; - private static readonly Assembly _systemCore = typeof(Expression).Assembly; - - /// - /// We can cache references to types, as long as they aren't in - /// collectable assemblies. Unfortunately, we can't really distinguish - /// between different flavors of assemblies. But, we can at least - /// create a whitelist for types in mscorlib (so we get the primitives) - /// and System.Core (so we find Func/Action overloads, etc). - /// - internal static bool CanCache(this Type t) { - // Note: we don't have to scan base or declaring types here. - // There's no way for a type in mscorlib to derive from or be - // contained in a type from another assembly. The only thing we - // need to look at is the generic arguments, which are the thing - // that allows mscorlib types to be specialized by types in other - // assemblies. - - var asm = t.Assembly; - if (asm != _mscorlib && asm != _systemCore) { - // Not in mscorlib or our assembly - return false; - } - - if (t.IsGenericType) { - foreach (Type g in t.GetGenericArguments()) { - if (!CanCache(g)) { - return false; - } - } - } - - return true; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/UnaryExpression.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/UnaryExpression.cs deleted file mode 100644 index 8cf3b2a6190..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Ast/UnaryExpression.cs +++ /dev/null @@ -1,995 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// Represents an expression that has a unary operator. - /// - [DebuggerTypeProxy(typeof(Expression.UnaryExpressionProxy))] - public sealed class UnaryExpression : Expression { - private readonly Expression _operand; - private readonly MethodInfo _method; - private readonly ExpressionType _nodeType; - private readonly Type _type; - - internal UnaryExpression(ExpressionType nodeType, Expression expression, Type type, MethodInfo method) { - _operand = expression; - _method = method; - _nodeType = nodeType; - _type = type; - } - - /// - /// Gets the static type of the expression that this represents. (Inherited from .) - /// - /// The that represents the static type of the expression. - public sealed override Type Type { - get { return _type; } - } - - /// - /// Returns the node type of this . (Inherited from .) - /// - /// The that represents this expression. - public sealed override ExpressionType NodeType { - get { return _nodeType; } - } - - /// - /// Gets the operand of the unary operation. - /// - /// An that represents the operand of the unary operation. - public Expression Operand { - get { return _operand; } - } - - /// - /// Gets the implementing method for the unary operation. - /// - /// The that represents the implementing method. - public MethodInfo Method { - get { return _method; } - } - - /// - /// Gets a value that indicates whether the expression tree node represents a lifted call to an operator. - /// - /// true if the node represents a lifted call; otherwise, false. - public bool IsLifted { - get { - if (NodeType == ExpressionType.TypeAs || NodeType == ExpressionType.Quote || NodeType == ExpressionType.Throw) { - return false; - } - bool operandIsNullable = TypeUtils.IsNullableType(_operand.Type); - bool resultIsNullable = TypeUtils.IsNullableType(this.Type); - if (_method != null) { - return (operandIsNullable && !TypeUtils.AreEquivalent(_method.GetParametersCached()[0].ParameterType, _operand.Type)) || - (resultIsNullable && !TypeUtils.AreEquivalent(_method.ReturnType, this.Type)); - } - return operandIsNullable || resultIsNullable; - } - } - - /// - /// Gets a value that indicates whether the expression tree node represents a lifted call to an operator whose return type is lifted to a nullable type. - /// - /// true if the operator's return type is lifted to a nullable type; otherwise, false. - public bool IsLiftedToNull { - get { - return IsLifted && TypeUtils.IsNullableType(this.Type); - } - } - - /// - /// Dispatches to the specific visit method for this node type. - /// - protected internal override Expression Accept(ExpressionVisitor visitor) { - return visitor.VisitUnary(this); - } - - /// - /// Gets a value that indicates whether the expression tree node can be reduced. - /// - public override bool CanReduce { - get { - switch (_nodeType) { - case ExpressionType.PreIncrementAssign: - case ExpressionType.PreDecrementAssign: - case ExpressionType.PostIncrementAssign: - case ExpressionType.PostDecrementAssign: - return true; - } - return false; - } - } - - /// - /// Reduces the expression node to a simpler expression. - /// If CanReduce returns true, this should return a valid expression. - /// This method is allowed to return another node which itself - /// must be reduced. - /// - /// The reduced expression. - public override Expression Reduce() { - if (CanReduce) { - switch (_operand.NodeType) { - case ExpressionType.Index: - return ReduceIndex(); - case ExpressionType.MemberAccess: - return ReduceMember(); - default: - return ReduceVariable(); - } - } - return this; - } - - private bool IsPrefix { - get { return _nodeType == ExpressionType.PreIncrementAssign || _nodeType == ExpressionType.PreDecrementAssign; } - } - - private UnaryExpression FunctionalOp(Expression operand) { - ExpressionType functional; - if (_nodeType == ExpressionType.PreIncrementAssign || _nodeType == ExpressionType.PostIncrementAssign) { - functional = ExpressionType.Increment; - } else { - functional = ExpressionType.Decrement; - } - return new UnaryExpression(functional, operand, operand.Type, _method); - } - - private Expression ReduceVariable() { - if (IsPrefix) { - // (op) var - // ... is reduced into ... - // var = op(var) - return Assign(_operand, FunctionalOp(_operand)); - } - // var (op) - // ... is reduced into ... - // temp = var - // var = op(var) - // temp - var temp = Parameter(_operand.Type, null); - return Block( - new[] { temp }, - Assign(temp, _operand), - Assign(_operand, FunctionalOp(temp)), - temp - ); - } - - private Expression ReduceMember() { - var member = (MemberExpression)_operand; - if (member.Expression == null) { - //static member, reduce the same as variable - return ReduceVariable(); - } else { - var temp1 = Parameter(member.Expression.Type, null); - var initTemp1 = Assign(temp1, member.Expression); - member = MakeMemberAccess(temp1, member.Member); - - if (IsPrefix) { - // (op) value.member - // ... is reduced into ... - // temp1 = value - // temp1.member = op(temp1.member) - return Block( - new[] { temp1 }, - initTemp1, - Assign(member, FunctionalOp(member)) - ); - } - - // value.member (op) - // ... is reduced into ... - // temp1 = value - // temp2 = temp1.member - // temp1.member = op(temp2) - // temp2 - var temp2 = Parameter(member.Type, null); - return Block( - new[] { temp1, temp2 }, - initTemp1, - Assign(temp2, member), - Assign(member, FunctionalOp(temp2)), - temp2 - ); - } - } - - private Expression ReduceIndex() { - // left[a0, a1, ... aN] (op) - // - // ... is reduced into ... - // - // tempObj = left - // tempArg0 = a0 - // ... - // tempArgN = aN - // tempValue = tempObj[tempArg0, ... tempArgN] - // tempObj[tempArg0, ... tempArgN] = op(tempValue) - // tempValue - - bool prefix = IsPrefix; - var index = (IndexExpression)_operand; - int count = index.Arguments.Count; - var block = new Expression[count + (prefix ? 2 : 4)]; - var temps = new ParameterExpression[count + (prefix ? 1 : 2)]; - var args = new ParameterExpression[count]; - - int i = 0; - temps[i] = Parameter(index.Object.Type, null); - block[i] = Assign(temps[i], index.Object); - i++; - while (i <= count) { - var arg = index.Arguments[i - 1]; - args[i - 1] = temps[i] = Parameter(arg.Type, null); - block[i] = Assign(temps[i], arg); - i++; - } - index = MakeIndex(temps[0], index.Indexer, new TrueReadOnlyCollection(args)); - if (!prefix) { - var lastTemp = temps[i] = Parameter(index.Type, null); - block[i] = Assign(temps[i], index); - i++; - Debug.Assert(i == temps.Length); - block[i++] = Assign(index, FunctionalOp(lastTemp)); - block[i++] = lastTemp; - } else { - Debug.Assert(i == temps.Length); - block[i++] = Assign(index, FunctionalOp(index)); - } - Debug.Assert(i == block.Length); - return Block(new TrueReadOnlyCollection(temps), new TrueReadOnlyCollection(block)); - } - - /// - /// Creates a new expression that is like this one, but using the - /// supplied children. If all of the children are the same, it will - /// return this expression. - /// - /// The property of the result. - /// This expression if no children changed, or an expression with the updated children. - public UnaryExpression Update(Expression operand) { - if (operand == Operand) { - return this; - } - return Expression.MakeUnary(NodeType, operand, Type, Method); - } - } - - public partial class Expression { - - /// - /// Creates a , given an operand, by calling the appropriate factory method. - /// - /// The that specifies the type of unary operation. - /// An that represents the operand. - /// The that specifies the type to be converted to (pass null if not applicable). - /// The that results from calling the appropriate factory method. - /// Thrown when does not correspond to a unary expression. - /// Thrown when is null. - public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type) { - return MakeUnary(unaryType, operand, type, null); - } - - /// - /// Creates a , given an operand and implementing method, by calling the appropriate factory method. - /// - /// The that specifies the type of unary operation. - /// An that represents the operand. - /// The that specifies the type to be converted to (pass null if not applicable). - /// The that represents the implementing method. - /// The that results from calling the appropriate factory method. - /// Thrown when does not correspond to a unary expression. - /// Thrown when is null. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - public static UnaryExpression MakeUnary(ExpressionType unaryType, Expression operand, Type type, MethodInfo method) { - switch (unaryType) { - case ExpressionType.Negate: - return Negate(operand, method); - case ExpressionType.NegateChecked: - return NegateChecked(operand, method); - case ExpressionType.Not: - return Not(operand, method); - case ExpressionType.IsFalse: - return IsFalse(operand, method); - case ExpressionType.IsTrue: - return IsTrue(operand, method); - case ExpressionType.OnesComplement: - return OnesComplement(operand, method); - case ExpressionType.ArrayLength: - return ArrayLength(operand); - case ExpressionType.Convert: - return Convert(operand, type, method); - case ExpressionType.ConvertChecked: - return ConvertChecked(operand, type, method); - case ExpressionType.Throw: - return Throw(operand, type); - case ExpressionType.TypeAs: - return TypeAs(operand, type); - case ExpressionType.Quote: - return Quote(operand); - case ExpressionType.UnaryPlus: - return UnaryPlus(operand, method); - case ExpressionType.Unbox: - return Unbox(operand, type); - case ExpressionType.Increment: - return Increment(operand, method); - case ExpressionType.Decrement: - return Decrement(operand, method); - case ExpressionType.PreIncrementAssign: - return PreIncrementAssign(operand, method); - case ExpressionType.PostIncrementAssign: - return PostIncrementAssign(operand, method); - case ExpressionType.PreDecrementAssign: - return PreDecrementAssign(operand, method); - case ExpressionType.PostDecrementAssign: - return PostDecrementAssign(operand, method); - default: - throw Error.UnhandledUnary(unaryType); - } - } - - private static UnaryExpression GetUserDefinedUnaryOperatorOrThrow(ExpressionType unaryType, string name, Expression operand) { - UnaryExpression u = GetUserDefinedUnaryOperator(unaryType, name, operand); - if (u != null) { - ValidateParamswithOperandsOrThrow(u.Method.GetParametersCached()[0].ParameterType, operand.Type, unaryType, name); - return u; - } - throw Error.UnaryOperatorNotDefined(unaryType, operand.Type); - } - - private static UnaryExpression GetUserDefinedUnaryOperator(ExpressionType unaryType, string name, Expression operand) { - Type operandType = operand.Type; - Type[] types = new Type[] { operandType }; - Type nnOperandType = TypeUtils.GetNonNullableType(operandType); - BindingFlags flags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; - MethodInfo method = nnOperandType.GetMethodValidated(name, flags, null, types, null); - if (method != null) { - return new UnaryExpression(unaryType, operand, method.ReturnType, method); - } - // try lifted call - if (TypeUtils.IsNullableType(operandType)) { - types[0] = nnOperandType; - method = nnOperandType.GetMethodValidated(name, flags, null, types, null); - if (method != null && method.ReturnType.IsValueType && !TypeUtils.IsNullableType(method.ReturnType)) { - return new UnaryExpression(unaryType, operand, TypeUtils.GetNullableType(method.ReturnType), method); - } - } - return null; - } - - private static UnaryExpression GetMethodBasedUnaryOperator(ExpressionType unaryType, Expression operand, MethodInfo method) { - System.Diagnostics.Debug.Assert(method != null); - ValidateOperator(method); - ParameterInfo[] pms = method.GetParametersCached(); - if (pms.Length != 1) - throw Error.IncorrectNumberOfMethodCallArguments(method); - if (ParameterIsAssignable(pms[0], operand.Type)) { - ValidateParamswithOperandsOrThrow(pms[0].ParameterType, operand.Type, unaryType, method.Name); - return new UnaryExpression(unaryType, operand, method.ReturnType, method); - } - // check for lifted call - if (TypeUtils.IsNullableType(operand.Type) && - ParameterIsAssignable(pms[0], TypeUtils.GetNonNullableType(operand.Type)) && - method.ReturnType.IsValueType && !TypeUtils.IsNullableType(method.ReturnType)) { - return new UnaryExpression(unaryType, operand, TypeUtils.GetNullableType(method.ReturnType), method); - } - - throw Error.OperandTypesDoNotMatchParameters(unaryType, method.Name); - } - - private static UnaryExpression GetUserDefinedCoercionOrThrow(ExpressionType coercionType, Expression expression, Type convertToType) { - UnaryExpression u = GetUserDefinedCoercion(coercionType, expression, convertToType); - if (u != null) { - return u; - } - throw Error.CoercionOperatorNotDefined(expression.Type, convertToType); - } - - private static UnaryExpression GetUserDefinedCoercion(ExpressionType coercionType, Expression expression, Type convertToType) { - MethodInfo method = TypeUtils.GetUserDefinedCoercionMethod(expression.Type, convertToType, false); - if (method != null) { - return new UnaryExpression(coercionType, expression, convertToType, method); - } else { - return null; - } - } - - private static UnaryExpression GetMethodBasedCoercionOperator(ExpressionType unaryType, Expression operand, Type convertToType, MethodInfo method) { - System.Diagnostics.Debug.Assert(method != null); - ValidateOperator(method); - ParameterInfo[] pms = method.GetParametersCached(); - if (pms.Length != 1) { - throw Error.IncorrectNumberOfMethodCallArguments(method); - } - if (ParameterIsAssignable(pms[0], operand.Type) && TypeUtils.AreEquivalent(method.ReturnType, convertToType)) { - return new UnaryExpression(unaryType, operand, method.ReturnType, method); - } - // check for lifted call - if ((TypeUtils.IsNullableType(operand.Type) || TypeUtils.IsNullableType(convertToType)) && - ParameterIsAssignable(pms[0], TypeUtils.GetNonNullableType(operand.Type)) && - TypeUtils.AreEquivalent(method.ReturnType, TypeUtils.GetNonNullableType(convertToType))) { - return new UnaryExpression(unaryType, operand, convertToType, method); - } - throw Error.OperandTypesDoNotMatchParameters(unaryType, method.Name); - } - - /// - /// Creates a that represents an arithmetic negation operation. - /// - /// An to set the property equal to. - /// A that has the property equal to and the properties set to the specified value. - /// Thrown when is null. - /// Thrown when the unary minus operator is not defined for - public static UnaryExpression Negate(Expression expression) { - return Negate(expression, null); - } - - /// - /// Creates a that represents an arithmetic negation operation. - /// - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to and the and properties set to the specified value. - /// Thrown when is null. - /// Thrown when is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument. - /// Thown when is null and the unary minus operator is not defined for expression.Type or expression.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by method. - public static UnaryExpression Negate(Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - if (method == null) { - if (TypeUtils.IsArithmetic(expression.Type) && !TypeUtils.IsUnsignedInt(expression.Type)) { - return new UnaryExpression(ExpressionType.Negate, expression, expression.Type, null); - } - return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.Negate, "op_UnaryNegation", expression); - } - return GetMethodBasedUnaryOperator(ExpressionType.Negate, expression, method); - } - - /// - /// Creates a that represents a unary plus operation. - /// - /// An to set the property equal to. - /// A that has the property equal to and the property set to the specified value. - /// Thrown when is null. - /// Thown when the unary minus operator is not defined for expression.Type. - public static UnaryExpression UnaryPlus(Expression expression) { - return UnaryPlus(expression, null); - } - - /// - /// Creates a that represents a unary plus operation. - /// - /// An to set the property equal to. - /// A to set the property equal to. - /// A that has the property equal to and the and property set to the specified value. - /// Thrown when is null. - /// Thrown when is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument. - /// Thown when is null and the unary minus operator is not defined for expression.Type or expression.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by method. - public static UnaryExpression UnaryPlus(Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - if (method == null) { - if (TypeUtils.IsArithmetic(expression.Type)) { - return new UnaryExpression(ExpressionType.UnaryPlus, expression, expression.Type, null); - } - return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.UnaryPlus, "op_UnaryPlus", expression); - } - return GetMethodBasedUnaryOperator(ExpressionType.UnaryPlus, expression, method); - } - - /// Creates a that represents an arithmetic negation operation that has overflow checking. - /// A that has the property equal to and the property set to the specified value. - /// An to set the property equal to. - /// - /// Thrown when is null. - /// Thrown when the unary minus operator is not defined for .Type. - public static UnaryExpression NegateChecked(Expression expression) { - return NegateChecked(expression, null); - } - - ///Creates a that represents an arithmetic negation operation that has overflow checking. The implementing method can be specified. - ///A that has the property equal to and the and properties set to the specified values. - ///An to set the property equal to. - ///A to set the property equal to. - /// - /// is null. - /// - /// is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument. - /// - /// is null and the unary minus operator is not defined for .Type.-or-.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by . - public static UnaryExpression NegateChecked(Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - if (method == null) { - if (TypeUtils.IsArithmetic(expression.Type) && !TypeUtils.IsUnsignedInt(expression.Type)) { - return new UnaryExpression(ExpressionType.NegateChecked, expression, expression.Type, null); - } - return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.NegateChecked, "op_UnaryNegation", expression); - } - return GetMethodBasedUnaryOperator(ExpressionType.NegateChecked, expression, method); - } - - ///Creates a that represents a bitwise complement operation. - ///A that has the property equal to and the property set to the specified value. - ///An to set the property equal to. - /// - /// is null. - ///The unary not operator is not defined for .Type. - public static UnaryExpression Not(Expression expression) { - return Not(expression, null); - } - - ///Creates a that represents a bitwise complement operation. The implementing method can be specified. - ///A that has the property equal to and the and properties set to the specified values. - ///An to set the property equal to. - ///A to set the property equal to. - /// - /// is null. - /// - /// is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument. - /// - /// is null and the unary not operator is not defined for .Type.-or-.Type (or its corresponding non-nullable type if it is a nullable value type) is not assignable to the argument type of the method represented by . - public static UnaryExpression Not(Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - if (method == null) { - if (TypeUtils.IsIntegerOrBool(expression.Type)) { - return new UnaryExpression(ExpressionType.Not, expression, expression.Type, null); - } - UnaryExpression u = GetUserDefinedUnaryOperator(ExpressionType.Not, "op_LogicalNot", expression); - if (u != null) { - return u; - } - return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.Not, "op_OnesComplement", expression); - } - return GetMethodBasedUnaryOperator(ExpressionType.Not, expression, method); - } - - /// - /// Returns whether the expression evaluates to false. - /// - /// An to evaluate. - /// An instance of . - public static UnaryExpression IsFalse(Expression expression) { - return IsFalse(expression, null); - } - - /// - /// Returns whether the expression evaluates to false. - /// - ///An to evaluate. - ///A that represents the implementing method. - /// An instance of . - public static UnaryExpression IsFalse(Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - if (method == null) { - if (TypeUtils.IsBool(expression.Type)) { - return new UnaryExpression(ExpressionType.IsFalse, expression, expression.Type, null); - } - return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.IsFalse, "op_False", expression); - } - return GetMethodBasedUnaryOperator(ExpressionType.IsFalse, expression, method); - } - - /// - /// Returns whether the expression evaluates to true. - /// - /// An to evaluate. - /// An instance of . - public static UnaryExpression IsTrue(Expression expression) { - return IsTrue(expression, null); - } - - /// - /// Returns whether the expression evaluates to true. - /// - ///An to evaluate. - ///A that represents the implementing method. - /// An instance of . - public static UnaryExpression IsTrue(Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - if (method == null) { - if (TypeUtils.IsBool(expression.Type)) { - return new UnaryExpression(ExpressionType.IsTrue, expression, expression.Type, null); - } - return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.IsTrue, "op_True", expression); - } - return GetMethodBasedUnaryOperator(ExpressionType.IsTrue, expression, method); - } - - /// - /// Returns the expression representing the ones complement. - /// - ///An . - /// An instance of . - public static UnaryExpression OnesComplement(Expression expression) { - return OnesComplement(expression, null); - } - - /// - /// Returns the expression representing the ones complement. - /// - /// An . - /// A that represents the implementing method. - /// An instance of . - public static UnaryExpression OnesComplement(Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - if (method == null) { - if (TypeUtils.IsInteger(expression.Type)) { - return new UnaryExpression(ExpressionType.OnesComplement, expression, expression.Type, null); - } - return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.OnesComplement, "op_OnesComplement", expression); - } - return GetMethodBasedUnaryOperator(ExpressionType.OnesComplement, expression, method); - } - - ///Creates a that represents an explicit reference or boxing conversion where null is supplied if the conversion fails. - ///A that has the property equal to and the and properties set to the specified values. - ///An to set the property equal to. - ///A to set the property equal to. - /// - /// or is null. - public static UnaryExpression TypeAs(Expression expression, Type type) { - RequiresCanRead(expression, "expression"); - ContractUtils.RequiresNotNull(type, "type"); - TypeUtils.ValidateType(type); - - if (type.IsValueType && !TypeUtils.IsNullableType(type)) { - throw Error.IncorrectTypeForTypeAs(type); - } - return new UnaryExpression(ExpressionType.TypeAs, expression, type, null); - } - - /// - /// Creates a that represents an explicit unboxing. - /// - /// An to unbox. - /// The new of the expression. - /// An instance of . - public static UnaryExpression Unbox(Expression expression, Type type) { - RequiresCanRead(expression, "expression"); - ContractUtils.RequiresNotNull(type, "type"); - if (!expression.Type.IsInterface && expression.Type != typeof(object)) { - throw Error.InvalidUnboxType(); - } - if (!type.IsValueType) throw Error.InvalidUnboxType(); - TypeUtils.ValidateType(type); - return new UnaryExpression(ExpressionType.Unbox, expression, type, null); - } - - ///Creates a that represents a conversion operation. - ///A that has the property equal to and the and properties set to the specified values. - ///An to set the property equal to. - ///A to set the property equal to. - /// - /// or is null. - ///No conversion operator is defined between .Type and . - public static UnaryExpression Convert(Expression expression, Type type) { - return Convert(expression, type, null); - } - - ///Creates a that represents a conversion operation for which the implementing method is specified. - ///A that has the property equal to and the , , and properties set to the specified values. - ///An to set the property equal to. - ///A to set the property equal to. - ///A to set the property equal to. - /// - /// or is null. - /// - /// is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument. - ///More than one method that matches the description was found. - ///No conversion operator is defined between .Type and .-or-.Type is not assignable to the argument type of the method represented by .-or-The return type of the method represented by is not assignable to .-or-.Type or is a nullable value type and the corresponding non-nullable value type does not equal the argument type or the return type, respectively, of the method represented by . - public static UnaryExpression Convert(Expression expression, Type type, MethodInfo method) { - RequiresCanRead(expression, "expression"); - ContractUtils.RequiresNotNull(type, "type"); - TypeUtils.ValidateType(type); - - if (method == null) { - if (TypeUtils.HasIdentityPrimitiveOrNullableConversion(expression.Type, type) || - TypeUtils.HasReferenceConversion(expression.Type, type)) { - return new UnaryExpression(ExpressionType.Convert, expression, type, null); - } - return GetUserDefinedCoercionOrThrow(ExpressionType.Convert, expression, type); - } - return GetMethodBasedCoercionOperator(ExpressionType.Convert, expression, type, method); - } - - ///Creates a that represents a conversion operation that throws an exception if the target type is overflowed. - ///A that has the property equal to and the and properties set to the specified values. - ///An to set the property equal to. - ///A to set the property equal to. - /// - /// or is null. - ///No conversion operator is defined between .Type and . - public static UnaryExpression ConvertChecked(Expression expression, Type type) { - return ConvertChecked(expression, type, null); - } - - ///Creates a that represents a conversion operation that throws an exception if the target type is overflowed and for which the implementing method is specified. - ///A that has the property equal to and the , , and properties set to the specified values. - ///An to set the property equal to. - ///A to set the property equal to. - ///A to set the property equal to. - /// - /// or is null. - /// - /// is not null and the method it represents returns void, is not static (Shared in Visual Basic), or does not take exactly one argument. - ///More than one method that matches the description was found. - ///No conversion operator is defined between .Type and .-or-.Type is not assignable to the argument type of the method represented by .-or-The return type of the method represented by is not assignable to .-or-.Type or is a nullable value type and the corresponding non-nullable value type does not equal the argument type or the return type, respectively, of the method represented by . - public static UnaryExpression ConvertChecked(Expression expression, Type type, MethodInfo method) { - RequiresCanRead(expression, "expression"); - ContractUtils.RequiresNotNull(type, "type"); - TypeUtils.ValidateType(type); - - if (method == null) { - if (TypeUtils.HasIdentityPrimitiveOrNullableConversion(expression.Type, type)) { - return new UnaryExpression(ExpressionType.ConvertChecked, expression, type, null); - } - if (TypeUtils.HasReferenceConversion(expression.Type, type)) { - return new UnaryExpression(ExpressionType.Convert, expression, type, null); - } - return GetUserDefinedCoercionOrThrow(ExpressionType.ConvertChecked, expression, type); - } - return GetMethodBasedCoercionOperator(ExpressionType.ConvertChecked, expression, type, method); - } - - ///Creates a that represents getting the length of a one-dimensional array. - ///A that has the property equal to and the property equal to . - ///An to set the property equal to. - /// - /// is null. - /// - ///.Type does not represent an array type. - public static UnaryExpression ArrayLength(Expression array) { - ContractUtils.RequiresNotNull(array, "array"); - if (!array.Type.IsArray || !typeof(Array).IsAssignableFrom(array.Type)) { - throw Error.ArgumentMustBeArray(); - } - if (array.Type.GetArrayRank() != 1) { - throw Error.ArgumentMustBeSingleDimensionalArrayType(); - } - return new UnaryExpression(ExpressionType.ArrayLength, array, typeof(int), null); - } - - ///Creates a that represents an expression that has a constant value of type . - ///A that has the property equal to and the property set to the specified value. - ///An to set the property equal to. - /// - /// is null. - public static UnaryExpression Quote(Expression expression) { - RequiresCanRead(expression, "expression"); - bool validQuote = expression is LambdaExpression; - if (!validQuote) throw Error.QuotedExpressionMustBeLambda(); - return new UnaryExpression(ExpressionType.Quote, expression, expression.GetType(), null); - } - - /// - /// Creates a that represents a rethrowing of an exception. - /// - /// A that represents a rethrowing of an exception. - public static UnaryExpression Rethrow() { - return Throw(null); - } - - /// - /// Creates a that represents a rethrowing of an exception with a given type. - /// - ///The new of the expression. - /// A that represents a rethrowing of an exception. - public static UnaryExpression Rethrow(Type type) { - return Throw(null, type); - } - - /// - /// Creates a that represents a throwing of an exception. - /// - /// An . - /// A that represents the exception. - public static UnaryExpression Throw(Expression value) { - return Throw(value, typeof(void)); - } - - /// - /// Creates a that represents a throwing of a value with a given type. - /// - /// An . - /// The new of the expression. - /// A that represents the exception. - public static UnaryExpression Throw(Expression value, Type type) { - ContractUtils.RequiresNotNull(type, "type"); - TypeUtils.ValidateType(type); - - if (value != null) { - RequiresCanRead(value, "value"); - if (value.Type.IsValueType) throw Error.ArgumentMustNotHaveValueType(); - } - return new UnaryExpression(ExpressionType.Throw, value, type, null); - } - - /// - /// Creates a that represents the incrementing of the expression by 1. - /// - /// An to increment. - /// A that represents the incremented expression. - public static UnaryExpression Increment(Expression expression) { - return Increment(expression, null); - } - - /// - /// Creates a that represents the incrementing of the expression by 1. - /// - /// An to increment. - ///A that represents the implementing method. - /// A that represents the incremented expression. - public static UnaryExpression Increment(Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - if (method == null) { - if (TypeUtils.IsArithmetic(expression.Type)) { - return new UnaryExpression(ExpressionType.Increment, expression, expression.Type, null); - } - return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.Increment, "op_Increment", expression); - } - return GetMethodBasedUnaryOperator(ExpressionType.Increment, expression, method); - } - - /// - /// Creates a that represents the decrementing of the expression by 1. - /// - /// An to decrement. - /// A that represents the decremented expression. - public static UnaryExpression Decrement(Expression expression) { - return Decrement(expression, null); - } - - /// - /// Creates a that represents the decrementing of the expression by 1. - /// - /// An to decrement. - ///A that represents the implementing method. - /// A that represents the decremented expression. - public static UnaryExpression Decrement(Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - if (method == null) { - if (TypeUtils.IsArithmetic(expression.Type)) { - return new UnaryExpression(ExpressionType.Decrement, expression, expression.Type, null); - } - return GetUserDefinedUnaryOperatorOrThrow(ExpressionType.Decrement, "op_Decrement", expression); - } - return GetMethodBasedUnaryOperator(ExpressionType.Decrement, expression, method); - } - - /// - /// Creates a that increments the expression by 1 - /// and assigns the result back to the expression. - /// - /// An to apply the operations on. - /// A that represents the resultant expression. - public static UnaryExpression PreIncrementAssign(Expression expression) { - return MakeOpAssignUnary(ExpressionType.PreIncrementAssign, expression, null); - - } - - /// - /// Creates a that increments the expression by 1 - /// and assigns the result back to the expression. - /// - /// An to apply the operations on. - /// A that represents the implementing method. - /// A that represents the resultant expression. - public static UnaryExpression PreIncrementAssign(Expression expression, MethodInfo method) { - return MakeOpAssignUnary(ExpressionType.PreIncrementAssign, expression, method); - } - - /// - /// Creates a that decrements the expression by 1 - /// and assigns the result back to the expression. - /// - /// An to apply the operations on. - /// A that represents the resultant expression. - public static UnaryExpression PreDecrementAssign(Expression expression) { - return MakeOpAssignUnary(ExpressionType.PreDecrementAssign, expression, null); - } - - /// - /// Creates a that decrements the expression by 1 - /// and assigns the result back to the expression. - /// - /// An to apply the operations on. - /// A that represents the implementing method. - /// A that represents the resultant expression. - public static UnaryExpression PreDecrementAssign(Expression expression, MethodInfo method) { - return MakeOpAssignUnary(ExpressionType.PreDecrementAssign, expression, method); - } - - /// - /// Creates a that represents the assignment of the expression - /// followed by a subsequent increment by 1 of the original expression. - /// - /// An to apply the operations on. - /// A that represents the resultant expression. - public static UnaryExpression PostIncrementAssign(Expression expression) { - return MakeOpAssignUnary(ExpressionType.PostIncrementAssign, expression, null); - } - - /// - /// Creates a that represents the assignment of the expression - /// followed by a subsequent increment by 1 of the original expression. - /// - /// An to apply the operations on. - /// A that represents the implementing method. - /// A that represents the resultant expression. - public static UnaryExpression PostIncrementAssign(Expression expression, MethodInfo method) { - return MakeOpAssignUnary(ExpressionType.PostIncrementAssign, expression, method); - } - - /// - /// Creates a that represents the assignment of the expression - /// followed by a subsequent decrement by 1 of the original expression. - /// - /// An to apply the operations on. - /// A that represents the resultant expression. - public static UnaryExpression PostDecrementAssign(Expression expression) { - return MakeOpAssignUnary(ExpressionType.PostDecrementAssign, expression, null); - } - - /// - /// Creates a that represents the assignment of the expression - /// followed by a subsequent decrement by 1 of the original expression. - /// - /// An to apply the operations on. - /// A that represents the implementing method. - /// A that represents the resultant expression. - public static UnaryExpression PostDecrementAssign(Expression expression, MethodInfo method) { - return MakeOpAssignUnary(ExpressionType.PostDecrementAssign, expression, method); - } - - private static UnaryExpression MakeOpAssignUnary(ExpressionType kind, Expression expression, MethodInfo method) { - RequiresCanRead(expression, "expression"); - RequiresCanWrite(expression, "expression"); - - UnaryExpression result; - if (method == null) { - if (TypeUtils.IsArithmetic(expression.Type)) { - return new UnaryExpression(kind, expression, expression.Type, null); - } - string name; - if (kind == ExpressionType.PreIncrementAssign || kind == ExpressionType.PostIncrementAssign) { - name = "op_Increment"; - } else { - name = "op_Decrement"; - } - result = GetUserDefinedUnaryOperatorOrThrow(kind, name, expression); - } else { - result = GetMethodBasedUnaryOperator(kind, expression, method); - } - // return type must be assignable back to the operand type - if (!TypeUtils.AreReferenceAssignable(expression.Type, result.Type)) { - throw Error.UserDefinedOpMustHaveValidReturnType(kind, method.Name); - } - return result; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/AnalyzedTree.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/AnalyzedTree.cs deleted file mode 100644 index 9afe053f9ac..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/AnalyzedTree.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections; -using System.Collections.Generic; -using System.Diagnostics.SymbolStore; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - internal sealed class AnalyzedTree { - internal readonly Dictionary Scopes = new Dictionary(); - internal readonly Dictionary Constants = new Dictionary(); - - internal DebugInfoGenerator DebugInfoGenerator { get; set; } - - // Created by VariableBinder - internal AnalyzedTree() { - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/AssemblyGen.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/AssemblyGen.cs deleted file mode 100644 index 2d436e41c7e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/AssemblyGen.cs +++ /dev/null @@ -1,177 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ -#if FEATURE_REFEMIT - -using System; -using System.Collections.Generic; -using System.Dynamic.Utils; -using System.IO; -using System.Reflection; -using System.Reflection.Emit; -using System.Security; -using System.Text; -using System.Threading; - -using Microsoft.Scripting.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - internal sealed class AssemblyGen { - private static AssemblyGen _assembly; - - // Testing options. Only ever set in CLR2 build - // configurations, see SetSaveAssemblies -#if !FEATURE_CORE_DLR - private static string _saveAssembliesPath; - private static bool _saveAssemblies; -#endif - - private readonly AssemblyBuilder _myAssembly; - private readonly ModuleBuilder _myModule; - -#if !FEATURE_CORE_DLR && !SILVERLIGHT - private readonly string _outFileName; // can be null iff !SaveAndReloadAssemblies - private readonly string _outDir; // null means the current directory -#endif - private int _index; - - private static AssemblyGen Assembly { - get { - if (_assembly == null) { - Interlocked.CompareExchange(ref _assembly, new AssemblyGen(), null); - } - return _assembly; - } - } - - private AssemblyGen() { - var name = new AssemblyName("Snippets"); - -#if SILVERLIGHT // AssemblyBuilderAccess.RunAndSave, Environment.CurrentDirectory - _myAssembly = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run); - _myModule = _myAssembly.DefineDynamicModule(name.Name, false); -#else - - // mark the assembly transparent so that it works in partial trust: - var attributes = new[] { - new CustomAttributeBuilder(typeof(SecurityTransparentAttribute).GetConstructor(ReflectionUtils.EmptyTypes), new object[0]) - }; - -#if !FEATURE_CORE_DLR - if (_saveAssemblies) { - string outDir = _saveAssembliesPath ?? Directory.GetCurrentDirectory(); - try { - outDir = Path.GetFullPath(outDir); - } catch (Exception) { - throw Error.InvalidOutputDir(); - } - try { - Path.Combine(outDir, name.Name + ".dll"); - } catch (ArgumentException) { - throw Error.InvalidAsmNameOrExtension(); - } - - _outFileName = name.Name + ".dll"; - _outDir = outDir; - _myAssembly = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.RunAndSave, outDir, - null, null, null, null, false, attributes); - - _myModule = _myAssembly.DefineDynamicModule(name.Name, _outFileName, false); - } else -#endif - { - _myAssembly = AppDomain.CurrentDomain.DefineDynamicAssembly(name, AssemblyBuilderAccess.Run, attributes); - _myModule = _myAssembly.DefineDynamicModule(name.Name, false); - } - - _myAssembly.DefineVersionInfoResource(); -#endif - } - - private TypeBuilder DefineType(string name, Type parent, TypeAttributes attr) { - ContractUtils.RequiresNotNull(name, "name"); - ContractUtils.RequiresNotNull(parent, "parent"); - - StringBuilder sb = new StringBuilder(name); - - int index = Interlocked.Increment(ref _index); - sb.Append("$"); - sb.Append(index); - - // There is a bug in Reflection.Emit that leads to - // Unhandled Exception: System.Runtime.InteropServices.COMException (0x80131130): Record not found on lookup. - // if there is any of the characters []*&+,\ in the type name and a method defined on the type is called. - sb.Replace('+', '_').Replace('[', '_').Replace(']', '_').Replace('*', '_').Replace('&', '_').Replace(',', '_').Replace('\\', '_'); - - name = sb.ToString(); - - return _myModule.DefineType(name, attr, parent); - } - - internal static TypeBuilder DefineDelegateType(string name) { - return Assembly.DefineType( - name, - typeof(MulticastDelegate), - TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.AnsiClass | TypeAttributes.AutoClass - ); - } - -#if !FEATURE_CORE_DLR - //Return the location of the saved assembly file. - //The file location is used by PE verification in Microsoft.Scripting. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal string SaveAssembly() { -#if !SILVERLIGHT // AssemblyBuilder.Save - _myAssembly.Save(_outFileName, PortableExecutableKinds.ILOnly, ImageFileMachine.I386); - return Path.Combine(_outDir, _outFileName); -#else - return null; -#endif - } - - // NOTE: this method is called through reflection from Microsoft.Scripting - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal static void SetSaveAssemblies(bool enable, string directory) { - _saveAssemblies = enable; - _saveAssembliesPath = directory; - } - - // NOTE: this method is called through reflection from Microsoft.Scripting - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] - internal static string[] SaveAssembliesToDisk() { - if (!_saveAssemblies) { - return new string[0]; - } - - var assemlyLocations = new List(); - - // first save all assemblies to disk: - if (_assembly != null) { - string assemblyLocation = _assembly.SaveAssembly(); - if (assemblyLocation != null) { - assemlyLocations.Add(assemblyLocation); - } - _assembly = null; - } - - return assemlyLocations.ToArray(); - } -#endif - } -} -#endif diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/BoundConstants.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/BoundConstants.cs deleted file mode 100644 index e7b604209ca..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/BoundConstants.cs +++ /dev/null @@ -1,191 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection.Emit; -using System.Runtime.CompilerServices; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - /// - /// This type tracks "runtime" constants--live objects that appear in - /// ConstantExpression nodes and must be bound to the delegate. - /// - internal sealed class BoundConstants { - - /// - /// Constants can emit themselves as different types - /// For caching purposes, we need to treat each distinct Type as a - /// seperate thing to cache. (If we have to cast it on the way out, it - /// ends up using a JIT temp and defeats the purpose of caching the - /// value in a local) - /// - private struct TypedConstant : IEquatable { - internal readonly object Value; - internal readonly Type Type; - - internal TypedConstant(object value, Type type) { - Value = value; - Type = type; - } - - public override int GetHashCode() { - return ReferenceEqualityComparer.Instance.GetHashCode(Value) ^ Type.GetHashCode(); - } - - public bool Equals(TypedConstant other) { - return object.ReferenceEquals(Value, other.Value) && Type.Equals(other.Type); - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2231:OverloadOperatorEqualsOnOverridingValueTypeEquals")] - public override bool Equals(object obj) { - return (obj is TypedConstant) && Equals((TypedConstant)obj); - } - } - - /// - /// The list of constants in the order they appear in the constant array - /// - private readonly List _values = new List(); - - /// - /// The index of each constant in the constant array - /// - private readonly Dictionary _indexes = new Dictionary(ReferenceEqualityComparer.Instance); - - /// - /// Each constant referenced within this lambda, and how often it was referenced - /// - private readonly Dictionary _references = new Dictionary(); - - /// - /// IL locals for storing frequently used constants - /// - private readonly Dictionary _cache = new Dictionary(); - - internal int Count { - get { return _values.Count; } - } - - internal object[] ToArray() { - return _values.ToArray(); - } - - /// - /// Called by VariableBinder. Adds the constant to the list (if needed) - /// and increases the reference count by one - /// - internal void AddReference(object value, Type type) { - if (!_indexes.ContainsKey(value)) { - _indexes.Add(value, _values.Count); - _values.Add(value); - } - Helpers.IncrementCount(new TypedConstant(value, type), _references); - } - - /// - /// Emits a live object as a constant - /// - internal void EmitConstant(LambdaCompiler lc, object value, Type type) { - Debug.Assert(!ILGen.CanEmitConstant(value, type)); - - if (!lc.CanEmitBoundConstants) { - throw Error.CannotCompileConstant(value); - } - - LocalBuilder local; - if (_cache.TryGetValue(new TypedConstant(value, type), out local)) { - lc.IL.Emit(OpCodes.Ldloc, local); - return; - } - EmitConstantsArray(lc); - EmitConstantFromArray(lc, value, type); - } - - /// - /// Emit code to cache frequently used constants into IL locals, - /// instead of pulling them out of the array each time - /// - internal void EmitCacheConstants(LambdaCompiler lc) { - int count = 0; - foreach (var reference in _references) { - if (!lc.CanEmitBoundConstants) { - throw Error.CannotCompileConstant(reference.Key.Value); - } - - if (ShouldCache(reference.Value)) { - count++; - } - } - if (count == 0) { - return; - } - EmitConstantsArray(lc); - - // The same lambda can be in multiple places in the tree, so we - // need to clear any locals from last time. - _cache.Clear(); - - foreach (var reference in _references) { - if (ShouldCache(reference.Value)) { - if (--count > 0) { - // Dup array to keep it on the stack - lc.IL.Emit(OpCodes.Dup); - } - LocalBuilder local = lc.IL.DeclareLocal(reference.Key.Type); - EmitConstantFromArray(lc, reference.Key.Value, local.LocalType); - lc.IL.Emit(OpCodes.Stloc, local); - _cache.Add(reference.Key, local); - } - } - } - - private static bool ShouldCache(int refCount) { - // This caching is too aggressive in the face of conditionals and - // switch. Also, it is too conservative for variables used inside - // of loops. - return refCount > 2; - } - - private static void EmitConstantsArray(LambdaCompiler lc) { - Debug.Assert(lc.CanEmitBoundConstants); // this should've been checked already - - lc.EmitClosureArgument(); - lc.IL.Emit(OpCodes.Ldfld, typeof(Closure).GetField("Constants")); - } - - private void EmitConstantFromArray(LambdaCompiler lc, object value, Type type) { - int index; - if (!_indexes.TryGetValue(value, out index)) { - _indexes.Add(value, index = _values.Count); - _values.Add(value); - } - - lc.IL.EmitInt(index); - lc.IL.Emit(OpCodes.Ldelem_Ref); - if (type.IsValueType) { - lc.IL.Emit(OpCodes.Unbox_Any, type); - } else if (type != typeof(object)) { - lc.IL.Emit(OpCodes.Castclass, type); - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs deleted file mode 100644 index 6c8bd4bc3f1..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/Closure.cs +++ /dev/null @@ -1,51 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.ComponentModel; -using System.Diagnostics; - -namespace System.Runtime.CompilerServices { - - /// - /// This API supports the .NET Framework infrastructure and is not intended to be used directly from your code. - /// Represents the runtime state of a dynamically generated method. - /// - [EditorBrowsable(EditorBrowsableState.Never), DebuggerStepThrough] - public sealed class Closure { - /// - /// Represents the non-trivial constants and locally executable expressions that are referenced by a dynamically generated method. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] - public readonly object[] Constants; - - /// - /// Represents the hoisted local variables from the parent context. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2105:ArrayFieldsShouldNotBeReadOnly")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] - public readonly object[] Locals; - - /// - /// Creates an object to hold state of a dynamically generated method. - /// - /// The constant values used by the method. - /// The hoisted local variables from the parent context. - public Closure(object[] constants, object[] locals) { - Constants = constants; - Locals = locals; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.Storage.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.Storage.cs deleted file mode 100644 index 18e7d5aa882..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.Storage.cs +++ /dev/null @@ -1,186 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - - internal sealed partial class CompilerScope { - - private abstract class Storage { - internal readonly LambdaCompiler Compiler; - internal readonly ParameterExpression Variable; - - internal Storage(LambdaCompiler compiler, ParameterExpression variable) { - Compiler = compiler; - Variable = variable; - } - - internal abstract void EmitLoad(); - internal abstract void EmitAddress(); - internal abstract void EmitStore(); - - internal virtual void EmitStore(Storage value) { - value.EmitLoad(); - EmitStore(); - } - - internal virtual void FreeLocal() { - } - } - - private sealed class LocalStorage : Storage { - private readonly LocalBuilder _local; - - internal LocalStorage(LambdaCompiler compiler, ParameterExpression variable) - : base(compiler, variable) { - // ByRef variables are supported. This is used internally by - // the compiler when emitting an inlined lambda invoke, to - // handle ByRef parameters. BlockExpression prevents this - // from being exposed to user created trees. - _local = compiler.GetNamedLocal(variable.IsByRef ? variable.Type.MakeByRefType() : variable.Type, variable); - } - - internal override void EmitLoad() { - Compiler.IL.Emit(OpCodes.Ldloc, _local); - } - - internal override void EmitStore() { - Compiler.IL.Emit(OpCodes.Stloc, _local); - } - - internal override void EmitAddress() { - Compiler.IL.Emit(OpCodes.Ldloca, _local); - } - } - - private sealed class ArgumentStorage : Storage { - private readonly int _argument; - - internal ArgumentStorage(LambdaCompiler compiler, ParameterExpression p) - : base(compiler, p) { - _argument = compiler.GetLambdaArgument(compiler.Parameters.IndexOf(p)); - } - - internal override void EmitLoad() { - Compiler.IL.EmitLoadArg(_argument); - } - - internal override void EmitStore() { - Compiler.IL.EmitStoreArg(_argument); - } - - internal override void EmitAddress() { - Compiler.IL.EmitLoadArgAddress(_argument); - } - } - - private sealed class ElementBoxStorage : Storage { - private readonly int _index; - private readonly Storage _array; - private readonly Type _boxType; - private readonly FieldInfo _boxValueField; - - internal ElementBoxStorage(Storage array, int index, ParameterExpression variable) - : base(array.Compiler, variable) { - _array = array; - _index = index; - _boxType = typeof(StrongBox<>).MakeGenericType(variable.Type); - _boxValueField = _boxType.GetField("Value"); - } - - internal override void EmitLoad() { - EmitLoadBox(); - Compiler.IL.Emit(OpCodes.Ldfld, _boxValueField); - } - - internal override void EmitStore() { - LocalBuilder value = Compiler.GetLocal(Variable.Type); - Compiler.IL.Emit(OpCodes.Stloc, value); - EmitLoadBox(); - Compiler.IL.Emit(OpCodes.Ldloc, value); - Compiler.FreeLocal(value); - Compiler.IL.Emit(OpCodes.Stfld, _boxValueField); - } - - internal override void EmitStore(Storage value) { - EmitLoadBox(); - value.EmitLoad(); - Compiler.IL.Emit(OpCodes.Stfld, _boxValueField); - } - - internal override void EmitAddress() { - EmitLoadBox(); - Compiler.IL.Emit(OpCodes.Ldflda, _boxValueField); - } - - internal void EmitLoadBox() { - _array.EmitLoad(); - Compiler.IL.EmitInt(_index); - Compiler.IL.Emit(OpCodes.Ldelem_Ref); - Compiler.IL.Emit(OpCodes.Castclass, _boxType); - } - } - - private sealed class LocalBoxStorage : Storage { - private readonly LocalBuilder _boxLocal; - private readonly Type _boxType; - private readonly FieldInfo _boxValueField; - - internal LocalBoxStorage(LambdaCompiler compiler, ParameterExpression variable) - : base(compiler, variable) { - _boxType = typeof(StrongBox<>).MakeGenericType(variable.Type); - _boxValueField = _boxType.GetField("Value"); - _boxLocal = compiler.GetNamedLocal(_boxType, variable); - } - - internal override void EmitLoad() { - Compiler.IL.Emit(OpCodes.Ldloc, _boxLocal); - Compiler.IL.Emit(OpCodes.Ldfld, _boxValueField); - } - - internal override void EmitAddress() { - Compiler.IL.Emit(OpCodes.Ldloc, _boxLocal); - Compiler.IL.Emit(OpCodes.Ldflda, _boxValueField); - } - - internal override void EmitStore() { - LocalBuilder value = Compiler.GetLocal(Variable.Type); - Compiler.IL.Emit(OpCodes.Stloc, value); - Compiler.IL.Emit(OpCodes.Ldloc, _boxLocal); - Compiler.IL.Emit(OpCodes.Ldloc, value); - Compiler.FreeLocal(value); - Compiler.IL.Emit(OpCodes.Stfld, _boxValueField); - } - - internal override void EmitStore(Storage value) { - Compiler.IL.Emit(OpCodes.Ldloc, _boxLocal); - value.EmitLoad(); - Compiler.IL.Emit(OpCodes.Stfld, _boxValueField); - } - - internal void EmitStoreBox() { - Compiler.IL.Emit(OpCodes.Stloc, _boxLocal); - } - } - } -} \ No newline at end of file diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.cs deleted file mode 100644 index 4391c6d6abb..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/CompilerScope.cs +++ /dev/null @@ -1,465 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Reflection.Emit; -using System.Runtime.CompilerServices; -using System.Dynamic; -using System.Dynamic.Utils; -using Microsoft.Scripting.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - internal enum VariableStorageKind { - Local, - Hoisted - } - - /// - /// CompilerScope is the data structure which the Compiler keeps information - /// related to compiling scopes. It stores the following information: - /// 1. Parent relationship (for resolving variables) - /// 2. Information about hoisted variables - /// 3. Information for resolving closures - /// - /// Instances are produced by VariableBinder, which does a tree walk - /// looking for scope nodes: LambdaExpression and BlockExpression. - /// - internal sealed partial class CompilerScope { - /// - /// parent scope, if any - /// - private CompilerScope _parent; - - /// - /// The expression node for this scope - /// Can be LambdaExpression, BlockExpression, or CatchBlock - /// - internal readonly object Node; - - /// - /// True if this node corresponds to an IL method. - /// Can only be true if the Node is a LambdaExpression. - /// But inlined lambdas will have it set to false. - /// - internal readonly bool IsMethod; - - /// - /// Does this scope (or any inner scope) close over variables from any - /// parent scope? - /// Populated by VariableBinder - /// - internal bool NeedsClosure; - - /// - /// Variables defined in this scope, and whether they're hoisted or not - /// Populated by VariableBinder - /// - internal readonly Dictionary Definitions = new Dictionary(); - - /// - /// Each variable referenced within this scope, and how often it was referenced - /// Populated by VariableBinder - /// - internal Dictionary ReferenceCount; - - /// - /// Scopes whose variables were merged into this one - /// - /// Created lazily as we create hundreds of compiler scopes w/o merging scopes when compiling rules. - /// - internal Set MergedScopes; - - /// - /// The scope's hoisted locals, if any. - /// Provides storage for variables that are referenced from nested lambdas - /// - private HoistedLocals _hoistedLocals; - - /// - /// The closed over hoisted locals - /// - private HoistedLocals _closureHoistedLocals; - - /// - /// Mutable dictionary that maps non-hoisted variables to either local - /// slots or argument slots - /// - private readonly Dictionary _locals = new Dictionary(); - - internal CompilerScope(object node, bool isMethod) { - Node = node; - IsMethod = isMethod; - var variables = GetVariables(node); - - Definitions = new Dictionary(variables.Count); - foreach (var v in variables) { - Definitions.Add(v, VariableStorageKind.Local); - } - } - - /// - /// This scope's hoisted locals, or the closed over locals, if any - /// Equivalent to: _hoistedLocals ?? _closureHoistedLocals - /// - internal HoistedLocals NearestHoistedLocals { - get { return _hoistedLocals ?? _closureHoistedLocals; } - } - - /// - /// Called when entering a lambda/block. Performs all variable allocation - /// needed, including creating hoisted locals and IL locals for accessing - /// parent locals - /// - internal CompilerScope Enter(LambdaCompiler lc, CompilerScope parent) { - SetParent(lc, parent); - - AllocateLocals(lc); - - if (IsMethod && _closureHoistedLocals != null) { - EmitClosureAccess(lc, _closureHoistedLocals); - } - - EmitNewHoistedLocals(lc); - - if (IsMethod) { - EmitCachedVariables(); - } - - return this; - } - - /// - /// Frees unnamed locals, clears state associated with this compiler - /// - internal CompilerScope Exit() { - // free scope's variables - if (!IsMethod) { - foreach (Storage storage in _locals.Values) { - storage.FreeLocal(); - } - } - - // Clear state that is associated with this parent - // (because the scope can be reused in another context) - CompilerScope parent = _parent; - _parent = null; - _hoistedLocals = null; - _closureHoistedLocals = null; - _locals.Clear(); - - return parent; - } - - #region LocalScopeExpression support - - internal void EmitVariableAccess(LambdaCompiler lc, ReadOnlyCollection vars) { - if (NearestHoistedLocals != null) { - // Find what array each variable is on & its index - var indexes = new List(vars.Count); - - foreach (var variable in vars) { - // For each variable, find what array it's defined on - ulong parents = 0; - HoistedLocals locals = NearestHoistedLocals; - while (!locals.Indexes.ContainsKey(variable)) { - parents++; - locals = locals.Parent; - Debug.Assert(locals != null); - } - - // combine the number of parents we walked, with the - // real index of variable to get the index to emit. - ulong index = (parents << 32) | (uint)locals.Indexes[variable]; - - indexes.Add((long)index); - } - - if (indexes.Count > 0) { - EmitGet(NearestHoistedLocals.SelfVariable); - lc.EmitConstantArray(indexes.ToArray()); - lc.IL.Emit(OpCodes.Call, typeof(RuntimeOps).GetMethod("CreateRuntimeVariables", new[] { typeof(object[]), typeof(long[]) })); - return; - } - } - - // No visible variables - lc.IL.Emit(OpCodes.Call, typeof(RuntimeOps).GetMethod("CreateRuntimeVariables", ReflectionUtils.EmptyTypes)); - return; - } - - #endregion - - #region Variable access - - /// - /// Adds a new virtual variable corresponding to an IL local - /// - internal void AddLocal(LambdaCompiler gen, ParameterExpression variable) { - _locals.Add(variable, new LocalStorage(gen, variable)); - } - - internal void EmitGet(ParameterExpression variable) { - ResolveVariable(variable).EmitLoad(); - } - - internal void EmitSet(ParameterExpression variable) { - ResolveVariable(variable).EmitStore(); - } - - internal void EmitAddressOf(ParameterExpression variable) { - ResolveVariable(variable).EmitAddress(); - } - - private Storage ResolveVariable(ParameterExpression variable) { - return ResolveVariable(variable, NearestHoistedLocals); - } - - /// - /// Resolve a local variable in this scope or a closed over scope - /// Throws if the variable is defined - /// - private Storage ResolveVariable(ParameterExpression variable, HoistedLocals hoistedLocals) { - // Search IL locals and arguments, but only in this lambda - for (CompilerScope s = this; s != null; s = s._parent) { - Storage storage; - if (s._locals.TryGetValue(variable, out storage)) { - return storage; - } - - // if this is a lambda, we're done - if (s.IsMethod) { - break; - } - } - - // search hoisted locals - for (HoistedLocals h = hoistedLocals; h != null; h = h.Parent) { - int index; - if (h.Indexes.TryGetValue(variable, out index)) { - return new ElementBoxStorage( - ResolveVariable(h.SelfVariable, hoistedLocals), - index, - variable - ); - } - } - - // - // If this is an unbound variable in the lambda, the error will be - // thrown from VariableBinder. So an error here is generally caused - // by an internal error, e.g. a scope was created but it bypassed - // VariableBinder. - // - throw Error.UndefinedVariable(variable.Name, variable.Type, CurrentLambdaName); - } - - #endregion - - private void SetParent(LambdaCompiler lc, CompilerScope parent) { - Debug.Assert(_parent == null && parent != this); - _parent = parent; - - if (NeedsClosure && _parent != null) { - _closureHoistedLocals = _parent.NearestHoistedLocals; - } - - var hoistedVars = GetVariables().Where(p => Definitions[p] == VariableStorageKind.Hoisted).ToReadOnly(); - - if (hoistedVars.Count > 0) { - _hoistedLocals = new HoistedLocals(_closureHoistedLocals, hoistedVars); - AddLocal(lc, _hoistedLocals.SelfVariable); - } - } - - // Emits creation of the hoisted local storage - private void EmitNewHoistedLocals(LambdaCompiler lc) { - if (_hoistedLocals == null) { - return; - } - - // create the array - lc.IL.EmitInt(_hoistedLocals.Variables.Count); - lc.IL.Emit(OpCodes.Newarr, typeof(object)); - - // initialize all elements - int i = 0; - foreach (ParameterExpression v in _hoistedLocals.Variables) { - // array[i] = new StrongBox(...); - lc.IL.Emit(OpCodes.Dup); - lc.IL.EmitInt(i++); - Type boxType = typeof(StrongBox<>).MakeGenericType(v.Type); - - if (IsMethod && lc.Parameters.Contains(v)) { - // array[i] = new StrongBox(argument); - int index = lc.Parameters.IndexOf(v); - lc.EmitLambdaArgument(index); - lc.IL.Emit(OpCodes.Newobj, boxType.GetConstructor(new Type[] { v.Type })); - } else if (v == _hoistedLocals.ParentVariable) { - // array[i] = new StrongBox(closure.Locals); - ResolveVariable(v, _closureHoistedLocals).EmitLoad(); - lc.IL.Emit(OpCodes.Newobj, boxType.GetConstructor(new Type[] { v.Type })); - } else { -#if !FEATURE_CORE_DLR - // array[i] = new StrongBox(default(T)); - lc.IL.EmitDefault(v.Type); - lc.IL.Emit(OpCodes.Newobj, boxType.GetConstructor(new Type[] { v.Type })); -#else - // array[i] = new StrongBox(); - lc.IL.Emit(OpCodes.Newobj, boxType.GetConstructor(ReflectionUtils.EmptyTypes)); -#endif - } - // if we want to cache this into a local, do it now - if (ShouldCache(v)) { - lc.IL.Emit(OpCodes.Dup); - CacheBoxToLocal(lc, v); - } - lc.IL.Emit(OpCodes.Stelem_Ref); - } - - // store it - EmitSet(_hoistedLocals.SelfVariable); - } - - // If hoisted variables are referenced "enough", we cache the - // StrongBox in an IL local, which saves an array index and a cast - // when we go to look it up later - private void EmitCachedVariables() { - if (ReferenceCount == null) { - return; - } - - foreach (var refCount in ReferenceCount) { - if (ShouldCache(refCount.Key, refCount.Value)) { - var storage = ResolveVariable(refCount.Key) as ElementBoxStorage; - if (storage != null) { - storage.EmitLoadBox(); - CacheBoxToLocal(storage.Compiler, refCount.Key); - } - } - } - } - - private bool ShouldCache(ParameterExpression v, int refCount) { - // This caching is too aggressive in the face of conditionals and - // switch. Also, it is too conservative for variables used inside - // of loops. - return refCount > 2 && !_locals.ContainsKey(v); - } - - private bool ShouldCache(ParameterExpression v) { - if (ReferenceCount == null) { - return false; - } - - int refCount; - return ReferenceCount.TryGetValue(v, out refCount) && ShouldCache(v, refCount); - } - - private void CacheBoxToLocal(LambdaCompiler lc, ParameterExpression v) { - Debug.Assert(ShouldCache(v) && !_locals.ContainsKey(v)); - var local = new LocalBoxStorage(lc, v); - local.EmitStoreBox(); - _locals.Add(v, local); - } - - // Creates IL locals for accessing closures - private void EmitClosureAccess(LambdaCompiler lc, HoistedLocals locals) { - if (locals == null) { - return; - } - - EmitClosureToVariable(lc, locals); - - while ((locals = locals.Parent) != null) { - var v = locals.SelfVariable; - var local = new LocalStorage(lc, v); - local.EmitStore(ResolveVariable(v)); - _locals.Add(v, local); - } - } - - private void EmitClosureToVariable(LambdaCompiler lc, HoistedLocals locals) { - lc.EmitClosureArgument(); - lc.IL.Emit(OpCodes.Ldfld, typeof(Closure).GetField("Locals")); - AddLocal(lc, locals.SelfVariable); - EmitSet(locals.SelfVariable); - } - - // Allocates slots for IL locals or IL arguments - private void AllocateLocals(LambdaCompiler lc) { - foreach (ParameterExpression v in GetVariables()) { - if (Definitions[v] == VariableStorageKind.Local) { - // - // If v is in lc.Parameters, it is a parameter. - // Otherwise, it is a local variable. - // - // Also, for inlined lambdas we'll create a local, which - // is possibly a byref local if the parameter is byref. - // - Storage s; - if (IsMethod && lc.Parameters.Contains(v)) { - s = new ArgumentStorage(lc, v); - } else { - s = new LocalStorage(lc, v); - } - _locals.Add(v, s); - } - } - } - - private IList GetVariables() { - var vars = GetVariables(Node); - if (MergedScopes == null) { - return vars; - } - var list = new List(vars); - foreach (var scope in MergedScopes) { - list.AddRange(GetVariables(scope)); - } - return list; - } - - private static IList GetVariables(object scope) { - var lambda = scope as LambdaExpression; - if (lambda != null) { - return lambda.Parameters; - } - var block = scope as BlockExpression; - if (block != null) { - return block.Variables; - } - return new[] { ((CatchBlock)scope).Variable }; - } - - private string CurrentLambdaName { - get { - CompilerScope s = this; - while (true) { - var lambda = s.Node as LambdaExpression; - if (lambda != null) { - return lambda.Name; - } - } - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/ConstantCheck.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/ConstantCheck.cs deleted file mode 100644 index 11470281c84..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/ConstantCheck.cs +++ /dev/null @@ -1,106 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - internal enum AnalyzeTypeIsResult { - KnownFalse, - KnownTrue, - KnownAssignable, // need null check only - Unknown, // need full runtime check - } - - internal static class ConstantCheck { - - internal static bool IsNull(Expression e) { - if (e.NodeType == ExpressionType.Constant) { - return ((ConstantExpression)e).Value == null; - } - return false; - } - - - /// - /// If the result of a TypeBinaryExpression is known statically, this - /// returns the result, otherwise it returns null, meaning we'll need - /// to perform the IsInst instruction at runtime. - /// - /// The result of this function must be equivalent to IsInst, or - /// null. - /// - internal static AnalyzeTypeIsResult AnalyzeTypeIs(TypeBinaryExpression typeIs) { - return AnalyzeTypeIs(typeIs.Expression, typeIs.TypeOperand); - } - - /// - /// If the result of an isinst opcode is known statically, this - /// returns the result, otherwise it returns null, meaning we'll need - /// to perform the IsInst instruction at runtime. - /// - /// The result of this function must be equivalent to IsInst, or - /// null. - /// - private static AnalyzeTypeIsResult AnalyzeTypeIs(Expression operand, Type testType) { - Type operandType = operand.Type; - - // Oddly, we allow void operands - // This is LinqV1 behavior of TypeIs - if (operandType == typeof(void)) { - return AnalyzeTypeIsResult.KnownFalse; - } - - // - // Type comparisons treat nullable types as if they were the - // underlying type. The reason is when you box a nullable it - // becomes a boxed value of the underlying type, or null. - // - Type nnOperandType = operandType.GetNonNullableType(); - Type nnTestType = testType.GetNonNullableType(); - - // - // See if we can determine the answer based on the static types - // - // Extensive testing showed that Type.IsAssignableFrom, - // Type.IsInstanceOfType, and the isinst instruction were all - // equivalent when used against a live object - // - if (nnTestType.IsAssignableFrom(nnOperandType)) { - // If the operand is a value type (other than nullable), we - // know the result is always true. - if (operandType.IsValueType && !operandType.IsNullableType()) { - return AnalyzeTypeIsResult.KnownTrue; - } - - // For reference/nullable types, we need to compare to null at runtime - return AnalyzeTypeIsResult.KnownAssignable; - } - - // We used to have an if IsSealed, return KnownFalse check here. - // but that doesn't handle generic types & co/contravariance correctly. - // So just use IsInst, which we know always gives us the right answer. - - // Otherwise we need a full runtime check - return AnalyzeTypeIsResult.Unknown; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs deleted file mode 100644 index b87eecde4e0..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DebugInfoGenerator.cs +++ /dev/null @@ -1,74 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Ast.Compiler; -#else -using System.Linq.Expressions; -using System.Linq.Expressions.Compiler; -#endif - -using System; -using System.Collections.Generic; -using System.Text; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif -using System.Diagnostics; -using System.Diagnostics.SymbolStore; -using System.Reflection; - -namespace System.Runtime.CompilerServices { -#if !FEATURE_CORE_DLR || SILVERLIGHT - using ILGenerator = OffsetTrackingILGenerator; -#endif - - /// - /// Generates debug information for lambdas in an expression tree. - /// - public abstract class DebugInfoGenerator { -#if FEATURE_PDBEMIT - /// - /// Creates PDB symbol generator. - /// - /// PDB symbol generator. - public static DebugInfoGenerator CreatePdbGenerator() { - return new SymbolDocumentGenerator(); - } -#else - public static DebugInfoGenerator CreatePdbGenerator() { - throw new PlatformNotSupportedException(); - } -#endif - /// - /// Marks a sequence point. - /// - /// The lambda being generated. - /// IL offset where to mark the sequence point. - /// Debug informaton corresponding to the sequence point. - public abstract void MarkSequencePoint(LambdaExpression method, int ilOffset, DebugInfoExpression sequencePoint); - -#if FEATURE_REFEMIT - internal virtual void MarkSequencePoint(LambdaExpression method, MethodBase methodBase, ILGenerator ilg, DebugInfoExpression sequencePoint) { - MarkSequencePoint(method, ilg.ILOffset, sequencePoint); - } - - internal virtual void SetLocalName(LocalBuilder localBuilder, string name) { - // nop - } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.Generated.cs deleted file mode 100644 index b2e172ff8fb..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.Generated.cs +++ /dev/null @@ -1,293 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { - using Microsoft.Scripting.Utils; -#else -namespace System.Linq.Expressions.Compiler { -#endif - internal static partial class DelegateHelpers { - private static TypeInfo _DelegateCache = new TypeInfo(); - - #region Generated Maximum Delegate Arity - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_max_delegate_arity from: generate_dynsites.py - - private const int MaximumArity = 17; - - // *** END GENERATED CODE *** - - #endregion - - internal class TypeInfo { - public Type DelegateType; - public Dictionary TypeChain; - - public Type MakeDelegateType(Type retType, params Expression[] args) { - return MakeDelegateType(retType, (IList)args); - } - - public Type MakeDelegateType(Type retType, IList args) { - // nope, go ahead and create it and spend the - // cost of creating the array. - Type[] paramTypes = new Type[args.Count + 2]; - paramTypes[0] = typeof(CallSite); - paramTypes[paramTypes.Length - 1] = retType; - for (int i = 0; i < args.Count; i++) { - paramTypes[i + 1] = args[i].Type; - } - - return DelegateType = MakeNewDelegate(paramTypes); - } - } - - - /// - /// Finds a delegate type using the types in the array. - /// We use the cache to avoid copying the array, and to cache the - /// created delegate type - /// - internal static Type MakeDelegateType(Type[] types) { - lock (_DelegateCache) { - TypeInfo curTypeInfo = _DelegateCache; - - // arguments & return type - for (int i = 0; i < types.Length; i++) { - curTypeInfo = NextTypeInfo(types[i], curTypeInfo); - } - - // see if we have the delegate already - if (curTypeInfo.DelegateType == null) { - // clone because MakeCustomDelegate can hold onto the array. - curTypeInfo.DelegateType = MakeNewDelegate((Type[])types.Clone()); - } - - return curTypeInfo.DelegateType; - } - } - - /// - /// Finds a delegate type for a CallSite using the types in the ReadOnlyCollection of Expression. - /// - /// We take the readonly collection of Expression explicitly to avoid allocating memory (an array - /// of types) on lookup of delegate types. - /// - internal static Type MakeCallSiteDelegate(ReadOnlyCollection types, Type returnType) { - lock (_DelegateCache) { - TypeInfo curTypeInfo = _DelegateCache; - - // CallSite - curTypeInfo = NextTypeInfo(typeof(CallSite), curTypeInfo); - - // arguments - for (int i = 0; i < types.Count; i++) { - curTypeInfo = NextTypeInfo(types[i].Type, curTypeInfo); - } - - // return type - curTypeInfo = NextTypeInfo(returnType, curTypeInfo); - - // see if we have the delegate already - if (curTypeInfo.DelegateType == null) { - curTypeInfo.MakeDelegateType(returnType, types); - } - - return curTypeInfo.DelegateType; - } - } - - /// - /// Finds a delegate type for a CallSite using the MetaObject array. - /// - /// We take the array of MetaObject explicitly to avoid allocating memory (an array of types) on - /// lookup of delegate types. - /// - internal static Type MakeDeferredSiteDelegate(DynamicMetaObject[] args, Type returnType) { - lock (_DelegateCache) { - TypeInfo curTypeInfo = _DelegateCache; - - // CallSite - curTypeInfo = NextTypeInfo(typeof(CallSite), curTypeInfo); - - // arguments - for (int i = 0; i < args.Length; i++) { - DynamicMetaObject mo = args[i]; - Type paramType = mo.Expression.Type; - if (IsByRef(mo)) { - paramType = paramType.MakeByRefType(); - } - curTypeInfo = NextTypeInfo(paramType, curTypeInfo); - } - - // return type - curTypeInfo = NextTypeInfo(returnType, curTypeInfo); - - // see if we have the delegate already - if (curTypeInfo.DelegateType == null) { - // nope, go ahead and create it and spend the - // cost of creating the array. - Type[] paramTypes = new Type[args.Length + 2]; - paramTypes[0] = typeof(CallSite); - paramTypes[paramTypes.Length - 1] = returnType; - for (int i = 0; i < args.Length; i++) { - DynamicMetaObject mo = args[i]; - Type paramType = mo.Expression.Type; - if (IsByRef(mo)) { - paramType = paramType.MakeByRefType(); - } - paramTypes[i + 1] = paramType; - } - - curTypeInfo.DelegateType = MakeNewDelegate(paramTypes); - } - - return curTypeInfo.DelegateType; - } - } - - private static bool IsByRef(DynamicMetaObject mo) { - ParameterExpression pe = mo.Expression as ParameterExpression; - return pe != null && pe.IsByRef; - } - - internal static TypeInfo NextTypeInfo(Type initialArg) { - lock (_DelegateCache) { - return NextTypeInfo(initialArg, _DelegateCache); - } - } - - internal static TypeInfo GetNextTypeInfo(Type initialArg, TypeInfo curTypeInfo) { - lock (_DelegateCache) { - return NextTypeInfo(initialArg, curTypeInfo); - } - } - - private static TypeInfo NextTypeInfo(Type initialArg, TypeInfo curTypeInfo) { - Type lookingUp = initialArg; - TypeInfo nextTypeInfo; - if (curTypeInfo.TypeChain == null) { - curTypeInfo.TypeChain = new Dictionary(); - } - - if (!curTypeInfo.TypeChain.TryGetValue(lookingUp, out nextTypeInfo)) { - nextTypeInfo = new TypeInfo(); - if (TypeUtils.CanCache(lookingUp)) { - curTypeInfo.TypeChain[lookingUp] = nextTypeInfo; - } - } - return nextTypeInfo; - } - - /// - /// Creates a new delegate, or uses a func/action - /// Note: this method does not cache - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private static Type MakeNewDelegate(Type[] types) { - Debug.Assert(types != null && types.Length > 0); - - // Can only used predefined delegates if we have no byref types and - // the arity is small enough to fit in Func<...> or Action<...> - if (types.Length > MaximumArity || types.Any(t => t.IsByRef)) { - return MakeNewCustomDelegate(types); - } - - Type result; - if (types[types.Length - 1] == typeof(void)) { - result = GetActionType(types.RemoveLast()); - } else { - result = GetFuncType(types); - } - Debug.Assert(result != null); - return result; - } - - internal static Type GetFuncType(Type[] types) { - switch (types.Length) { - #region Generated Delegate Func Types - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_delegate_func from: generate_dynsites.py - - case 1: return typeof(Func<>).MakeGenericType(types); - case 2: return typeof(Func<,>).MakeGenericType(types); - case 3: return typeof(Func<,,>).MakeGenericType(types); - case 4: return typeof(Func<,,,>).MakeGenericType(types); - case 5: return typeof(Func<,,,,>).MakeGenericType(types); - case 6: return typeof(Func<,,,,,>).MakeGenericType(types); - case 7: return typeof(Func<,,,,,,>).MakeGenericType(types); - case 8: return typeof(Func<,,,,,,,>).MakeGenericType(types); - case 9: return typeof(Func<,,,,,,,,>).MakeGenericType(types); - case 10: return typeof(Func<,,,,,,,,,>).MakeGenericType(types); - case 11: return typeof(Func<,,,,,,,,,,>).MakeGenericType(types); - case 12: return typeof(Func<,,,,,,,,,,,>).MakeGenericType(types); - case 13: return typeof(Func<,,,,,,,,,,,,>).MakeGenericType(types); - case 14: return typeof(Func<,,,,,,,,,,,,,>).MakeGenericType(types); - case 15: return typeof(Func<,,,,,,,,,,,,,,>).MakeGenericType(types); - case 16: return typeof(Func<,,,,,,,,,,,,,,,>).MakeGenericType(types); - case 17: return typeof(Func<,,,,,,,,,,,,,,,,>).MakeGenericType(types); - - // *** END GENERATED CODE *** - - #endregion - - default: return null; - } - } - - internal static Type GetActionType(Type[] types) { - switch (types.Length) { - case 0: return typeof(Action); - #region Generated Delegate Action Types - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_delegate_action from: generate_dynsites.py - - case 1: return typeof(Action<>).MakeGenericType(types); - case 2: return typeof(Action<,>).MakeGenericType(types); - case 3: return typeof(Action<,,>).MakeGenericType(types); - case 4: return typeof(Action<,,,>).MakeGenericType(types); - case 5: return typeof(Action<,,,,>).MakeGenericType(types); - case 6: return typeof(Action<,,,,,>).MakeGenericType(types); - case 7: return typeof(Action<,,,,,,>).MakeGenericType(types); - case 8: return typeof(Action<,,,,,,,>).MakeGenericType(types); - case 9: return typeof(Action<,,,,,,,,>).MakeGenericType(types); - case 10: return typeof(Action<,,,,,,,,,>).MakeGenericType(types); - case 11: return typeof(Action<,,,,,,,,,,>).MakeGenericType(types); - case 12: return typeof(Action<,,,,,,,,,,,>).MakeGenericType(types); - case 13: return typeof(Action<,,,,,,,,,,,,>).MakeGenericType(types); - case 14: return typeof(Action<,,,,,,,,,,,,,>).MakeGenericType(types); - case 15: return typeof(Action<,,,,,,,,,,,,,,>).MakeGenericType(types); - case 16: return typeof(Action<,,,,,,,,,,,,,,,>).MakeGenericType(types); - - // *** END GENERATED CODE *** - - #endregion - - default: return null; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs deleted file mode 100644 index 3489ee15514..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/DelegateHelpers.cs +++ /dev/null @@ -1,50 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Dynamic.Utils; -using System.Reflection; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - internal static partial class DelegateHelpers { - private const MethodAttributes CtorAttributes = MethodAttributes.RTSpecialName | MethodAttributes.HideBySig | MethodAttributes.Public; - private const MethodImplAttributes ImplAttributes = MethodImplAttributes.Runtime | MethodImplAttributes.Managed; - private const MethodAttributes InvokeAttributes = MethodAttributes.Public | MethodAttributes.HideBySig | MethodAttributes.NewSlot | MethodAttributes.Virtual; -#if FEATURE_REFEMIT - private static readonly Type[] _DelegateCtorSignature = new Type[] { typeof(object), typeof(IntPtr) }; -#endif - - private static Type MakeNewCustomDelegate(Type[] types) { -#if FEATURE_REFEMIT - Type returnType = types[types.Length - 1]; - Type[] parameters = types.RemoveLast(); - - TypeBuilder builder = AssemblyGen.DefineDelegateType("Delegate" + types.Length); - builder.DefineConstructor(CtorAttributes, CallingConventions.Standard, _DelegateCtorSignature).SetImplementationFlags(ImplAttributes); - builder.DefineMethod("Invoke", InvokeAttributes, returnType, parameters).SetImplementationFlags(ImplAttributes); - return builder.CreateType(); -#else - throw new NotSupportedException("Method signature not supported on this platform"); -#endif - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/ExpressionQuoter.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/ExpressionQuoter.cs deleted file mode 100644 index b26a8266d18..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/ExpressionQuoter.cs +++ /dev/null @@ -1,247 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Ast.Compiler; -#else -using System.Linq.Expressions; -using System.Linq.Expressions.Compiler; -#endif - -using System.Collections.Generic; -using System.ComponentModel; -using System.Diagnostics; -using System.Dynamic.Utils; - -namespace System.Runtime.CompilerServices { - public partial class RuntimeOps { - /// - /// Quotes the provided expression tree. - /// - /// The expression to quote. - /// The hoisted local state provided by the compiler. - /// The actual hoisted local values. - /// The quoted expression. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static Expression Quote(Expression expression, object hoistedLocals, object[] locals) { - Debug.Assert(hoistedLocals != null && locals != null); - var quoter = new ExpressionQuoter((HoistedLocals)hoistedLocals, locals); - return quoter.Visit(expression); - } - - /// - /// Combines two runtime variable lists and returns a new list. - /// - /// The first list. - /// The second list. - /// The index array indicating which list to get variables from. - /// The merged runtime variables. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static IRuntimeVariables MergeRuntimeVariables(IRuntimeVariables first, IRuntimeVariables second, int[] indexes) { - return new MergedRuntimeVariables(first, second, indexes); - } - - // Modifies a quoted Expression instance by changing hoisted variables and - // parameters into hoisted local references. The variable's StrongBox is - // burned as a constant, and all hoisted variables/parameters are rewritten - // as indexing expressions. - // - // The behavior of Quote is indended to be like C# and VB expression quoting - private sealed class ExpressionQuoter : ExpressionVisitor { - private readonly HoistedLocals _scope; - private readonly object[] _locals; - - // A stack of variables that are defined in nested scopes. We search - // this first when resolving a variable in case a nested scope shadows - // one of our variable instances. - private readonly Stack> _shadowedVars = new Stack>(); - - internal ExpressionQuoter(HoistedLocals scope, object[] locals) { - _scope = scope; - _locals = locals; - } - - protected internal override Expression VisitLambda(Expression node) { - _shadowedVars.Push(new Set(node.Parameters)); - Expression b = Visit(node.Body); - _shadowedVars.Pop(); - if (b == node.Body) { - return node; - } - return Expression.Lambda(b, node.Name, node.TailCall, node.Parameters); - } - - protected internal override Expression VisitBlock(BlockExpression node) { - if (node.Variables.Count > 0) { - _shadowedVars.Push(new Set(node.Variables)); - } - var b = Visit(node.Expressions); - if (node.Variables.Count > 0) { - _shadowedVars.Pop(); - } - if (b == node.Expressions) { - return node; - } - return Expression.Block(node.Variables, b); - } - - protected override CatchBlock VisitCatchBlock(CatchBlock node) { - if (node.Variable != null) { - _shadowedVars.Push(new Set(new[] { node.Variable })); - } - Expression b = Visit(node.Body); - Expression f = Visit(node.Filter); - if (node.Variable != null) { - _shadowedVars.Pop(); - } - if (b == node.Body && f == node.Filter) { - return node; - } - return Expression.MakeCatchBlock(node.Test, node.Variable, b, f); - } - - protected internal override Expression VisitRuntimeVariables(RuntimeVariablesExpression node) { - int count = node.Variables.Count; - var boxes = new List(); - var vars = new List(); - var indexes = new int[count]; - for (int i = 0; i < count; i++) { - IStrongBox box = GetBox(node.Variables[i]); - if (box == null) { - indexes[i] = vars.Count; - vars.Add(node.Variables[i]); - } else { - indexes[i] = -1 - boxes.Count; - boxes.Add(box); - } - } - - // No variables were rewritten. Just return the original node - if (boxes.Count == 0) { - return node; - } - - var boxesConst = Expression.Constant(new RuntimeVariables(boxes.ToArray()), typeof(IRuntimeVariables)); - // All of them were rewritten. Just return the array as a constant - if (vars.Count == 0) { - return boxesConst; - } - - // Otherwise, we need to return an object that merges them - return Expression.Call( - typeof(RuntimeOps).GetMethod("MergeRuntimeVariables"), - Expression.RuntimeVariables(new TrueReadOnlyCollection(vars.ToArray())), - boxesConst, - Expression.Constant(indexes) - ); - } - - protected internal override Expression VisitParameter(ParameterExpression node) { - IStrongBox box = GetBox(node); - if (box == null) { - return node; - } - return Expression.Field(Expression.Constant(box), "Value"); - } - - private IStrongBox GetBox(ParameterExpression variable) { - // Skip variables that are shadowed by a nested scope/lambda - foreach (Set hidden in _shadowedVars) { - if (hidden.Contains(variable)) { - return null; - } - } - - HoistedLocals scope = _scope; - object[] locals = _locals; - while (true) { - int hoistIndex; - if (scope.Indexes.TryGetValue(variable, out hoistIndex)) { - return (IStrongBox)locals[hoistIndex]; - } - scope = scope.Parent; - if (scope == null) { - break; - } - locals = HoistedLocals.GetParent(locals); - } - - // Unbound variable: an error should've been thrown already - // from VariableBinder - throw ContractUtils.Unreachable; - } - } - - private sealed class RuntimeVariables : IRuntimeVariables { - private readonly IStrongBox[] _boxes; - - internal RuntimeVariables(IStrongBox[] boxes) { - _boxes = boxes; - } - - int IRuntimeVariables.Count { - get { return _boxes.Length; } - } - - object IRuntimeVariables.this[int index] { - get { - return _boxes[index].Value; - } - set { - _boxes[index].Value = value; - } - } - } - - /// - /// Provides a list of variables, supporing read/write of the values - /// Exposed via RuntimeVariablesExpression - /// - private sealed class MergedRuntimeVariables : IRuntimeVariables { - private readonly IRuntimeVariables _first; - private readonly IRuntimeVariables _second; - - // For reach item, the index into the first or second list - // Positive values mean the first array, negative means the second - private readonly int[] _indexes; - - internal MergedRuntimeVariables(IRuntimeVariables first, IRuntimeVariables second, int[] indexes) { - _first = first; - _second = second; - _indexes = indexes; - } - - public int Count { - get { return _indexes.Length; } - } - - public object this[int index] { - get { - index = _indexes[index]; - return (index >= 0) ? _first[index] : _second[-1 - index]; - } - set { - index = _indexes[index]; - if (index >= 0) { - _first[index] = value; - } else { - _second[-1 - index] = value; - } - } - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs deleted file mode 100644 index ddb304be986..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/HoistedLocals.cs +++ /dev/null @@ -1,101 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Runtime.CompilerServices; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - - // Suppose we have something like: - // - // (string s)=>()=>s. - // - // We wish to generate the outer as: - // - // Func OuterMethod(Closure closure, string s) - // { - // object[] locals = new object[1]; - // locals[0] = new StrongBox(); - // ((StrongBox)locals[0]).Value = s; - // return ((DynamicMethod)closure.Constants[0]).CreateDelegate(typeof(Func), new Closure(null, locals)); - // } - // - // ... and the inner as: - // - // string InnerMethod(Closure closure) - // { - // object[] locals = closure.Locals; - // return ((StrongBox)locals[0]).Value; - // } - // - // This class tracks that "s" was hoisted into a closure, as the 0th - // element in the array - // - /// - /// Stores information about locals and arguments that are hoisted into - /// the closure array because they're referenced in an inner lambda. - /// - /// This class is sometimes emitted as a runtime constant for internal - /// use to hoist variables/parameters in quoted expressions - /// - /// Invariant: this class stores no mutable state - /// - internal sealed class HoistedLocals { - - // The parent locals, if any - internal readonly HoistedLocals Parent; - - // A mapping of hoisted variables to their indexes in the array - internal readonly System.Dynamic.Utils.ReadOnlyDictionary Indexes; - - // The variables, in the order they appear in the array - internal readonly ReadOnlyCollection Variables; - - // A virtual variable for accessing this locals array - internal readonly ParameterExpression SelfVariable; - - internal HoistedLocals(HoistedLocals parent, ReadOnlyCollection vars) { - - if (parent != null) { - // Add the parent locals array as the 0th element in the array - vars = new TrueReadOnlyCollection(vars.AddFirst(parent.SelfVariable)); - } - - Dictionary indexes = new Dictionary(vars.Count); - for (int i = 0; i < vars.Count; i++) { - indexes.Add(vars[i], i); - } - - SelfVariable = Expression.Variable(typeof(object[]), null); - Parent = parent; - Variables = vars; - Indexes = new System.Dynamic.Utils.ReadOnlyDictionary(indexes); - } - - internal ParameterExpression ParentVariable { - get { return Parent != null ? Parent.SelfVariable : null; } - } - - internal static object[] GetParent(object[] locals) { - return ((StrongBox)locals[0]).Value; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/ILGen.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/ILGen.cs deleted file mode 100644 index 5577d656495..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/ILGen.cs +++ /dev/null @@ -1,1051 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.CompilerServices; -using Microsoft.Scripting.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif -#if !FEATURE_CORE_DLR || SILVERLIGHT - using ILGenerator = OffsetTrackingILGenerator; -#endif - - internal static class ILGen { - - internal static void Emit(this ILGenerator il, OpCode opcode, MethodBase methodBase) { - Debug.Assert(methodBase is MethodInfo || methodBase is ConstructorInfo); - - if (methodBase.MemberType == MemberTypes.Constructor) { - il.Emit(opcode, (ConstructorInfo)methodBase); - } else { - il.Emit(opcode, (MethodInfo)methodBase); - } - } - - #region Instruction helpers - - internal static void EmitLoadArg(this ILGenerator il, int index) { - Debug.Assert(index >= 0); - - switch (index) { - case 0: - il.Emit(OpCodes.Ldarg_0); - break; - case 1: - il.Emit(OpCodes.Ldarg_1); - break; - case 2: - il.Emit(OpCodes.Ldarg_2); - break; - case 3: - il.Emit(OpCodes.Ldarg_3); - break; - default: - if (index <= Byte.MaxValue) { - il.Emit(OpCodes.Ldarg_S, (byte)index); - } else { - il.Emit(OpCodes.Ldarg, index); - } - break; - } - } - - internal static void EmitLoadArgAddress(this ILGenerator il, int index) { - Debug.Assert(index >= 0); - - if (index <= Byte.MaxValue) { - il.Emit(OpCodes.Ldarga_S, (byte)index); - } else { - il.Emit(OpCodes.Ldarga, index); - } - } - - internal static void EmitStoreArg(this ILGenerator il, int index) { - Debug.Assert(index >= 0); - - if (index <= Byte.MaxValue) { - il.Emit(OpCodes.Starg_S, (byte)index); - } else { - il.Emit(OpCodes.Starg, index); - } - } - - /// - /// Emits a Ldind* instruction for the appropriate type - /// - internal static void EmitLoadValueIndirect(this ILGenerator il, Type type) { - ContractUtils.RequiresNotNull(type, "type"); - - if (type.IsValueType) { - if (type == typeof(int)) { - il.Emit(OpCodes.Ldind_I4); - } else if (type == typeof(uint)) { - il.Emit(OpCodes.Ldind_U4); - } else if (type == typeof(short)) { - il.Emit(OpCodes.Ldind_I2); - } else if (type == typeof(ushort)) { - il.Emit(OpCodes.Ldind_U2); - } else if (type == typeof(long) || type == typeof(ulong)) { - il.Emit(OpCodes.Ldind_I8); - } else if (type == typeof(char)) { - il.Emit(OpCodes.Ldind_I2); - } else if (type == typeof(bool)) { - il.Emit(OpCodes.Ldind_I1); - } else if (type == typeof(float)) { - il.Emit(OpCodes.Ldind_R4); - } else if (type == typeof(double)) { - il.Emit(OpCodes.Ldind_R8); - } else { - il.Emit(OpCodes.Ldobj, type); - } - } else { - il.Emit(OpCodes.Ldind_Ref); - } - } - - - /// - /// Emits a Stind* instruction for the appropriate type. - /// - internal static void EmitStoreValueIndirect(this ILGenerator il, Type type) { - ContractUtils.RequiresNotNull(type, "type"); - - if (type.IsValueType) { - if (type == typeof(int)) { - il.Emit(OpCodes.Stind_I4); - } else if (type == typeof(short)) { - il.Emit(OpCodes.Stind_I2); - } else if (type == typeof(long) || type == typeof(ulong)) { - il.Emit(OpCodes.Stind_I8); - } else if (type == typeof(char)) { - il.Emit(OpCodes.Stind_I2); - } else if (type == typeof(bool)) { - il.Emit(OpCodes.Stind_I1); - } else if (type == typeof(float)) { - il.Emit(OpCodes.Stind_R4); - } else if (type == typeof(double)) { - il.Emit(OpCodes.Stind_R8); - } else { - il.Emit(OpCodes.Stobj, type); - } - } else { - il.Emit(OpCodes.Stind_Ref); - } - } - - // Emits the Ldelem* instruction for the appropriate type - - internal static void EmitLoadElement(this ILGenerator il, Type type) { - ContractUtils.RequiresNotNull(type, "type"); - - if (!type.IsValueType) { - il.Emit(OpCodes.Ldelem_Ref); - } else if (type.IsEnum) { - il.Emit(OpCodes.Ldelem, type); - } else { - switch (Type.GetTypeCode(type)) { - case TypeCode.Boolean: - case TypeCode.SByte: - il.Emit(OpCodes.Ldelem_I1); - break; - case TypeCode.Byte: - il.Emit(OpCodes.Ldelem_U1); - break; - case TypeCode.Int16: - il.Emit(OpCodes.Ldelem_I2); - break; - case TypeCode.Char: - case TypeCode.UInt16: - il.Emit(OpCodes.Ldelem_U2); - break; - case TypeCode.Int32: - il.Emit(OpCodes.Ldelem_I4); - break; - case TypeCode.UInt32: - il.Emit(OpCodes.Ldelem_U4); - break; - case TypeCode.Int64: - case TypeCode.UInt64: - il.Emit(OpCodes.Ldelem_I8); - break; - case TypeCode.Single: - il.Emit(OpCodes.Ldelem_R4); - break; - case TypeCode.Double: - il.Emit(OpCodes.Ldelem_R8); - break; - default: - il.Emit(OpCodes.Ldelem, type); - break; - } - } - } - - /// - /// Emits a Stelem* instruction for the appropriate type. - /// - internal static void EmitStoreElement(this ILGenerator il, Type type) { - ContractUtils.RequiresNotNull(type, "type"); - - if (type.IsEnum) { - il.Emit(OpCodes.Stelem, type); - return; - } - switch (Type.GetTypeCode(type)) { - case TypeCode.Boolean: - case TypeCode.SByte: - case TypeCode.Byte: - il.Emit(OpCodes.Stelem_I1); - break; - case TypeCode.Char: - case TypeCode.Int16: - case TypeCode.UInt16: - il.Emit(OpCodes.Stelem_I2); - break; - case TypeCode.Int32: - case TypeCode.UInt32: - il.Emit(OpCodes.Stelem_I4); - break; - case TypeCode.Int64: - case TypeCode.UInt64: - il.Emit(OpCodes.Stelem_I8); - break; - case TypeCode.Single: - il.Emit(OpCodes.Stelem_R4); - break; - case TypeCode.Double: - il.Emit(OpCodes.Stelem_R8); - break; - default: - if (type.IsValueType) { - il.Emit(OpCodes.Stelem, type); - } else { - il.Emit(OpCodes.Stelem_Ref); - } - break; - } - } - - internal static void EmitType(this ILGenerator il, Type type) { - ContractUtils.RequiresNotNull(type, "type"); - - il.Emit(OpCodes.Ldtoken, type); - il.Emit(OpCodes.Call, typeof(Type).GetMethod("GetTypeFromHandle")); - } - - #endregion - - #region Fields, properties and methods - - internal static void EmitFieldAddress(this ILGenerator il, FieldInfo fi) { - ContractUtils.RequiresNotNull(fi, "fi"); - - if (fi.IsStatic) { - il.Emit(OpCodes.Ldsflda, fi); - } else { - il.Emit(OpCodes.Ldflda, fi); - } - } - - internal static void EmitFieldGet(this ILGenerator il, FieldInfo fi) { - ContractUtils.RequiresNotNull(fi, "fi"); - - if (fi.IsStatic) { - il.Emit(OpCodes.Ldsfld, fi); - } else { - il.Emit(OpCodes.Ldfld, fi); - } - } - - internal static void EmitFieldSet(this ILGenerator il, FieldInfo fi) { - ContractUtils.RequiresNotNull(fi, "fi"); - - if (fi.IsStatic) { - il.Emit(OpCodes.Stsfld, fi); - } else { - il.Emit(OpCodes.Stfld, fi); - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] - internal static void EmitNew(this ILGenerator il, ConstructorInfo ci) { - ContractUtils.RequiresNotNull(ci, "ci"); - - if (ci.DeclaringType.ContainsGenericParameters) { - throw Error.IllegalNewGenericParams(ci.DeclaringType); - } - - il.Emit(OpCodes.Newobj, ci); - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1711:IdentifiersShouldNotHaveIncorrectSuffix")] - internal static void EmitNew(this ILGenerator il, Type type, Type[] paramTypes) { - ContractUtils.RequiresNotNull(type, "type"); - ContractUtils.RequiresNotNull(paramTypes, "paramTypes"); - - ConstructorInfo ci = type.GetConstructor(paramTypes); - if (ci == null) throw Error.TypeDoesNotHaveConstructorForTheSignature(); - il.EmitNew(ci); - } - - #endregion - - #region Constants - - internal static void EmitNull(this ILGenerator il) { - il.Emit(OpCodes.Ldnull); - } - - internal static void EmitString(this ILGenerator il, string value) { - ContractUtils.RequiresNotNull(value, "value"); - il.Emit(OpCodes.Ldstr, value); - } - - internal static void EmitBoolean(this ILGenerator il, bool value) { - if (value) { - il.Emit(OpCodes.Ldc_I4_1); - } else { - il.Emit(OpCodes.Ldc_I4_0); - } - } - - internal static void EmitChar(this ILGenerator il, char value) { - il.EmitInt(value); - il.Emit(OpCodes.Conv_U2); - } - - internal static void EmitByte(this ILGenerator il, byte value) { - il.EmitInt(value); - il.Emit(OpCodes.Conv_U1); - } - - internal static void EmitSByte(this ILGenerator il, sbyte value) { - il.EmitInt(value); - il.Emit(OpCodes.Conv_I1); - } - - internal static void EmitShort(this ILGenerator il, short value) { - il.EmitInt(value); - il.Emit(OpCodes.Conv_I2); - } - - internal static void EmitUShort(this ILGenerator il, ushort value) { - il.EmitInt(value); - il.Emit(OpCodes.Conv_U2); - } - - internal static void EmitInt(this ILGenerator il, int value) { - OpCode c; - switch (value) { - case -1: - c = OpCodes.Ldc_I4_M1; - break; - case 0: - c = OpCodes.Ldc_I4_0; - break; - case 1: - c = OpCodes.Ldc_I4_1; - break; - case 2: - c = OpCodes.Ldc_I4_2; - break; - case 3: - c = OpCodes.Ldc_I4_3; - break; - case 4: - c = OpCodes.Ldc_I4_4; - break; - case 5: - c = OpCodes.Ldc_I4_5; - break; - case 6: - c = OpCodes.Ldc_I4_6; - break; - case 7: - c = OpCodes.Ldc_I4_7; - break; - case 8: - c = OpCodes.Ldc_I4_8; - break; - default: - if (value >= -128 && value <= 127) { - il.Emit(OpCodes.Ldc_I4_S, (sbyte)value); - } else { - il.Emit(OpCodes.Ldc_I4, value); - } - return; - } - il.Emit(c); - } - - internal static void EmitUInt(this ILGenerator il, uint value) { - il.EmitInt((int)value); - il.Emit(OpCodes.Conv_U4); - } - - internal static void EmitLong(this ILGenerator il, long value) { - il.Emit(OpCodes.Ldc_I8, value); - - // - // Now, emit convert to give the constant type information. - // - // Otherwise, it is treated as unsigned and overflow is not - // detected if it's used in checked ops. - // - il.Emit(OpCodes.Conv_I8); - } - - internal static void EmitULong(this ILGenerator il, ulong value) { - il.Emit(OpCodes.Ldc_I8, (long)value); - il.Emit(OpCodes.Conv_U8); - } - - internal static void EmitDouble(this ILGenerator il, double value) { - il.Emit(OpCodes.Ldc_R8, value); - } - - internal static void EmitSingle(this ILGenerator il, float value) { - il.Emit(OpCodes.Ldc_R4, value); - } - - // matches TryEmitConstant - internal static bool CanEmitConstant(object value, Type type) { - if (value == null || CanEmitILConstant(type)) { - return true; - } - - Type t = value as Type; - if (t != null && ShouldLdtoken(t)) { - return true; - } - - MethodBase mb = value as MethodBase; - if (mb != null && ShouldLdtoken(mb)) { - return true; - } - - return false; - } - - // matches TryEmitILConstant - private static bool CanEmitILConstant(Type type) { - switch (Type.GetTypeCode(type)) { - case TypeCode.Boolean: - case TypeCode.SByte: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.Int64: - case TypeCode.Single: - case TypeCode.Double: - case TypeCode.Char: - case TypeCode.Byte: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.UInt64: - case TypeCode.Decimal: - case TypeCode.String: - return true; - } - return false; - } - - internal static void EmitConstant(this ILGenerator il, object value) { - Debug.Assert(value != null); - EmitConstant(il, value, value.GetType()); - } - - - // - // Note: we support emitting more things as IL constants than - // Linq does - internal static void EmitConstant(this ILGenerator il, object value, Type type) { - if (value == null) { - // Smarter than the Linq implementation which uses the initobj - // pattern for all value types (works, but requires a local and - // more IL) - il.EmitDefault(type); - return; - } - - // Handle the easy cases - if (il.TryEmitILConstant(value, type)) { - return; - } - - // Check for a few more types that we support emitting as constants - Type t = value as Type; - if (t != null && ShouldLdtoken(t)) { - il.EmitType(t); - if (type != typeof(Type)) { - il.Emit(OpCodes.Castclass, type); - } - return; - } - - MethodBase mb = value as MethodBase; - if (mb != null && ShouldLdtoken(mb)) { - il.Emit(OpCodes.Ldtoken, mb); - Type dt = mb.DeclaringType; - if (dt != null && dt.IsGenericType) { - il.Emit(OpCodes.Ldtoken, dt); - il.Emit(OpCodes.Call, typeof(MethodBase).GetMethod("GetMethodFromHandle", new Type[] { typeof(RuntimeMethodHandle), typeof(RuntimeTypeHandle) })); - } else { - il.Emit(OpCodes.Call, typeof(MethodBase).GetMethod("GetMethodFromHandle", new Type[] { typeof(RuntimeMethodHandle) })); - } - if (type != typeof(MethodBase)) { - il.Emit(OpCodes.Castclass, type); - } - return; - } - - throw ContractUtils.Unreachable; - } - - internal static bool ShouldLdtoken(Type t) { -#if FEATURE_REFEMIT - if (t is TypeBuilder) { - return true; - } -#endif - return t.IsGenericParameter || t.IsVisible; - } - - internal static bool ShouldLdtoken(MethodBase mb) { - // Can't ldtoken on a DynamicMethod - if (mb is DynamicMethod) { - return false; - } - - Type dt = mb.DeclaringType; - return dt == null || ShouldLdtoken(dt); - } - - - private static bool TryEmitILConstant(this ILGenerator il, object value, Type type) { - switch (Type.GetTypeCode(type)) { - case TypeCode.Boolean: - il.EmitBoolean((bool)value); - return true; - case TypeCode.SByte: - il.EmitSByte((sbyte)value); - return true; - case TypeCode.Int16: - il.EmitShort((short)value); - return true; - case TypeCode.Int32: - il.EmitInt((int)value); - return true; - case TypeCode.Int64: - il.EmitLong((long)value); - return true; - case TypeCode.Single: - il.EmitSingle((float)value); - return true; - case TypeCode.Double: - il.EmitDouble((double)value); - return true; - case TypeCode.Char: - il.EmitChar((char)value); - return true; - case TypeCode.Byte: - il.EmitByte((byte)value); - return true; - case TypeCode.UInt16: - il.EmitUShort((ushort)value); - return true; - case TypeCode.UInt32: - il.EmitUInt((uint)value); - return true; - case TypeCode.UInt64: - il.EmitULong((ulong)value); - return true; - case TypeCode.Decimal: - il.EmitDecimal((decimal)value); - return true; - case TypeCode.String: - il.EmitString((string)value); - return true; - default: - return false; - } - } - - #endregion - - #region Linq Conversions - - internal static void EmitConvertToType(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked) { - if (TypeUtils.AreEquivalent(typeFrom, typeTo)) { - return; - } - - if (typeFrom == typeof(void) || typeTo == typeof(void)) { - throw ContractUtils.Unreachable; - } - - bool isTypeFromNullable = TypeUtils.IsNullableType(typeFrom); - bool isTypeToNullable = TypeUtils.IsNullableType(typeTo); - - Type nnExprType = TypeUtils.GetNonNullableType(typeFrom); - Type nnType = TypeUtils.GetNonNullableType(typeTo); - - if (typeFrom.IsInterface || // interface cast - typeTo.IsInterface || - typeFrom == typeof(object) || // boxing cast - typeTo == typeof(object) || - typeFrom == typeof(System.Enum) || - typeFrom == typeof(System.ValueType) || - TypeUtils.IsLegalExplicitVariantDelegateConversion(typeFrom, typeTo)) - { - il.EmitCastToType(typeFrom, typeTo); - } else if (isTypeFromNullable || isTypeToNullable) { - il.EmitNullableConversion(typeFrom, typeTo, isChecked); - } else if (!(TypeUtils.IsConvertible(typeFrom) && TypeUtils.IsConvertible(typeTo)) // primitive runtime conversion - && - (nnExprType.IsAssignableFrom(nnType) || // down cast - nnType.IsAssignableFrom(nnExprType))) // up cast - { - il.EmitCastToType(typeFrom, typeTo); - } else if (typeFrom.IsArray && typeTo.IsArray) { - // See DevDiv Bugs #94657. - il.EmitCastToType(typeFrom, typeTo); - } else { - il.EmitNumericConversion(typeFrom, typeTo, isChecked); - } - } - - - private static void EmitCastToType(this ILGenerator il, Type typeFrom, Type typeTo) { - if (!typeFrom.IsValueType && typeTo.IsValueType) { - il.Emit(OpCodes.Unbox_Any, typeTo); - } else if (typeFrom.IsValueType && !typeTo.IsValueType) { - il.Emit(OpCodes.Box, typeFrom); - if (typeTo != typeof(object)) { - il.Emit(OpCodes.Castclass, typeTo); - } - } else if (!typeFrom.IsValueType && !typeTo.IsValueType) { - il.Emit(OpCodes.Castclass, typeTo); - } else { - throw Error.InvalidCast(typeFrom, typeTo); - } - } - - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private static void EmitNumericConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked) { - bool isFromUnsigned = TypeUtils.IsUnsigned(typeFrom); - bool isFromFloatingPoint = TypeUtils.IsFloatingPoint(typeFrom); - if (typeTo == typeof(Single)) { - if (isFromUnsigned) - il.Emit(OpCodes.Conv_R_Un); - il.Emit(OpCodes.Conv_R4); - } else if (typeTo == typeof(Double)) { - if (isFromUnsigned) - il.Emit(OpCodes.Conv_R_Un); - il.Emit(OpCodes.Conv_R8); - } else { - TypeCode tc = Type.GetTypeCode(typeTo); - if (isChecked) { - // Overflow checking needs to know if the source value on the IL stack is unsigned or not. - if (isFromUnsigned) { - switch (tc) { - case TypeCode.SByte: - il.Emit(OpCodes.Conv_Ovf_I1_Un); - break; - case TypeCode.Int16: - il.Emit(OpCodes.Conv_Ovf_I2_Un); - break; - case TypeCode.Int32: - il.Emit(OpCodes.Conv_Ovf_I4_Un); - break; - case TypeCode.Int64: - il.Emit(OpCodes.Conv_Ovf_I8_Un); - break; - case TypeCode.Byte: - il.Emit(OpCodes.Conv_Ovf_U1_Un); - break; - case TypeCode.UInt16: - case TypeCode.Char: - il.Emit(OpCodes.Conv_Ovf_U2_Un); - break; - case TypeCode.UInt32: - il.Emit(OpCodes.Conv_Ovf_U4_Un); - break; - case TypeCode.UInt64: - il.Emit(OpCodes.Conv_Ovf_U8_Un); - break; - default: - throw Error.UnhandledConvert(typeTo); - } - } else { - switch (tc) { - case TypeCode.SByte: - il.Emit(OpCodes.Conv_Ovf_I1); - break; - case TypeCode.Int16: - il.Emit(OpCodes.Conv_Ovf_I2); - break; - case TypeCode.Int32: - il.Emit(OpCodes.Conv_Ovf_I4); - break; - case TypeCode.Int64: - il.Emit(OpCodes.Conv_Ovf_I8); - break; - case TypeCode.Byte: - il.Emit(OpCodes.Conv_Ovf_U1); - break; - case TypeCode.UInt16: - case TypeCode.Char: - il.Emit(OpCodes.Conv_Ovf_U2); - break; - case TypeCode.UInt32: - il.Emit(OpCodes.Conv_Ovf_U4); - break; - case TypeCode.UInt64: - il.Emit(OpCodes.Conv_Ovf_U8); - break; - default: - throw Error.UnhandledConvert(typeTo); - } - } - } else { - switch (tc) { - case TypeCode.SByte: - il.Emit(OpCodes.Conv_I1); - break; - case TypeCode.Byte: - il.Emit(OpCodes.Conv_U1); - break; - case TypeCode.Int16: - il.Emit(OpCodes.Conv_I2); - break; - case TypeCode.UInt16: - case TypeCode.Char: - il.Emit(OpCodes.Conv_U2); - break; - case TypeCode.Int32: - il.Emit(OpCodes.Conv_I4); - break; - case TypeCode.UInt32: - il.Emit(OpCodes.Conv_U4); - break; - case TypeCode.Int64: - if (isFromUnsigned) { - il.Emit(OpCodes.Conv_U8); - } else { - il.Emit(OpCodes.Conv_I8); - } - break; - case TypeCode.UInt64: - if (isFromUnsigned || isFromFloatingPoint) { - il.Emit(OpCodes.Conv_U8); - } else { - il.Emit(OpCodes.Conv_I8); - } - break; - default: - throw Error.UnhandledConvert(typeTo); - } - } - } - } - - private static void EmitNullableToNullableConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked) { - Debug.Assert(TypeUtils.IsNullableType(typeFrom)); - Debug.Assert(TypeUtils.IsNullableType(typeTo)); - Label labIfNull = default(Label); - Label labEnd = default(Label); - LocalBuilder locFrom = null; - LocalBuilder locTo = null; - locFrom = il.DeclareLocal(typeFrom); - il.Emit(OpCodes.Stloc, locFrom); - locTo = il.DeclareLocal(typeTo); - // test for null - il.Emit(OpCodes.Ldloca, locFrom); - il.EmitHasValue(typeFrom); - labIfNull = il.DefineLabel(); - il.Emit(OpCodes.Brfalse_S, labIfNull); - il.Emit(OpCodes.Ldloca, locFrom); - il.EmitGetValueOrDefault(typeFrom); - Type nnTypeFrom = TypeUtils.GetNonNullableType(typeFrom); - Type nnTypeTo = TypeUtils.GetNonNullableType(typeTo); - il.EmitConvertToType(nnTypeFrom, nnTypeTo, isChecked); - // construct result type - ConstructorInfo ci = typeTo.GetConstructor(new Type[] { nnTypeTo }); - il.Emit(OpCodes.Newobj, ci); - il.Emit(OpCodes.Stloc, locTo); - labEnd = il.DefineLabel(); - il.Emit(OpCodes.Br_S, labEnd); - // if null then create a default one - il.MarkLabel(labIfNull); - il.Emit(OpCodes.Ldloca, locTo); - il.Emit(OpCodes.Initobj, typeTo); - il.MarkLabel(labEnd); - il.Emit(OpCodes.Ldloc, locTo); - } - - - private static void EmitNonNullableToNullableConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked) { - Debug.Assert(!TypeUtils.IsNullableType(typeFrom)); - Debug.Assert(TypeUtils.IsNullableType(typeTo)); - LocalBuilder locTo = null; - locTo = il.DeclareLocal(typeTo); - Type nnTypeTo = TypeUtils.GetNonNullableType(typeTo); - il.EmitConvertToType(typeFrom, nnTypeTo, isChecked); - ConstructorInfo ci = typeTo.GetConstructor(new Type[] { nnTypeTo }); - il.Emit(OpCodes.Newobj, ci); - il.Emit(OpCodes.Stloc, locTo); - il.Emit(OpCodes.Ldloc, locTo); - } - - - private static void EmitNullableToNonNullableConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked) { - Debug.Assert(TypeUtils.IsNullableType(typeFrom)); - Debug.Assert(!TypeUtils.IsNullableType(typeTo)); - if (typeTo.IsValueType) - il.EmitNullableToNonNullableStructConversion(typeFrom, typeTo, isChecked); - else - il.EmitNullableToReferenceConversion(typeFrom); - } - - - private static void EmitNullableToNonNullableStructConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked) { - Debug.Assert(TypeUtils.IsNullableType(typeFrom)); - Debug.Assert(!TypeUtils.IsNullableType(typeTo)); - Debug.Assert(typeTo.IsValueType); - LocalBuilder locFrom = null; - locFrom = il.DeclareLocal(typeFrom); - il.Emit(OpCodes.Stloc, locFrom); - il.Emit(OpCodes.Ldloca, locFrom); - il.EmitGetValue(typeFrom); - Type nnTypeFrom = TypeUtils.GetNonNullableType(typeFrom); - il.EmitConvertToType(nnTypeFrom, typeTo, isChecked); - } - - - private static void EmitNullableToReferenceConversion(this ILGenerator il, Type typeFrom) { - Debug.Assert(TypeUtils.IsNullableType(typeFrom)); - // We've got a conversion from nullable to Object, ValueType, Enum, etc. Just box it so that - // we get the nullable semantics. - il.Emit(OpCodes.Box, typeFrom); - } - - - private static void EmitNullableConversion(this ILGenerator il, Type typeFrom, Type typeTo, bool isChecked) { - bool isTypeFromNullable = TypeUtils.IsNullableType(typeFrom); - bool isTypeToNullable = TypeUtils.IsNullableType(typeTo); - Debug.Assert(isTypeFromNullable || isTypeToNullable); - if (isTypeFromNullable && isTypeToNullable) - il.EmitNullableToNullableConversion(typeFrom, typeTo, isChecked); - else if (isTypeFromNullable) - il.EmitNullableToNonNullableConversion(typeFrom, typeTo, isChecked); - else - il.EmitNonNullableToNullableConversion(typeFrom, typeTo, isChecked); - } - - - internal static void EmitHasValue(this ILGenerator il, Type nullableType) { - MethodInfo mi = nullableType.GetMethod("get_HasValue", BindingFlags.Instance | BindingFlags.Public); - Debug.Assert(nullableType.IsValueType); - il.Emit(OpCodes.Call, mi); - } - - - internal static void EmitGetValue(this ILGenerator il, Type nullableType) { - MethodInfo mi = nullableType.GetMethod("get_Value", BindingFlags.Instance | BindingFlags.Public); - Debug.Assert(nullableType.IsValueType); - il.Emit(OpCodes.Call, mi); - } - - - internal static void EmitGetValueOrDefault(this ILGenerator il, Type nullableType) { - MethodInfo mi = nullableType.GetMethod("GetValueOrDefault", ReflectionUtils.EmptyTypes); - Debug.Assert(nullableType.IsValueType); - il.Emit(OpCodes.Call, mi); - } - - #endregion - - #region Arrays - - /// - /// Emits an array of constant values provided in the given list. - /// The array is strongly typed. - /// - internal static void EmitArray(this ILGenerator il, IList items) { - ContractUtils.RequiresNotNull(items, "items"); - - il.EmitInt(items.Count); - il.Emit(OpCodes.Newarr, typeof(T)); - for (int i = 0; i < items.Count; i++) { - il.Emit(OpCodes.Dup); - il.EmitInt(i); - il.EmitConstant(items[i], typeof(T)); - il.EmitStoreElement(typeof(T)); - } - } - - /// - /// Emits an array of values of count size. The items are emitted via the callback - /// which is provided with the current item index to emit. - /// - internal static void EmitArray(this ILGenerator il, Type elementType, int count, Action emit) { - ContractUtils.RequiresNotNull(elementType, "elementType"); - ContractUtils.RequiresNotNull(emit, "emit"); - if (count < 0) throw Error.CountCannotBeNegative(); - - il.EmitInt(count); - il.Emit(OpCodes.Newarr, elementType); - for (int i = 0; i < count; i++) { - il.Emit(OpCodes.Dup); - il.EmitInt(i); - - emit(i); - - il.EmitStoreElement(elementType); - } - } - - /// - /// Emits an array construction code. - /// The code assumes that bounds for all dimensions - /// are already emitted. - /// - internal static void EmitArray(this ILGenerator il, Type arrayType) { - ContractUtils.RequiresNotNull(arrayType, "arrayType"); - if (!arrayType.IsArray) throw Error.ArrayTypeMustBeArray(); - - int rank = arrayType.GetArrayRank(); - if (rank == 1) { - il.Emit(OpCodes.Newarr, arrayType.GetElementType()); - } else { - Type[] types = new Type[rank]; - for (int i = 0; i < rank; i++) { - types[i] = typeof(int); - } - il.EmitNew(arrayType, types); - } - } - - #endregion - - #region Support for emitting constants - - internal static void EmitDecimal(this ILGenerator il, decimal value) { - if (Decimal.Truncate(value) == value) { - if (Int32.MinValue <= value && value <= Int32.MaxValue) { - int intValue = Decimal.ToInt32(value); - il.EmitInt(intValue); - il.EmitNew(typeof(Decimal).GetConstructor(new Type[] { typeof(int) })); - } else if (Int64.MinValue <= value && value <= Int64.MaxValue) { - long longValue = Decimal.ToInt64(value); - il.EmitLong(longValue); - il.EmitNew(typeof(Decimal).GetConstructor(new Type[] { typeof(long) })); - } else { - il.EmitDecimalBits(value); - } - } else { - il.EmitDecimalBits(value); - } - } - - private static void EmitDecimalBits(this ILGenerator il, decimal value) { - int[] bits = Decimal.GetBits(value); - il.EmitInt(bits[0]); - il.EmitInt(bits[1]); - il.EmitInt(bits[2]); - il.EmitBoolean((bits[3] & 0x80000000) != 0); - il.EmitByte((byte)(bits[3] >> 16)); - il.EmitNew(typeof(decimal).GetConstructor(new Type[] { typeof(int), typeof(int), typeof(int), typeof(bool), typeof(byte) })); - } - - /// - /// Emits default(T) - /// Semantics match C# compiler behavior - /// - internal static void EmitDefault(this ILGenerator il, Type type) { - switch (Type.GetTypeCode(type)) { - case TypeCode.Object: - case TypeCode.DateTime: - if (type.IsValueType) { - // Type.GetTypeCode on an enum returns the underlying - // integer TypeCode, so we won't get here. - Debug.Assert(!type.IsEnum); - - // This is the IL for default(T) if T is a generic type - // parameter, so it should work for any type. It's also - // the standard pattern for structs. - LocalBuilder lb = il.DeclareLocal(type); - il.Emit(OpCodes.Ldloca, lb); - il.Emit(OpCodes.Initobj, type); - il.Emit(OpCodes.Ldloc, lb); - } else { - il.Emit(OpCodes.Ldnull); - } - break; - - case TypeCode.Empty: - case TypeCode.String: - case TypeCode.DBNull: - il.Emit(OpCodes.Ldnull); - break; - - case TypeCode.Boolean: - case TypeCode.Char: - case TypeCode.SByte: - case TypeCode.Byte: - case TypeCode.Int16: - case TypeCode.UInt16: - case TypeCode.Int32: - case TypeCode.UInt32: - il.Emit(OpCodes.Ldc_I4_0); - break; - - case TypeCode.Int64: - case TypeCode.UInt64: - il.Emit(OpCodes.Ldc_I4_0); - il.Emit(OpCodes.Conv_I8); - break; - - case TypeCode.Single: - il.Emit(OpCodes.Ldc_R4, default(Single)); - break; - - case TypeCode.Double: - il.Emit(OpCodes.Ldc_R8, default(Double)); - break; - - case TypeCode.Decimal: - il.Emit(OpCodes.Ldc_I4_0); - il.Emit(OpCodes.Newobj, typeof(Decimal).GetConstructor(new Type[] { typeof(int) })); - break; - - default: - throw ContractUtils.Unreachable; - } - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/KeyedQueue.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/KeyedQueue.cs deleted file mode 100644 index cdca6446351..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/KeyedQueue.cs +++ /dev/null @@ -1,88 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections.Generic; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - - /// - /// A simple dictionary of queues, keyed off a particular type - /// This is useful for storing free lists of variables - /// - internal sealed class KeyedQueue { - private readonly Dictionary> _data; - - internal KeyedQueue() { - _data = new Dictionary>(); - } - - internal void Enqueue(K key, V value) { - Queue queue; - if (!_data.TryGetValue(key, out queue)) { - _data.Add(key, queue = new Queue()); - } - queue.Enqueue(value); - } - - internal V Dequeue(K key) { - Queue queue; - if (!_data.TryGetValue(key, out queue)) { - throw Error.QueueEmpty(); - } - V result = queue.Dequeue(); - if (queue.Count == 0) { - _data.Remove(key); - } - return result; - } - - internal bool TryDequeue(K key, out V value) { - Queue queue; - if (_data.TryGetValue(key, out queue) && queue.Count > 0) { - value = queue.Dequeue(); - if (queue.Count == 0) { - _data.Remove(key); - } - return true; - } - value = default(V); - return false; - } - - internal V Peek(K key) { - Queue queue; - if (!_data.TryGetValue(key, out queue)) { - throw Error.QueueEmpty(); - } - return queue.Peek(); - } - - internal int GetCount(K key) { - Queue queue; - if (!_data.TryGetValue(key, out queue)) { - return 0; - } - return queue.Count; - } - - internal void Clear() { - _data.Clear(); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LabelInfo.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LabelInfo.cs deleted file mode 100644 index 74e05ff3090..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LabelInfo.cs +++ /dev/null @@ -1,357 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection.Emit; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif -#if !FEATURE_CORE_DLR || SILVERLIGHT - using ILGenerator = OffsetTrackingILGenerator; -#endif - - /// - /// Contains compiler state corresponding to a LabelTarget - /// See also LabelScopeInfo. - /// - internal sealed class LabelInfo { - // The tree node representing this label - private readonly LabelTarget _node; - - // The IL label, will be mutated if Node is redefined - private Label _label; - private bool _labelDefined; - - internal Label Label { - get { - EnsureLabelAndValue(); - return _label; - } - } - - // The local that carries the label's value, if any - private LocalBuilder _value; - - // The blocks where this label is defined. If it has more than one item, - // the blocks can't be jumped to except from a child block - private readonly Set _definitions = new Set(); - - // Blocks that jump to this block - private readonly List _references = new List(); - - // True if this label is the last thing in this block - // (meaning we can emit a direct return) - private readonly bool _canReturn; - - // True if at least one jump is across blocks - // If we have any jump across blocks to this label, then the - // LabelTarget can only be defined in one place - private bool _acrossBlockJump; - - // Until we have more information, default to a leave instruction, - // which always works. Note: leave spills the stack, so we need to - // ensure that StackSpiller has guarenteed us an empty stack at this - // point. Otherwise Leave and Branch are not equivalent - private OpCode _opCode = OpCodes.Leave; - - private readonly ILGenerator _ilg; - - internal LabelInfo(ILGenerator il, LabelTarget node, bool canReturn) { - _ilg = il; - _node = node; - _canReturn = canReturn; - } - - internal bool CanReturn { - get { return _canReturn; } - } - - /// - /// Indicates if it is legal to emit a "branch" instruction based on - /// currently available information. Call the Reference method before - /// using this property. - /// - internal bool CanBranch { - get { return _opCode != OpCodes.Leave; } - } - - internal void Reference(LabelScopeInfo block) { - _references.Add(block); - if (_definitions.Count > 0) { - ValidateJump(block); - } - } - - // Returns true if the label was successfully defined - // or false if the label is now ambiguous - internal void Define(LabelScopeInfo block) { - // Prevent the label from being shadowed, which enforces cleaner - // trees. Also we depend on this for simplicity (keeping only one - // active IL Label per LabelInfo) - for (LabelScopeInfo j = block; j != null; j = j.Parent) { - if (j.ContainsTarget(_node)) { - throw Error.LabelTargetAlreadyDefined(_node.Name); - } - } - - _definitions.Add(block); - block.AddLabelInfo(_node, this); - - // Once defined, validate all jumps - if (_definitions.Count == 1) { - foreach (var r in _references) { - ValidateJump(r); - } - } else { - // Was just redefined, if we had any across block jumps, they're - // now invalid - if (_acrossBlockJump) { - throw Error.AmbiguousJump(_node.Name); - } - // For local jumps, we need a new IL label - // This is okay because: - // 1. no across block jumps have been made or will be made - // 2. we don't allow the label to be shadowed - _labelDefined = false; - } - } - - private void ValidateJump(LabelScopeInfo reference) { - // Assume we can do a ret/branch - _opCode = _canReturn ? OpCodes.Ret : OpCodes.Br; - - // look for a simple jump out - for (LabelScopeInfo j = reference; j != null; j = j.Parent) { - if (_definitions.Contains(j)) { - // found it, jump is valid! - return; - } - if (j.Kind == LabelScopeKind.Finally || - j.Kind == LabelScopeKind.Filter) { - break; - } - if (j.Kind == LabelScopeKind.Try || - j.Kind == LabelScopeKind.Catch) { - _opCode = OpCodes.Leave; - } - } - - _acrossBlockJump = true; - if (_node != null && _node.Type != typeof(void)) { - throw Error.NonLocalJumpWithValue(_node.Name); - } - - if (_definitions.Count > 1) { - throw Error.AmbiguousJump(_node.Name); - } - - // We didn't find an outward jump. Look for a jump across blocks - LabelScopeInfo def = _definitions.First(); - LabelScopeInfo common = Helpers.CommonNode(def, reference, b => b.Parent); - - // Assume we can do a ret/branch - _opCode = _canReturn ? OpCodes.Ret : OpCodes.Br; - - // Validate that we aren't jumping across a finally - for (LabelScopeInfo j = reference; j != common; j = j.Parent) { - if (j.Kind == LabelScopeKind.Finally) { - throw Error.ControlCannotLeaveFinally(); - } - if (j.Kind == LabelScopeKind.Filter) { - throw Error.ControlCannotLeaveFilterTest(); - } - if (j.Kind == LabelScopeKind.Try || - j.Kind == LabelScopeKind.Catch) { - _opCode = OpCodes.Leave; - } - } - - // Valdiate that we aren't jumping into a catch or an expression - for (LabelScopeInfo j = def; j != common; j = j.Parent) { - if (!j.CanJumpInto) { - if (j.Kind == LabelScopeKind.Expression) { - throw Error.ControlCannotEnterExpression(); - } else { - throw Error.ControlCannotEnterTry(); - } - } - } - } - - internal void ValidateFinish() { - // Make sure that if this label was jumped to, it is also defined - if (_references.Count > 0 && _definitions.Count == 0) { - throw Error.LabelTargetUndefined(_node.Name); - } - } - - internal void EmitJump() { - // Return directly if we can - if (_opCode == OpCodes.Ret) { - _ilg.Emit(OpCodes.Ret); - } else { - StoreValue(); - _ilg.Emit(_opCode, Label); - } - } - - private void StoreValue() { - EnsureLabelAndValue(); - if (_value != null) { - _ilg.Emit(OpCodes.Stloc, _value); - } - } - - internal void Mark() { - if (_canReturn) { - // Don't mark return labels unless they were actually jumped to - // (returns are last so we know for sure if anyone jumped to it) - if (!_labelDefined) { - // We don't even need to emit the "ret" because - // LambdaCompiler does that for us. - return; - } - - // Otherwise, emit something like: - // ret - // : - // ldloc - _ilg.Emit(OpCodes.Ret); - } else { - - // For the normal case, we emit: - // stloc - // : - // ldloc - StoreValue(); - } - MarkWithEmptyStack(); - } - - // Like Mark, but assumes the stack is empty - internal void MarkWithEmptyStack() { - _ilg.MarkLabel(Label); - if (_value != null) { - // We always read the value from a local, because we don't know - // if there will be a "leave" instruction targeting it ("branch" - // preserves its stack, but "leave" empties the stack) - _ilg.Emit(OpCodes.Ldloc, _value); - } - } - - private void EnsureLabelAndValue() { - if (!_labelDefined) { - _labelDefined = true; - _label = _ilg.DefineLabel(); - if (_node != null && _node.Type != typeof(void)) { - _value = _ilg.DeclareLocal(_node.Type); - } - } - } - } - - internal enum LabelScopeKind { - // any "statement like" node that can be jumped into - Statement, - - // these correspond to the node of the same name - Block, - Switch, - Lambda, - Try, - - // these correspond to the part of the try block we're in - Catch, - Finally, - Filter, - - // the catch-all value for any other expression type - // (means we can't jump into it) - Expression, - } - - // - // Tracks scoping information for LabelTargets. Logically corresponds to a - // "label scope". Even though we have arbitrary goto support, we still need - // to track what kinds of nodes that gotos are jumping through, both to - // emit property IL ("leave" out of a try block), and for validation, and - // to allow labels to be duplicated in the tree, as long as the jumps are - // considered "up only" jumps. - // - // We create one of these for every Expression that can be jumped into, as - // well as creating them for the first expression we can't jump into. The - // "Kind" property indicates what kind of scope this is. - // - internal sealed class LabelScopeInfo { - private Dictionary Labels; // lazily allocated, we typically use this only once every 6th-7th block - internal readonly LabelScopeKind Kind; - internal readonly LabelScopeInfo Parent; - - internal LabelScopeInfo(LabelScopeInfo parent, LabelScopeKind kind) { - Parent = parent; - Kind = kind; - } - - /// - /// Returns true if we can jump into this node - /// - internal bool CanJumpInto { - get { - switch (Kind) { - case LabelScopeKind.Block: - case LabelScopeKind.Statement: - case LabelScopeKind.Switch: - case LabelScopeKind.Lambda: - return true; - } - return false; - } - } - - - internal bool ContainsTarget(LabelTarget target) { - if (Labels == null) { - return false; - } - - return Labels.ContainsKey(target); - } - - internal bool TryGetLabelInfo(LabelTarget target, out LabelInfo info) { - if (Labels == null) { - info = null; - return false; - } - - return Labels.TryGetValue(target, out info); - } - - internal void AddLabelInfo(LabelTarget target, LabelInfo info) { - Debug.Assert(CanJumpInto); - - if (Labels == null) { - Labels = new Dictionary(); - } - - Labels.Add(target, info); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Address.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Address.cs deleted file mode 100644 index 5b34dd25aed..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Address.cs +++ /dev/null @@ -1,334 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Reflection.Emit; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - partial class LambdaCompiler { - private void EmitAddress(Expression node, Type type) { - EmitAddress(node, type, CompilationFlags.EmitExpressionStart); - } - - // We don't want "ref" parameters to modify values of expressions - // except where it would in IL: locals, args, fields, and array elements - // (Unbox is an exception, it's intended to emit a ref to the orignal - // boxed value) - private void EmitAddress(Expression node, Type type, CompilationFlags flags) { - Debug.Assert(node != null); - bool emitStart = (flags & CompilationFlags.EmitExpressionStartMask) == CompilationFlags.EmitExpressionStart; - CompilationFlags startEmitted = emitStart ? EmitExpressionStart(node) : CompilationFlags.EmitNoExpressionStart; - - switch (node.NodeType) { - default: - EmitExpressionAddress(node, type); - break; - - case ExpressionType.ArrayIndex: - AddressOf((BinaryExpression)node, type); - break; - - case ExpressionType.Parameter: - AddressOf((ParameterExpression)node, type); - break; - - case ExpressionType.MemberAccess: - AddressOf((MemberExpression)node, type); - break; - - case ExpressionType.Unbox: - AddressOf((UnaryExpression)node, type); - break; - - case ExpressionType.Call: - AddressOf((MethodCallExpression)node, type); - break; - - case ExpressionType.Index: - AddressOf((IndexExpression)node, type); - break; - } - - if (emitStart) { - EmitExpressionEnd(startEmitted); - } - } - - - private void AddressOf(BinaryExpression node, Type type) { - Debug.Assert(node.NodeType == ExpressionType.ArrayIndex && node.Method == null); - - if (TypeUtils.AreEquivalent(type, node.Type)) { - EmitExpression(node.Left); - EmitExpression(node.Right); - Type rightType = node.Right.Type; - if (TypeUtils.IsNullableType(rightType)) { - LocalBuilder loc = GetLocal(rightType); - _ilg.Emit(OpCodes.Stloc, loc); - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.EmitGetValue(rightType); - FreeLocal(loc); - } - Type indexType = TypeUtils.GetNonNullableType(rightType); - if (indexType != typeof(int)) { - _ilg.EmitConvertToType(indexType, typeof(int), true); - } - _ilg.Emit(OpCodes.Ldelema, node.Type); - } else { - EmitExpressionAddress(node, type); - } - } - - private void AddressOf(ParameterExpression node, Type type) { - if (TypeUtils.AreEquivalent(type, node.Type)) { - if (node.IsByRef) { - _scope.EmitGet(node); - } else { - _scope.EmitAddressOf(node); - } - } else { - EmitExpressionAddress(node, type); - } - } - - - private void AddressOf(MemberExpression node, Type type) { - if (TypeUtils.AreEquivalent(type, node.Type)) { - // emit "this", if any - Type objectType = null; - if (node.Expression != null) { - EmitInstance(node.Expression, objectType = node.Expression.Type); - } - EmitMemberAddress(node.Member, objectType); - } else { - EmitExpressionAddress(node, type); - } - } - - // assumes the instance is already on the stack - private void EmitMemberAddress(MemberInfo member, Type objectType) { - if (member.MemberType == MemberTypes.Field) { - FieldInfo field = (FieldInfo)member; - - // Verifiable code may not take the address of an init-only field. - // If we are asked to do so then get the value out of the field, stuff it - // into a local of the same type, and then take the address of the local. - // Typically this is what we want to do anyway; if we are saying - // Foo.bar.ToString() for a static value-typed field bar then we don't need - // the address of field bar to do the call. The address of a local which - // has the same value as bar is sufficient. - - // CONSIDER: - // The C# compiler will not compile a lambda expression tree - // which writes to the address of an init-only field. But one could - // probably use the expression tree API to build such an expression. - // (When compiled, such an expression would fail silently.) It might - // be worth it to add checking to the expression tree API to ensure - // that it is illegal to attempt to write to an init-only field, - // the same way that it is illegal to write to a read-only property. - // The same goes for literal fields. - if (!field.IsLiteral && !field.IsInitOnly) { - _ilg.EmitFieldAddress(field); - return; - } - } - - EmitMemberGet(member, objectType); - LocalBuilder temp = GetLocal(GetMemberType(member)); - _ilg.Emit(OpCodes.Stloc, temp); - _ilg.Emit(OpCodes.Ldloca, temp); - } - - - private void AddressOf(MethodCallExpression node, Type type) { - // An array index of a multi-dimensional array is represented by a call to Array.Get, - // rather than having its own array-access node. This means that when we are trying to - // get the address of a member of a multi-dimensional array, we'll be trying to - // get the address of a Get method, and it will fail to do so. Instead, detect - // this situation and replace it with a call to the Address method. - if (!node.Method.IsStatic && - node.Object.Type.IsArray && - node.Method == node.Object.Type.GetMethod("Get", BindingFlags.Public | BindingFlags.Instance)) { - - MethodInfo mi = node.Object.Type.GetMethod("Address", BindingFlags.Public | BindingFlags.Instance); - - EmitMethodCall(node.Object, mi, node); - } else { - EmitExpressionAddress(node, type); - } - } - - private void AddressOf(IndexExpression node, Type type) { - if (!TypeUtils.AreEquivalent(type, node.Type) || node.Indexer != null) { - EmitExpressionAddress(node, type); - return; - } - - if (node.Arguments.Count == 1) { - EmitExpression(node.Object); - EmitExpression(node.Arguments[0]); - _ilg.Emit(OpCodes.Ldelema, node.Type); - } else { - var address = node.Object.Type.GetMethod("Address", BindingFlags.Public | BindingFlags.Instance); - EmitMethodCall(node.Object, address, node); - } - } - - private void AddressOf(UnaryExpression node, Type type) { - Debug.Assert(node.NodeType == ExpressionType.Unbox); - Debug.Assert(type.IsValueType && !TypeUtils.IsNullableType(type)); - - // Unbox leaves a pointer to the boxed value on the stack - EmitExpression(node.Operand); - _ilg.Emit(OpCodes.Unbox, type); - } - - private void EmitExpressionAddress(Expression node, Type type) { - Debug.Assert(TypeUtils.AreReferenceAssignable(type, node.Type)); - - EmitExpression(node, CompilationFlags.EmitAsNoTail | CompilationFlags.EmitNoExpressionStart); - LocalBuilder tmp = GetLocal(type); - _ilg.Emit(OpCodes.Stloc, tmp); - _ilg.Emit(OpCodes.Ldloca, tmp); - } - - - // Emits the address of the expression, returning the write back if necessary - // - // For properties, we want to write back into the property if it's - // passed byref. - private WriteBack EmitAddressWriteBack(Expression node, Type type) { - CompilationFlags startEmitted = EmitExpressionStart(node); - - WriteBack result = null; - if (TypeUtils.AreEquivalent(type, node.Type)) { - switch (node.NodeType) { - case ExpressionType.MemberAccess: - result = AddressOfWriteBack((MemberExpression)node); - break; - case ExpressionType.Index: - result = AddressOfWriteBack((IndexExpression)node); - break; - } - } - if (result == null) { - EmitAddress(node, type, CompilationFlags.EmitAsNoTail | CompilationFlags.EmitNoExpressionStart); - } - - EmitExpressionEnd(startEmitted); - - return result; - } - - private WriteBack AddressOfWriteBack(MemberExpression node) { - if (node.Member.MemberType != MemberTypes.Property || !((PropertyInfo)node.Member).CanWrite) { - return null; - } - - // emit instance, if any - LocalBuilder instanceLocal = null; - Type instanceType = null; - if (node.Expression != null) { - EmitInstance(node.Expression, instanceType = node.Expression.Type); - // store in local - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Stloc, instanceLocal = GetLocal(instanceType)); - } - - PropertyInfo pi = (PropertyInfo)node.Member; - - // emit the get - EmitCall(instanceType, pi.GetGetMethod(true)); - - // emit the address of the value - var valueLocal = GetLocal(node.Type); - _ilg.Emit(OpCodes.Stloc, valueLocal); - _ilg.Emit(OpCodes.Ldloca, valueLocal); - - // Set the property after the method call - // don't re-evaluate anything - return delegate() { - if (instanceLocal != null) { - _ilg.Emit(OpCodes.Ldloc, instanceLocal); - FreeLocal(instanceLocal); - } - _ilg.Emit(OpCodes.Ldloc, valueLocal); - FreeLocal(valueLocal); - EmitCall(instanceType, pi.GetSetMethod(true)); - }; - } - - private WriteBack AddressOfWriteBack(IndexExpression node) { - if (node.Indexer == null || !node.Indexer.CanWrite) { - return null; - } - - // emit instance, if any - LocalBuilder instanceLocal = null; - Type instanceType = null; - if (node.Object != null) { - EmitInstance(node.Object, instanceType = node.Object.Type); - - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Stloc, instanceLocal = GetLocal(instanceType)); - } - - // Emit indexes. We don't allow byref args, so no need to worry - // about writebacks or EmitAddress - List args = new List(); - foreach (var arg in node.Arguments) { - EmitExpression(arg); - - var argLocal = GetLocal(arg.Type); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Stloc, argLocal); - args.Add(argLocal); - } - - // emit the get - EmitGetIndexCall(node, instanceType); - - // emit the address of the value - var valueLocal = GetLocal(node.Type); - _ilg.Emit(OpCodes.Stloc, valueLocal); - _ilg.Emit(OpCodes.Ldloca, valueLocal); - - // Set the property after the method call - // don't re-evaluate anything - return delegate() { - if (instanceLocal != null) { - _ilg.Emit(OpCodes.Ldloc, instanceLocal); - FreeLocal(instanceLocal); - } - foreach (var arg in args) { - _ilg.Emit(OpCodes.Ldloc, arg); - FreeLocal(arg); - } - _ilg.Emit(OpCodes.Ldloc, valueLocal); - FreeLocal(valueLocal); - - EmitSetIndexCall(node, instanceType); - }; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs deleted file mode 100644 index 3c9ec62326e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Binary.cs +++ /dev/null @@ -1,707 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Reflection.Emit; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - partial class LambdaCompiler { - - private void EmitBinaryExpression(Expression expr) { - EmitBinaryExpression(expr, CompilationFlags.EmitAsNoTail); - } - - private void EmitBinaryExpression(Expression expr, CompilationFlags flags) { - BinaryExpression b = (BinaryExpression)expr; - - Debug.Assert(b.NodeType != ExpressionType.AndAlso && b.NodeType != ExpressionType.OrElse && b.NodeType != ExpressionType.Coalesce); - - if (b.Method != null) { - EmitBinaryMethod(b, flags); - return; - } - - // For EQ and NE, if there is a user-specified method, use it. - // Otherwise implement the C# semantics that allow equality - // comparisons on non-primitive nullable structs that don't - // overload "==" - if ((b.NodeType == ExpressionType.Equal || b.NodeType == ExpressionType.NotEqual) && - (b.Type == typeof(bool) || b.Type == typeof(bool?))) { - - // If we have x==null, x!=null, null==x or null!=x where x is - // nullable but not null, then generate a call to x.HasValue. - Debug.Assert(!b.IsLiftedToNull || b.Type == typeof(bool?)); - if (ConstantCheck.IsNull(b.Left) && !ConstantCheck.IsNull(b.Right) && TypeUtils.IsNullableType(b.Right.Type)) { - EmitNullEquality(b.NodeType, b.Right, b.IsLiftedToNull); - return; - } - if (ConstantCheck.IsNull(b.Right) && !ConstantCheck.IsNull(b.Left) && TypeUtils.IsNullableType(b.Left.Type)) { - EmitNullEquality(b.NodeType, b.Left, b.IsLiftedToNull); - return; - } - - // For EQ and NE, we can avoid some conversions if we're - // ultimately just comparing two managed pointers. - EmitExpression(GetEqualityOperand(b.Left)); - EmitExpression(GetEqualityOperand(b.Right)); - } else { - // Otherwise generate it normally - EmitExpression(b.Left); - EmitExpression(b.Right); - } - - EmitBinaryOperator(b.NodeType, b.Left.Type, b.Right.Type, b.Type, b.IsLiftedToNull); - } - - - private void EmitNullEquality(ExpressionType op, Expression e, bool isLiftedToNull) { - Debug.Assert(TypeUtils.IsNullableType(e.Type)); - Debug.Assert(op == ExpressionType.Equal || op == ExpressionType.NotEqual); - // If we are lifted to null then just evaluate the expression for its side effects, discard, - // and generate null. If we are not lifted to null then generate a call to HasValue. - if (isLiftedToNull) { - EmitExpressionAsVoid(e); - _ilg.EmitDefault(typeof(bool?)); - } else { - EmitAddress(e, e.Type); - _ilg.EmitHasValue(e.Type); - if (op == ExpressionType.Equal) { - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - } - } - } - - - private void EmitBinaryMethod(BinaryExpression b, CompilationFlags flags) { - if (b.IsLifted) { - ParameterExpression p1 = Expression.Variable(TypeUtils.GetNonNullableType(b.Left.Type), null); - ParameterExpression p2 = Expression.Variable(TypeUtils.GetNonNullableType(b.Right.Type), null); - MethodCallExpression mc = Expression.Call(null, b.Method, p1, p2); - Type resultType = null; - if (b.IsLiftedToNull) { - resultType = TypeUtils.GetNullableType(mc.Type); - } else { - switch (b.NodeType) { - case ExpressionType.Equal: - case ExpressionType.NotEqual: - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - if (mc.Type != typeof(bool)) { - throw Error.ArgumentMustBeBoolean(); - } - resultType = typeof(bool); - break; - default: - resultType = TypeUtils.GetNullableType(mc.Type); - break; - } - } - var variables = new ParameterExpression[] { p1, p2 }; - var arguments = new Expression[] { b.Left, b.Right }; - ValidateLift(variables, arguments); - EmitLift(b.NodeType, resultType, mc, variables, arguments); - } else { - EmitMethodCallExpression(Expression.Call(null, b.Method, b.Left, b.Right), flags); - } - } - - - private void EmitBinaryOperator(ExpressionType op, Type leftType, Type rightType, Type resultType, bool liftedToNull) { - bool leftIsNullable = TypeUtils.IsNullableType(leftType); - bool rightIsNullable = TypeUtils.IsNullableType(rightType); - - switch (op) { - case ExpressionType.ArrayIndex: - if (rightType != typeof(int)) { - throw ContractUtils.Unreachable; - } - _ilg.EmitLoadElement(leftType.GetElementType()); - return; - case ExpressionType.Coalesce: - throw Error.UnexpectedCoalesceOperator(); - } - - if (leftIsNullable || rightIsNullable) { - EmitLiftedBinaryOp(op, leftType, rightType, resultType, liftedToNull); - } else { - EmitUnliftedBinaryOp(op, leftType, rightType); - EmitConvertArithmeticResult(op, resultType); - } - } - - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void EmitUnliftedBinaryOp(ExpressionType op, Type leftType, Type rightType) { - Debug.Assert(!TypeUtils.IsNullableType(leftType)); - Debug.Assert(!TypeUtils.IsNullableType(rightType)); - - if (op == ExpressionType.Equal || op == ExpressionType.NotEqual) { - EmitUnliftedEquality(op, leftType); - return; - } - if (!leftType.IsPrimitive) { - throw Error.OperatorNotImplementedForType(op, leftType); - } - switch (op) { - case ExpressionType.Add: - _ilg.Emit(OpCodes.Add); - break; - case ExpressionType.AddChecked: - if (TypeUtils.IsFloatingPoint(leftType)) { - _ilg.Emit(OpCodes.Add); - } else if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Add_Ovf_Un); - } else { - _ilg.Emit(OpCodes.Add_Ovf); - } - break; - case ExpressionType.Subtract: - _ilg.Emit(OpCodes.Sub); - break; - case ExpressionType.SubtractChecked: - if (TypeUtils.IsFloatingPoint(leftType)) { - _ilg.Emit(OpCodes.Sub); - } else if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Sub_Ovf_Un); - } else { - _ilg.Emit(OpCodes.Sub_Ovf); - } - break; - case ExpressionType.Multiply: - _ilg.Emit(OpCodes.Mul); - break; - case ExpressionType.MultiplyChecked: - if (TypeUtils.IsFloatingPoint(leftType)) { - _ilg.Emit(OpCodes.Mul); - } else if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Mul_Ovf_Un); - } else { - _ilg.Emit(OpCodes.Mul_Ovf); - } - break; - case ExpressionType.Divide: - if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Div_Un); - } else { - _ilg.Emit(OpCodes.Div); - } - break; - case ExpressionType.Modulo: - if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Rem_Un); - } else { - _ilg.Emit(OpCodes.Rem); - } - break; - case ExpressionType.And: - case ExpressionType.AndAlso: - _ilg.Emit(OpCodes.And); - break; - case ExpressionType.Or: - case ExpressionType.OrElse: - _ilg.Emit(OpCodes.Or); - break; - case ExpressionType.LessThan: - if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Clt_Un); - } else { - _ilg.Emit(OpCodes.Clt); - } - break; - case ExpressionType.LessThanOrEqual: { - Label labFalse = _ilg.DefineLabel(); - Label labEnd = _ilg.DefineLabel(); - if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Ble_Un_S, labFalse); - } else { - _ilg.Emit(OpCodes.Ble_S, labFalse); - } - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Br_S, labEnd); - _ilg.MarkLabel(labFalse); - _ilg.Emit(OpCodes.Ldc_I4_1); - _ilg.MarkLabel(labEnd); - } - break; - case ExpressionType.GreaterThan: - if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Cgt_Un); - } else { - _ilg.Emit(OpCodes.Cgt); - } - break; - case ExpressionType.GreaterThanOrEqual: { - Label labFalse = _ilg.DefineLabel(); - Label labEnd = _ilg.DefineLabel(); - if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Bge_Un_S, labFalse); - } else { - _ilg.Emit(OpCodes.Bge_S, labFalse); - } - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Br_S, labEnd); - _ilg.MarkLabel(labFalse); - _ilg.Emit(OpCodes.Ldc_I4_1); - _ilg.MarkLabel(labEnd); - } - break; - case ExpressionType.ExclusiveOr: - _ilg.Emit(OpCodes.Xor); - break; - case ExpressionType.LeftShift: - if (rightType != typeof(int)) { - throw ContractUtils.Unreachable; - } - // Note: If this code is made to handle unsigned - // rightType types, emit the following when rightType: - // is unsigned - //_ilg.EmitInt(0x3f); - _ilg.EmitInt(0x1f); - _ilg.Emit(OpCodes.And); - _ilg.Emit(OpCodes.Shl); - break; - case ExpressionType.RightShift: - if (rightType != typeof(int)) { - throw ContractUtils.Unreachable; - } - if (TypeUtils.IsUnsigned(leftType)) { - _ilg.Emit(OpCodes.Shr_Un); - } else { - _ilg.Emit(OpCodes.Shr); - } - break; - default: - throw Error.UnhandledBinary(op); - } - } - - // Binary/unary operations on 8 and 16 bit operand types will leave a - // 32-bit value on the stack, because that's how IL works. For these - // cases, we need to cast it back to the resultType, possibly using a - // checked conversion if the original operator was convert - private void EmitConvertArithmeticResult(ExpressionType op, Type resultType) { - Debug.Assert(!resultType.IsNullableType()); - - switch (Type.GetTypeCode(resultType)) { - case TypeCode.Byte: - _ilg.Emit(IsChecked(op) ? OpCodes.Conv_Ovf_U1 : OpCodes.Conv_U1); - break; - case TypeCode.SByte: - _ilg.Emit(IsChecked(op) ? OpCodes.Conv_Ovf_I1 : OpCodes.Conv_I1); - break; - case TypeCode.UInt16: - _ilg.Emit(IsChecked(op) ? OpCodes.Conv_Ovf_U2 : OpCodes.Conv_U2); - break; - case TypeCode.Int16: - _ilg.Emit(IsChecked(op) ? OpCodes.Conv_Ovf_I2 : OpCodes.Conv_I2); - break; - } - } - - private void EmitUnliftedEquality(ExpressionType op, Type type) { - Debug.Assert(op == ExpressionType.Equal || op == ExpressionType.NotEqual); - if (!type.IsPrimitive && type.IsValueType && !type.IsEnum) { - throw Error.OperatorNotImplementedForType(op, type); - } - _ilg.Emit(OpCodes.Ceq); - if (op == ExpressionType.NotEqual) { - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - } - } - - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void EmitLiftedBinaryOp(ExpressionType op, Type leftType, Type rightType, Type resultType, bool liftedToNull) { - Debug.Assert(TypeUtils.IsNullableType(leftType) || TypeUtils.IsNullableType(rightType)); - switch (op) { - case ExpressionType.And: - if (leftType == typeof(bool?)) { - EmitLiftedBooleanAnd(); - } else { - EmitLiftedBinaryArithmetic(op, leftType, rightType, resultType); - } - break; - case ExpressionType.Or: - if (leftType == typeof(bool?)) { - EmitLiftedBooleanOr(); - } else { - EmitLiftedBinaryArithmetic(op, leftType, rightType, resultType); - } - break; - case ExpressionType.ExclusiveOr: - case ExpressionType.Add: - case ExpressionType.AddChecked: - case ExpressionType.Subtract: - case ExpressionType.SubtractChecked: - case ExpressionType.Multiply: - case ExpressionType.MultiplyChecked: - case ExpressionType.Divide: - case ExpressionType.Modulo: - case ExpressionType.LeftShift: - case ExpressionType.RightShift: - EmitLiftedBinaryArithmetic(op, leftType, rightType, resultType); - break; - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - case ExpressionType.Equal: - case ExpressionType.NotEqual: - EmitLiftedRelational(op, leftType, rightType, resultType, liftedToNull); - break; - case ExpressionType.AndAlso: - case ExpressionType.OrElse: - default: - throw ContractUtils.Unreachable; - } - } - - - private void EmitLiftedRelational(ExpressionType op, Type leftType, Type rightType, Type resultType, bool liftedToNull) { - Debug.Assert(TypeUtils.IsNullableType(leftType)); - - Label shortCircuit = _ilg.DefineLabel(); - LocalBuilder locLeft = GetLocal(leftType); - LocalBuilder locRight = GetLocal(rightType); - - // store values (reverse order since they are already on the stack) - _ilg.Emit(OpCodes.Stloc, locRight); - _ilg.Emit(OpCodes.Stloc, locLeft); - - if (op == ExpressionType.Equal) { - // test for both null -> true - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(leftType); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(rightType); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.And); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Brtrue_S, shortCircuit); - _ilg.Emit(OpCodes.Pop); - - // test for either is null -> false - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(leftType); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(rightType); - _ilg.Emit(OpCodes.And); - - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Brfalse_S, shortCircuit); - _ilg.Emit(OpCodes.Pop); - } else if (op == ExpressionType.NotEqual) { - // test for both null -> false - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(leftType); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(rightType); - _ilg.Emit(OpCodes.Or); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Brfalse_S, shortCircuit); - _ilg.Emit(OpCodes.Pop); - - // test for either is null -> true - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(leftType); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(rightType); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Or); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Brtrue_S, shortCircuit); - _ilg.Emit(OpCodes.Pop); - } else { - // test for either is null -> false - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(leftType); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(rightType); - _ilg.Emit(OpCodes.And); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Brfalse_S, shortCircuit); - _ilg.Emit(OpCodes.Pop); - } - - // do op on values - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitGetValueOrDefault(leftType); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitGetValueOrDefault(rightType); - - //RELEASING locLeft locRight - FreeLocal(locLeft); - FreeLocal(locRight); - - EmitBinaryOperator( - op, - TypeUtils.GetNonNullableType(leftType), - TypeUtils.GetNonNullableType(rightType), - TypeUtils.GetNonNullableType(resultType), - false - ); - - if (!liftedToNull) { - _ilg.MarkLabel(shortCircuit); - } - - if (!TypeUtils.AreEquivalent(resultType, TypeUtils.GetNonNullableType(resultType))) { - _ilg.EmitConvertToType(TypeUtils.GetNonNullableType(resultType), resultType, true); - } - - if (liftedToNull) { - Label labEnd = _ilg.DefineLabel(); - _ilg.Emit(OpCodes.Br, labEnd); - _ilg.MarkLabel(shortCircuit); - _ilg.Emit(OpCodes.Pop); - _ilg.Emit(OpCodes.Ldnull); - _ilg.Emit(OpCodes.Unbox_Any, resultType); - _ilg.MarkLabel(labEnd); - } - } - - - private void EmitLiftedBinaryArithmetic(ExpressionType op, Type leftType, Type rightType, Type resultType) { - bool leftIsNullable = TypeUtils.IsNullableType(leftType); - bool rightIsNullable = TypeUtils.IsNullableType(rightType); - - Debug.Assert(leftIsNullable || rightIsNullable); - - Label labIfNull = _ilg.DefineLabel(); - Label labEnd = _ilg.DefineLabel(); - LocalBuilder locLeft = GetLocal(leftType); - LocalBuilder locRight = GetLocal(rightType); - LocalBuilder locResult = GetLocal(resultType); - - // store values (reverse order since they are already on the stack) - _ilg.Emit(OpCodes.Stloc, locRight); - _ilg.Emit(OpCodes.Stloc, locLeft); - - // test for null - // use short circuiting - if (leftIsNullable) { - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(leftType); - _ilg.Emit(OpCodes.Brfalse_S, labIfNull); - } - if (rightIsNullable) { - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(rightType); - _ilg.Emit(OpCodes.Brfalse_S, labIfNull); - } - - // do op on values - if (leftIsNullable) { - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitGetValueOrDefault(leftType); - } else { - _ilg.Emit(OpCodes.Ldloc, locLeft); - } - - if (rightIsNullable) { - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitGetValueOrDefault(rightType); - } else { - _ilg.Emit(OpCodes.Ldloc, locRight); - } - - //RELEASING locLeft locRight - FreeLocal(locLeft); - FreeLocal(locRight); - - EmitBinaryOperator(op, TypeUtils.GetNonNullableType(leftType), TypeUtils.GetNonNullableType(rightType), TypeUtils.GetNonNullableType(resultType), false); - - // construct result type - ConstructorInfo ci = resultType.GetConstructor(new Type[] { TypeUtils.GetNonNullableType(resultType) }); - _ilg.Emit(OpCodes.Newobj, ci); - _ilg.Emit(OpCodes.Stloc, locResult); - _ilg.Emit(OpCodes.Br_S, labEnd); - - // if null then create a default one - _ilg.MarkLabel(labIfNull); - _ilg.Emit(OpCodes.Ldloca, locResult); - _ilg.Emit(OpCodes.Initobj, resultType); - - _ilg.MarkLabel(labEnd); - - _ilg.Emit(OpCodes.Ldloc, locResult); - - //RELEASING locResult - FreeLocal(locResult); - } - - - private void EmitLiftedBooleanAnd() { - Type type = typeof(bool?); - Label labComputeRight = _ilg.DefineLabel(); - Label labReturnFalse = _ilg.DefineLabel(); - Label labReturnNull = _ilg.DefineLabel(); - Label labReturnValue = _ilg.DefineLabel(); - Label labExit = _ilg.DefineLabel(); - - // store values (reverse order since they are already on the stack) - LocalBuilder locLeft = GetLocal(type); - LocalBuilder locRight = GetLocal(type); - _ilg.Emit(OpCodes.Stloc, locRight); - _ilg.Emit(OpCodes.Stloc, locLeft); - - // compute left - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse, labComputeRight); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitGetValueOrDefault(type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brtrue, labReturnFalse); - - // compute right - _ilg.MarkLabel(labComputeRight); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse_S, labReturnNull); - _ilg.Emit(OpCodes.Ldloca, locRight); - - //RELEASING locRight - FreeLocal(locRight); - - _ilg.EmitGetValueOrDefault(type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brtrue_S, labReturnFalse); - - // check left for null again - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse, labReturnNull); - - // return true - _ilg.Emit(OpCodes.Ldc_I4_1); - _ilg.Emit(OpCodes.Br_S, labReturnValue); - - // return false - _ilg.MarkLabel(labReturnFalse); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Br_S, labReturnValue); - - _ilg.MarkLabel(labReturnValue); - ConstructorInfo ci = type.GetConstructor(new Type[] { typeof(bool) }); - _ilg.Emit(OpCodes.Newobj, ci); - _ilg.Emit(OpCodes.Stloc, locLeft); - _ilg.Emit(OpCodes.Br, labExit); - - // return null - _ilg.MarkLabel(labReturnNull); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.Emit(OpCodes.Initobj, type); - - _ilg.MarkLabel(labExit); - _ilg.Emit(OpCodes.Ldloc, locLeft); - - //RELEASING locLeft - FreeLocal(locLeft); - } - - - private void EmitLiftedBooleanOr() { - Type type = typeof(bool?); - Label labComputeRight = _ilg.DefineLabel(); - Label labReturnTrue = _ilg.DefineLabel(); - Label labReturnNull = _ilg.DefineLabel(); - Label labReturnValue = _ilg.DefineLabel(); - Label labExit = _ilg.DefineLabel(); - - // store values (reverse order since they are already on the stack) - LocalBuilder locLeft = GetLocal(type); - LocalBuilder locRight = GetLocal(type); - _ilg.Emit(OpCodes.Stloc, locRight); - _ilg.Emit(OpCodes.Stloc, locLeft); - - // compute left - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse, labComputeRight); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitGetValueOrDefault(type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brfalse, labReturnTrue); - - // compute right - _ilg.MarkLabel(labComputeRight); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse_S, labReturnNull); - _ilg.Emit(OpCodes.Ldloca, locRight); - - //RELEASING locRight - FreeLocal(locRight); - - _ilg.EmitGetValueOrDefault(type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brfalse_S, labReturnTrue); - - // check left for null again - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse, labReturnNull); - - // return false - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Br_S, labReturnValue); - - // return true - _ilg.MarkLabel(labReturnTrue); - _ilg.Emit(OpCodes.Ldc_I4_1); - _ilg.Emit(OpCodes.Br_S, labReturnValue); - - _ilg.MarkLabel(labReturnValue); - ConstructorInfo ci = type.GetConstructor(new Type[] { typeof(bool) }); - _ilg.Emit(OpCodes.Newobj, ci); - _ilg.Emit(OpCodes.Stloc, locLeft); - _ilg.Emit(OpCodes.Br, labExit); - - // return null - _ilg.MarkLabel(labReturnNull); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.Emit(OpCodes.Initobj, type); - - _ilg.MarkLabel(labExit); - _ilg.Emit(OpCodes.Ldloc, locLeft); - - //RELEASING locLeft - FreeLocal(locLeft); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.ControlFlow.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.ControlFlow.cs deleted file mode 100644 index 2e8cede7064..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.ControlFlow.cs +++ /dev/null @@ -1,257 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - - // The part of the LambdaCompiler dealing with low level control flow - // break, contiue, return, exceptions, etc - partial class LambdaCompiler { - - private LabelInfo EnsureLabel(LabelTarget node) { - LabelInfo result; - if (!_labelInfo.TryGetValue(node, out result)) { - _labelInfo.Add(node, result = new LabelInfo(_ilg, node, false)); - } - return result; - } - - private LabelInfo ReferenceLabel(LabelTarget node) { - LabelInfo result = EnsureLabel(node); - result.Reference(_labelBlock); - return result; - } - - private LabelInfo DefineLabel(LabelTarget node) { - if (node == null) { - return new LabelInfo(_ilg, null, false); - } - LabelInfo result = EnsureLabel(node); - result.Define(_labelBlock); - return result; - } - - private void PushLabelBlock(LabelScopeKind type) { - _labelBlock = new LabelScopeInfo(_labelBlock, type); - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "kind")] - private void PopLabelBlock(LabelScopeKind kind) { - Debug.Assert(_labelBlock != null && _labelBlock.Kind == kind); - _labelBlock = _labelBlock.Parent; - } - - private void EmitLabelExpression(Expression expr, CompilationFlags flags) { - var node = (LabelExpression)expr; - Debug.Assert(node.Target != null); - - // If we're an immediate child of a block, our label will already - // be defined. If not, we need to define our own block so this - // label isn't exposed except to its own child expression. - LabelInfo label = null; - - if (_labelBlock.Kind == LabelScopeKind.Block) { - _labelBlock.TryGetLabelInfo(node.Target, out label); - - // We're in a block but didn't find our label, try switch - if (label == null && _labelBlock.Parent.Kind == LabelScopeKind.Switch) { - _labelBlock.Parent.TryGetLabelInfo(node.Target, out label); - } - - // if we're in a switch or block, we should've found the label - Debug.Assert(label != null); - } - - if (label == null) { - label = DefineLabel(node.Target); - } - - if (node.DefaultValue != null) { - if (node.Target.Type == typeof(void)) { - EmitExpressionAsVoid(node.DefaultValue, flags); - } else { - flags = UpdateEmitExpressionStartFlag(flags, CompilationFlags.EmitExpressionStart); - EmitExpression(node.DefaultValue, flags); - } - } - - label.Mark(); - } - - private void EmitGotoExpression(Expression expr, CompilationFlags flags) { - var node = (GotoExpression)expr; - var labelInfo = ReferenceLabel(node.Target); - - var tailCall = flags & CompilationFlags.EmitAsTailCallMask; - if (tailCall != CompilationFlags.EmitAsNoTail) { - // Since tail call flags are not passed into EmitTryExpression, CanReturn - // means the goto will be emitted as Ret. Therefore we can emit the goto's - // default value with tail call. This can be improved by detecting if the - // target label is equivalent to the return label. - tailCall = labelInfo.CanReturn ? CompilationFlags.EmitAsTail : CompilationFlags.EmitAsNoTail; - flags = UpdateEmitAsTailCallFlag(flags, tailCall); - } - - if (node.Value != null) { - if (node.Target.Type == typeof(void)) { - EmitExpressionAsVoid(node.Value, flags); - } else { - flags = UpdateEmitExpressionStartFlag(flags, CompilationFlags.EmitExpressionStart); - EmitExpression(node.Value, flags); - } - } - - labelInfo.EmitJump(); - - EmitUnreachable(node, flags); - } - - // We need to push default(T), unless we're emitting ourselves as - // void. Even though the code is unreachable, we still have to - // generate correct IL. We can get rid of this once we have better - // reachability analysis. - private void EmitUnreachable(Expression node, CompilationFlags flags) { - if (node.Type != typeof(void) && (flags & CompilationFlags.EmitAsVoidType) == 0) { - _ilg.EmitDefault(node.Type); - } - } - - private bool TryPushLabelBlock(Expression node) { - // Anything that is "statement-like" -- e.g. has no associated - // stack state can be jumped into, with the exception of try-blocks - // We indicate this by a "Block" - // - // Otherwise, we push an "Expression" to indicate that it can't be - // jumped into - switch (node.NodeType) { - default: - if (_labelBlock.Kind != LabelScopeKind.Expression) { - PushLabelBlock(LabelScopeKind.Expression); - return true; - } - return false; - case ExpressionType.Label: - // LabelExpression is a bit special, if it's directly in a - // block it becomes associate with the block's scope. Same - // thing if it's in a switch case body. - if (_labelBlock.Kind == LabelScopeKind.Block) { - var label = ((LabelExpression)node).Target; - if (_labelBlock.ContainsTarget(label)) { - return false; - } - if (_labelBlock.Parent.Kind == LabelScopeKind.Switch && - _labelBlock.Parent.ContainsTarget(label)) { - return false; - } - } - PushLabelBlock(LabelScopeKind.Statement); - return true; - case ExpressionType.Block: - if (node is SpilledExpressionBlock) { - // treat it as an expression - goto default; - } - - PushLabelBlock(LabelScopeKind.Block); - // Labels defined immediately in the block are valid for - // the whole block. - if (_labelBlock.Parent.Kind != LabelScopeKind.Switch) { - DefineBlockLabels(node); - } - return true; - case ExpressionType.Switch: - PushLabelBlock(LabelScopeKind.Switch); - // Define labels inside of the switch cases so theyare in - // scope for the whole switch. This allows "goto case" and - // "goto default" to be considered as local jumps. - var @switch = (SwitchExpression)node; - foreach (SwitchCase c in @switch.Cases) { - DefineBlockLabels(c.Body); - } - DefineBlockLabels(@switch.DefaultBody); - return true; - - // Remove this when Convert(Void) goes away. - case ExpressionType.Convert: - if (node.Type != typeof(void)) { - // treat it as an expression - goto default; - } - PushLabelBlock(LabelScopeKind.Statement); - return true; - - case ExpressionType.Conditional: - case ExpressionType.Loop: - case ExpressionType.Goto: - PushLabelBlock(LabelScopeKind.Statement); - return true; - } - } - - private void DefineBlockLabels(Expression node) { - var block = node as BlockExpression; - if (block == null || block is SpilledExpressionBlock) { - return; - } - for (int i = 0, n = block.ExpressionCount; i < n; i++) { - Expression e = block.GetExpression(i); - - var label = e as LabelExpression; - if (label != null) { - DefineLabel(label.Target); - } - } - } - - // See if this lambda has a return label - // If so, we'll create it now and mark it as allowing the "ret" opcode - // This allows us to generate better IL - private void AddReturnLabel(LambdaExpression lambda) { - var expression = lambda.Body; - - while (true) { - switch (expression.NodeType) { - default: - // Didn't find return label - return; - case ExpressionType.Label: - // Found the label. We can directly return from this place - // only if the label type is reference assignable to the lambda return type. - var label = ((LabelExpression)expression).Target; - _labelInfo.Add(label, new LabelInfo(_ilg, label, TypeUtils.AreReferenceAssignable(lambda.ReturnType, label.Type))); - return; - case ExpressionType.Block: - // Look in the last significant expression of a block - var body = (BlockExpression)expression; - // omit empty and debuginfo at the end of the block since they - // are not going to emit any IL - for (int i = body.ExpressionCount - 1; i >= 0; i--) { - expression = body.GetExpression(i); - if (Significant(expression)) { - break; - } - } - continue; - } - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Expressions.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Expressions.cs deleted file mode 100644 index 10abcd4ef62..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Expressions.cs +++ /dev/null @@ -1,1085 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - partial class LambdaCompiler { - [Flags] - internal enum CompilationFlags { - EmitExpressionStart = 0x0001, - EmitNoExpressionStart = 0x0002, - EmitAsDefaultType = 0x0010, - EmitAsVoidType = 0x0020, - EmitAsTail = 0x0100, // at the tail position of a lambda, tail call can be safely emitted - EmitAsMiddle = 0x0200, // in the middle of a lambda, tail call can be emitted if it is in a return - EmitAsNoTail = 0x0400, // neither at the tail or in a return, or tail call is not turned on, no tail call is emitted - - EmitExpressionStartMask = 0x000f, - EmitAsTypeMask = 0x00f0, - EmitAsTailCallMask = 0x0f00 - } - - /// - /// Update the flag with a new EmitAsTailCall flag - /// - private static CompilationFlags UpdateEmitAsTailCallFlag(CompilationFlags flags, CompilationFlags newValue) { - Debug.Assert(newValue == CompilationFlags.EmitAsTail || newValue == CompilationFlags.EmitAsMiddle || newValue == CompilationFlags.EmitAsNoTail); - var oldValue = flags & CompilationFlags.EmitAsTailCallMask; - return flags ^ oldValue | newValue; - } - - /// - /// Update the flag with a new EmitExpressionStart flag - /// - private static CompilationFlags UpdateEmitExpressionStartFlag(CompilationFlags flags, CompilationFlags newValue) { - Debug.Assert(newValue == CompilationFlags.EmitExpressionStart || newValue == CompilationFlags.EmitNoExpressionStart); - var oldValue = flags & CompilationFlags.EmitExpressionStartMask; - return flags ^ oldValue | newValue; - } - - /// - /// Update the flag with a new EmitAsType flag - /// - private static CompilationFlags UpdateEmitAsTypeFlag(CompilationFlags flags, CompilationFlags newValue) { - Debug.Assert(newValue == CompilationFlags.EmitAsDefaultType || newValue == CompilationFlags.EmitAsVoidType); - var oldValue = flags & CompilationFlags.EmitAsTypeMask; - return flags ^ oldValue | newValue; - } - - /// - /// Generates code for this expression in a value position. - /// This method will leave the value of the expression - /// on the top of the stack typed as Type. - /// - internal void EmitExpression(Expression node) { - EmitExpression(node, CompilationFlags.EmitAsNoTail | CompilationFlags.EmitExpressionStart); - } - - /// - /// Emits an expression and discards the result. For some nodes this emits - /// more optimial code then EmitExpression/Pop - /// - private void EmitExpressionAsVoid(Expression node) { - EmitExpressionAsVoid(node, CompilationFlags.EmitAsNoTail); - } - - private void EmitExpressionAsVoid(Expression node, CompilationFlags flags) { - Debug.Assert(node != null); - - CompilationFlags startEmitted = EmitExpressionStart(node); - - switch (node.NodeType) { - case ExpressionType.Assign: - EmitAssign((BinaryExpression)node, CompilationFlags.EmitAsVoidType); - break; - case ExpressionType.Block: - Emit((BlockExpression)node, UpdateEmitAsTypeFlag(flags, CompilationFlags.EmitAsVoidType)); - break; - case ExpressionType.Throw: - EmitThrow((UnaryExpression)node, CompilationFlags.EmitAsVoidType); - break; - case ExpressionType.Goto: - EmitGotoExpression(node, UpdateEmitAsTypeFlag(flags, CompilationFlags.EmitAsVoidType)); - break; - case ExpressionType.Constant: - case ExpressionType.Default: - case ExpressionType.Parameter: - // no-op - break; - default: - if (node.Type == typeof(void)) { - EmitExpression(node, UpdateEmitExpressionStartFlag(flags, CompilationFlags.EmitNoExpressionStart)); - } else { - EmitExpression(node, CompilationFlags.EmitAsNoTail | CompilationFlags.EmitNoExpressionStart); - _ilg.Emit(OpCodes.Pop); - } - break; - } - EmitExpressionEnd(startEmitted); - } - - private void EmitExpressionAsType(Expression node, Type type, CompilationFlags flags) { - - if (type == typeof(void)) { - EmitExpressionAsVoid(node, flags); - } else { - // if the node is emitted as a different type, CastClass IL is emitted at the end, - // should not emit with tail calls. - if (!TypeUtils.AreEquivalent(node.Type, type)) { - EmitExpression(node); - Debug.Assert(TypeUtils.AreReferenceAssignable(type, node.Type)); - _ilg.Emit(OpCodes.Castclass, type); - } else { - // emit the with the flags and emit emit expression start - EmitExpression(node, UpdateEmitExpressionStartFlag(flags, CompilationFlags.EmitExpressionStart)); - } - } - } - - #region label block tracking - - private CompilationFlags EmitExpressionStart(Expression node) { - if (TryPushLabelBlock(node)) { - return CompilationFlags.EmitExpressionStart; - } - return CompilationFlags.EmitNoExpressionStart; - } - - private void EmitExpressionEnd(CompilationFlags flags) { - if ((flags & CompilationFlags.EmitExpressionStartMask) == CompilationFlags.EmitExpressionStart) { - PopLabelBlock(_labelBlock.Kind); - } - } - - #endregion - - #region InvocationExpression - - private void EmitInvocationExpression(Expression expr, CompilationFlags flags) { - InvocationExpression node = (InvocationExpression)expr; - - // Optimization: inline code for literal lambda's directly - // - // This is worth it because otherwise we end up with a extra call - // to DynamicMethod.CreateDelegate, which is expensive. - // - if (node.LambdaOperand != null) { - EmitInlinedInvoke(node, flags); - return; - } - - expr = node.Expression; - if (typeof(LambdaExpression).IsAssignableFrom(expr.Type)) { - // if the invoke target is a lambda expression tree, first compile it into a delegate - expr = Expression.Call(expr, expr.Type.GetMethod("Compile", new Type[0])); - } - expr = Expression.Call(expr, expr.Type.GetMethod("Invoke"), node.Arguments); - - EmitExpression(expr); - } - - private void EmitInlinedInvoke(InvocationExpression invoke, CompilationFlags flags) { - var lambda = invoke.LambdaOperand; - - // This is tricky: we need to emit the arguments outside of the - // scope, but set them inside the scope. Fortunately, using the IL - // stack it is entirely doable. - - // 1. Emit invoke arguments - List wb = EmitArguments(lambda.Type.GetMethod("Invoke"), invoke); - - // 2. Create the nested LambdaCompiler - var inner = new LambdaCompiler(this, lambda); - - // 3. Emit the body - // if the inlined lambda is the last expression of the whole lambda, - // tail call can be applied. - if (wb.Count != 0) { - flags = UpdateEmitAsTailCallFlag(flags, CompilationFlags.EmitAsNoTail); - } - inner.EmitLambdaBody(_scope, true, flags); - - // 4. Emit writebacks if needed - EmitWriteBack(wb); - } - - #endregion - - #region IndexExpression - - private void EmitIndexExpression(Expression expr) { - var node = (IndexExpression)expr; - - // Emit instance, if calling an instance method - Type objectType = null; - if (node.Object != null) { - EmitInstance(node.Object, objectType = node.Object.Type); - } - - // Emit indexes. We don't allow byref args, so no need to worry - // about writebacks or EmitAddress - foreach (var arg in node.Arguments) { - EmitExpression(arg); - } - - EmitGetIndexCall(node, objectType); - } - - private void EmitIndexAssignment(BinaryExpression node, CompilationFlags flags) { - var index = (IndexExpression)node.Left; - - var emitAs = flags & CompilationFlags.EmitAsTypeMask; - - // Emit instance, if calling an instance method - Type objectType = null; - if (index.Object != null) { - EmitInstance(index.Object, objectType = index.Object.Type); - } - - // Emit indexes. We don't allow byref args, so no need to worry - // about writebacks or EmitAddress - foreach (var arg in index.Arguments) { - EmitExpression(arg); - } - - // Emit value - EmitExpression(node.Right); - - // Save the expression value, if needed - LocalBuilder temp = null; - if (emitAs != CompilationFlags.EmitAsVoidType) { - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Stloc, temp = GetLocal(node.Type)); - } - - EmitSetIndexCall(index, objectType); - - // Restore the value - if (emitAs != CompilationFlags.EmitAsVoidType) { - _ilg.Emit(OpCodes.Ldloc, temp); - FreeLocal(temp); - } - } - - private void EmitGetIndexCall(IndexExpression node, Type objectType) { - if (node.Indexer != null) { - // For indexed properties, just call the getter - var method = node.Indexer.GetGetMethod(true); - EmitCall(objectType, method); - } else if (node.Arguments.Count != 1) { - // Multidimensional arrays, call get - _ilg.Emit(OpCodes.Call, node.Object.Type.GetMethod("Get", BindingFlags.Public | BindingFlags.Instance)); - } else { - // For one dimensional arrays, emit load - _ilg.EmitLoadElement(node.Type); - } - } - - private void EmitSetIndexCall(IndexExpression node, Type objectType) { - if (node.Indexer != null) { - // For indexed properties, just call the setter - var method = node.Indexer.GetSetMethod(true); - EmitCall(objectType, method); - } else if (node.Arguments.Count != 1) { - // Multidimensional arrays, call set - _ilg.Emit(OpCodes.Call, node.Object.Type.GetMethod("Set", BindingFlags.Public | BindingFlags.Instance)); - } else { - // For one dimensional arrays, emit store - _ilg.EmitStoreElement(node.Type); - } - } - - #endregion - - #region MethodCallExpression - - private void EmitMethodCallExpression(Expression expr, CompilationFlags flags) { - MethodCallExpression node = (MethodCallExpression)expr; - - EmitMethodCall(node.Object, node.Method, node, flags); - } - - private void EmitMethodCallExpression(Expression expr) { - EmitMethodCallExpression(expr, CompilationFlags.EmitAsNoTail); - } - - private void EmitMethodCall(Expression obj, MethodInfo method, IArgumentProvider methodCallExpr) { - EmitMethodCall(obj, method, methodCallExpr, CompilationFlags.EmitAsNoTail); - } - - private void EmitMethodCall(Expression obj, MethodInfo method, IArgumentProvider methodCallExpr, CompilationFlags flags) { - // Emit instance, if calling an instance method - Type objectType = null; - if (!method.IsStatic) { - EmitInstance(obj, objectType = obj.Type); - } - // if the obj has a value type, its address is passed to the method call so we cannot destroy the - // stack by emitting a tail call - if (obj != null && obj.Type.IsValueType) { - EmitMethodCall(method, methodCallExpr, objectType); - } else { - EmitMethodCall(method, methodCallExpr, objectType, flags); - } - } - - // assumes 'object' of non-static call is already on stack - private void EmitMethodCall(MethodInfo mi, IArgumentProvider args, Type objectType) { - EmitMethodCall(mi, args, objectType, CompilationFlags.EmitAsNoTail); - } - - // assumes 'object' of non-static call is already on stack - private void EmitMethodCall(MethodInfo mi, IArgumentProvider args, Type objectType, CompilationFlags flags) { - - // Emit arguments - List wb = EmitArguments(mi, args); - - // Emit the actual call - OpCode callOp = UseVirtual(mi) ? OpCodes.Callvirt : OpCodes.Call; - if (callOp == OpCodes.Callvirt && objectType.IsValueType) { - // This automatically boxes value types if necessary. - _ilg.Emit(OpCodes.Constrained, objectType); - } - // The method call can be a tail call if - // 1) the method call is the last instruction before Ret - // 2) the method does not have any ByRef parameters, refer to ECMA-335 Partition III Section 2.4. - // "Verification requires that no managed pointers are passed to the method being called, since - // it does not track pointers into the current frame." - if ((flags & CompilationFlags.EmitAsTailCallMask) == CompilationFlags.EmitAsTail && !MethodHasByRefParameter(mi)) { - _ilg.Emit(OpCodes.Tailcall); - } - if (mi.CallingConvention == CallingConventions.VarArgs) { - _ilg.EmitCall(callOp, mi, args.Map(a => a.Type)); - } else { - _ilg.Emit(callOp, mi); - } - - // Emit writebacks for properties passed as "ref" arguments - EmitWriteBack(wb); - } - - private static bool MethodHasByRefParameter(MethodInfo mi) { - foreach (var pi in mi.GetParametersCached()) { - if (pi.IsByRefParameter()) { - return true; - } - } - return false; - } - - private void EmitCall(Type objectType, MethodInfo method) { - if (method.CallingConvention == CallingConventions.VarArgs) { - throw Error.UnexpectedVarArgsCall(method); - } - - OpCode callOp = UseVirtual(method) ? OpCodes.Callvirt : OpCodes.Call; - if (callOp == OpCodes.Callvirt && objectType.IsValueType) { - _ilg.Emit(OpCodes.Constrained, objectType); - } - _ilg.Emit(callOp, method); - } - - private static bool UseVirtual(MethodInfo mi) { - // There are two factors: is the method static, virtual or non-virtual instance? - // And is the object ref or value? - // The cases are: - // - // static, ref: call - // static, value: call - // virtual, ref: callvirt - // virtual, value: call -- eg, double.ToString must be a non-virtual call to be verifiable. - // instance, ref: callvirt -- this looks wrong, but is verifiable and gives us a free null check. - // instance, value: call - // - // We never need to generate a nonvirtual call to a virtual method on a reference type because - // expression trees do not support "base.Foo()" style calling. - // - // We could do an optimization here for the case where we know that the object is a non-null - // reference type and the method is a non-virtual instance method. For example, if we had - // (new Foo()).Bar() for instance method Bar we don't need the null check so we could do a - // call rather than a callvirt. However that seems like it would not be a very big win for - // most dynamically generated code scenarios, so let's not do that for now. - - if (mi.IsStatic) { - return false; - } - if (mi.DeclaringType.IsValueType) { - return false; - } - return true; - } - - /// - /// Emits arguments to a call, and returns an array of writebacks that - /// should happen after the call. - /// - private List EmitArguments(MethodBase method, IArgumentProvider args) { - return EmitArguments(method, args, 0); - } - - /// - /// Emits arguments to a call, and returns an array of writebacks that - /// should happen after the call. For emitting dynamic expressions, we - /// need to skip the first parameter of the method (the call site). - /// - private List EmitArguments(MethodBase method, IArgumentProvider args, int skipParameters) { - ParameterInfo[] pis = method.GetParametersCached(); - Debug.Assert(args.ArgumentCount + skipParameters == pis.Length); - - var writeBacks = new List(); - for (int i = skipParameters, n = pis.Length; i < n; i++) { - ParameterInfo parameter = pis[i]; - Expression argument = args.GetArgument(i - skipParameters); - Type type = parameter.ParameterType; - - if (type.IsByRef) { - type = type.GetElementType(); - - WriteBack wb = EmitAddressWriteBack(argument, type); - if (wb != null) { - writeBacks.Add(wb); - } - } else { - EmitExpression(argument); - } - } - return writeBacks; - } - - private static void EmitWriteBack(IList writeBacks) { - foreach (WriteBack wb in writeBacks) { - wb(); - } - } - - #endregion - - private void EmitConstantExpression(Expression expr) { - ConstantExpression node = (ConstantExpression)expr; - - EmitConstant(node.Value, node.Type); - } - - private void EmitConstant(object value, Type type) { - // Try to emit the constant directly into IL - if (ILGen.CanEmitConstant(value, type)) { - _ilg.EmitConstant(value, type); - return; - } - - _boundConstants.EmitConstant(this, value, type); - } - - private void EmitDynamicExpression(Expression expr) { - if (!(_method is DynamicMethod)) { - throw Error.CannotCompileDynamic(); - } - - var node = (DynamicExpression)expr; - - var site = CallSite.Create(node.DelegateType, node.Binder); - Type siteType = site.GetType(); - - var invoke = node.DelegateType.GetMethod("Invoke"); - - // site.Target.Invoke(site, args) - EmitConstant(site, siteType); - - // Emit the temp as type CallSite so we get more reuse - _ilg.Emit(OpCodes.Dup); -#if !FEATURE_CORE_DLR - // For 3.5, emit the temp as CallSite to work around a Jit32 - // verifier issue (fixed in 3.5 sp1) - var siteTemp = GetLocal(siteType); -#else - var siteTemp = GetLocal(typeof(CallSite)); -#endif - _ilg.Emit(OpCodes.Stloc, siteTemp); - _ilg.Emit(OpCodes.Ldfld, siteType.GetField("Target")); - _ilg.Emit(OpCodes.Ldloc, siteTemp); - FreeLocal(siteTemp); - - List wb = EmitArguments(invoke, node, 1); - _ilg.Emit(OpCodes.Callvirt, invoke); - EmitWriteBack(wb); - } - - private void EmitNewExpression(Expression expr) { - NewExpression node = (NewExpression)expr; - - if (node.Constructor != null) { - List wb = EmitArguments(node.Constructor, node); - _ilg.Emit(OpCodes.Newobj, node.Constructor); - EmitWriteBack(wb); - } else { - Debug.Assert(node.Arguments.Count == 0, "Node with arguments must have a constructor."); - Debug.Assert(node.Type.IsValueType, "Only value type may have constructor not set."); - LocalBuilder temp = GetLocal(node.Type); - _ilg.Emit(OpCodes.Ldloca, temp); - _ilg.Emit(OpCodes.Initobj, node.Type); - _ilg.Emit(OpCodes.Ldloc, temp); - FreeLocal(temp); - } - } - - private void EmitTypeBinaryExpression(Expression expr) { - TypeBinaryExpression node = (TypeBinaryExpression)expr; - - if (node.NodeType == ExpressionType.TypeEqual) { - EmitExpression(node.ReduceTypeEqual()); - return; - } - - Type type = node.Expression.Type; - - // Try to determine the result statically - AnalyzeTypeIsResult result = ConstantCheck.AnalyzeTypeIs(node); - - if (result == AnalyzeTypeIsResult.KnownTrue || - result == AnalyzeTypeIsResult.KnownFalse) { - // Result is known statically, so just emit the expression for - // its side effects and return the result - EmitExpressionAsVoid(node.Expression); - _ilg.EmitBoolean(result == AnalyzeTypeIsResult.KnownTrue); - return; - } - - if (result == AnalyzeTypeIsResult.KnownAssignable) { - // We know the type can be assigned, but still need to check - // for null at runtime - if (type.IsNullableType()) { - EmitAddress(node.Expression, type); - _ilg.EmitHasValue(type); - return; - } - - Debug.Assert(!type.IsValueType); - EmitExpression(node.Expression); - _ilg.Emit(OpCodes.Ldnull); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - return; - } - - Debug.Assert(result == AnalyzeTypeIsResult.Unknown); - - // Emit a full runtime "isinst" check - EmitExpression(node.Expression); - if (type.IsValueType) { - _ilg.Emit(OpCodes.Box, type); - } - _ilg.Emit(OpCodes.Isinst, node.TypeOperand); - _ilg.Emit(OpCodes.Ldnull); - _ilg.Emit(OpCodes.Cgt_Un); - } - - private void EmitVariableAssignment(BinaryExpression node, CompilationFlags flags) { - var variable = (ParameterExpression)node.Left; - var emitAs = flags & CompilationFlags.EmitAsTypeMask; - - EmitExpression(node.Right); - if (emitAs != CompilationFlags.EmitAsVoidType) { - _ilg.Emit(OpCodes.Dup); - } - - if (variable.IsByRef) { - // Note: the stloc/ldloc pattern is a bit suboptimal, but it - // saves us from having to spill stack when assigning to a - // byref parameter. We already make this same tradeoff for - // hoisted variables, see ElementStorage.EmitStore - - LocalBuilder value = GetLocal(variable.Type); - _ilg.Emit(OpCodes.Stloc, value); - _scope.EmitGet(variable); - _ilg.Emit(OpCodes.Ldloc, value); - FreeLocal(value); - _ilg.EmitStoreValueIndirect(variable.Type); - } else { - _scope.EmitSet(variable); - } - } - - private void EmitAssignBinaryExpression(Expression expr) { - EmitAssign((BinaryExpression)expr, CompilationFlags.EmitAsDefaultType); - } - - private void EmitAssign(BinaryExpression node, CompilationFlags emitAs) { - switch (node.Left.NodeType) { - case ExpressionType.Index: - EmitIndexAssignment(node, emitAs); - return; - case ExpressionType.MemberAccess: - EmitMemberAssignment(node, emitAs); - return; - case ExpressionType.Parameter: - EmitVariableAssignment(node, emitAs); - return; - default: - throw Error.InvalidLvalue(node.Left.NodeType); - } - } - - private void EmitParameterExpression(Expression expr) { - ParameterExpression node = (ParameterExpression)expr; - _scope.EmitGet(node); - if (node.IsByRef) { - _ilg.EmitLoadValueIndirect(node.Type); - } - } - - private void EmitLambdaExpression(Expression expr) { - LambdaExpression node = (LambdaExpression)expr; - EmitDelegateConstruction(node); - } - - private void EmitRuntimeVariablesExpression(Expression expr) { - RuntimeVariablesExpression node = (RuntimeVariablesExpression)expr; - _scope.EmitVariableAccess(this, node.Variables); - } - - private void EmitMemberAssignment(BinaryExpression node, CompilationFlags flags) { - MemberExpression lvalue = (MemberExpression)node.Left; - MemberInfo member = lvalue.Member; - - // emit "this", if any - Type objectType = null; - if (lvalue.Expression != null) { - EmitInstance(lvalue.Expression, objectType = lvalue.Expression.Type); - } - - // emit value - EmitExpression(node.Right); - - LocalBuilder temp = null; - var emitAs = flags & CompilationFlags.EmitAsTypeMask; - if (emitAs != CompilationFlags.EmitAsVoidType) { - // save the value so we can return it - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Stloc, temp = GetLocal(node.Type)); - } - - switch (member.MemberType) { - case MemberTypes.Field: - _ilg.EmitFieldSet((FieldInfo)member); - break; - case MemberTypes.Property: - EmitCall(objectType, ((PropertyInfo)member).GetSetMethod(true)); - break; - default: - throw Error.InvalidMemberType(member.MemberType); - } - - if (emitAs != CompilationFlags.EmitAsVoidType) { - _ilg.Emit(OpCodes.Ldloc, temp); - FreeLocal(temp); - } - } - - private void EmitMemberExpression(Expression expr) { - MemberExpression node = (MemberExpression)expr; - - // emit "this", if any - Type instanceType = null; - if (node.Expression != null) { - EmitInstance(node.Expression, instanceType = node.Expression.Type); - } - - EmitMemberGet(node.Member, instanceType); - } - - // assumes instance is already on the stack - private void EmitMemberGet(MemberInfo member, Type objectType) { - switch (member.MemberType) { - case MemberTypes.Field: - FieldInfo fi = (FieldInfo)member; - if (fi.IsLiteral) { - EmitConstant(fi.GetRawConstantValue(), fi.FieldType); - } else { - _ilg.EmitFieldGet(fi); - } - break; - case MemberTypes.Property: - EmitCall(objectType, ((PropertyInfo)member).GetGetMethod(true)); - break; - default: - throw ContractUtils.Unreachable; - } - } - - private void EmitInstance(Expression instance, Type type) { - if (instance != null) { - if (type.IsValueType) { - EmitAddress(instance, type); - } else { - EmitExpression(instance); - } - } - } - - private void EmitNewArrayExpression(Expression expr) { - NewArrayExpression node = (NewArrayExpression)expr; - - if (node.NodeType == ExpressionType.NewArrayInit) { - _ilg.EmitArray( - node.Type.GetElementType(), - node.Expressions.Count, - delegate(int index) { - EmitExpression(node.Expressions[index]); - } - ); - } else { - ReadOnlyCollection bounds = node.Expressions; - for (int i = 0; i < bounds.Count; i++) { - Expression x = bounds[i]; - EmitExpression(x); - _ilg.EmitConvertToType(x.Type, typeof(int), true); - } - _ilg.EmitArray(node.Type); - } - } - - private void EmitDebugInfoExpression(Expression expr) { - if (!EmitDebugSymbols) { - return; - } - var node = (DebugInfoExpression)expr; - - if (node.IsClear && _sequencePointCleared) { - // Emitting another clearance after one clearance does not - // have any effect, so we can save it. - return; - } - - _tree.DebugInfoGenerator.MarkSequencePoint(_lambda, _method, _ilg, node); - _ilg.Emit(OpCodes.Nop); - _sequencePointCleared = node.IsClear; - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "expr")] - private static void EmitExtensionExpression(Expression expr) { - throw Error.ExtensionNotReduced(); - } - - #region ListInit, MemberInit - - private void EmitListInitExpression(Expression expr) { - EmitListInit((ListInitExpression)expr); - } - - private void EmitMemberInitExpression(Expression expr) { - EmitMemberInit((MemberInitExpression)expr); - } - - private void EmitBinding(MemberBinding binding, Type objectType) { - switch (binding.BindingType) { - case MemberBindingType.Assignment: - EmitMemberAssignment((MemberAssignment)binding, objectType); - break; - case MemberBindingType.ListBinding: - EmitMemberListBinding((MemberListBinding)binding); - break; - case MemberBindingType.MemberBinding: - EmitMemberMemberBinding((MemberMemberBinding)binding); - break; - default: - throw Error.UnknownBindingType(); - } - } - - private void EmitMemberAssignment(MemberAssignment binding, Type objectType) { - EmitExpression(binding.Expression); - FieldInfo fi = binding.Member as FieldInfo; - if (fi != null) { - _ilg.Emit(OpCodes.Stfld, fi); - } else { - PropertyInfo pi = binding.Member as PropertyInfo; - if (pi != null) { - EmitCall(objectType, pi.GetSetMethod(true)); - } else { - throw Error.UnhandledBinding(); - } - } - } - - private void EmitMemberMemberBinding(MemberMemberBinding binding) { - Type type = GetMemberType(binding.Member); - if (binding.Member is PropertyInfo && type.IsValueType) { - throw Error.CannotAutoInitializeValueTypeMemberThroughProperty(binding.Member); - } - if (type.IsValueType) { - EmitMemberAddress(binding.Member, binding.Member.DeclaringType); - } else { - EmitMemberGet(binding.Member, binding.Member.DeclaringType); - } - EmitMemberInit(binding.Bindings, false, type); - } - - private void EmitMemberListBinding(MemberListBinding binding) { - Type type = GetMemberType(binding.Member); - if (binding.Member is PropertyInfo && type.IsValueType) { - throw Error.CannotAutoInitializeValueTypeElementThroughProperty(binding.Member); - } - if (type.IsValueType) { - EmitMemberAddress(binding.Member, binding.Member.DeclaringType); - } else { - EmitMemberGet(binding.Member, binding.Member.DeclaringType); - } - EmitListInit(binding.Initializers, false, type); - } - - private void EmitMemberInit(MemberInitExpression init) { - EmitExpression(init.NewExpression); - LocalBuilder loc = null; - if (init.NewExpression.Type.IsValueType && init.Bindings.Count > 0) { - loc = _ilg.DeclareLocal(init.NewExpression.Type); - _ilg.Emit(OpCodes.Stloc, loc); - _ilg.Emit(OpCodes.Ldloca, loc); - } - EmitMemberInit(init.Bindings, loc == null, init.NewExpression.Type); - if (loc != null) { - _ilg.Emit(OpCodes.Ldloc, loc); - } - } - - // This method assumes that the instance is on the stack and is expected, based on "keepOnStack" flag - // to either leave the instance on the stack, or pop it. - private void EmitMemberInit(ReadOnlyCollection bindings, bool keepOnStack, Type objectType) { - int n = bindings.Count; - if (n == 0) { - // If there are no initializers and instance is not to be kept on the stack, we must pop explicitly. - if (!keepOnStack) { - _ilg.Emit(OpCodes.Pop); - } - } else { - for (int i = 0; i < n; i++) { - if (keepOnStack || i < n - 1) { - _ilg.Emit(OpCodes.Dup); - } - EmitBinding(bindings[i], objectType); - } - } - } - - private void EmitListInit(ListInitExpression init) { - EmitExpression(init.NewExpression); - LocalBuilder loc = null; - if (init.NewExpression.Type.IsValueType) { - loc = _ilg.DeclareLocal(init.NewExpression.Type); - _ilg.Emit(OpCodes.Stloc, loc); - _ilg.Emit(OpCodes.Ldloca, loc); - } - EmitListInit(init.Initializers, loc == null, init.NewExpression.Type); - if (loc != null) { - _ilg.Emit(OpCodes.Ldloc, loc); - } - } - - // This method assumes that the list instance is on the stack and is expected, based on "keepOnStack" flag - // to either leave the list instance on the stack, or pop it. - private void EmitListInit(ReadOnlyCollection initializers, bool keepOnStack, Type objectType) { - int n = initializers.Count; - - if (n == 0) { - // If there are no initializers and instance is not to be kept on the stack, we must pop explicitly. - if (!keepOnStack) { - _ilg.Emit(OpCodes.Pop); - } - } else { - for (int i = 0; i < n; i++) { - if (keepOnStack || i < n - 1) { - _ilg.Emit(OpCodes.Dup); - } - EmitMethodCall(initializers[i].AddMethod, initializers[i], objectType); - - // Aome add methods, ArrayList.Add for example, return non-void - if (initializers[i].AddMethod.ReturnType != typeof(void)) { - _ilg.Emit(OpCodes.Pop); - } - } - } - } - - private static Type GetMemberType(MemberInfo member) { - FieldInfo fi = member as FieldInfo; - if (fi != null) return fi.FieldType; - PropertyInfo pi = member as PropertyInfo; - if (pi != null) return pi.PropertyType; - throw Error.MemberNotFieldOrProperty(member); - } - - #endregion - - #region Expression helpers - - internal static void ValidateLift(IList variables, IList arguments) { - System.Diagnostics.Debug.Assert(variables != null); - System.Diagnostics.Debug.Assert(arguments != null); - - if (variables.Count != arguments.Count) { - throw Error.IncorrectNumberOfIndexes(); - } - for (int i = 0, n = variables.Count; i < n; i++) { - if (!TypeUtils.AreReferenceAssignable(variables[i].Type, TypeUtils.GetNonNullableType(arguments[i].Type))) { - throw Error.ArgumentTypesMustMatch(); - } - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void EmitLift(ExpressionType nodeType, Type resultType, MethodCallExpression mc, ParameterExpression[] paramList, Expression[] argList) { - Debug.Assert(TypeUtils.AreEquivalent(TypeUtils.GetNonNullableType(resultType), TypeUtils.GetNonNullableType(mc.Type))); - - switch (nodeType) { - default: - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: { - Label exit = _ilg.DefineLabel(); - Label exitNull = _ilg.DefineLabel(); - LocalBuilder anyNull = _ilg.DeclareLocal(typeof(bool)); - for (int i = 0, n = paramList.Length; i < n; i++) { - ParameterExpression v = paramList[i]; - Expression arg = argList[i]; - if (TypeUtils.IsNullableType(arg.Type)) { - _scope.AddLocal(this, v); - EmitAddress(arg, arg.Type); - _ilg.Emit(OpCodes.Dup); - _ilg.EmitHasValue(arg.Type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Stloc, anyNull); - _ilg.EmitGetValueOrDefault(arg.Type); - _scope.EmitSet(v); - } else { - _scope.AddLocal(this, v); - EmitExpression(arg); - if (!arg.Type.IsValueType) { - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Ldnull); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Stloc, anyNull); - } - _scope.EmitSet(v); - } - _ilg.Emit(OpCodes.Ldloc, anyNull); - _ilg.Emit(OpCodes.Brtrue, exitNull); - } - EmitMethodCallExpression(mc); - if (TypeUtils.IsNullableType(resultType) && !TypeUtils.AreEquivalent(resultType, mc.Type)) { - ConstructorInfo ci = resultType.GetConstructor(new Type[] { mc.Type }); - _ilg.Emit(OpCodes.Newobj, ci); - } - _ilg.Emit(OpCodes.Br_S, exit); - _ilg.MarkLabel(exitNull); - if (TypeUtils.AreEquivalent(resultType, TypeUtils.GetNullableType(mc.Type))) { - if (resultType.IsValueType) { - LocalBuilder result = GetLocal(resultType); - _ilg.Emit(OpCodes.Ldloca, result); - _ilg.Emit(OpCodes.Initobj, resultType); - _ilg.Emit(OpCodes.Ldloc, result); - FreeLocal(result); - } else { - _ilg.Emit(OpCodes.Ldnull); - } - } else { - switch (nodeType) { - case ExpressionType.LessThan: - case ExpressionType.LessThanOrEqual: - case ExpressionType.GreaterThan: - case ExpressionType.GreaterThanOrEqual: - _ilg.Emit(OpCodes.Ldc_I4_0); - break; - default: - throw Error.UnknownLiftType(nodeType); - } - } - _ilg.MarkLabel(exit); - return; - } - case ExpressionType.Equal: - case ExpressionType.NotEqual: { - if (TypeUtils.AreEquivalent(resultType, TypeUtils.GetNullableType(mc.Type))) { - goto default; - } - Label exit = _ilg.DefineLabel(); - Label exitAllNull = _ilg.DefineLabel(); - Label exitAnyNull = _ilg.DefineLabel(); - - LocalBuilder anyNull = _ilg.DeclareLocal(typeof(bool)); - LocalBuilder allNull = _ilg.DeclareLocal(typeof(bool)); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Stloc, anyNull); - _ilg.Emit(OpCodes.Ldc_I4_1); - _ilg.Emit(OpCodes.Stloc, allNull); - - for (int i = 0, n = paramList.Length; i < n; i++) { - ParameterExpression v = paramList[i]; - Expression arg = argList[i]; - _scope.AddLocal(this, v); - if (TypeUtils.IsNullableType(arg.Type)) { - EmitAddress(arg, arg.Type); - _ilg.Emit(OpCodes.Dup); - _ilg.EmitHasValue(arg.Type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Ldloc, anyNull); - _ilg.Emit(OpCodes.Or); - _ilg.Emit(OpCodes.Stloc, anyNull); - _ilg.Emit(OpCodes.Ldloc, allNull); - _ilg.Emit(OpCodes.And); - _ilg.Emit(OpCodes.Stloc, allNull); - _ilg.EmitGetValueOrDefault(arg.Type); - } else { - EmitExpression(arg); - if (!arg.Type.IsValueType) { - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Ldnull); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Ldloc, anyNull); - _ilg.Emit(OpCodes.Or); - _ilg.Emit(OpCodes.Stloc, anyNull); - _ilg.Emit(OpCodes.Ldloc, allNull); - _ilg.Emit(OpCodes.And); - _ilg.Emit(OpCodes.Stloc, allNull); - } else { - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Stloc, allNull); - } - } - _scope.EmitSet(v); - } - _ilg.Emit(OpCodes.Ldloc, allNull); - _ilg.Emit(OpCodes.Brtrue, exitAllNull); - _ilg.Emit(OpCodes.Ldloc, anyNull); - _ilg.Emit(OpCodes.Brtrue, exitAnyNull); - - EmitMethodCallExpression(mc); - if (TypeUtils.IsNullableType(resultType) && !TypeUtils.AreEquivalent(resultType, mc.Type)) { - ConstructorInfo ci = resultType.GetConstructor(new Type[] { mc.Type }); - _ilg.Emit(OpCodes.Newobj, ci); - } - _ilg.Emit(OpCodes.Br_S, exit); - - _ilg.MarkLabel(exitAllNull); - _ilg.EmitBoolean(nodeType == ExpressionType.Equal); - _ilg.Emit(OpCodes.Br_S, exit); - - _ilg.MarkLabel(exitAnyNull); - _ilg.EmitBoolean(nodeType == ExpressionType.NotEqual); - - _ilg.MarkLabel(exit); - return; - } - } - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Generated.cs deleted file mode 100644 index bd79a7a50de..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Generated.cs +++ /dev/null @@ -1,282 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - partial class LambdaCompiler { - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1505:AvoidUnmaintainableCode"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void EmitExpression(Expression node, CompilationFlags flags) { - Debug.Assert(node != null); - - bool emitStart = (flags & CompilationFlags.EmitExpressionStartMask) == CompilationFlags.EmitExpressionStart; - - CompilationFlags startEmitted = emitStart ? EmitExpressionStart(node) : CompilationFlags.EmitNoExpressionStart; - // only pass tail call flags to emit the expression - flags = flags & CompilationFlags.EmitAsTailCallMask; - - switch (node.NodeType) { - #region Generated Expression Compiler - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_compiler from: generate_tree.py - - case ExpressionType.Add: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.AddChecked: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.And: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.AndAlso: - EmitAndAlsoBinaryExpression(node, flags); - break; - case ExpressionType.ArrayLength: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.ArrayIndex: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.Call: - EmitMethodCallExpression(node, flags); - break; - case ExpressionType.Coalesce: - EmitCoalesceBinaryExpression(node); - break; - case ExpressionType.Conditional: - EmitConditionalExpression(node, flags); - break; - case ExpressionType.Constant: - EmitConstantExpression(node); - break; - case ExpressionType.Convert: - EmitConvertUnaryExpression(node, flags); - break; - case ExpressionType.ConvertChecked: - EmitConvertUnaryExpression(node, flags); - break; - case ExpressionType.Divide: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.Equal: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.ExclusiveOr: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.GreaterThan: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.GreaterThanOrEqual: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.Invoke: - EmitInvocationExpression(node, flags); - break; - case ExpressionType.Lambda: - EmitLambdaExpression(node); - break; - case ExpressionType.LeftShift: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.LessThan: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.LessThanOrEqual: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.ListInit: - EmitListInitExpression(node); - break; - case ExpressionType.MemberAccess: - EmitMemberExpression(node); - break; - case ExpressionType.MemberInit: - EmitMemberInitExpression(node); - break; - case ExpressionType.Modulo: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.Multiply: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.MultiplyChecked: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.Negate: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.UnaryPlus: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.NegateChecked: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.New: - EmitNewExpression(node); - break; - case ExpressionType.NewArrayInit: - EmitNewArrayExpression(node); - break; - case ExpressionType.NewArrayBounds: - EmitNewArrayExpression(node); - break; - case ExpressionType.Not: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.NotEqual: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.Or: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.OrElse: - EmitOrElseBinaryExpression(node, flags); - break; - case ExpressionType.Parameter: - EmitParameterExpression(node); - break; - case ExpressionType.Power: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.Quote: - EmitQuoteUnaryExpression(node); - break; - case ExpressionType.RightShift: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.Subtract: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.SubtractChecked: - EmitBinaryExpression(node, flags); - break; - case ExpressionType.TypeAs: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.TypeIs: - EmitTypeBinaryExpression(node); - break; - case ExpressionType.Assign: - EmitAssignBinaryExpression(node); - break; - case ExpressionType.Block: - EmitBlockExpression(node, flags); - break; - case ExpressionType.DebugInfo: - EmitDebugInfoExpression(node); - break; - case ExpressionType.Decrement: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.Dynamic: - EmitDynamicExpression(node); - break; - case ExpressionType.Default: - EmitDefaultExpression(node); - break; - case ExpressionType.Extension: - EmitExtensionExpression(node); - break; - case ExpressionType.Goto: - EmitGotoExpression(node, flags); - break; - case ExpressionType.Increment: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.Index: - EmitIndexExpression(node); - break; - case ExpressionType.Label: - EmitLabelExpression(node, flags); - break; - case ExpressionType.RuntimeVariables: - EmitRuntimeVariablesExpression(node); - break; - case ExpressionType.Loop: - EmitLoopExpression(node); - break; - case ExpressionType.Switch: - EmitSwitchExpression(node, flags); - break; - case ExpressionType.Throw: - EmitThrowUnaryExpression(node); - break; - case ExpressionType.Try: - EmitTryExpression(node); - break; - case ExpressionType.Unbox: - EmitUnboxUnaryExpression(node); - break; - case ExpressionType.TypeEqual: - EmitTypeBinaryExpression(node); - break; - case ExpressionType.OnesComplement: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.IsTrue: - EmitUnaryExpression(node, flags); - break; - case ExpressionType.IsFalse: - EmitUnaryExpression(node, flags); - break; - - // *** END GENERATED CODE *** - - #endregion - - default: - throw ContractUtils.Unreachable; - } - - if (emitStart) { - EmitExpressionEnd(startEmitted); - } - } - - private static bool IsChecked(ExpressionType op) { - switch (op) { - #region Generated Checked Operations - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_checked_ops from: generate_tree.py - - case ExpressionType.AddChecked: - case ExpressionType.ConvertChecked: - case ExpressionType.MultiplyChecked: - case ExpressionType.NegateChecked: - case ExpressionType.SubtractChecked: - case ExpressionType.AddAssignChecked: - case ExpressionType.MultiplyAssignChecked: - case ExpressionType.SubtractAssignChecked: - - // *** END GENERATED CODE *** - - #endregion - return true; - } - return false; - } - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Lambda.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Lambda.cs deleted file mode 100644 index 40756223bdf..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Lambda.cs +++ /dev/null @@ -1,199 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.CompilerServices; -using System.Threading; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - - /// - /// Dynamic Language Runtime Compiler. - /// This part compiles lambdas. - /// - partial class LambdaCompiler { - private static int _Counter; - - internal void EmitConstantArray(T[] array) { - // Emit as runtime constant if possible - // if not, emit into IL - if (_method is DynamicMethod) { - EmitConstant(array, typeof(T[])); -#if FEATURE_REFEMIT - } else if(_typeBuilder != null) { - // store into field in our type builder, we will initialize - // the value only once. - FieldBuilder fb = CreateStaticField("ConstantArray", typeof(T[])); - Label l = _ilg.DefineLabel(); - _ilg.Emit(OpCodes.Ldsfld, fb); - _ilg.Emit(OpCodes.Ldnull); - _ilg.Emit(OpCodes.Bne_Un, l); - _ilg.EmitArray(array); - _ilg.Emit(OpCodes.Stsfld, fb); - _ilg.MarkLabel(l); - _ilg.Emit(OpCodes.Ldsfld, fb); -#endif - } else { - _ilg.EmitArray(array); - } - } - - private void EmitClosureCreation(LambdaCompiler inner) { - bool closure = inner._scope.NeedsClosure; - bool boundConstants = inner._boundConstants.Count > 0; - - if (!closure && !boundConstants) { - _ilg.EmitNull(); - return; - } - - // new Closure(constantPool, currentHoistedLocals) - if (boundConstants) { - _boundConstants.EmitConstant(this, inner._boundConstants.ToArray(), typeof(object[])); - } else { - _ilg.EmitNull(); - } - if (closure) { - _scope.EmitGet(_scope.NearestHoistedLocals.SelfVariable); - } else { - _ilg.EmitNull(); - } - _ilg.EmitNew(typeof(Closure).GetConstructor(new Type[] { typeof(object[]), typeof(object[]) })); - } - - /// - /// Emits code which creates new instance of the delegateType delegate. - /// - /// Since the delegate is getting closed over the "Closure" argument, this - /// cannot be used with virtual/instance methods (inner must be static method) - /// - private void EmitDelegateConstruction(LambdaCompiler inner) { - Type delegateType = inner._lambda.Type; - DynamicMethod dynamicMethod = inner._method as DynamicMethod; - if (dynamicMethod != null) { - // dynamicMethod.CreateDelegate(delegateType, closure) - _boundConstants.EmitConstant(this, dynamicMethod, typeof(DynamicMethod)); - _ilg.EmitType(delegateType); - EmitClosureCreation(inner); - _ilg.Emit(OpCodes.Callvirt, typeof(DynamicMethod).GetMethod("CreateDelegate", new Type[] { typeof(Type), typeof(object) })); - _ilg.Emit(OpCodes.Castclass, delegateType); - } else { - // new DelegateType(closure) - EmitClosureCreation(inner); - _ilg.Emit(OpCodes.Ldftn, (MethodInfo)inner._method); - _ilg.Emit(OpCodes.Newobj, (ConstructorInfo)(delegateType.GetMember(".ctor")[0])); - } - } - - /// - /// Emits a delegate to the method generated for the LambdaExpression. - /// May end up creating a wrapper to match the requested delegate type. - /// - /// Lambda for which to generate a delegate - /// - private void EmitDelegateConstruction(LambdaExpression lambda) { - // 1. Create the new compiler - LambdaCompiler impl = CreateCompiler(lambda); - - // 2. emit the lambda - // Since additional ILs are always emitted after the lambda's body, should not emit with tail call optimization. - impl.EmitLambdaBody(_scope, false, CompilationFlags.EmitAsNoTail); - - // 3. emit the delegate creation in the outer lambda - EmitDelegateConstruction(impl); - } - - private LambdaCompiler CreateCompiler(LambdaExpression lambda) { -#if FEATURE_REFEMIT - if (!(_method is DynamicMethod)) { - // When the lambda does not have a name or the name is empty, generate a unique name for it. - string name = String.IsNullOrEmpty(lambda.Name) ? GetUniqueMethodName() : lambda.Name; - MethodBuilder mb = _typeBuilder.DefineMethod(name, MethodAttributes.Private | MethodAttributes.Static); - return new LambdaCompiler(_tree, lambda, mb); - } -#endif - return new LambdaCompiler(_tree, lambda); - } - - private static Type[] GetParameterTypes(LambdaExpression lambda) { - return lambda.Parameters.Map(p => p.IsByRef ? p.Type.MakeByRefType() : p.Type); - } - - private static string GetUniqueMethodName() { - return "{" + Interlocked.Increment(ref _Counter) + "}lambda_method"; - } - - private void EmitLambdaBody() { - // The lambda body is the "last" expression of the lambda - CompilationFlags tailCallFlag = _lambda.TailCall ? CompilationFlags.EmitAsTail : CompilationFlags.EmitAsNoTail; - EmitLambdaBody(null, false, tailCallFlag); - } - - /// - /// Emits the lambda body. If inlined, the parameters should already be - /// pushed onto the IL stack. - /// - /// The parent scope. - /// true if the lambda is inlined; false otherwise. - /// - /// The emum to specify if the lambda is compiled with the tail call optimization. - /// - private void EmitLambdaBody(CompilerScope parent, bool inlined, CompilationFlags flags) { - _scope.Enter(this, parent); - - if (inlined) { - // The arguments were already pushed onto the IL stack. - // Store them into locals, popping in reverse order. - // - // If any arguments were ByRef, the address is on the stack and - // we'll be storing it into the variable, which has a ref type. - for (int i = _lambda.Parameters.Count - 1; i >= 0; i--) { - _scope.EmitSet(_lambda.Parameters[i]); - } - } - - // Need to emit the expression start for the lambda body - flags = UpdateEmitExpressionStartFlag(flags, CompilationFlags.EmitExpressionStart); - if (_lambda.ReturnType == typeof(void)) { - EmitExpressionAsVoid(_lambda.Body, flags); - } else { - EmitExpression(_lambda.Body, flags); - } - - // Return must be the last instruction in a CLI method. - // But if we're inlining the lambda, we want to leave the return - // value on the IL stack. - if (!inlined) { - _ilg.Emit(OpCodes.Ret); - } - - _scope.Exit(); - - // Validate labels - Debug.Assert(_labelBlock.Parent == null && _labelBlock.Kind == LabelScopeKind.Lambda); - foreach (LabelInfo label in _labelInfo.Values) { - label.ValidateFinish(); - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Logical.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Logical.cs deleted file mode 100644 index 5af3a571386..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Logical.cs +++ /dev/null @@ -1,645 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Reflection.Emit; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - - partial class LambdaCompiler { - - #region Conditional - - private void EmitConditionalExpression(Expression expr, CompilationFlags flags) { - ConditionalExpression node = (ConditionalExpression)expr; - Debug.Assert(node.Test.Type == typeof(bool)); - Label labFalse = _ilg.DefineLabel(); - EmitExpressionAndBranch(false, node.Test, labFalse); - EmitExpressionAsType(node.IfTrue, node.Type, flags); - - if (NotEmpty(node.IfFalse)) { - Label labEnd = _ilg.DefineLabel(); - if ((flags & CompilationFlags.EmitAsTailCallMask) == CompilationFlags.EmitAsTail) { - // We know the conditional expression is at the end of the lambda, - // so it is safe to emit Ret here. - _ilg.Emit(OpCodes.Ret); - } else { - _ilg.Emit(OpCodes.Br, labEnd); - } - _ilg.MarkLabel(labFalse); - EmitExpressionAsType(node.IfFalse, node.Type, flags); - _ilg.MarkLabel(labEnd); - } else { - _ilg.MarkLabel(labFalse); - } - } - - /// - /// returns true if the expression is not empty, otherwise false. - /// - private static bool NotEmpty(Expression node) { - var empty = node as DefaultExpression; - if (empty == null || empty.Type != typeof(void)) { - return true; - } - - return false; - } - - /// - /// returns true if the expression is NOT empty and is not debug info, - /// or a block that contains only insignificant expressions. - /// - private static bool Significant(Expression node) { - var block = node as BlockExpression; - if (block != null) { - for (int i = 0; i < block.ExpressionCount; i++) { - if (Significant(block.GetExpression(i))) { - return true; - } - } - return false; - } - return NotEmpty(node) && !(node is DebugInfoExpression); - } - - #endregion - - #region Coalesce - - - private void EmitCoalesceBinaryExpression(Expression expr) { - BinaryExpression b = (BinaryExpression)expr; - Debug.Assert(b.Method == null); - - if (TypeUtils.IsNullableType(b.Left.Type)) { - EmitNullableCoalesce(b); - } else if (b.Left.Type.IsValueType) { - throw Error.CoalesceUsedOnNonNullType(); - } else if (b.Conversion != null) { - EmitLambdaReferenceCoalesce(b); - } else { - EmitReferenceCoalesceWithoutConversion(b); - } - } - - - private void EmitNullableCoalesce(BinaryExpression b) { - Debug.Assert(b.Method == null); - - LocalBuilder loc = GetLocal(b.Left.Type); - Label labIfNull = _ilg.DefineLabel(); - Label labEnd = _ilg.DefineLabel(); - EmitExpression(b.Left); - _ilg.Emit(OpCodes.Stloc, loc); - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.EmitHasValue(b.Left.Type); - _ilg.Emit(OpCodes.Brfalse, labIfNull); - - Type nnLeftType = TypeUtils.GetNonNullableType(b.Left.Type); - if (b.Conversion != null) { - Debug.Assert(b.Conversion.Parameters.Count == 1); - ParameterExpression p = b.Conversion.Parameters[0]; - Debug.Assert(p.Type.IsAssignableFrom(b.Left.Type) || - p.Type.IsAssignableFrom(nnLeftType)); - - // emit the delegate instance - EmitLambdaExpression(b.Conversion); - - // emit argument - if (!p.Type.IsAssignableFrom(b.Left.Type)) { - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.EmitGetValueOrDefault(b.Left.Type); - } else { - _ilg.Emit(OpCodes.Ldloc, loc); - } - - // emit call to invoke - _ilg.Emit(OpCodes.Callvirt, b.Conversion.Type.GetMethod("Invoke")); - } else if (!TypeUtils.AreEquivalent(b.Type, nnLeftType)) { - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.EmitGetValueOrDefault(b.Left.Type); - _ilg.EmitConvertToType(nnLeftType, b.Type, true); - } else { - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.EmitGetValueOrDefault(b.Left.Type); - } - FreeLocal(loc); - - _ilg.Emit(OpCodes.Br, labEnd); - _ilg.MarkLabel(labIfNull); - EmitExpression(b.Right); - if (!TypeUtils.AreEquivalent(b.Right.Type, b.Type)) { - _ilg.EmitConvertToType(b.Right.Type, b.Type, true); - } - _ilg.MarkLabel(labEnd); - } - - - private void EmitLambdaReferenceCoalesce(BinaryExpression b) { - LocalBuilder loc = GetLocal(b.Left.Type); - Label labEnd = _ilg.DefineLabel(); - Label labNotNull = _ilg.DefineLabel(); - EmitExpression(b.Left); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Stloc, loc); - _ilg.Emit(OpCodes.Ldnull); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brfalse, labNotNull); - EmitExpression(b.Right); - _ilg.Emit(OpCodes.Br, labEnd); - - // if not null, call conversion - _ilg.MarkLabel(labNotNull); - Debug.Assert(b.Conversion.Parameters.Count == 1); - - // emit the delegate instance - EmitLambdaExpression(b.Conversion); - - // emit argument - _ilg.Emit(OpCodes.Ldloc, loc); - FreeLocal(loc); - - // emit call to invoke - _ilg.Emit(OpCodes.Callvirt, b.Conversion.Type.GetMethod("Invoke")); - - _ilg.MarkLabel(labEnd); - } - - - private void EmitReferenceCoalesceWithoutConversion(BinaryExpression b) { - Label labEnd = _ilg.DefineLabel(); - Label labCast = _ilg.DefineLabel(); - EmitExpression(b.Left); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Ldnull); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brfalse, labCast); - _ilg.Emit(OpCodes.Pop); - EmitExpression(b.Right); - if (!TypeUtils.AreEquivalent(b.Right.Type, b.Type)) { - if (b.Right.Type.IsValueType) { - _ilg.Emit(OpCodes.Box, b.Right.Type); - } - _ilg.Emit(OpCodes.Castclass, b.Type); - } - _ilg.Emit(OpCodes.Br_S, labEnd); - _ilg.MarkLabel(labCast); - if (!TypeUtils.AreEquivalent(b.Left.Type, b.Type)) { - Debug.Assert(!b.Left.Type.IsValueType); - _ilg.Emit(OpCodes.Castclass, b.Type); - } - _ilg.MarkLabel(labEnd); - } - - #endregion - - #region AndAlso - - private void EmitLiftedAndAlso(BinaryExpression b) { - Type type = typeof(bool?); - Label labComputeRight = _ilg.DefineLabel(); - Label labReturnFalse = _ilg.DefineLabel(); - Label labReturnNull = _ilg.DefineLabel(); - Label labReturnValue = _ilg.DefineLabel(); - Label labExit = _ilg.DefineLabel(); - LocalBuilder locLeft = GetLocal(type); - LocalBuilder locRight = GetLocal(type); - EmitExpression(b.Left); - _ilg.Emit(OpCodes.Stloc, locLeft); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse, labComputeRight); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitGetValueOrDefault(type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brtrue, labReturnFalse); - // compute right - _ilg.MarkLabel(labComputeRight); - EmitExpression(b.Right); - _ilg.Emit(OpCodes.Stloc, locRight); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse_S, labReturnNull); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitGetValueOrDefault(type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brtrue_S, labReturnFalse); - // check left for null again - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse, labReturnNull); - // return true - _ilg.Emit(OpCodes.Ldc_I4_1); - _ilg.Emit(OpCodes.Br_S, labReturnValue); - // return false - _ilg.MarkLabel(labReturnFalse); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Br_S, labReturnValue); - _ilg.MarkLabel(labReturnValue); - ConstructorInfo ci = type.GetConstructor(new Type[] { typeof(bool) }); - _ilg.Emit(OpCodes.Newobj, ci); - _ilg.Emit(OpCodes.Stloc, locLeft); - _ilg.Emit(OpCodes.Br, labExit); - // return null - _ilg.MarkLabel(labReturnNull); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.Emit(OpCodes.Initobj, type); - _ilg.MarkLabel(labExit); - _ilg.Emit(OpCodes.Ldloc, locLeft); - FreeLocal(locLeft); - FreeLocal(locRight); - } - - private void EmitMethodAndAlso(BinaryExpression b, CompilationFlags flags) { - Label labEnd = _ilg.DefineLabel(); - EmitExpression(b.Left); - _ilg.Emit(OpCodes.Dup); - MethodInfo opFalse = TypeUtils.GetBooleanOperator(b.Method.DeclaringType, "op_False"); - Debug.Assert(opFalse != null, "factory should check that the method exists"); - _ilg.Emit(OpCodes.Call, opFalse); - _ilg.Emit(OpCodes.Brtrue, labEnd); - - //store the value of the left value before emitting b.Right to empty the evaluation stack - LocalBuilder locLeft = GetLocal(b.Left.Type); - _ilg.Emit(OpCodes.Stloc, locLeft); - - EmitExpression(b.Right); - //store the right value to local - LocalBuilder locRight = GetLocal(b.Right.Type); - _ilg.Emit(OpCodes.Stloc, locRight); - - Debug.Assert(b.Method.IsStatic); - _ilg.Emit(OpCodes.Ldloc, locLeft); - _ilg.Emit(OpCodes.Ldloc, locRight); - if ((flags & CompilationFlags.EmitAsTailCallMask) == CompilationFlags.EmitAsTail) { - _ilg.Emit(OpCodes.Tailcall); - } - _ilg.Emit(OpCodes.Call, b.Method); - FreeLocal(locLeft); - FreeLocal(locRight); - _ilg.MarkLabel(labEnd); - } - - private void EmitUnliftedAndAlso(BinaryExpression b) { - Label @else = _ilg.DefineLabel(); - Label end = _ilg.DefineLabel(); - EmitExpressionAndBranch(false, b.Left, @else); - EmitExpression(b.Right); - _ilg.Emit(OpCodes.Br, end); - _ilg.MarkLabel(@else); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.MarkLabel(end); - } - - private void EmitAndAlsoBinaryExpression(Expression expr, CompilationFlags flags) { - BinaryExpression b = (BinaryExpression)expr; - - if (b.Method != null && !b.IsLiftedLogical) { - EmitMethodAndAlso(b, flags); - } else if (b.Left.Type == typeof(bool?)) { - EmitLiftedAndAlso(b); - } else if (b.IsLiftedLogical) { - EmitExpression(b.ReduceUserdefinedLifted()); - } else { - EmitUnliftedAndAlso(b); - } - } - - #endregion - - #region OrElse - - private void EmitLiftedOrElse(BinaryExpression b) { - Type type = typeof(bool?); - Label labComputeRight = _ilg.DefineLabel(); - Label labReturnTrue = _ilg.DefineLabel(); - Label labReturnNull = _ilg.DefineLabel(); - Label labReturnValue = _ilg.DefineLabel(); - Label labExit = _ilg.DefineLabel(); - LocalBuilder locLeft = GetLocal(type); - LocalBuilder locRight = GetLocal(type); - EmitExpression(b.Left); - _ilg.Emit(OpCodes.Stloc, locLeft); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse, labComputeRight); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitGetValueOrDefault(type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brfalse, labReturnTrue); - // compute right - _ilg.MarkLabel(labComputeRight); - EmitExpression(b.Right); - _ilg.Emit(OpCodes.Stloc, locRight); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse_S, labReturnNull); - _ilg.Emit(OpCodes.Ldloca, locRight); - _ilg.EmitGetValueOrDefault(type); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brfalse_S, labReturnTrue); - // check left for null again - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.EmitHasValue(type); - _ilg.Emit(OpCodes.Brfalse, labReturnNull); - // return false - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Br_S, labReturnValue); - // return true - _ilg.MarkLabel(labReturnTrue); - _ilg.Emit(OpCodes.Ldc_I4_1); - _ilg.Emit(OpCodes.Br_S, labReturnValue); - _ilg.MarkLabel(labReturnValue); - ConstructorInfo ci = type.GetConstructor(new Type[] { typeof(bool) }); - _ilg.Emit(OpCodes.Newobj, ci); - _ilg.Emit(OpCodes.Stloc, locLeft); - _ilg.Emit(OpCodes.Br, labExit); - // return null - _ilg.MarkLabel(labReturnNull); - _ilg.Emit(OpCodes.Ldloca, locLeft); - _ilg.Emit(OpCodes.Initobj, type); - _ilg.MarkLabel(labExit); - _ilg.Emit(OpCodes.Ldloc, locLeft); - FreeLocal(locLeft); - FreeLocal(locRight); - } - - private void EmitUnliftedOrElse(BinaryExpression b) { - Label @else = _ilg.DefineLabel(); - Label end = _ilg.DefineLabel(); - EmitExpressionAndBranch(false, b.Left, @else); - _ilg.Emit(OpCodes.Ldc_I4_1); - _ilg.Emit(OpCodes.Br, end); - _ilg.MarkLabel(@else); - EmitExpression(b.Right); - _ilg.MarkLabel(end); - } - - private void EmitMethodOrElse(BinaryExpression b, CompilationFlags flags) { - Label labEnd = _ilg.DefineLabel(); - EmitExpression(b.Left); - _ilg.Emit(OpCodes.Dup); - MethodInfo opTrue = TypeUtils.GetBooleanOperator(b.Method.DeclaringType, "op_True"); - Debug.Assert(opTrue != null, "factory should check that the method exists"); - _ilg.Emit(OpCodes.Call, opTrue); - _ilg.Emit(OpCodes.Brtrue, labEnd); - - //store the value of the left value before emitting b.Right to empty the evaluation stack - LocalBuilder locLeft = GetLocal(b.Left.Type); - _ilg.Emit(OpCodes.Stloc, locLeft); - - EmitExpression(b.Right); - //store the right value to local - LocalBuilder locRight = GetLocal(b.Right.Type); - _ilg.Emit(OpCodes.Stloc, locRight); - - Debug.Assert(b.Method.IsStatic); - _ilg.Emit(OpCodes.Ldloc, locLeft); - _ilg.Emit(OpCodes.Ldloc, locRight); - if ((flags & CompilationFlags.EmitAsTailCallMask) == CompilationFlags.EmitAsTail) { - _ilg.Emit(OpCodes.Tailcall); - } - _ilg.Emit(OpCodes.Call, b.Method); - FreeLocal(locLeft); - FreeLocal(locRight); - _ilg.MarkLabel(labEnd); - } - - private void EmitOrElseBinaryExpression(Expression expr, CompilationFlags flags) { - BinaryExpression b = (BinaryExpression)expr; - - if (b.Method != null && !b.IsLiftedLogical) { - EmitMethodOrElse(b, flags); - } else if (b.Left.Type == typeof(bool?)) { - EmitLiftedOrElse(b); - } else if (b.IsLiftedLogical) { - EmitExpression(b.ReduceUserdefinedLifted()); - } else { - EmitUnliftedOrElse(b); - } - } - - #endregion - - #region Optimized branching - - /// - /// Emits the expression and then either brtrue/brfalse to the label. - /// - /// True for brtrue, false for brfalse. - /// The expression to emit. - /// The label to conditionally branch to. - /// - /// This function optimizes equality and short circuiting logical - /// operators to avoid double-branching, minimize instruction count, - /// and generate similar IL to the C# compiler. This is important for - /// the JIT to optimize patterns like: - /// x != null AndAlso x.GetType() == typeof(SomeType) - /// - /// One optimization we don't do: we always emits at least one - /// conditional branch to the label, and always possibly falls through, - /// even if we know if the branch will always succeed or always fail. - /// We do this to avoid generating unreachable code, which is fine for - /// the CLR JIT, but doesn't verify with peverify. - /// - /// This kind of optimization could be implemented safely, by doing - /// constant folding over conditionals and logical expressions at the - /// tree level. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")] - private void EmitExpressionAndBranch(bool branchValue, Expression node, Label label) { - CompilationFlags startEmitted = EmitExpressionStart(node); - try { - if (node.Type == typeof(bool)) { - switch (node.NodeType) { - case ExpressionType.Not: - EmitBranchNot(branchValue, (UnaryExpression)node, label); - return; - case ExpressionType.AndAlso: - case ExpressionType.OrElse: - EmitBranchLogical(branchValue, (BinaryExpression)node, label); - return; - case ExpressionType.Block: - EmitBranchBlock(branchValue, (BlockExpression)node, label); - return; - case ExpressionType.Equal: - case ExpressionType.NotEqual: - EmitBranchComparison(branchValue, (BinaryExpression)node, label); - return; - } - } - EmitExpression(node, CompilationFlags.EmitAsNoTail | CompilationFlags.EmitNoExpressionStart); - EmitBranchOp(branchValue, label); - } finally { - EmitExpressionEnd(startEmitted); - } - } - - private void EmitBranchOp(bool branch, Label label) { - _ilg.Emit(branch ? OpCodes.Brtrue : OpCodes.Brfalse, label); - } - - private void EmitBranchNot(bool branch, UnaryExpression node, Label label) { - if (node.Method != null) { - EmitExpression(node, CompilationFlags.EmitAsNoTail | CompilationFlags.EmitNoExpressionStart); - EmitBranchOp(branch, label); - return; - } - EmitExpressionAndBranch(!branch, node.Operand, label); - } - - private void EmitBranchComparison(bool branch, BinaryExpression node, Label label) { - Debug.Assert(node.NodeType == ExpressionType.Equal || node.NodeType == ExpressionType.NotEqual); - Debug.Assert(!node.IsLiftedToNull); - - // To share code paths, we want to treat NotEqual as an inverted Equal - bool branchWhenEqual = branch == (node.NodeType == ExpressionType.Equal); - - if (node.Method != null) { - EmitBinaryMethod(node, CompilationFlags.EmitAsNoTail); - // EmitBinaryMethod takes into account the Equal/NotEqual - // node kind, so use the original branch value - EmitBranchOp(branch, label); - } else if (ConstantCheck.IsNull(node.Left)) { - if (TypeUtils.IsNullableType(node.Right.Type)) { - EmitAddress(node.Right, node.Right.Type); - _ilg.EmitHasValue(node.Right.Type); - } else { - Debug.Assert(!node.Right.Type.IsValueType); - EmitExpression(GetEqualityOperand(node.Right)); - } - EmitBranchOp(!branchWhenEqual, label); - } else if (ConstantCheck.IsNull(node.Right)) { - if (TypeUtils.IsNullableType(node.Left.Type)) { - EmitAddress(node.Left, node.Left.Type); - _ilg.EmitHasValue(node.Left.Type); - } else { - Debug.Assert(!node.Left.Type.IsValueType); - EmitExpression(GetEqualityOperand(node.Left)); - } - EmitBranchOp(!branchWhenEqual, label); - } else if (TypeUtils.IsNullableType(node.Left.Type) || TypeUtils.IsNullableType(node.Right.Type)) { - EmitBinaryExpression(node); - // EmitBinaryExpression takes into account the Equal/NotEqual - // node kind, so use the original branch value - EmitBranchOp(branch, label); - } else { - EmitExpression(GetEqualityOperand(node.Left)); - EmitExpression(GetEqualityOperand(node.Right)); - if (branchWhenEqual) { - _ilg.Emit(OpCodes.Beq, label); - } else { - _ilg.Emit(OpCodes.Ceq); - _ilg.Emit(OpCodes.Brfalse, label); - } - } - } - - // For optimized Equal/NotEqual, we can eliminate reference - // conversions. IL allows comparing managed pointers regardless of - // type. See ECMA-335 "Binary Comparison or Branch Operations", in - // Partition III, Section 1.5 Table 4. - private static Expression GetEqualityOperand(Expression expression) { - if (expression.NodeType == ExpressionType.Convert) { - var convert = (UnaryExpression)expression; - if (TypeUtils.AreReferenceAssignable(convert.Type, convert.Operand.Type)) { - return convert.Operand; - } - } - return expression; - } - - private void EmitBranchLogical(bool branch, BinaryExpression node, Label label) { - Debug.Assert(node.NodeType == ExpressionType.AndAlso || node.NodeType == ExpressionType.OrElse); - Debug.Assert(!node.IsLiftedToNull); - - if (node.Method != null || node.IsLifted) { - EmitExpression(node); - EmitBranchOp(branch, label); - return; - } - - - bool isAnd = node.NodeType == ExpressionType.AndAlso; - - // To share code, we make the following substitutions: - // if (!(left || right)) branch value - // becomes: - // if (!left && !right) branch value - // and: - // if (!(left && right)) branch value - // becomes: - // if (!left || !right) branch value - // - // The observation is that "brtrue(x && y)" has the same codegen as - // "brfalse(x || y)" except the branches have the opposite sign. - // Same for "brfalse(x && y)" and "brtrue(x || y)". - // - if (branch == isAnd) { - EmitBranchAnd(branch, node, label); - } else { - EmitBranchOr(branch, node, label); - } - } - - // Generates optimized AndAlso with branch == true - // or optimized OrElse with branch == false - private void EmitBranchAnd(bool branch, BinaryExpression node, Label label) { - // if (left) then - // if (right) branch label - // endif - - Label endif = _ilg.DefineLabel(); - EmitExpressionAndBranch(!branch, node.Left, endif); - EmitExpressionAndBranch(branch, node.Right, label); - _ilg.MarkLabel(endif); - } - - // Generates optimized OrElse with branch == true - // or optimized AndAlso with branch == false - private void EmitBranchOr(bool branch, BinaryExpression node, Label label) { - // if (left OR right) branch label - - EmitExpressionAndBranch(branch, node.Left, label); - EmitExpressionAndBranch(branch, node.Right, label); - } - - private void EmitBranchBlock(bool branch, BlockExpression node, Label label) { - EnterScope(node); - - int count = node.ExpressionCount; - for (int i = 0; i < count - 1; i++) { - EmitExpressionAsVoid(node.GetExpression(i)); - } - EmitExpressionAndBranch(branch, node.GetExpression(count - 1), label); - - ExitScope(node); - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Statements.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Statements.cs deleted file mode 100644 index 7ab065c2d93..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Statements.cs +++ /dev/null @@ -1,821 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Reflection.Emit; -using System.Globalization; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - partial class LambdaCompiler { - private void EmitBlockExpression(Expression expr, CompilationFlags flags) { - // emit body - Emit((BlockExpression)expr, UpdateEmitAsTypeFlag(flags, CompilationFlags.EmitAsDefaultType)); - } - - private void Emit(BlockExpression node, CompilationFlags flags) { - EnterScope(node); - - CompilationFlags emitAs = flags & CompilationFlags.EmitAsTypeMask; - - int count = node.ExpressionCount; - CompilationFlags tailCall = flags & CompilationFlags.EmitAsTailCallMask; - for (int index = 0; index < count - 1; index++) { - var e = node.GetExpression(index); - var next = node.GetExpression(index + 1); - - if (EmitDebugSymbols) { - // No need to emit a clearance if the next expression in the block is also a - // DebugInfoExprssion. - var debugInfo = e as DebugInfoExpression; - if (debugInfo != null && debugInfo.IsClear && next is DebugInfoExpression) { - continue; - } - } - - CompilationFlags tailCallFlag; - if (tailCall != CompilationFlags.EmitAsNoTail) { - var g = next as GotoExpression; - if (g != null && (g.Value == null || !Significant(g.Value)) && ReferenceLabel(g.Target).CanReturn) { - // Since tail call flags are not passed into EmitTryExpression, CanReturn means the goto will be emitted - // as Ret. Therefore we can emit the current expression with tail call. - tailCallFlag = CompilationFlags.EmitAsTail; - } else { - // In the middle of the block. - // We may do better here by marking it as Tail if the following expressions are not going to emit any IL. - tailCallFlag = CompilationFlags.EmitAsMiddle; - } - } else { - tailCallFlag = CompilationFlags.EmitAsNoTail; - } - - flags = UpdateEmitAsTailCallFlag(flags, tailCallFlag); - EmitExpressionAsVoid(e, flags); - } - - // if the type of Block it means this is not a Comma - // so we will force the last expression to emit as void. - // We don't need EmitAsType flag anymore, should only pass - // the EmitTailCall field in flags to emitting the last expression. - if (emitAs == CompilationFlags.EmitAsVoidType || node.Type == typeof(void)) { - EmitExpressionAsVoid(node.GetExpression(count - 1), tailCall); - } else { - EmitExpressionAsType(node.GetExpression(count - 1), node.Type, tailCall); - } - - ExitScope(node); - } - - private void EnterScope(object node) { - if (HasVariables(node) && - (_scope.MergedScopes == null || !_scope.MergedScopes.Contains(node))) { - - CompilerScope scope; - if (!_tree.Scopes.TryGetValue(node, out scope)) { - // - // Very often, we want to compile nodes as reductions - // rather than as IL, but usually they need to allocate - // some IL locals. To support this, we allow emitting a - // BlockExpression that was not bound by VariableBinder. - // This works as long as the variables are only used - // locally -- i.e. not closed over. - // - // User-created blocks will never hit this case; only our - // internally reduced nodes will. - // - scope = new CompilerScope(node, false) { NeedsClosure = _scope.NeedsClosure }; - } - - _scope = scope.Enter(this, _scope); - Debug.Assert(_scope.Node == node); - } - } - - private static bool HasVariables(object node) { - var block = node as BlockExpression; - if (block != null) { - return block.Variables.Count > 0; - } - return ((CatchBlock)node).Variable != null; - } - - private void ExitScope(object node) { - if (_scope.Node == node) { - _scope = _scope.Exit(); - } - } - - private void EmitDefaultExpression(Expression expr) { - var node = (DefaultExpression)expr; - if (node.Type != typeof(void)) { - // emit default(T) - _ilg.EmitDefault(node.Type); - } - } - - private void EmitLoopExpression(Expression expr) { - LoopExpression node = (LoopExpression)expr; - - PushLabelBlock(LabelScopeKind.Statement); - LabelInfo breakTarget = DefineLabel(node.BreakLabel); - LabelInfo continueTarget = DefineLabel(node.ContinueLabel); - - continueTarget.MarkWithEmptyStack(); - - EmitExpressionAsVoid(node.Body); - - _ilg.Emit(OpCodes.Br, continueTarget.Label); - - PopLabelBlock(LabelScopeKind.Statement); - - breakTarget.MarkWithEmptyStack(); - } - - #region SwitchExpression - - private void EmitSwitchExpression(Expression expr, CompilationFlags flags) { - SwitchExpression node = (SwitchExpression)expr; - - // Try to emit it as an IL switch. Works for integer types. - if (TryEmitSwitchInstruction(node, flags)) { - return; - } - - // Try to emit as a hashtable lookup. Works for strings. - if (TryEmitHashtableSwitch(node, flags)) { - return; - } - - // - // Fall back to a series of tests. We need to IL gen instead of - // transform the tree to avoid stack overflow on a big switch. - // - - var switchValue = Expression.Parameter(node.SwitchValue.Type, "switchValue"); - var testValue = Expression.Parameter(GetTestValueType(node), "testValue"); - _scope.AddLocal(this, switchValue); - _scope.AddLocal(this, testValue); - - EmitExpression(node.SwitchValue); - _scope.EmitSet(switchValue); - - // Emit tests - var labels = new Label[node.Cases.Count]; - var isGoto = new bool[node.Cases.Count]; - for (int i = 0, n = node.Cases.Count; i < n; i++) { - DefineSwitchCaseLabel(node.Cases[i], out labels[i], out isGoto[i]); - foreach (Expression test in node.Cases[i].TestValues) { - // Pull the test out into a temp so it runs on the same - // stack as the switch. This simplifies spilling. - EmitExpression(test); - _scope.EmitSet(testValue); - Debug.Assert(TypeUtils.AreReferenceAssignable(testValue.Type, test.Type)); - EmitExpressionAndBranch(true, Expression.Equal(switchValue, testValue, false, node.Comparison), labels[i]); - } - } - - // Define labels - Label end = _ilg.DefineLabel(); - Label @default = (node.DefaultBody == null) ? end : _ilg.DefineLabel(); - - // Emit the case and default bodies - EmitSwitchCases(node, labels, isGoto, @default, end, flags); - } - - /// - /// Gets the common test test value type of the SwitchExpression. - /// - private static Type GetTestValueType(SwitchExpression node) { - if (node.Comparison == null) { - // If we have no comparison, all right side types must be the - // same. - return node.Cases[0].TestValues[0].Type; - } - - // Otherwise, get the type from the method. - Type result = node.Comparison.GetParametersCached()[1].ParameterType.GetNonRefType(); - if (node.IsLifted) { - result = TypeUtils.GetNullableType(result); - } - return result; - } - - private sealed class SwitchLabel { - internal readonly decimal Key; - internal readonly Label Label; - - // Boxed version of Key, preseving the original type. - internal readonly object Constant; - - internal SwitchLabel(decimal key, object @constant, Label label) { - Key = key; - Constant = @constant; - Label = label; - } - } - - private sealed class SwitchInfo { - internal readonly SwitchExpression Node; - internal readonly LocalBuilder Value; - internal readonly Label Default; - internal readonly Type Type; - internal readonly bool IsUnsigned; - internal readonly bool Is64BitSwitch; - - internal SwitchInfo(SwitchExpression node, LocalBuilder value, Label @default) { - Node = node; - Value = value; - Default = @default; - Type = Node.SwitchValue.Type; - IsUnsigned = TypeUtils.IsUnsigned(Type); - var code = Type.GetTypeCode(Type); - Is64BitSwitch = code == TypeCode.UInt64 || code == TypeCode.Int64; - } - } - - private static bool FitsInBucket(List buckets, decimal key, int count) { - Debug.Assert(key > buckets[buckets.Count - 1].Key); - decimal jumpTableSlots = key - buckets[0].Key + 1; - if (jumpTableSlots > int.MaxValue) { - return false; - } - // density must be > 50% - return (buckets.Count + count) * 2 > jumpTableSlots; - } - - private static void MergeBuckets(List> buckets) { - while (buckets.Count > 1) { - List first = buckets[buckets.Count - 2]; - List second = buckets[buckets.Count - 1]; - - if (!FitsInBucket(first, second[second.Count - 1].Key, second.Count)) { - return; - } - - // Merge them - first.AddRange(second); - buckets.RemoveAt(buckets.Count - 1); - } - } - - // Add key to a new or existing bucket - private static void AddToBuckets(List> buckets, SwitchLabel key) { - if (buckets.Count > 0) { - List last = buckets[buckets.Count - 1]; - if (FitsInBucket(last, key.Key, 1)) { - last.Add(key); - // we might be able to merge now - MergeBuckets(buckets); - return; - } - } - // else create a new bucket - buckets.Add(new List { key }); - } - - // Determines if the type is an integer we can switch on. - private static bool CanOptimizeSwitchType(Type valueType) { - // enums & char are allowed - switch (Type.GetTypeCode(valueType)) { - case TypeCode.Byte: - case TypeCode.SByte: - case TypeCode.Char: - case TypeCode.Int16: - case TypeCode.Int32: - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.Int64: - case TypeCode.UInt64: - return true; - default: - return false; - } - } - - // Tries to emit switch as a jmp table - private bool TryEmitSwitchInstruction(SwitchExpression node, CompilationFlags flags) { - // If we have a comparison, bail - if (node.Comparison != null) { - return false; - } - - // Make sure the switch value type and the right side type - // are types we can optimize - Type type = node.SwitchValue.Type; - if (!CanOptimizeSwitchType(type) || - !TypeUtils.AreEquivalent(type, node.Cases[0].TestValues[0].Type)) { - return false; - } - - // Make sure all test values are constant, or we can't emit the - // jump table. - if (!node.Cases.All(c => c.TestValues.All(t => t is ConstantExpression))) { - return false; - } - - // - // We can emit the optimized switch, let's do it. - // - - // Build target labels, collect keys. - var labels = new Label[node.Cases.Count]; - var isGoto = new bool[node.Cases.Count]; - - var uniqueKeys = new Set(); - var keys = new List(); - for (int i = 0; i < node.Cases.Count; i++) { - - DefineSwitchCaseLabel(node.Cases[i], out labels[i], out isGoto[i]); - - foreach (ConstantExpression test in node.Cases[i].TestValues) { - // Guarenteed to work thanks to CanOptimizeSwitchType. - // - // Use decimal because it can hold Int64 or UInt64 without - // precision loss or signed/unsigned conversions. - decimal key = ConvertSwitchValue(test.Value); - - // Only add each key once. If it appears twice, it's - // allowed, but can't be reached. - if (!uniqueKeys.Contains(key)) { - keys.Add(new SwitchLabel(key, test.Value, labels[i])); - uniqueKeys.Add(key); - } - } - } - - // Sort the keys, and group them into buckets. - keys.Sort((x, y) => Math.Sign(x.Key - y.Key)); - var buckets = new List>(); - foreach (var key in keys) { - AddToBuckets(buckets, key); - } - - // Emit the switchValue - LocalBuilder value = GetLocal(node.SwitchValue.Type); - EmitExpression(node.SwitchValue); - _ilg.Emit(OpCodes.Stloc, value); - - // Create end label, and default label if needed - Label end = _ilg.DefineLabel(); - Label @default = (node.DefaultBody == null) ? end : _ilg.DefineLabel(); - - // Emit the switch - var info = new SwitchInfo(node, value, @default); - EmitSwitchBuckets(info, buckets, 0, buckets.Count - 1); - - // Emit the case bodies and default - EmitSwitchCases(node, labels, isGoto, @default, end, flags); - - FreeLocal(value); - return true; - } - - private static decimal ConvertSwitchValue(object value) { - if (value is char) { - return (int)(char)value; - } - return Convert.ToDecimal(value, CultureInfo.InvariantCulture); - } - - /// - /// Creates the label for this case. - /// Optimization: if the body is just a goto, and we can branch - /// to it, put the goto target directly in the jump table. - /// - private void DefineSwitchCaseLabel(SwitchCase @case, out Label label, out bool isGoto) { - var jump = @case.Body as GotoExpression; - // if it's a goto with no value - if (jump != null && jump.Value == null) { - // Reference the label from the switch. This will cause us to - // analyze the jump target and determine if it is safe. - LabelInfo jumpInfo = ReferenceLabel(jump.Target); - - // If we have are allowed to emit the "branch" opcode, then we - // can jump directly there from the switch's jump table. - // (Otherwise, we need to emit the goto later as a "leave".) - if (jumpInfo.CanBranch) { - label = jumpInfo.Label; - isGoto = true; - return; - } - } - // otherwise, just define a new label - label = _ilg.DefineLabel(); - isGoto = false; - } - - private void EmitSwitchCases(SwitchExpression node, Label[] labels, bool[] isGoto, Label @default, Label end, CompilationFlags flags) { - // Jump to default (to handle the fallthrough case) - _ilg.Emit(OpCodes.Br, @default); - - // Emit the cases - for (int i = 0, n = node.Cases.Count; i < n; i++) { - // If the body is a goto, we already emitted an optimized - // branch directly to it. No need to emit anything else. - if (isGoto[i]) { - continue; - } - - _ilg.MarkLabel(labels[i]); - EmitExpressionAsType(node.Cases[i].Body, node.Type, flags); - - // Last case doesn't need branch - if (node.DefaultBody != null || i < n - 1) { - if ((flags & CompilationFlags.EmitAsTailCallMask) == CompilationFlags.EmitAsTail) { - //The switch case is at the tail of the lambda so - //it is safe to emit a Ret. - _ilg.Emit(OpCodes.Ret); - } else { - _ilg.Emit(OpCodes.Br, end); - } - } - } - - // Default value - if (node.DefaultBody != null) { - _ilg.MarkLabel(@default); - EmitExpressionAsType(node.DefaultBody, node.Type, flags); - } - - _ilg.MarkLabel(end); - } - - private void EmitSwitchBuckets(SwitchInfo info, List> buckets, int first, int last) { - if (first == last) { - EmitSwitchBucket(info, buckets[first]); - return; - } - - // Split the buckets into two groups, and use an if test to find - // the right bucket. This ensures we'll only need O(lg(B)) tests - // where B is the number of buckets - int mid = (int)(((long)first + last + 1) / 2); - - if (first == mid - 1) { - EmitSwitchBucket(info, buckets[first]); - } else { - // If the first half contains more than one, we need to emit an - // explicit guard - Label secondHalf = _ilg.DefineLabel(); - _ilg.Emit(OpCodes.Ldloc, info.Value); - _ilg.EmitConstant(buckets[mid - 1].Last().Constant); - _ilg.Emit(info.IsUnsigned ? OpCodes.Bgt_Un : OpCodes.Bgt, secondHalf); - EmitSwitchBuckets(info, buckets, first, mid - 1); - _ilg.MarkLabel(secondHalf); - } - - EmitSwitchBuckets(info, buckets, mid, last); - } - - private void EmitSwitchBucket(SwitchInfo info, List bucket) { - // No need for switch if we only have one value - if (bucket.Count == 1) { - _ilg.Emit(OpCodes.Ldloc, info.Value); - _ilg.EmitConstant(bucket[0].Constant); - _ilg.Emit(OpCodes.Beq, bucket[0].Label); - return; - } - - // - // If we're switching off of Int64/UInt64, we need more guards here - // because we'll have to narrow the switch value to an Int32, and - // we can't do that unless the value is in the right range. - // - Label? after = null; - if (info.Is64BitSwitch) { - after = _ilg.DefineLabel(); - _ilg.Emit(OpCodes.Ldloc, info.Value); - _ilg.EmitConstant(bucket.Last().Constant); - _ilg.Emit(info.IsUnsigned ? OpCodes.Bgt_Un : OpCodes.Bgt, after.Value); - _ilg.Emit(OpCodes.Ldloc, info.Value); - _ilg.EmitConstant(bucket[0].Constant); - _ilg.Emit(info.IsUnsigned ? OpCodes.Blt_Un : OpCodes.Blt, after.Value); - } - - _ilg.Emit(OpCodes.Ldloc, info.Value); - - // Normalize key - decimal key = bucket[0].Key; - if (key != 0) { - _ilg.EmitConstant(bucket[0].Constant); - _ilg.Emit(OpCodes.Sub); - } - - if (info.Is64BitSwitch) { - _ilg.Emit(OpCodes.Conv_I4); - } - - // Collect labels - int len = (int)(bucket[bucket.Count - 1].Key - bucket[0].Key + 1); - Label[] jmpLabels = new Label[len]; - - // Initialize all labels to the default - int slot = 0; - foreach (SwitchLabel label in bucket) { - while (key++ != label.Key) { - jmpLabels[slot++] = info.Default; - } - jmpLabels[slot++] = label.Label; - } - - // check we used all keys and filled all slots - Debug.Assert(key == bucket[bucket.Count - 1].Key + 1); - Debug.Assert(slot == jmpLabels.Length); - - // Finally, emit the switch instruction - _ilg.Emit(OpCodes.Switch, jmpLabels); - - if (info.Is64BitSwitch) { - _ilg.MarkLabel(after.Value); - } - } - - private bool TryEmitHashtableSwitch(SwitchExpression node, CompilationFlags flags) { - // If we have a comparison other than string equality, bail - if (node.Comparison != typeof(string).GetMethod("op_Equality", BindingFlags.Public | BindingFlags.Static | BindingFlags.ExactBinding, null, new[] { typeof(string), typeof(string) }, null)) { - return false; - } - - // All test values must be constant. - int tests = 0; - foreach (SwitchCase c in node.Cases) { - foreach (Expression t in c.TestValues) { - if (!(t is ConstantExpression)) { - return false; - } - tests++; - } - } - - // Must have >= 7 labels for it to be worth it. - if (tests < 7) { - return false; - } - - // If we're in a DynamicMethod, we could just build the dictionary - // immediately. But that would cause the two code paths to be more - // different than they really need to be. - var initializers = new List(tests); - var cases = new List(node.Cases.Count); - - int nullCase = -1; - MethodInfo add = typeof(Dictionary).GetMethod("Add", new[] { typeof(string), typeof(int) }); - for (int i = 0, n = node.Cases.Count; i < n; i++) { - foreach (ConstantExpression t in node.Cases[i].TestValues) { - if (t.Value != null) { - initializers.Add(Expression.ElementInit(add, t, Expression.Constant(i))); - } else { - nullCase = i; - } - } - cases.Add(Expression.SwitchCase(node.Cases[i].Body, Expression.Constant(i))); - } - - // Create the field to hold the lazily initialized dictionary - MemberExpression dictField = CreateLazyInitializedField>("dictionarySwitch"); - - // If we happen to initialize it twice (multithreaded case), it's - // not the end of the world. The C# compiler does better here by - // emitting a volatile access to the field. - Expression dictInit = Expression.Condition( - Expression.Equal(dictField, Expression.Constant(null, dictField.Type)), - Expression.Assign( - dictField, - Expression.ListInit( - Expression.New( - typeof(Dictionary).GetConstructor(new[] { typeof(int) }), - Expression.Constant(initializers.Count) - ), - initializers - ) - ), - dictField - ); - - // - // Create a tree like: - // - // switchValue = switchValueExpression; - // if (switchValue == null) { - // switchIndex = nullCase; - // } else { - // if (_dictField == null) { - // _dictField = new Dictionary(count) { { ... }, ... }; - // } - // if (!_dictField.TryGetValue(switchValue, out switchIndex)) { - // switchIndex = -1; - // } - // } - // switch (switchIndex) { - // case 0: ... - // case 1: ... - // ... - // default: - // } - // - var switchValue = Expression.Variable(typeof(string), "switchValue"); - var switchIndex = Expression.Variable(typeof(int), "switchIndex"); - var reduced = Expression.Block( - new[] { switchIndex, switchValue }, - Expression.Assign(switchValue, node.SwitchValue), - Expression.IfThenElse( - Expression.Equal(switchValue, Expression.Constant(null, typeof(string))), - Expression.Assign(switchIndex, Expression.Constant(nullCase)), - Expression.IfThenElse( - Expression.Call(dictInit, "TryGetValue", null, switchValue, switchIndex), - Expression.Empty(), - Expression.Assign(switchIndex, Expression.Constant(-1)) - ) - ), - Expression.Switch(node.Type, switchIndex, node.DefaultBody, null, cases) - ); - - EmitExpression(reduced, flags); - return true; - } - - #endregion - - private void CheckRethrow() { - // Rethrow is only valid inside a catch. - for (LabelScopeInfo j = _labelBlock; j != null; j = j.Parent) { - if (j.Kind == LabelScopeKind.Catch) { - return; - } else if (j.Kind == LabelScopeKind.Finally) { - // Rethrow from inside finally is not verifiable - break; - } - } - throw Error.RethrowRequiresCatch(); - } - - #region TryStatement - - private void CheckTry() { - // Try inside a filter is not verifiable - for (LabelScopeInfo j = _labelBlock; j != null; j = j.Parent) { - if (j.Kind == LabelScopeKind.Filter) { - throw Error.TryNotAllowedInFilter(); - } - } - } - - private void EmitSaveExceptionOrPop(CatchBlock cb) { - if (cb.Variable != null) { - // If the variable is present, store the exception - // in the variable. - _scope.EmitSet(cb.Variable); - } else { - // Otherwise, pop it off the stack. - _ilg.Emit(OpCodes.Pop); - } - } - - private void EmitTryExpression(Expression expr) { - var node = (TryExpression)expr; - - CheckTry(); - - //****************************************************************** - // 1. ENTERING TRY - //****************************************************************** - - PushLabelBlock(LabelScopeKind.Try); - _ilg.BeginExceptionBlock(); - - //****************************************************************** - // 2. Emit the try statement body - //****************************************************************** - - EmitExpression(node.Body); - - Type tryType = expr.Type; - LocalBuilder value = null; - if (tryType != typeof(void)) { - //store the value of the try body - value = GetLocal(tryType); - _ilg.Emit(OpCodes.Stloc, value); - } - //****************************************************************** - // 3. Emit the catch blocks - //****************************************************************** - - foreach (CatchBlock cb in node.Handlers) { - PushLabelBlock(LabelScopeKind.Catch); - - // Begin the strongly typed exception block - if (cb.Filter == null) { - _ilg.BeginCatchBlock(cb.Test); - } else { - _ilg.BeginExceptFilterBlock(); - } - - EnterScope(cb); - - EmitCatchStart(cb); - - // - // Emit the catch block body - // - EmitExpression(cb.Body); - if (tryType != typeof(void)) { - //store the value of the catch block body - _ilg.Emit(OpCodes.Stloc, value); - } - - ExitScope(cb); - - PopLabelBlock(LabelScopeKind.Catch); - } - - //****************************************************************** - // 4. Emit the finally block - //****************************************************************** - - if (node.Finally != null || node.Fault != null) { - PushLabelBlock(LabelScopeKind.Finally); - - if (node.Finally != null) { - _ilg.BeginFinallyBlock(); - } else { - _ilg.BeginFaultBlock(); - } - - // Emit the body - EmitExpressionAsVoid(node.Finally ?? node.Fault); - - _ilg.EndExceptionBlock(); - PopLabelBlock(LabelScopeKind.Finally); - } else { - _ilg.EndExceptionBlock(); - } - - if (tryType != typeof(void)) { - _ilg.Emit(OpCodes.Ldloc, value); - FreeLocal(value); - } - PopLabelBlock(LabelScopeKind.Try); - } - - /// - /// Emits the start of a catch block. The exception value that is provided by the - /// CLR is stored in the variable specified by the catch block or popped if no - /// variable is provided. - /// - private void EmitCatchStart(CatchBlock cb) { - if (cb.Filter == null) { - EmitSaveExceptionOrPop(cb); - return; - } - - // emit filter block. Filter blocks are untyped so we need to do - // the type check ourselves. - Label endFilter = _ilg.DefineLabel(); - Label rightType = _ilg.DefineLabel(); - - // skip if it's not our exception type, but save - // the exception if it is so it's available to the - // filter - _ilg.Emit(OpCodes.Isinst, cb.Test); - _ilg.Emit(OpCodes.Dup); - _ilg.Emit(OpCodes.Brtrue, rightType); - _ilg.Emit(OpCodes.Pop); - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Br, endFilter); - - // it's our type, save it and emit the filter. - _ilg.MarkLabel(rightType); - EmitSaveExceptionOrPop(cb); - PushLabelBlock(LabelScopeKind.Filter); - EmitExpression(cb.Filter); - PopLabelBlock(LabelScopeKind.Filter); - - // begin the catch, clear the exception, we've - // already saved it - _ilg.MarkLabel(endFilter); - _ilg.BeginCatchBlock(null); - _ilg.Emit(OpCodes.Pop); - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Unary.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Unary.cs deleted file mode 100644 index 79726b09a0d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.Unary.cs +++ /dev/null @@ -1,344 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - partial class LambdaCompiler { - - private void EmitQuoteUnaryExpression(Expression expr) { - EmitQuote((UnaryExpression)expr); - } - - - private void EmitQuote(UnaryExpression quote) { - // emit the quoted expression as a runtime constant - EmitConstant(quote.Operand, quote.Type); - - // Heuristic: only emit the tree rewrite logic if we have hoisted - // locals. - if (_scope.NearestHoistedLocals != null) { - // HoistedLocals is internal so emit as System.Object - EmitConstant(_scope.NearestHoistedLocals, typeof(object)); - _scope.EmitGet(_scope.NearestHoistedLocals.SelfVariable); - _ilg.Emit(OpCodes.Call, typeof(RuntimeOps).GetMethod("Quote")); - - if (quote.Type != typeof(Expression)) { - _ilg.Emit(OpCodes.Castclass, quote.Type); - } - } - } - - private void EmitThrowUnaryExpression(Expression expr) { - EmitThrow((UnaryExpression)expr, CompilationFlags.EmitAsDefaultType); - } - - private void EmitThrow(UnaryExpression expr, CompilationFlags flags) { - if (expr.Operand == null) { - CheckRethrow(); - - _ilg.Emit(OpCodes.Rethrow); - } else { - EmitExpression(expr.Operand); - _ilg.Emit(OpCodes.Throw); - } - - EmitUnreachable(expr, flags); - } - - private void EmitUnaryExpression(Expression expr, CompilationFlags flags) { - EmitUnary((UnaryExpression)expr, flags); - } - - private void EmitUnary(UnaryExpression node, CompilationFlags flags) { - if (node.Method != null) { - EmitUnaryMethod(node, flags); - } else if (node.NodeType == ExpressionType.NegateChecked && TypeUtils.IsInteger(node.Operand.Type)) { - EmitExpression(node.Operand); - LocalBuilder loc = GetLocal(node.Operand.Type); - _ilg.Emit(OpCodes.Stloc, loc); - _ilg.EmitInt(0); - _ilg.EmitConvertToType(typeof(int), node.Operand.Type, false); - _ilg.Emit(OpCodes.Ldloc, loc); - FreeLocal(loc); - EmitBinaryOperator(ExpressionType.SubtractChecked, node.Operand.Type, node.Operand.Type, node.Type, false); - } else { - EmitExpression(node.Operand); - EmitUnaryOperator(node.NodeType, node.Operand.Type, node.Type); - } - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private void EmitUnaryOperator(ExpressionType op, Type operandType, Type resultType) { - bool operandIsNullable = TypeUtils.IsNullableType(operandType); - - if (op == ExpressionType.ArrayLength) { - _ilg.Emit(OpCodes.Ldlen); - return; - } - - if (operandIsNullable) { - switch (op) { - case ExpressionType.Not: { - if (operandType != typeof(bool?)) { - goto case ExpressionType.Negate; - } - Label labEnd = _ilg.DefineLabel(); - LocalBuilder loc = GetLocal(operandType); - - // store values (reverse order since they are already on the stack) - _ilg.Emit(OpCodes.Stloc, loc); - - // test for null - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.EmitHasValue(operandType); - _ilg.Emit(OpCodes.Brfalse_S, labEnd); - - // do op on non-null value - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.EmitGetValueOrDefault(operandType); - Type nnOperandType = TypeUtils.GetNonNullableType(operandType); - EmitUnaryOperator(op, nnOperandType, typeof(bool)); - - // construct result - ConstructorInfo ci = resultType.GetConstructor(new Type[] { typeof(bool) }); - _ilg.Emit(OpCodes.Newobj, ci); - _ilg.Emit(OpCodes.Stloc, loc); - - _ilg.MarkLabel(labEnd); - _ilg.Emit(OpCodes.Ldloc, loc); - FreeLocal(loc); - return; - } - case ExpressionType.UnaryPlus: - case ExpressionType.NegateChecked: - case ExpressionType.Negate: - case ExpressionType.Increment: - case ExpressionType.Decrement: - case ExpressionType.OnesComplement: - case ExpressionType.IsFalse: - case ExpressionType.IsTrue: { - Debug.Assert(TypeUtils.AreEquivalent(operandType, resultType)); - Label labIfNull = _ilg.DefineLabel(); - Label labEnd = _ilg.DefineLabel(); - LocalBuilder loc = GetLocal(operandType); - - // check for null - _ilg.Emit(OpCodes.Stloc, loc); - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.EmitHasValue(operandType); - _ilg.Emit(OpCodes.Brfalse_S, labIfNull); - - // apply operator to non-null value - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.EmitGetValueOrDefault(operandType); - Type nnOperandType = TypeUtils.GetNonNullableType(resultType); - EmitUnaryOperator(op, nnOperandType, nnOperandType); - - // construct result - ConstructorInfo ci = resultType.GetConstructor(new Type[] { nnOperandType }); - _ilg.Emit(OpCodes.Newobj, ci); - _ilg.Emit(OpCodes.Stloc, loc); - _ilg.Emit(OpCodes.Br_S, labEnd); - - // if null then create a default one - _ilg.MarkLabel(labIfNull); - _ilg.Emit(OpCodes.Ldloca, loc); - _ilg.Emit(OpCodes.Initobj, resultType); - - _ilg.MarkLabel(labEnd); - _ilg.Emit(OpCodes.Ldloc, loc); - FreeLocal(loc); - return; - } - case ExpressionType.TypeAs: - _ilg.Emit(OpCodes.Box, operandType); - _ilg.Emit(OpCodes.Isinst, resultType); - if (TypeUtils.IsNullableType(resultType)) { - _ilg.Emit(OpCodes.Unbox_Any, resultType); - } - return; - default: - throw Error.UnhandledUnary(op); - } - } else { - switch (op) { - case ExpressionType.Not: - if (operandType == typeof(bool)) { - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - } else { - _ilg.Emit(OpCodes.Not); - } - break; - case ExpressionType.OnesComplement: - _ilg.Emit(OpCodes.Not); - break; - case ExpressionType.IsFalse: - _ilg.Emit(OpCodes.Ldc_I4_0); - _ilg.Emit(OpCodes.Ceq); - // Not an arithmetic operation -> no conversion - return; - case ExpressionType.IsTrue: - _ilg.Emit(OpCodes.Ldc_I4_1); - _ilg.Emit(OpCodes.Ceq); - // Not an arithmetic operation -> no conversion - return; - case ExpressionType.UnaryPlus: - _ilg.Emit(OpCodes.Nop); - break; - case ExpressionType.Negate: - case ExpressionType.NegateChecked: - _ilg.Emit(OpCodes.Neg); - break; - case ExpressionType.TypeAs: - if (operandType.IsValueType) { - _ilg.Emit(OpCodes.Box, operandType); - } - _ilg.Emit(OpCodes.Isinst, resultType); - if (TypeUtils.IsNullableType(resultType)) { - _ilg.Emit(OpCodes.Unbox_Any, resultType); - } - // Not an arithmetic operation -> no conversion - return; - case ExpressionType.Increment: - EmitConstantOne(resultType); - _ilg.Emit(OpCodes.Add); - break; - case ExpressionType.Decrement: - EmitConstantOne(resultType); - _ilg.Emit(OpCodes.Sub); - break; - default: - throw Error.UnhandledUnary(op); - } - - EmitConvertArithmeticResult(op, resultType); - } - } - - private void EmitConstantOne(Type type) { - switch (Type.GetTypeCode(type)) { - case TypeCode.UInt16: - case TypeCode.UInt32: - case TypeCode.Int16: - case TypeCode.Int32: - _ilg.Emit(OpCodes.Ldc_I4_1); - break; - case TypeCode.Int64: - case TypeCode.UInt64: - _ilg.Emit(OpCodes.Ldc_I8, (long)1); - break; - case TypeCode.Single: - _ilg.Emit(OpCodes.Ldc_R4, 1.0f); - break; - case TypeCode.Double: - _ilg.Emit(OpCodes.Ldc_R8, 1.0d); - break; - default: - // we only have to worry about aritmetic types, see - // TypeUtils.IsArithmetic - throw ContractUtils.Unreachable; - } - } - - private void EmitUnboxUnaryExpression(Expression expr) { - var node = (UnaryExpression)expr; - Debug.Assert(node.Type.IsValueType && !TypeUtils.IsNullableType(node.Type)); - - // Unbox_Any leaves the value on the stack - EmitExpression(node.Operand); - _ilg.Emit(OpCodes.Unbox_Any, node.Type); - } - - private void EmitConvertUnaryExpression(Expression expr, CompilationFlags flags) { - EmitConvert((UnaryExpression)expr, flags); - } - - private void EmitConvert(UnaryExpression node, CompilationFlags flags) { - if (node.Method != null) { - // User-defined conversions are only lifted if both source and - // destination types are value types. The C# compiler gets this wrong. - // In C#, if you have an implicit conversion from int->MyClass and you - // "lift" the conversion to int?->MyClass then a null int? goes to a - // null MyClass. This is contrary to the specification, which states - // that the correct behaviour is to unwrap the int?, throw an exception - // if it is null, and then call the conversion. - // - // We cannot fix this in C# but there is no reason why we need to - // propagate this bug into the expression tree API. Unfortunately - // this means that when the C# compiler generates the lambda - // (int? i)=>(MyClass)i, we will get different results for converting - // that lambda to a delegate directly and converting that lambda to - // an expression tree and then compiling it. We can live with this - // discrepancy however. - - if (node.IsLifted && (!node.Type.IsValueType || !node.Operand.Type.IsValueType)) { - ParameterInfo[] pis = node.Method.GetParametersCached(); - Debug.Assert(pis != null && pis.Length == 1); - Type paramType = pis[0].ParameterType; - if (paramType.IsByRef) { - paramType = paramType.GetElementType(); - } - - UnaryExpression e = Expression.Convert( - Expression.Call( - node.Method, - Expression.Convert(node.Operand, pis[0].ParameterType) - ), - node.Type - ); - - EmitConvert(e, flags); - } else { - EmitUnaryMethod(node, flags); - } - } else if (node.Type == typeof(void)) { - EmitExpressionAsVoid(node.Operand, flags); - } else { - if (TypeUtils.AreEquivalent(node.Operand.Type, node.Type)) { - EmitExpression(node.Operand, flags); - } else { - // A conversion is emitted after emitting the operand, no tail call is emitted - EmitExpression(node.Operand); - _ilg.EmitConvertToType(node.Operand.Type, node.Type, node.NodeType == ExpressionType.ConvertChecked); - } - } - } - - - private void EmitUnaryMethod(UnaryExpression node, CompilationFlags flags) { - if (node.IsLifted) { - ParameterExpression v = Expression.Variable(TypeUtils.GetNonNullableType(node.Operand.Type), null); - MethodCallExpression mc = Expression.Call(node.Method, v); - - Type resultType = TypeUtils.GetNullableType(mc.Type); - EmitLift(node.NodeType, resultType, mc, new ParameterExpression[] { v }, new Expression[] { node.Operand }); - _ilg.EmitConvertToType(resultType, node.Type, false); - } else { - EmitMethodCallExpression(Expression.Call(node.Method, node.Operand), flags); - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.cs deleted file mode 100644 index 3c13eac7020..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/LambdaCompiler.cs +++ /dev/null @@ -1,327 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Reflection.Emit; -using System.Runtime.CompilerServices; -using System.Threading; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif -#if !FEATURE_CORE_DLR || SILVERLIGHT - using ILGenerator = OffsetTrackingILGenerator; -#endif - - /// - /// LambdaCompiler is responsible for compiling individual lambda (LambdaExpression). The complete tree may - /// contain multiple lambdas, the Compiler class is reponsible for compiling the whole tree, individual - /// lambdas are then compiled by the LambdaCompiler. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling")] - internal sealed partial class LambdaCompiler { - - private delegate void WriteBack(); - - // Information on the entire lambda tree currently being compiled - private readonly AnalyzedTree _tree; - - private readonly ILGenerator _ilg; - -#if FEATURE_REFEMIT - // The TypeBuilder backing this method, if any - private readonly TypeBuilder _typeBuilder; -#endif - private readonly MethodInfo _method; - - // Currently active LabelTargets and their mapping to IL labels - private LabelScopeInfo _labelBlock = new LabelScopeInfo(null, LabelScopeKind.Lambda); - // Mapping of labels used for "long" jumps (jumping out and into blocks) - private readonly Dictionary _labelInfo = new Dictionary(); - - // The currently active variable scope - private CompilerScope _scope; - - // The lambda we are compiling - private readonly LambdaExpression _lambda; - - // True if the method's first argument is of type Closure - private readonly bool _hasClosureArgument; - - // True if we want to emitting debug symbols - private bool EmitDebugSymbols { get { return _tree.DebugInfoGenerator != null; } } - - // Runtime constants bound to the delegate - private readonly BoundConstants _boundConstants; - - // Free list of locals, so we reuse them rather than creating new ones - private readonly KeyedQueue _freeLocals = new KeyedQueue(); - - /// - /// The value is true if a clearance was emitted and no new sequence point - /// has been emitted since that. - /// - bool _sequencePointCleared; - - /// - /// Creates a lambda compiler that will compile to a dynamic method - /// - private LambdaCompiler(AnalyzedTree tree, LambdaExpression lambda) { - Type[] parameterTypes = GetParameterTypes(lambda).AddFirst(typeof(Closure)); - -#if (SILVERLIGHT && CLR2) || WP75 - var method = new DynamicMethod(lambda.Name ?? "lambda_method", lambda.ReturnType, parameterTypes); -#else - var method = new DynamicMethod(lambda.Name ?? "lambda_method", lambda.ReturnType, parameterTypes, true); -#endif - - _tree = tree; - _lambda = lambda; - _method = method; - -#if !FEATURE_CORE_DLR || SILVERLIGHT - _ilg = new OffsetTrackingILGenerator(method.GetILGenerator()); -#else - _ilg = method.GetILGenerator(); -#endif - - _hasClosureArgument = true; - - // These are populated by AnalyzeTree/VariableBinder - _scope = tree.Scopes[lambda]; - _boundConstants = tree.Constants[lambda]; - - InitializeMethod(); - } - -#if FEATURE_REFEMIT - /// - /// Creates a lambda compiler that will compile into the provided Methodbuilder - /// - private LambdaCompiler(AnalyzedTree tree, LambdaExpression lambda, MethodBuilder method) { - _hasClosureArgument = tree.Scopes[lambda].NeedsClosure; - Type[] paramTypes = GetParameterTypes(lambda); - if (_hasClosureArgument) { - paramTypes = paramTypes.AddFirst(typeof(Closure)); - } - - method.SetReturnType(lambda.ReturnType); - method.SetParameters(paramTypes); - var paramNames = lambda.Parameters.Map(p => p.Name); - // parameters are index from 1, with closure argument we need to skip the first arg - int startIndex = _hasClosureArgument ? 2 : 1; - for (int i = 0; i < paramNames.Length; i++) { - method.DefineParameter(i + startIndex, ParameterAttributes.None, paramNames[i]); - } - - _tree = tree; - _lambda = lambda; - _typeBuilder = (TypeBuilder)method.DeclaringType; - _method = method; - -#if !FEATURE_CORE_DLR || SILVERLIGHT - _ilg = new OffsetTrackingILGenerator(method.GetILGenerator()); -#else - _ilg = method.GetILGenerator(); -#endif - - // These are populated by AnalyzeTree/VariableBinder - _scope = tree.Scopes[lambda]; - _boundConstants = tree.Constants[lambda]; - - InitializeMethod(); - } -#endif - - /// - /// Creates a lambda compiler for an inlined lambda - /// - private LambdaCompiler(LambdaCompiler parent, LambdaExpression lambda) { - _tree = parent._tree; - _lambda = lambda; - _method = parent._method; - _ilg = parent._ilg; - _hasClosureArgument = parent._hasClosureArgument; - _scope = _tree.Scopes[lambda]; - _boundConstants = parent._boundConstants; -#if FEATURE_REFEMIT - _typeBuilder = parent._typeBuilder; -#endif - } - - private void InitializeMethod() { - // See if we can find a return label, so we can emit better IL - AddReturnLabel(_lambda); - _boundConstants.EmitCacheConstants(this); - } - - public override string ToString() { - return _method.ToString(); - } - - internal ILGenerator IL { - get { return _ilg; } - } - - internal ReadOnlyCollection Parameters { - get { return _lambda.Parameters; } - } - - internal bool CanEmitBoundConstants { - get { return _method is DynamicMethod; } - } - - #region Compiler entry points - - /// - /// Compiler entry point - /// - /// LambdaExpression to compile. - /// Debug info generator. - /// The compiled delegate. - internal static Delegate Compile(LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator) { - // 1. Bind lambda - AnalyzedTree tree = AnalyzeLambda(ref lambda); - - tree.DebugInfoGenerator = debugInfoGenerator; - - // 2. Create lambda compiler - LambdaCompiler c = new LambdaCompiler(tree, lambda); - - // 3. Emit - c.EmitLambdaBody(); - - // 4. Return the delegate. - return c.CreateDelegate(); - } - -#if FEATURE_REFEMIT - /// - /// Mutates the MethodBuilder parameter, filling in IL, parameters, - /// and return type. - /// - /// (probably shouldn't be modifying parameters/return type...) - /// - internal static void Compile(LambdaExpression lambda, MethodBuilder method, DebugInfoGenerator debugInfoGenerator) { - // 1. Bind lambda - AnalyzedTree tree = AnalyzeLambda(ref lambda); - - tree.DebugInfoGenerator = debugInfoGenerator; - - // 2. Create lambda compiler - LambdaCompiler c = new LambdaCompiler(tree, lambda, method); - - // 3. Emit - c.EmitLambdaBody(); - } -#endif - #endregion - - private static AnalyzedTree AnalyzeLambda(ref LambdaExpression lambda) { - // Spill the stack for any exception handling blocks or other - // constructs which require entering with an empty stack - lambda = StackSpiller.AnalyzeLambda(lambda); - - // Bind any variable references in this lambda - return VariableBinder.Bind(lambda); - } - - internal LocalBuilder GetLocal(Type type) { - Debug.Assert(type != null); - - LocalBuilder local; - if (_freeLocals.TryDequeue(type, out local)) { - Debug.Assert(type == local.LocalType); - return local; - } - - return _ilg.DeclareLocal(type); - } - - internal void FreeLocal(LocalBuilder local) { - if (local != null) { - _freeLocals.Enqueue(local.LocalType, local); - } - } - - internal LocalBuilder GetNamedLocal(Type type, ParameterExpression variable) { - Debug.Assert(type != null && variable != null); - - LocalBuilder lb = _ilg.DeclareLocal(type); - if (EmitDebugSymbols && variable.Name != null) { - _tree.DebugInfoGenerator.SetLocalName(lb, variable.Name); - } - return lb; - } - - /// - /// Gets the argument slot corresponding to the parameter at the given - /// index. Assumes that the method takes a certain number of prefix - /// arguments, followed by the real parameters stored in Parameters - /// - internal int GetLambdaArgument(int index) { - return index + (_hasClosureArgument ? 1 : 0) + (_method.IsStatic ? 0 : 1); - } - - /// - /// Returns the index-th argument. This method provides access to the actual arguments - /// defined on the lambda itself, and excludes the possible 0-th closure argument. - /// - internal void EmitLambdaArgument(int index) { - _ilg.EmitLoadArg(GetLambdaArgument(index)); - } - - internal void EmitClosureArgument() { - Debug.Assert(_hasClosureArgument, "must have a Closure argument"); - Debug.Assert(_method.IsStatic, "must be a static method"); - _ilg.EmitLoadArg(0); - } - - private Delegate CreateDelegate() { - Debug.Assert(_method is DynamicMethod); - - return _method.CreateDelegate(_lambda.Type, new Closure(_boundConstants.ToArray(), null)); - } - -#if FEATURE_REFEMIT - private FieldBuilder CreateStaticField(string name, Type type) { - // We are emitting into someone else's type. We don't want name - // conflicts, so choose a long name that is unlikely to confict. - // Naming scheme chosen here is similar to what the C# compiler - // uses. - return _typeBuilder.DefineField("{" + Interlocked.Increment(ref _Counter) + "}" + name, type, FieldAttributes.Static | FieldAttributes.Private); - } -#endif - /// - /// Creates an unitialized field suitible for private implementation details - /// Works with DynamicMethods or TypeBuilders. - /// - private MemberExpression CreateLazyInitializedField(string name) { -#if FEATURE_REFEMIT - if (!(_method is DynamicMethod)) { - return Expression.Field(null, CreateStaticField(name, typeof(T))); - } -#endif - return Expression.Field(Expression.Constant(new StrongBox(default(T))), "Value"); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/OffsetTrackingILGenerator.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/OffsetTrackingILGenerator.cs deleted file mode 100644 index 024cfb90aff..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/OffsetTrackingILGenerator.cs +++ /dev/null @@ -1,366 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Reflection; -using System.Reflection.Emit; -using System.Diagnostics.SymbolStore; - -// Not needed in CLR 4 builds because we have the -// ILGenerator.ILOffset property. - -#if !FEATURE_CORE_DLR || SILVERLIGHT - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - /// - /// Wraps ILGenerator with code that tracks the current IL offset as instructions are emitted into the IL stream. - /// - internal sealed class OffsetTrackingILGenerator { - private readonly ILGenerator _ilg; - internal int _offset; - - internal int ILOffset { get { return _offset; } } - - internal OffsetTrackingILGenerator(ILGenerator ilg) { - Debug.Assert(ilg != null); - _ilg = ilg; - } - - private void AdvanceOffset(OpCode opcode) { - _offset += opcode.Size; - } - - private void AdvanceOffsetWithLabel(OpCode opcode) { - AdvanceOffset(opcode); - if (OpCodes.TakesSingleByteArgument(opcode)) { - _offset++; - } else { - _offset += 4; - } - } - - #region Simple Instructions - - internal void Emit(OpCode opcode) { - _ilg.Emit(opcode); - AdvanceOffset(opcode); - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, byte arg) { - _ilg.Emit(opcode, arg); - AdvanceOffset(opcode); - _offset++; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, sbyte arg) { - _ilg.Emit(opcode, arg); - AdvanceOffset(opcode); - _offset++; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, int arg) { - _ilg.Emit(opcode, arg); - AdvanceOffset(opcode); - _offset += 4; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, MethodInfo meth) { - _ilg.Emit(opcode, meth); - AdvanceOffset(opcode); - _offset += 4; - AssertOffsetMatches(); - } - - internal void EmitCall(OpCode opcode, MethodInfo methodInfo, Type[] optionalParameterTypes) { - _ilg.EmitCall(opcode, methodInfo, optionalParameterTypes); - AdvanceOffset(opcode); - _offset += 4; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, ConstructorInfo con) { - _ilg.Emit(opcode, con); - AdvanceOffset(opcode); - _offset += 4; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, Type cls) { - _ilg.Emit(opcode, cls); - AdvanceOffset(opcode); - _offset += 4; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, long arg) { - _ilg.Emit(opcode, arg); - AdvanceOffset(opcode); - _offset += 8; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, float arg) { - _ilg.Emit(opcode, arg); - AdvanceOffset(opcode); - _offset += 4; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, double arg) { - _ilg.Emit(opcode, arg); - AdvanceOffset(opcode); - _offset += 8; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, Label label) { - _ilg.Emit(opcode, label); - AdvanceOffsetWithLabel(opcode); - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, Label[] labels) { - _ilg.Emit(opcode, labels); - AdvanceOffset(opcode); - _offset += 4; - for (int remaining = labels.Length * 4, i = 0; remaining > 0; remaining -= 4, i++) { - _offset += 4; - } - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, FieldInfo field) { - _ilg.Emit(opcode, field); - AdvanceOffset(opcode); - _offset += 4; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, String str) { - _ilg.Emit(opcode, str); - AdvanceOffset(opcode); - _offset += 4; - AssertOffsetMatches(); - } - - internal void Emit(OpCode opcode, LocalBuilder local) { - _ilg.Emit(opcode, local); - int tempVal = local.LocalIndex; - if (opcode.Equals(OpCodes.Ldloc)) { - switch (tempVal) { - case 0: - opcode = OpCodes.Ldloc_0; - break; - case 1: - opcode = OpCodes.Ldloc_1; - break; - case 2: - opcode = OpCodes.Ldloc_2; - break; - case 3: - opcode = OpCodes.Ldloc_3; - break; - default: - if (tempVal <= 255) - opcode = OpCodes.Ldloc_S; - break; - } - } else if (opcode.Equals(OpCodes.Stloc)) { - switch (tempVal) { - case 0: - opcode = OpCodes.Stloc_0; - break; - case 1: - opcode = OpCodes.Stloc_1; - break; - case 2: - opcode = OpCodes.Stloc_2; - break; - case 3: - opcode = OpCodes.Stloc_3; - break; - default: - if (tempVal <= 255) - opcode = OpCodes.Stloc_S; - break; - } - } else if (opcode.Equals(OpCodes.Ldloca)) { - if (tempVal <= 255) - opcode = OpCodes.Ldloca_S; - } - - AdvanceOffset(opcode); - - if (opcode.OperandType == OperandType.InlineNone) - return; - else if (!OpCodes.TakesSingleByteArgument(opcode)) { - _offset += 2; - } else { - _offset++; - } - AssertOffsetMatches(); - } - - #endregion - - #region Exception Handling - - private enum ExceptionState { - Try = 0, - Filter = 1, - Catch = 2, - Finally = 3, - Fault = 4, - } - - private Stack _exceptionState = new Stack(); - - internal void BeginExceptionBlock() { - _ilg.BeginExceptionBlock(); - _exceptionState.Push(ExceptionState.Try); - AssertOffsetMatches(); - } - - internal void EndExceptionBlock() { - _ilg.EndExceptionBlock(); - - ExceptionState state = _exceptionState.Pop(); - if (state == ExceptionState.Catch) { - AdvanceOffsetWithLabel(OpCodes.Leave); - } else if (state == ExceptionState.Finally || state == ExceptionState.Fault) { - AdvanceOffset(OpCodes.Endfinally); - } - - AssertOffsetMatches(); - } - - internal void BeginExceptFilterBlock() { - _ilg.BeginExceptFilterBlock(); - - _exceptionState.Pop(); - _exceptionState.Push(ExceptionState.Filter); - - AssertOffsetMatches(); - } - - internal void BeginCatchBlock(Type exceptionType) { - _ilg.BeginCatchBlock(exceptionType); - - ExceptionState state = _exceptionState.Pop(); - if (state == ExceptionState.Filter) { - AdvanceOffset(OpCodes.Endfilter); - } else { - AdvanceOffsetWithLabel(OpCodes.Leave); - } - - _exceptionState.Push(ExceptionState.Catch); - - AssertOffsetMatches(); - } - - internal void BeginFaultBlock() { - _ilg.BeginFaultBlock(); - - AdvanceOffsetWithLabel(OpCodes.Leave); - _exceptionState.Pop(); - _exceptionState.Push(ExceptionState.Fault); - - AssertOffsetMatches(); - } - - internal void BeginFinallyBlock() { - _ilg.BeginFinallyBlock(); - - ExceptionState state = _exceptionState.Pop(); - if (state != ExceptionState.Try) { - // leave for any preceeding catch clause - AdvanceOffsetWithLabel(OpCodes.Leave); - } - - // leave for try clause - AdvanceOffsetWithLabel(OpCodes.Leave); - _exceptionState.Push(ExceptionState.Finally); - - AssertOffsetMatches(); - } - - #endregion - - #region Labels and Locals - - internal Label DefineLabel() { - return _ilg.DefineLabel(); - } - - internal void MarkLabel(Label loc) { - _ilg.MarkLabel(loc); - } - - internal LocalBuilder DeclareLocal(Type localType) { - return _ilg.DeclareLocal(localType); - } - - internal void MarkSequencePoint(ISymbolDocumentWriter document, int startLine, int startColumn, int endLine, int endColumn) { - _ilg.MarkSequencePoint(document, startLine, startColumn, endLine, endColumn); - } - - #endregion - - #region Assertions - -#if STRESS_DEBUG - private FieldInfo _ilgOffsetField; - private bool _checkOffset = true; -#endif - - [Conditional("STRESS_DEBUG")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] - private void AssertOffsetMatches() { -#if STRESS_DEBUG - if (!_checkOffset) { - return; - } - - int m_length = -1; - try { - if (_ilgOffsetField == null) { - _ilgOffsetField = typeof(ILGenerator).GetField("m_length", BindingFlags.NonPublic | BindingFlags.Instance); - } - m_length = (int)_ilgOffsetField.GetValue(_ilg); - } catch (Exception) { - _checkOffset = false; - } - - if (_checkOffset) { - Debug.Assert(m_length == _offset); - } -#endif - } - - #endregion - } -} - -#endif diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/RuntimeVariableList.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/RuntimeVariableList.cs deleted file mode 100644 index 3b22542c2dc..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/RuntimeVariableList.cs +++ /dev/null @@ -1,123 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast.Compiler; -#else -using System.Linq.Expressions.Compiler; -#endif - -using System.ComponentModel; -using System.Diagnostics; - -namespace System.Runtime.CompilerServices { - - /// - /// This API supports the .NET Framework infrastructure and is not intended to be used directly from your code. - /// Contains helper methods called from dynamically generated methods. - /// - [EditorBrowsable(EditorBrowsableState.Never), DebuggerStepThrough] - public static partial class RuntimeOps { - /// - /// Creates an interface that can be used to modify closed over variables at runtime. - /// - /// The closure array. - /// An array of indicies into the closure array where variables are found. - /// An interface to access variables. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static IRuntimeVariables CreateRuntimeVariables(object[] data, long[] indexes) { - return new RuntimeVariableList(data, indexes); - } - - /// - /// Creates an interface that can be used to modify closed over variables at runtime. - /// - /// An interface to access variables. - [Obsolete("do not use this method", true), EditorBrowsable(EditorBrowsableState.Never)] - public static IRuntimeVariables CreateRuntimeVariables() { - return new EmptyRuntimeVariables(); - } - - private sealed class EmptyRuntimeVariables : IRuntimeVariables { - int IRuntimeVariables.Count { - get { return 0; } - } - - object IRuntimeVariables.this[int index] { - get { - throw new ArgumentOutOfRangeException("index"); - } - set { - throw new ArgumentOutOfRangeException("index"); - } - } - } - - /// - /// Provides a list of variables, supporing read/write of the values - /// Exposed via RuntimeVariablesExpression - /// - private sealed class RuntimeVariableList : IRuntimeVariables { - // The top level environment. It contains pointers to parent - // environments, which are always in the first element - private readonly object[] _data; - - // An array of (int, int) pairs, each representing how to find a - // variable in the environment data struction. - // - // The first integer indicates the number of times to go up in the - // closure chain, the second integer indicates the index into that - // closure chain. - private readonly long[] _indexes; - - internal RuntimeVariableList(object[] data, long[] indexes) { - Debug.Assert(data != null); - Debug.Assert(indexes != null); - - _data = data; - _indexes = indexes; - } - - public int Count { - get { return _indexes.Length; } - } - - public object this[int index] { - get { - return GetStrongBox(index).Value; - } - set { - GetStrongBox(index).Value = value; - } - } - - private IStrongBox GetStrongBox(int index) { - // We lookup the closure using two ints: - // 1. The high dword is the number of parents to go up - // 2. The low dword is the index into that array - long closureKey = _indexes[index]; - - // walk up the parent chain to find the real environment - object[] result = _data; - for (int parents = (int)(closureKey >> 32); parents > 0; parents--) { - result = HoistedLocals.GetParent(result); - } - - // Return the variable storage - return (IStrongBox)result[(int)closureKey]; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/Set.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/Set.cs deleted file mode 100644 index 4c864ad58fb..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/Set.cs +++ /dev/null @@ -1,94 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections; -using System.Collections.Generic; - -// Note: can't move to Utils because name conflicts with System.Linq.Set -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - /// - /// A simple hashset, built on Dictionary{K, V} - /// - internal sealed class Set : ICollection { - private readonly Dictionary _data; - - internal Set() { - _data = new Dictionary(); - } - - internal Set(IEqualityComparer comparer) { - _data = new Dictionary(comparer); - } - - internal Set(IList list) { - _data = new Dictionary(list.Count); - foreach (T t in list) { - Add(t); - } - } - - internal Set(IEnumerable list) { - _data = new Dictionary(); - foreach (T t in list) { - Add(t); - } - } - - internal Set(int capacity) { - _data = new Dictionary(capacity); - } - - public void Add(T item) { - _data[item] = null; - } - - public void Clear() { - _data.Clear(); - } - - public bool Contains(T item) { - return _data.ContainsKey(item); - } - - public void CopyTo(T[] array, int arrayIndex) { - _data.Keys.CopyTo(array, arrayIndex); - } - - public int Count { - get { return _data.Count; } - } - - public bool IsReadOnly { - get { return false; } - } - - public bool Remove(T item) { - return _data.Remove(item); - } - - public IEnumerator GetEnumerator() { - return _data.Keys.GetEnumerator(); - } - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return _data.Keys.GetEnumerator(); - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Bindings.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Bindings.cs deleted file mode 100644 index 1c166a6ce4e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Bindings.cs +++ /dev/null @@ -1,228 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections.ObjectModel; -using System.Dynamic.Utils; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - - internal partial class StackSpiller { - - private abstract class BindingRewriter { - protected MemberBinding _binding; - protected RewriteAction _action; - protected StackSpiller _spiller; - - internal BindingRewriter(MemberBinding binding, StackSpiller spiller) { - _binding = binding; - _spiller = spiller; - } - - internal RewriteAction Action { - get { return _action; } - } - - internal abstract MemberBinding AsBinding(); - internal abstract Expression AsExpression(Expression target); - - internal static BindingRewriter Create(MemberBinding binding, StackSpiller spiller, Stack stack) { - switch (binding.BindingType) { - case MemberBindingType.Assignment: - MemberAssignment assign = (MemberAssignment)binding; - return new MemberAssignmentRewriter(assign, spiller, stack); - case MemberBindingType.ListBinding: - MemberListBinding list = (MemberListBinding)binding; - return new ListBindingRewriter(list, spiller, stack); - case MemberBindingType.MemberBinding: - MemberMemberBinding member = (MemberMemberBinding)binding; - return new MemberMemberBindingRewriter(member, spiller, stack); - } - throw Error.UnhandledBinding(); - } - } - - private class MemberMemberBindingRewriter : BindingRewriter { - ReadOnlyCollection _bindings; - BindingRewriter[] _bindingRewriters; - - internal MemberMemberBindingRewriter(MemberMemberBinding binding, StackSpiller spiller, Stack stack) : - base(binding, spiller) { - - _bindings = binding.Bindings; - _bindingRewriters = new BindingRewriter[_bindings.Count]; - for (int i = 0; i < _bindings.Count; i++) { - BindingRewriter br = BindingRewriter.Create(_bindings[i], spiller, stack); - _action |= br.Action; - _bindingRewriters[i] = br; - } - } - - internal override MemberBinding AsBinding() { - switch (_action) { - case RewriteAction.None: - return _binding; - case RewriteAction.Copy: - MemberBinding[] newBindings = new MemberBinding[_bindings.Count]; - for (int i = 0; i < _bindings.Count; i++) { - newBindings[i] = _bindingRewriters[i].AsBinding(); - } - return Expression.MemberBind(_binding.Member, new TrueReadOnlyCollection(newBindings)); - } - throw ContractUtils.Unreachable; - } - - internal override Expression AsExpression(Expression target) { - if (target.Type.IsValueType && _binding.Member is System.Reflection.PropertyInfo) { - throw Error.CannotAutoInitializeValueTypeMemberThroughProperty(_binding.Member); - } - RequireNotRefInstance(target); - - MemberExpression member = Expression.MakeMemberAccess(target, _binding.Member); - ParameterExpression memberTemp = _spiller.MakeTemp(member.Type); - - Expression[] block = new Expression[_bindings.Count + 2]; - block[0] = Expression.Assign(memberTemp, member); - - for (int i = 0; i < _bindings.Count; i++) { - BindingRewriter br = _bindingRewriters[i]; - block[i + 1] = br.AsExpression(memberTemp); - } - - // We need to copy back value types - if (memberTemp.Type.IsValueType) { - block[_bindings.Count + 1] = Expression.Block( - typeof(void), - Expression.Assign(Expression.MakeMemberAccess(target, _binding.Member), memberTemp) - ); - } else { - block[_bindings.Count + 1] = Expression.Empty(); - } - return MakeBlock(block); - } - } - - private class ListBindingRewriter : BindingRewriter { - ReadOnlyCollection _inits; - ChildRewriter[] _childRewriters; - - internal ListBindingRewriter(MemberListBinding binding, StackSpiller spiller, Stack stack) : - base(binding, spiller) { - - _inits = binding.Initializers; - - _childRewriters = new ChildRewriter[_inits.Count]; - for (int i = 0; i < _inits.Count; i++) { - ElementInit init = _inits[i]; - - ChildRewriter cr = new ChildRewriter(spiller, stack, init.Arguments.Count); - cr.Add(init.Arguments); - - _action |= cr.Action; - _childRewriters[i] = cr; - } - } - - internal override MemberBinding AsBinding() { - switch (_action) { - case RewriteAction.None: - return _binding; - case RewriteAction.Copy: - ElementInit[] newInits = new ElementInit[_inits.Count]; - for (int i = 0; i < _inits.Count; i++) { - ChildRewriter cr = _childRewriters[i]; - if (cr.Action == RewriteAction.None) { - newInits[i] = _inits[i]; - } else { - newInits[i] = Expression.ElementInit(_inits[i].AddMethod, cr[0, -1]); - } - } - return Expression.ListBind(_binding.Member, new TrueReadOnlyCollection(newInits)); - } - throw ContractUtils.Unreachable; - } - - internal override Expression AsExpression(Expression target) { - if (target.Type.IsValueType && _binding.Member is System.Reflection.PropertyInfo) { - throw Error.CannotAutoInitializeValueTypeElementThroughProperty(_binding.Member); - } - RequireNotRefInstance(target); - - MemberExpression member = Expression.MakeMemberAccess(target, _binding.Member); - ParameterExpression memberTemp = _spiller.MakeTemp(member.Type); - - Expression[] block = new Expression[_inits.Count + 2]; - block[0] = Expression.Assign(memberTemp, member); - - for (int i = 0; i < _inits.Count; i++) { - ChildRewriter cr = _childRewriters[i]; - Result add = cr.Finish(Expression.Call(memberTemp, _inits[i].AddMethod, cr[0, -1])); - block[i + 1] = add.Node; - } - - // We need to copy back value types - if (memberTemp.Type.IsValueType) { - block[_inits.Count + 1] = Expression.Block( - typeof(void), - Expression.Assign(Expression.MakeMemberAccess(target, _binding.Member), memberTemp) - ); - } else { - block[_inits.Count + 1] = Expression.Empty(); - } - return MakeBlock(block); - } - } - - private class MemberAssignmentRewriter : BindingRewriter { - Expression _rhs; - - internal MemberAssignmentRewriter(MemberAssignment binding, StackSpiller spiller, Stack stack) : - base(binding, spiller) { - - Result result = spiller.RewriteExpression(binding.Expression, stack); - _action = result.Action; - _rhs = result.Node; - } - - internal override MemberBinding AsBinding() { - switch (_action) { - case RewriteAction.None: - return _binding; - case RewriteAction.Copy: - return Expression.Bind(_binding.Member, _rhs); - } - throw ContractUtils.Unreachable; - } - - internal override Expression AsExpression(Expression target) { - RequireNotRefInstance(target); - - MemberExpression member = Expression.MakeMemberAccess(target, _binding.Member); - ParameterExpression memberTemp = _spiller.MakeTemp(member.Type); - - return MakeBlock( - Expression.Assign(memberTemp, _rhs), - Expression.Assign(member, memberTemp), - Expression.Empty() - ); - } - } - - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Generated.cs deleted file mode 100644 index d0aea62ff84..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Generated.cs +++ /dev/null @@ -1,272 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - internal partial class StackSpiller { - - /// - /// Rewrite the expression - /// - /// - /// Expression to rewrite - /// State of the stack before the expression is emitted. - /// Rewritten expression. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1505:AvoidUnmaintainableCode")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1502:AvoidExcessiveComplexity")] - private Result RewriteExpression(Expression node, Stack stack) { - if (node == null) { - return new Result(RewriteAction.None, null); - } - - Result result; - switch (node.NodeType) { - #region Generated StackSpiller Switch - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_stackspiller_switch from: generate_tree.py - - case ExpressionType.Add: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.AddChecked: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.And: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.AndAlso: - result = RewriteLogicalBinaryExpression(node, stack); - break; - case ExpressionType.ArrayLength: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.ArrayIndex: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.Call: - result = RewriteMethodCallExpression(node, stack); - break; - case ExpressionType.Coalesce: - result = RewriteLogicalBinaryExpression(node, stack); - break; - case ExpressionType.Conditional: - result = RewriteConditionalExpression(node, stack); - break; - case ExpressionType.Convert: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.ConvertChecked: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.Divide: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.Equal: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.ExclusiveOr: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.GreaterThan: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.GreaterThanOrEqual: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.Invoke: - result = RewriteInvocationExpression(node, stack); - break; - case ExpressionType.Lambda: - result = RewriteLambdaExpression(node, stack); - break; - case ExpressionType.LeftShift: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.LessThan: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.LessThanOrEqual: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.ListInit: - result = RewriteListInitExpression(node, stack); - break; - case ExpressionType.MemberAccess: - result = RewriteMemberExpression(node, stack); - break; - case ExpressionType.MemberInit: - result = RewriteMemberInitExpression(node, stack); - break; - case ExpressionType.Modulo: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.Multiply: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.MultiplyChecked: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.Negate: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.UnaryPlus: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.NegateChecked: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.New: - result = RewriteNewExpression(node, stack); - break; - case ExpressionType.NewArrayInit: - result = RewriteNewArrayExpression(node, stack); - break; - case ExpressionType.NewArrayBounds: - result = RewriteNewArrayExpression(node, stack); - break; - case ExpressionType.Not: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.NotEqual: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.Or: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.OrElse: - result = RewriteLogicalBinaryExpression(node, stack); - break; - case ExpressionType.Power: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.RightShift: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.Subtract: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.SubtractChecked: - result = RewriteBinaryExpression(node, stack); - break; - case ExpressionType.TypeAs: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.TypeIs: - result = RewriteTypeBinaryExpression(node, stack); - break; - case ExpressionType.Assign: - result = RewriteAssignBinaryExpression(node, stack); - break; - case ExpressionType.Block: - result = RewriteBlockExpression(node, stack); - break; - case ExpressionType.Decrement: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.Dynamic: - result = RewriteDynamicExpression(node, stack); - break; - case ExpressionType.Extension: - result = RewriteExtensionExpression(node, stack); - break; - case ExpressionType.Goto: - result = RewriteGotoExpression(node, stack); - break; - case ExpressionType.Increment: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.Index: - result = RewriteIndexExpression(node, stack); - break; - case ExpressionType.Label: - result = RewriteLabelExpression(node, stack); - break; - case ExpressionType.Loop: - result = RewriteLoopExpression(node, stack); - break; - case ExpressionType.Switch: - result = RewriteSwitchExpression(node, stack); - break; - case ExpressionType.Throw: - result = RewriteThrowUnaryExpression(node, stack); - break; - case ExpressionType.Try: - result = RewriteTryExpression(node, stack); - break; - case ExpressionType.Unbox: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.TypeEqual: - result = RewriteTypeBinaryExpression(node, stack); - break; - case ExpressionType.OnesComplement: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.IsTrue: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.IsFalse: - result = RewriteUnaryExpression(node, stack); - break; - case ExpressionType.AddAssign: - case ExpressionType.AndAssign: - case ExpressionType.DivideAssign: - case ExpressionType.ExclusiveOrAssign: - case ExpressionType.LeftShiftAssign: - case ExpressionType.ModuloAssign: - case ExpressionType.MultiplyAssign: - case ExpressionType.OrAssign: - case ExpressionType.PowerAssign: - case ExpressionType.RightShiftAssign: - case ExpressionType.SubtractAssign: - case ExpressionType.AddAssignChecked: - case ExpressionType.MultiplyAssignChecked: - case ExpressionType.SubtractAssignChecked: - case ExpressionType.PreIncrementAssign: - case ExpressionType.PreDecrementAssign: - case ExpressionType.PostIncrementAssign: - case ExpressionType.PostDecrementAssign: - result = RewriteReducibleExpression(node, stack); - break; - case ExpressionType.Quote: - case ExpressionType.Parameter: - case ExpressionType.Constant: - case ExpressionType.RuntimeVariables: - case ExpressionType.Default: - case ExpressionType.DebugInfo: - return new Result(RewriteAction.None, node); - - // *** END GENERATED CODE *** - - #endregion - - default: - throw ContractUtils.Unreachable; - } - - VerifyRewrite(result, node); - - return result; - } - } -} - diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Temps.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Temps.cs deleted file mode 100644 index fce1b961e57..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.Temps.cs +++ /dev/null @@ -1,308 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - - internal partial class StackSpiller { - - private class TempMaker { - /// - /// Current temporary variable - /// - private int _temp; - - /// - /// List of free temporary variables. These can be recycled for new temps. - /// - private List _freeTemps; - - /// - /// Stack of currently active temporary variables. - /// - private Stack _usedTemps; - - /// - /// List of all temps created by stackspiller for this rule/lambda - /// - private List _temps = new List(); - - internal List Temps { - get { return _temps; } - } - - internal ParameterExpression Temp(Type type) { - ParameterExpression temp; - if (_freeTemps != null) { - // Recycle from the free-list if possible. - for (int i = _freeTemps.Count - 1; i >= 0; i--) { - temp = _freeTemps[i]; - if (temp.Type == type) { - _freeTemps.RemoveAt(i); - return UseTemp(temp); - } - } - } - // Not on the free-list, create a brand new one. - temp = Expression.Variable(type, "$temp$" + _temp++); - _temps.Add(temp); - return UseTemp(temp); - } - - private ParameterExpression UseTemp(ParameterExpression temp) { - Debug.Assert(_freeTemps == null || !_freeTemps.Contains(temp)); - Debug.Assert(_usedTemps == null || !_usedTemps.Contains(temp)); - - if (_usedTemps == null) { - _usedTemps = new Stack(); - } - _usedTemps.Push(temp); - return temp; - } - - private void FreeTemp(ParameterExpression temp) { - Debug.Assert(_freeTemps == null || !_freeTemps.Contains(temp)); - if (_freeTemps == null) { - _freeTemps = new List(); - } - _freeTemps.Add(temp); - } - - internal int Mark() { - return _usedTemps != null ? _usedTemps.Count : 0; - } - - // Free temporaries created since the last marking. - // This is a performance optimization to lower the overall number of tempories needed. - internal void Free(int mark) { - // (_usedTemps != null) ==> (mark <= _usedTemps.Count) - Debug.Assert(_usedTemps == null || mark <= _usedTemps.Count); - // (_usedTemps == null) ==> (mark == 0) - Debug.Assert(mark == 0 || _usedTemps != null); - - if (_usedTemps != null) { - while (mark < _usedTemps.Count) { - FreeTemp(_usedTemps.Pop()); - } - } - } - - [Conditional("DEBUG")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] - internal void VerifyTemps() { - Debug.Assert(_usedTemps == null || _usedTemps.Count == 0); - } - } - - - /// - /// Rewrites child expressions, spilling them into temps if needed. The - /// stack starts in the inital state, and after the first subexpression - /// is added it is change to non-empty. This behavior can be overridden - /// by setting the stack manually between adds. - /// - /// When all children have been added, the caller should rewrite the - /// node if Rewrite is true. Then, it should call Finish with etiher - /// the orignal expression or the rewritten expression. Finish will call - /// Expression.Comma if necessary and return a new Result. - /// - private class ChildRewriter { - private readonly StackSpiller _self; - private readonly Expression[] _expressions; - private int _expressionsCount; - private List _comma; - private RewriteAction _action; - private Stack _stack; - private bool _done; - - internal ChildRewriter(StackSpiller self, Stack stack, int count) { - _self = self; - _stack = stack; - _expressions = new Expression[count]; - } - - internal void Add(Expression node) { - Debug.Assert(!_done); - - if (node == null) { - _expressions[_expressionsCount++] = null; - return; - } - - Result exp = _self.RewriteExpression(node, _stack); - _action |= exp.Action; - _stack = Stack.NonEmpty; - - // track items in case we need to copy or spill stack - _expressions[_expressionsCount++] = exp.Node; - } - - internal void Add(IList expressions) { - for (int i = 0, count = expressions.Count; i < count; i++) { - Add(expressions[i]); - } - } - - internal void AddArguments(IArgumentProvider expressions) { - for (int i = 0, count = expressions.ArgumentCount; i < count; i++) { - Add(expressions.GetArgument(i)); - } - } - - private void EnsureDone() { - // done adding arguments, build the comma if necessary - if (!_done) { - _done = true; - - if (_action == RewriteAction.SpillStack) { - Expression[] clone = _expressions; - int count = clone.Length; - List comma = new List(count + 1); - for (int i = 0; i < count; i++) { - if (clone[i] != null) { - Expression temp; - clone[i] = _self.ToTemp(clone[i], out temp); - comma.Add(temp); - } - } - comma.Capacity = comma.Count + 1; - _comma = comma; - } - } - } - - internal bool Rewrite { - get { return _action != RewriteAction.None; } - } - - internal RewriteAction Action { - get { return _action; } - } - - internal Result Finish(Expression expr) { - EnsureDone(); - - if (_action == RewriteAction.SpillStack) { - Debug.Assert(_comma.Capacity == _comma.Count + 1); - _comma.Add(expr); - expr = MakeBlock(_comma); - } - - return new Result(_action, expr); - } - - internal Expression this[int index] { - get { - EnsureDone(); - if (index < 0) { - index += _expressions.Length; - } - return _expressions[index]; - } - } - - internal Expression[] this[int first, int last] { - get { - EnsureDone(); - if (last < 0) { - last += _expressions.Length; - } - int count = last - first + 1; - ContractUtils.RequiresArrayRange(_expressions, first, count, "first", "last"); - - if (count == _expressions.Length) { - Debug.Assert(first == 0); - // if the entire array is requested just return it so we don't make a new array - return _expressions; - } - - Expression[] clone = new Expression[count]; - Array.Copy(_expressions, first, clone, 0, count); - return clone; - } - } - } - - - private ParameterExpression MakeTemp(Type type) { - return _tm.Temp(type); - } - - private int Mark() { - return _tm.Mark(); - } - - private void Free(int mark) { - _tm.Free(mark); - } - - [Conditional("DEBUG")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic")] - private void VerifyTemps() { - _tm.VerifyTemps(); - } - - /// - /// Will perform: - /// save: temp = expression - /// return value: temp - /// - private ParameterExpression ToTemp(Expression expression, out Expression save) { - ParameterExpression temp = MakeTemp(expression.Type); - save = Expression.Assign(temp, expression); - return temp; - } - - /// - /// Creates a special block that is marked as not allowing jumps in. - /// This should not be used for rewriting BlockExpression itself, or - /// anything else that supports jumping. - /// - private static Expression MakeBlock(params Expression[] expressions) { - return MakeBlock((IList)expressions); - } - - /// - /// Creates a special block that is marked as not allowing jumps in. - /// This should not be used for rewriting BlockExpression itself, or - /// anything else that supports jumping. - /// - private static Expression MakeBlock(IList expressions) { - return new SpilledExpressionBlock(expressions); - } - } - - /// - /// A special subtype of BlockExpression that indicates to the compiler - /// that this block is a spilled expression and should not allow jumps in. - /// - internal sealed class SpilledExpressionBlock : BlockN { - internal SpilledExpressionBlock(IList expressions) - : base(expressions) { - } - internal override BlockExpression Rewrite(ReadOnlyCollection variables, Expression[] args) { - throw ContractUtils.Unreachable; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.cs deleted file mode 100644 index ff1077ce758..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/StackSpiller.cs +++ /dev/null @@ -1,982 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; -using System.Reflection; -using System.Runtime.CompilerServices; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - - /// - /// Expression rewriting to spill the CLR stack into temporary variables - /// in order to guarantee some properties of code generation, for - /// example that we always enter try block on empty stack. - /// - internal partial class StackSpiller { - - // Is the evaluation stack empty? - private enum Stack { - Empty, - NonEmpty - }; - - // Should the parent nodes be rewritten, and in what way? - // Designed so bitwise-or produces the correct result when merging two - // subtrees. In particular, SpillStack is preferred over Copy which is - // preferred over None. - // - // Values: - // None -> no rewrite needed - // Copy -> copy into a new node - // SpillStack -> spill stack into temps - [Flags] - private enum RewriteAction { - None = 0, - Copy = 1, - SpillStack = 3, - } - - // Result of a rewrite operation. Always contains an action and a node. - private struct Result { - internal readonly RewriteAction Action; - internal readonly Expression Node; - - internal Result(RewriteAction action, Expression node) { - Action = action; - Node = node; - } - } - - /// - /// The source of temporary variables - /// - private readonly TempMaker _tm = new TempMaker(); - - /// - /// Initial stack state. Normally empty, but when inlining the lambda - /// we might have a non-empty starting stack state. - /// - private readonly Stack _startingStack; - - /// - /// Lambda rewrite result. We need this for inlined lambdas to figure - /// out whether we need to guarentee it an empty stack. - /// - private RewriteAction _lambdaRewrite; - - /// - /// Analyzes a lambda, producing a new one that has correct invariants - /// for codegen. In particular, it spills the IL stack to temps in - /// places where it's invalid to have a non-empty stack (for example, - /// entering a try statement). - /// - internal static LambdaExpression AnalyzeLambda(LambdaExpression lambda) { - return lambda.Accept(new StackSpiller(Stack.Empty)); - } - - private StackSpiller(Stack stack) { - _startingStack = stack; - } - - // called by Expression.Accept - internal Expression Rewrite(Expression lambda) { - VerifyTemps(); - - // Lambda starts with an empty stack - Result body = RewriteExpressionFreeTemps(lambda.Body, _startingStack); - _lambdaRewrite = body.Action; - - VerifyTemps(); - - if (body.Action != RewriteAction.None) { - // Create a new scope for temps - // (none of these will be hoisted so there is no closure impact) - Expression newBody = body.Node; - if (_tm.Temps.Count > 0) { - newBody = Expression.Block(_tm.Temps, newBody); - } - - // Clone the lambda, replacing the body & variables - return new Expression(newBody, lambda.Name, lambda.TailCall, lambda.Parameters); - } - - return lambda; - } - - #region Expressions - - [Conditional("DEBUG")] - private static void VerifyRewrite(Result result, Expression node) { - Debug.Assert(result.Node != null); - - // (result.Action == RewriteAction.None) if and only if (node == result.Node) - Debug.Assert((result.Action == RewriteAction.None) ^ (node != result.Node), "rewrite action does not match node object identity"); - - // if the original node is an extension node, it should have been rewritten - Debug.Assert(result.Node.NodeType != ExpressionType.Extension, "extension nodes must be rewritten"); - - // if we have Copy, then node type must match - Debug.Assert( - result.Action != RewriteAction.Copy || node.NodeType == result.Node.NodeType || node.CanReduce, - "rewrite action does not match node object kind" - ); - - // New type must be reference assignable to the old type - // (our rewrites preserve type exactly, but the rules for rewriting - // an extension node are more lenient, see Expression.ReduceAndCheck()) - Debug.Assert( - TypeUtils.AreReferenceAssignable(node.Type, result.Node.Type), - "rewritten object must be reference assignable to the original type" - ); - } - - private Result RewriteExpressionFreeTemps(Expression expression, Stack stack) { - int mark = Mark(); - Result result = RewriteExpression(expression, stack); - Free(mark); - return result; - } - - // DynamicExpression - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "stack")] - private Result RewriteDynamicExpression(Expression expr, Stack stack) { - var node = (DynamicExpression)expr; - - // CallSite is on the stack - IArgumentProvider argNode = (IArgumentProvider)node; - ChildRewriter cr = new ChildRewriter(this, Stack.NonEmpty, argNode.ArgumentCount); - cr.AddArguments(argNode); - if (cr.Action == RewriteAction.SpillStack) { - RequireNoRefArgs(node.DelegateType.GetMethod("Invoke")); - } - return cr.Finish(cr.Rewrite ? node.Rewrite(cr[0, -1]) : expr); - } - - private Result RewriteIndexAssignment(BinaryExpression node, Stack stack) { - IndexExpression index = (IndexExpression)node.Left; - - ChildRewriter cr = new ChildRewriter(this, stack, 2 + index.Arguments.Count); - - cr.Add(index.Object); - cr.Add(index.Arguments); - cr.Add(node.Right); - - if (cr.Action == RewriteAction.SpillStack) { - RequireNotRefInstance(index.Object); - } - - if (cr.Rewrite) { - node = new AssignBinaryExpression( - new IndexExpression( - cr[0], // Object - index.Indexer, - cr[1, -2] // arguments - ), - cr[-1] // value - ); - } - - return cr.Finish(node); - } - - // BinaryExpression: AndAlso, OrElse - private Result RewriteLogicalBinaryExpression(Expression expr, Stack stack) { - BinaryExpression node = (BinaryExpression)expr; - - // Left expression runs on a stack as left by parent - Result left = RewriteExpression(node.Left, stack); - // ... and so does the right one - Result right = RewriteExpression(node.Right, stack); - //conversion is a lambda. stack state will be ignored. - Result conversion = RewriteExpression(node.Conversion, stack); - - RewriteAction action = left.Action | right.Action | conversion.Action; - if (action != RewriteAction.None) { - - // We don't have to worry about byref parameters here, because the - // factory doesn't allow it (it requires identical parameters and - // return type from the AndAlso/OrElse method) - - expr = BinaryExpression.Create( - node.NodeType, - left.Node, - right.Node, - node.Type, - node.Method, - (LambdaExpression)conversion.Node - ); - } - return new Result(action, expr); - } - - private Result RewriteReducibleExpression(Expression expr, Stack stack) { - Result result = RewriteExpression(expr.Reduce(), stack); - // it's at least Copy because we reduced the node - return new Result(result.Action | RewriteAction.Copy, result.Node); - } - - // BinaryExpression - private Result RewriteBinaryExpression(Expression expr, Stack stack) { - BinaryExpression node = (BinaryExpression)expr; - - ChildRewriter cr = new ChildRewriter(this, stack, 3); - // Left expression executes on the stack as left by parent - cr.Add(node.Left); - // Right expression always has non-empty stack (left is on it) - cr.Add(node.Right); - // conversion is a lambda, stack state will be ignored - cr.Add(node.Conversion); - - if (cr.Action == RewriteAction.SpillStack) { - RequireNoRefArgs(node.Method); - } - - return cr.Finish(cr.Rewrite ? - BinaryExpression.Create( - node.NodeType, - cr[0], - cr[1], - node.Type, - node.Method, - (LambdaExpression)cr[2]) : - expr); - } - - // variable assignment - private Result RewriteVariableAssignment(BinaryExpression node, Stack stack) { - // Expression is evaluated on a stack in current state - Result right = RewriteExpression(node.Right, stack); - if (right.Action != RewriteAction.None) { - node = Expression.Assign(node.Left, right.Node); - } - return new Result(right.Action, node); - } - - private Result RewriteAssignBinaryExpression(Expression expr, Stack stack) { - var node = (BinaryExpression)expr; - - switch (node.Left.NodeType) { - case ExpressionType.Index: - return RewriteIndexAssignment(node, stack); - case ExpressionType.MemberAccess: - return RewriteMemberAssignment(node, stack); - case ExpressionType.Parameter: - return RewriteVariableAssignment(node, stack); - case ExpressionType.Extension: - return RewriteExtensionAssignment(node, stack); - default: - throw Error.InvalidLvalue(node.Left.NodeType); - } - } - - private Result RewriteExtensionAssignment(BinaryExpression node, Stack stack) { - node = Expression.Assign(node.Left.ReduceExtensions(), node.Right); - Result result = RewriteAssignBinaryExpression(node, stack); - // it's at least Copy because we reduced the node - return new Result(result.Action | RewriteAction.Copy, result.Node); - } - - // LambdaExpression - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "stack")] - private static Result RewriteLambdaExpression(Expression expr, Stack stack) { - LambdaExpression node = (LambdaExpression)expr; - - // Call back into the rewriter - expr = AnalyzeLambda(node); - - // If the lambda gets rewritten, we don't need to spill the stack, - // but we do need to rebuild the tree above us so it includes the new node. - RewriteAction action = (expr == node) ? RewriteAction.None : RewriteAction.Copy; - - return new Result(action, expr); - } - - // ConditionalExpression - private Result RewriteConditionalExpression(Expression expr, Stack stack) { - ConditionalExpression node = (ConditionalExpression)expr; - // Test executes at the stack as left by parent - Result test = RewriteExpression(node.Test, stack); - // The test is popped by conditional jump so branches execute - // at the stack as left by parent too. - Result ifTrue = RewriteExpression(node.IfTrue, stack); - Result ifFalse = RewriteExpression(node.IfFalse, stack); - - RewriteAction action = test.Action | ifTrue.Action | ifFalse.Action; - if (action != RewriteAction.None) { - expr = Expression.Condition(test.Node, ifTrue.Node, ifFalse.Node, node.Type); - } - - return new Result(action, expr); - } - - // member assignment - private Result RewriteMemberAssignment(BinaryExpression node, Stack stack) { - MemberExpression lvalue = (MemberExpression)node.Left; - - ChildRewriter cr = new ChildRewriter(this, stack, 2); - - // If there's an instance, it executes on the stack in current state - // and rest is executed on non-empty stack. - // Otherwise the stack is left unchaged. - cr.Add(lvalue.Expression); - - cr.Add(node.Right); - - if (cr.Action == RewriteAction.SpillStack) { - RequireNotRefInstance(lvalue.Expression); - } - - if (cr.Rewrite) { - return cr.Finish( - new AssignBinaryExpression( - MemberExpression.Make(cr[0], lvalue.Member), - cr[1] - ) - ); - } - return new Result(RewriteAction.None, node); - } - - // MemberExpression - private Result RewriteMemberExpression(Expression expr, Stack stack) { - MemberExpression node = (MemberExpression)expr; - - // Expression is emitted on top of the stack in current state - Result expression = RewriteExpression(node.Expression, stack); - if (expression.Action != RewriteAction.None) { - if (expression.Action == RewriteAction.SpillStack && - node.Member.MemberType == MemberTypes.Property) { - // Only need to validate propreties because reading a field - // is always side-effect free. - RequireNotRefInstance(node.Expression); - } - expr = MemberExpression.Make(expression.Node, node.Member); - } - return new Result(expression.Action, expr); - } - - //RewriteIndexExpression - private Result RewriteIndexExpression(Expression expr, Stack stack) { - IndexExpression node = (IndexExpression)expr; - - ChildRewriter cr = new ChildRewriter(this, stack, node.Arguments.Count + 1); - - // For instance methods, the instance executes on the - // stack as is, but stays on the stack, making it non-empty. - cr.Add(node.Object); - cr.Add(node.Arguments); - - if (cr.Action == RewriteAction.SpillStack) { - RequireNotRefInstance(node.Object); - } - - if (cr.Rewrite) { - expr = new IndexExpression( - cr[0], - node.Indexer, - cr[1, -1] - ); - } - - return cr.Finish(expr); - } - - // MethodCallExpression - private Result RewriteMethodCallExpression(Expression expr, Stack stack) { - MethodCallExpression node = (MethodCallExpression)expr; - - ChildRewriter cr = new ChildRewriter(this, stack, node.Arguments.Count + 1); - - // For instance methods, the instance executes on the - // stack as is, but stays on the stack, making it non-empty. - cr.Add(node.Object); - - cr.AddArguments(node); - - if (cr.Action == RewriteAction.SpillStack) { - RequireNotRefInstance(node.Object); - RequireNoRefArgs(node.Method); - } - - return cr.Finish(cr.Rewrite ? node.Rewrite(cr[0], cr[1, -1]) : expr); - } - - // NewArrayExpression - private Result RewriteNewArrayExpression(Expression expr, Stack stack) { - NewArrayExpression node = (NewArrayExpression)expr; - - if (node.NodeType == ExpressionType.NewArrayInit) { - // In a case of array construction with element initialization - // the element expressions are never emitted on an empty stack because - // the array reference and the index are on the stack. - stack = Stack.NonEmpty; - } else { - // In a case of NewArrayBounds we make no modifications to the stack - // before emitting bounds expressions. - } - - ChildRewriter cr = new ChildRewriter(this, stack, node.Expressions.Count); - cr.Add(node.Expressions); - - if (cr.Rewrite) { - Type element = node.Type.GetElementType(); - if (node.NodeType == ExpressionType.NewArrayInit) { - expr = Expression.NewArrayInit(element, cr[0, -1]); - } else { - expr = Expression.NewArrayBounds(element, cr[0, -1]); - } - } - - return cr.Finish(expr); - } - - // InvocationExpression - private Result RewriteInvocationExpression(Expression expr, Stack stack) { - InvocationExpression node = (InvocationExpression)expr; - - ChildRewriter cr; - - // See if the lambda will be inlined - LambdaExpression lambda = node.LambdaOperand; - if (lambda != null) { - // Arguments execute on current stack - cr = new ChildRewriter(this, stack, node.Arguments.Count); - cr.Add(node.Arguments); - - if (cr.Action == RewriteAction.SpillStack) { - RequireNoRefArgs(Expression.GetInvokeMethod(node.Expression)); - } - - // Lambda body also executes on current stack - var spiller = new StackSpiller(stack); - lambda = lambda.Accept(spiller); - - if (cr.Rewrite || spiller._lambdaRewrite != RewriteAction.None) { - node = new InvocationExpression(lambda, cr[0, -1], node.Type); - } - - Result result = cr.Finish(node); - return new Result(result.Action | spiller._lambdaRewrite, result.Node); - } - - cr = new ChildRewriter(this, stack, node.Arguments.Count + 1); - - // first argument starts on stack as provided - cr.Add(node.Expression); - - // rest of arguments have non-empty stack (delegate instance on the stack) - cr.Add(node.Arguments); - - if (cr.Action == RewriteAction.SpillStack) { - RequireNoRefArgs(Expression.GetInvokeMethod(node.Expression)); - } - - return cr.Finish(cr.Rewrite ? new InvocationExpression(cr[0], cr[1, -1], node.Type) : expr); - } - - // NewExpression - private Result RewriteNewExpression(Expression expr, Stack stack) { - NewExpression node = (NewExpression)expr; - - // The first expression starts on a stack as provided by parent, - // rest are definitely non-emtpy (which ChildRewriter guarantees) - ChildRewriter cr = new ChildRewriter(this, stack, node.Arguments.Count); - cr.AddArguments(node); - - if (cr.Action == RewriteAction.SpillStack) { - RequireNoRefArgs(node.Constructor); - } - - return cr.Finish(cr.Rewrite ? new NewExpression(node.Constructor, cr[0, -1], node.Members) : expr); - } - - // TypeBinaryExpression - private Result RewriteTypeBinaryExpression(Expression expr, Stack stack) { - TypeBinaryExpression node = (TypeBinaryExpression)expr; - // The expression is emitted on top of current stack - Result expression = RewriteExpression(node.Expression, stack); - if (expression.Action != RewriteAction.None) { - if (node.NodeType == ExpressionType.TypeIs) { - expr = Expression.TypeIs(expression.Node, node.TypeOperand); - } else { - expr = Expression.TypeEqual(expression.Node, node.TypeOperand); - } - } - return new Result(expression.Action, expr); - } - - // Throw - private Result RewriteThrowUnaryExpression(Expression expr, Stack stack) { - UnaryExpression node = (UnaryExpression)expr; - - // Throw statement itself does not care about the stack - // but it will empty the stack and it may cause stack misbalance - // it so we need to restore stack after unconditional throw to make JIT happy - // this has an effect of executing Throw on an empty stack. - - Result value = RewriteExpressionFreeTemps(node.Operand, Stack.Empty); - RewriteAction action = value.Action; - - if (stack != Stack.Empty) { - action = RewriteAction.SpillStack; - } - - if (action != RewriteAction.None) { - expr = Expression.Throw(value.Node, node.Type); - } - - return new Result(action, expr); - } - - // UnaryExpression - private Result RewriteUnaryExpression(Expression expr, Stack stack) { - UnaryExpression node = (UnaryExpression)expr; - - Debug.Assert(node.NodeType != ExpressionType.Quote, "unexpected Quote"); - Debug.Assert(node.NodeType != ExpressionType.Throw, "unexpected Throw"); - - // Operand is emitted on top of the stack as is - Result expression = RewriteExpression(node.Operand, stack); - - if (expression.Action == RewriteAction.SpillStack) { - RequireNoRefArgs(node.Method); - } - - if (expression.Action != RewriteAction.None) { - expr = new UnaryExpression(node.NodeType, expression.Node, node.Type, node.Method); - } - return new Result(expression.Action, expr); - } - - // RewriteListInitExpression - private Result RewriteListInitExpression(Expression expr, Stack stack) { - ListInitExpression node = (ListInitExpression)expr; - - //ctor runs on initial stack - Result newResult = RewriteExpression(node.NewExpression, stack); - Expression rewrittenNew = newResult.Node; - RewriteAction action = newResult.Action; - - ReadOnlyCollection inits = node.Initializers; - - ChildRewriter[] cloneCrs = new ChildRewriter[inits.Count]; - - for (int i = 0; i < inits.Count; i++) { - ElementInit init = inits[i]; - - //initializers all run on nonempty stack - ChildRewriter cr = new ChildRewriter(this, Stack.NonEmpty, init.Arguments.Count); - cr.Add(init.Arguments); - - action |= cr.Action; - cloneCrs[i] = cr; - } - - switch (action) { - case RewriteAction.None: - break; - case RewriteAction.Copy: - ElementInit[] newInits = new ElementInit[inits.Count]; - for (int i = 0; i < inits.Count; i++) { - ChildRewriter cr = cloneCrs[i]; - if (cr.Action == RewriteAction.None) { - newInits[i] = inits[i]; - } else { - newInits[i] = Expression.ElementInit(inits[i].AddMethod, cr[0, -1]); - } - } - expr = Expression.ListInit((NewExpression)rewrittenNew, new TrueReadOnlyCollection(newInits)); - break; - case RewriteAction.SpillStack: - RequireNotRefInstance(node.NewExpression); - - ParameterExpression tempNew = MakeTemp(rewrittenNew.Type); - Expression[] comma = new Expression[inits.Count + 2]; - comma[0] = Expression.Assign(tempNew, rewrittenNew); - - for (int i = 0; i < inits.Count; i++) { - ChildRewriter cr = cloneCrs[i]; - Result add = cr.Finish(Expression.Call(tempNew, inits[i].AddMethod, cr[0, -1])); - comma[i + 1] = add.Node; - } - comma[inits.Count + 1] = tempNew; - expr = MakeBlock(comma); - break; - default: - throw ContractUtils.Unreachable; - } - - return new Result(action, expr); - } - - // RewriteMemberInitExpression - private Result RewriteMemberInitExpression(Expression expr, Stack stack) { - MemberInitExpression node = (MemberInitExpression)expr; - - //ctor runs on original stack - Result result = RewriteExpression(node.NewExpression, stack); - Expression rewrittenNew = result.Node; - RewriteAction action = result.Action; - - ReadOnlyCollection bindings = node.Bindings; - BindingRewriter[] bindingRewriters = new BindingRewriter[bindings.Count]; - for (int i = 0; i < bindings.Count; i++) { - MemberBinding binding = bindings[i]; - //bindings run on nonempty stack - BindingRewriter rewriter = BindingRewriter.Create(binding, this, Stack.NonEmpty); - bindingRewriters[i] = rewriter; - action |= rewriter.Action; - } - - switch (action) { - case RewriteAction.None: - break; - case RewriteAction.Copy: - MemberBinding[] newBindings = new MemberBinding[bindings.Count]; - for (int i = 0; i < bindings.Count; i++) { - newBindings[i] = bindingRewriters[i].AsBinding(); - } - expr = Expression.MemberInit((NewExpression)rewrittenNew, new TrueReadOnlyCollection(newBindings)); - break; - case RewriteAction.SpillStack: - RequireNotRefInstance(node.NewExpression); - - ParameterExpression tempNew = MakeTemp(rewrittenNew.Type); - Expression[] comma = new Expression[bindings.Count + 2]; - comma[0] = Expression.Assign(tempNew, rewrittenNew); - for (int i = 0; i < bindings.Count; i++) { - BindingRewriter cr = bindingRewriters[i]; - Expression initExpr = cr.AsExpression(tempNew); - comma[i + 1] = initExpr; - } - comma[bindings.Count + 1] = tempNew; - expr = MakeBlock(comma); - break; - default: - throw ContractUtils.Unreachable; - } - return new Result(action, expr); - } - - #endregion - - #region Statements - - // Block - private Result RewriteBlockExpression(Expression expr, Stack stack) { - BlockExpression node = (BlockExpression)expr; - - int count = node.ExpressionCount; - RewriteAction action = RewriteAction.None; - Expression[] clone = null; - for (int i = 0; i < count; i++) { - Expression expression = node.GetExpression(i); - // All statements within the block execute at the - // same stack state. - Result rewritten = RewriteExpression(expression, stack); - action |= rewritten.Action; - - if (clone == null && rewritten.Action != RewriteAction.None) { - clone = Clone(node.Expressions, i); - } - - if (clone != null) { - clone[i] = rewritten.Node; - } - } - - if (action != RewriteAction.None) { - // okay to wrap since we know no one can mutate the clone array - expr = node.Rewrite(null, clone); - } - return new Result(action, expr); - } - - // LabelExpression - private Result RewriteLabelExpression(Expression expr, Stack stack) { - LabelExpression node = (LabelExpression)expr; - - Result expression = RewriteExpression(node.DefaultValue, stack); - if (expression.Action != RewriteAction.None) { - expr = Expression.Label(node.Target, expression.Node); - } - return new Result(expression.Action, expr); - } - - // LoopStatement - private Result RewriteLoopExpression(Expression expr, Stack stack) { - LoopExpression node = (LoopExpression)expr; - - // The loop statement requires empty stack for itself, so it - // can guarantee it to the child nodes. - Result body = RewriteExpression(node.Body, Stack.Empty); - - RewriteAction action = body.Action; - - // However, the loop itself requires that it executes on an empty stack - // so we need to rewrite if the stack is not empty. - if (stack != Stack.Empty) { - action = RewriteAction.SpillStack; - } - - if (action != RewriteAction.None) { - expr = new LoopExpression(body.Node, node.BreakLabel, node.ContinueLabel); - } - return new Result(action, expr); - } - - // GotoExpression - // Note: goto does not necessarily need an empty stack. We could always - // emit it as a "leave" which would clear the stack for us. That would - // prevent us from doing certain optimizations we might want to do, - // however, like the switch-case-goto pattern. For now, be conservative - private Result RewriteGotoExpression(Expression expr, Stack stack) { - GotoExpression node = (GotoExpression)expr; - - // Goto requires empty stack to execute so the expression is - // going to execute on an empty stack. - Result value = RewriteExpressionFreeTemps(node.Value, Stack.Empty); - - // However, the statement itself needs an empty stack for itself - // so if stack is not empty, rewrite to empty the stack. - RewriteAction action = value.Action; - if (stack != Stack.Empty) { - action = RewriteAction.SpillStack; - } - - if (action != RewriteAction.None) { - expr = Expression.MakeGoto(node.Kind, node.Target, value.Node, node.Type); - } - return new Result(action, expr); - } - - // SwitchStatement - private Result RewriteSwitchExpression(Expression expr, Stack stack) { - SwitchExpression node = (SwitchExpression)expr; - - // The switch statement test is emitted on the stack in current state - Result switchValue = RewriteExpressionFreeTemps(node.SwitchValue, stack); - - RewriteAction action = switchValue.Action; - ReadOnlyCollection cases = node.Cases; - SwitchCase[] clone = null; - for (int i = 0; i < cases.Count; i++) { - SwitchCase @case = cases[i]; - - Expression[] cloneTests = null; - ReadOnlyCollection testValues = @case.TestValues; - for (int j = 0; j < testValues.Count; j++) { - // All tests execute at the same stack state as the switch. - // This is guarenteed by the compiler (to simplify spilling) - Result test = RewriteExpression(testValues[j], stack); - action |= test.Action; - - if (cloneTests == null && test.Action != RewriteAction.None) { - cloneTests = Clone(testValues, j); - } - - if (cloneTests != null) { - cloneTests[j] = test.Node; - } - } - - // And all the cases also run on the same stack level. - Result body = RewriteExpression(@case.Body, stack); - action |= body.Action; - - if (body.Action != RewriteAction.None || cloneTests != null) { - if (cloneTests != null) { - testValues = new ReadOnlyCollection(cloneTests); - } - @case = new SwitchCase(body.Node, testValues); - - if (clone == null) { - clone = Clone(cases, i); - } - } - - if (clone != null) { - clone[i] = @case; - } - } - - // default body also runs on initial stack - Result defaultBody = RewriteExpression(node.DefaultBody, stack); - action |= defaultBody.Action; - - if (action != RewriteAction.None) { - if (clone != null) { - // okay to wrap because we aren't modifying the array - cases = new ReadOnlyCollection(clone); - } - - expr = new SwitchExpression(node.Type, switchValue.Node, defaultBody.Node, node.Comparison, cases); - } - - return new Result(action, expr); - } - - // TryStatement - private Result RewriteTryExpression(Expression expr, Stack stack) { - TryExpression node = (TryExpression)expr; - - // Try statement definitely needs an empty stack so its - // child nodes execute at empty stack. - Result body = RewriteExpression(node.Body, Stack.Empty); - ReadOnlyCollection handlers = node.Handlers; - CatchBlock[] clone = null; - - RewriteAction action = body.Action; - if (handlers != null) { - for (int i = 0; i < handlers.Count; i++) { - RewriteAction curAction = body.Action; - - CatchBlock handler = handlers[i]; - - Expression filter = handler.Filter; - if (handler.Filter != null) { - // our code gen saves the incoming filter value and provides it as a varaible so the stack is empty - Result rfault = RewriteExpression(handler.Filter, Stack.Empty); - action |= rfault.Action; - curAction |= rfault.Action; - filter = rfault.Node; - } - - // Catch block starts with an empty stack (guaranteed by TryStatement) - Result rbody = RewriteExpression(handler.Body, Stack.Empty); - action |= rbody.Action; - curAction |= rbody.Action; - - if (curAction != RewriteAction.None) { - handler = Expression.MakeCatchBlock(handler.Test, handler.Variable, rbody.Node, filter); - - if (clone == null) { - clone = Clone(handlers, i); - } - } - - if (clone != null) { - clone[i] = handler; - } - } - } - - Result fault = RewriteExpression(node.Fault, Stack.Empty); - action |= fault.Action; - - Result @finally = RewriteExpression(node.Finally, Stack.Empty); - action |= @finally.Action; - - // If the stack is initially not empty, rewrite to spill the stack - if (stack != Stack.Empty) { - action = RewriteAction.SpillStack; - } - - if (action != RewriteAction.None) { - if (clone != null) { - // okay to wrap because we aren't modifying the array - handlers = new ReadOnlyCollection(clone); - } - - expr = new TryExpression(node.Type, body.Node, @finally.Node, fault.Node, handlers); - } - return new Result(action, expr); - } - - private Result RewriteExtensionExpression(Expression expr, Stack stack) { - Result result = RewriteExpression(expr.ReduceExtensions(), stack); - // it's at least Copy because we reduced the node - return new Result(result.Action | RewriteAction.Copy, result.Node); - } - - #endregion - - #region Cloning - - /// - /// Will clone an IList into an array of the same size, and copy - /// all vaues up to (and NOT including) the max index - /// - /// The cloned array. - private static T[] Clone(ReadOnlyCollection original, int max) { - Debug.Assert(original != null); - Debug.Assert(max < original.Count); - - T[] clone = new T[original.Count]; - for (int j = 0; j < max; j++) { - clone[j] = original[j]; - } - return clone; - } - - #endregion - - /// - /// If we are spilling, requires that there are no byref arguments to - /// the method call. - /// - /// Used for: - /// NewExpression, - /// MethodCallExpression, - /// InvocationExpression, - /// DynamicExpression, - /// UnaryExpression, - /// BinaryExpression. - /// - /// - /// We could support this if spilling happened later in the compiler. - /// Other expressions that can emit calls with arguments (such as - /// ListInitExpression and IndexExpression) don't allow byref arguments. - /// - private static void RequireNoRefArgs(MethodBase method) { - if (method != null && method.GetParametersCached().Any(p => p.ParameterType.IsByRef)) { - throw Error.TryNotSupportedForMethodsWithRefArgs(method); - } - } - - /// - /// Requires that the instance is not a value type (primitive types are - /// okay because they're immutable). - /// - /// Used for: - /// MethodCallExpression, - /// MemberExpression (for properties), - /// IndexExpression, - /// ListInitExpression, - /// MemberInitExpression, - /// assign to MemberExpression, - /// assign to IndexExpression. - /// - /// - /// We could support this if spilling happened later in the compiler. - /// - private static void RequireNotRefInstance(Expression instance) { - // Primitive value types are okay because they are all readonly, - // but we can't rely on this for non-primitive types. So we throw - // NotSupported. - if (instance != null && instance.Type.IsValueType && Type.GetTypeCode(instance.Type) == TypeCode.Object) { - throw Error.TryNotSupportedForValueTypeInstances(instance.Type); - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolDocumentGenerator.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolDocumentGenerator.cs deleted file mode 100644 index 25e0b394d88..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolDocumentGenerator.cs +++ /dev/null @@ -1,72 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ -#if FEATURE_REFEMIT && FEATURE_PDBEMIT - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Ast.Compiler; -#else -using System.Linq.Expressions; -using System.Linq.Expressions.Compiler; -#endif - -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.SymbolStore; -using System.Reflection; -using System.Reflection.Emit; - -namespace System.Runtime.CompilerServices { -#if !FEATURE_CORE_DLR || SILVERLIGHT - using ILGenerator = OffsetTrackingILGenerator; -#endif - - /// - /// Generator of PDB debugging information for expression trees. - /// - internal sealed class SymbolDocumentGenerator : DebugInfoGenerator { - private Dictionary _symbolWriters; - - private ISymbolDocumentWriter GetSymbolWriter(MethodBuilder method, SymbolDocumentInfo document) { - ISymbolDocumentWriter result; - if (_symbolWriters == null) { - _symbolWriters = new Dictionary(); - } - - if (!_symbolWriters.TryGetValue(document, out result)) { - result = ((ModuleBuilder)method.Module).DefineDocument(document.FileName, document.Language, document.LanguageVendor, SymbolGuids.DocumentType_Text); - _symbolWriters.Add(document, result); - } - - return result; - } - - internal override void MarkSequencePoint(LambdaExpression method, MethodBase methodBase, ILGenerator ilg, DebugInfoExpression sequencePoint) { - MethodBuilder builder = methodBase as MethodBuilder; - if (builder != null) { - ilg.MarkSequencePoint(GetSymbolWriter(builder, sequencePoint.Document), sequencePoint.StartLine, sequencePoint.StartColumn, sequencePoint.EndLine, sequencePoint.EndColumn); - } - } - - public override void MarkSequencePoint(LambdaExpression method, int ilOffset, DebugInfoExpression sequencePoint) { - throw Error.PdbGeneratorNeedsExpressionCompiler(); - } - - internal override void SetLocalName(LocalBuilder localBuilder, string name) { - localBuilder.SetLocalSymInfo(name); - } - } -} -#endif diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolGuids.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolGuids.cs deleted file mode 100644 index ec8f0f84c2d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/SymbolGuids.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - internal static class SymbolGuids { - internal static readonly Guid DocumentType_Text = - new Guid(0x5a869d0b, 0x6611, 0x11d3, 0xbd, 0x2a, 0, 0, 0xf8, 8, 0x49, 0xbd); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/VariableBinder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/VariableBinder.cs deleted file mode 100644 index 2711f48d08f..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Compiler/VariableBinder.cs +++ /dev/null @@ -1,244 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Dynamic.Utils; - -#if SILVERLIGHT -using System.Core; -#endif - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast.Compiler { -#else -namespace System.Linq.Expressions.Compiler { -#endif - /// - /// Determines if variables are closed over in nested lambdas and need to - /// be hoisted. - /// - internal sealed class VariableBinder : ExpressionVisitor { - private readonly AnalyzedTree _tree = new AnalyzedTree(); - private readonly Stack _scopes = new Stack(); - private readonly Stack _constants = new Stack(); - private bool _inQuote; - - internal static AnalyzedTree Bind(LambdaExpression lambda) { - var binder = new VariableBinder(); - binder.Visit(lambda); - return binder._tree; - } - - private VariableBinder() { - } - - protected internal override Expression VisitConstant(ConstantExpression node) { - // If we're in Quote, we can ignore constants completely - if (_inQuote) { - return node; - } - - // Constants that can be emitted into IL don't need to be stored on - // the delegate - if (ILGen.CanEmitConstant(node.Value, node.Type)) { - return node; - } - - _constants.Peek().AddReference(node.Value, node.Type); - return node; - } - - protected internal override Expression VisitUnary(UnaryExpression node) { - if (node.NodeType == ExpressionType.Quote) { - bool savedInQuote = _inQuote; - _inQuote = true; - Visit(node.Operand); - _inQuote = savedInQuote; - } else { - Visit(node.Operand); - } - return node; - } - - protected internal override Expression VisitLambda(Expression node) { - _scopes.Push(_tree.Scopes[node] = new CompilerScope(node, true)); - _constants.Push(_tree.Constants[node] = new BoundConstants()); - Visit(MergeScopes(node)); - _constants.Pop(); - _scopes.Pop(); - return node; - } - - protected internal override Expression VisitInvocation(InvocationExpression node) { - LambdaExpression lambda = node.LambdaOperand; - - // optimization: inline code for literal lambda's directly - if (lambda != null) { - // visit the lambda, but treat it more like a scope - _scopes.Push(_tree.Scopes[lambda] = new CompilerScope(lambda, false)); - Visit(MergeScopes(lambda)); - _scopes.Pop(); - // visit the invoke's arguments - Visit(node.Arguments); - return node; - } - - return base.VisitInvocation(node); - } - - protected internal override Expression VisitBlock(BlockExpression node) { - if (node.Variables.Count == 0) { - Visit(node.Expressions); - return node; - } - _scopes.Push(_tree.Scopes[node] = new CompilerScope(node, false)); - Visit(MergeScopes(node)); - _scopes.Pop(); - return node; - } - - protected override CatchBlock VisitCatchBlock(CatchBlock node) { - if (node.Variable == null) { - Visit(node.Body); - return node; - } - _scopes.Push(_tree.Scopes[node] = new CompilerScope(node, false)); - Visit(node.Body); - _scopes.Pop(); - return node; - } - - // If the immediate child is another scope, merge it into this one - // This is an optimization to save environment allocations and - // array accesses. - private ReadOnlyCollection MergeScopes(Expression node) { - ReadOnlyCollection body; - var lambda = node as LambdaExpression; - if (lambda != null) { - body = new ReadOnlyCollection(new[] { lambda.Body }); - } else { - body = ((BlockExpression)node).Expressions; - } - - var currentScope = _scopes.Peek(); - - // A block body is mergeable if the body only contains one single block node containing variables, - // and the child block has the same type as the parent block. - while (body.Count == 1 && body[0].NodeType == ExpressionType.Block) { - var block = (BlockExpression)body[0]; - - if (block.Variables.Count > 0) { - // Make sure none of the variables are shadowed. If any - // are, we can't merge it. - foreach (var v in block.Variables) { - if (currentScope.Definitions.ContainsKey(v)) { - return body; - } - } - - // Otherwise, merge it - if (currentScope.MergedScopes == null) { - currentScope.MergedScopes = new Set(ReferenceEqualityComparer.Instance); - } - currentScope.MergedScopes.Add(block); - foreach (var v in block.Variables) { - currentScope.Definitions.Add(v, VariableStorageKind.Local); - } - } - node = block; - body = block.Expressions; - } - return body; - } - - - protected internal override Expression VisitParameter(ParameterExpression node) { - Reference(node, VariableStorageKind.Local); - - // - // Track reference count so we can emit it in a more optimal way if - // it is used a lot. - // - CompilerScope referenceScope = null; - foreach (CompilerScope scope in _scopes) { - // - // There are two times we care about references: - // 1. When we enter a lambda, we want to cache frequently - // used variables - // 2. When we enter a scope with closed-over variables, we - // want to cache it immediately when we allocate the - // closure slot for it - // - if (scope.IsMethod || scope.Definitions.ContainsKey(node)) { - referenceScope = scope; - break; - } - } - - Debug.Assert(referenceScope != null); - if (referenceScope.ReferenceCount == null) { - referenceScope.ReferenceCount = new Dictionary(); - } - - Helpers.IncrementCount(node, referenceScope.ReferenceCount); - return node; - } - - protected internal override Expression VisitRuntimeVariables(RuntimeVariablesExpression node) { - foreach (var v in node.Variables) { - // Force hoisting of these variables - Reference(v, VariableStorageKind.Hoisted); - } - return node; - } - - private void Reference(ParameterExpression node, VariableStorageKind storage) { - CompilerScope definition = null; - foreach (CompilerScope scope in _scopes) { - if (scope.Definitions.ContainsKey(node)) { - definition = scope; - break; - } - scope.NeedsClosure = true; - if (scope.IsMethod) { - storage = VariableStorageKind.Hoisted; - } - } - if (definition == null) { - throw Error.UndefinedVariable(node.Name, node.Type, CurrentLambdaName); - } - if (storage == VariableStorageKind.Hoisted) { - if (node.IsByRef) { - throw Error.CannotCloseOverByRef(node.Name, CurrentLambdaName); - } - definition.Definitions[node] = VariableStorageKind.Hoisted; - } - } - - private string CurrentLambdaName { - get { - foreach (var scope in _scopes) { - var lambda = scope.Node as LambdaExpression; - if (lambda != null) { - return lambda.Name; - } - } - throw ContractUtils.Unreachable; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/GlobalSuppressions.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/GlobalSuppressions.cs deleted file mode 100644 index a21aeca06cf..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/GlobalSuppressions.cs +++ /dev/null @@ -1,20 +0,0 @@ -// This file is used by Code Analysis to maintain SuppressMessage -// attributes that are applied to this project. -// Project-level suppressions either have no target or are given -// a specific target and scoped to a namespace, type, member, etc. -// -// To add a suppression to this file, right-click the message in the -// Error List, point to "Suppress Message(s)", and click -// "In Project Suppression File". -// You do not need to add suppressions to this file manually. - -//UnhandledExpressionType is used by System.Linq.Expressions.OldExpressionVisitor -#if !FEATURE_CORE_DLR -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Scripting.Ast.Error.#UnhandledExpressionType(System.Object)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Scripting.Ast.Strings.#UnhandledExpressionType(System.Object)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Scripting.Ast.Error.#InvalidNullValue(System.Object)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Scripting.Ast.Error.#InvalidObjectType(System.Object,System.Object)")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Scripting.Ast.Error.#HomogenousAppDomainRequired()")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Scope = "member", Target = "Microsoft.Scripting.Ast.Strings.#HomogenousAppDomainRequired")] -#endif -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1033:InterfaceMethodsShouldBeCallableByChildTypes", Scope = "member", Target = "System.Runtime.CompilerServices.StrongBox`1.#System.Runtime.CompilerServices.IStrongBox.Value")] diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Microsoft.Scripting.Core.csproj b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Microsoft.Scripting.Core.csproj deleted file mode 100644 index 05b0240151e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Microsoft.Scripting.Core.csproj +++ /dev/null @@ -1,163 +0,0 @@ - - - - - 2.0 - {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4} - Library - Properties - System.Scripting - Microsoft.Scripting.Core - 855638016 - $(AssemblyName).ruleset - $(SolutionDir)..\bin\$(Configuration)\$(AssemblyName).xml - - - - - - - - - - - - - - - - - - Properties\SilverlightVersion.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Microsoft.Scripting.ExtensionAttribute.csproj b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Microsoft.Scripting.ExtensionAttribute.csproj deleted file mode 100644 index 27331e55160..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Microsoft.Scripting.ExtensionAttribute.csproj +++ /dev/null @@ -1,104 +0,0 @@ - - - - - Debug - AnyCPU - 10.0.20624 - 2.0 - {8B0F1074-750E-4D64-BF23-A1E0F54261E5} - Library - Properties - Microsoft.Scripting.ExtensionAttribute - Microsoft.Scripting.ExtensionAttribute -$(SolutionDir)Runtime\MSSharedLibKey.snk - true - SIGNED - true - 866123776 - $(ProgramFiles)\Microsoft Silverlight\3.0.40818.0\ - v2.0 - - - pdbonly - true -$(SolutionDir)..\Bin\fxcop\ - TRACE;$(SignedSym) - prompt - 4 - true - true - -Microsoft.Usage#CA2209;+!Microsoft.Design#CA1012;-!Microsoft.Design#CA2210;+!Microsoft.Design#CA1040;+!Microsoft.Design#CA1005;+!Microsoft.Design#CA1020;-!Microsoft.Design#CA1021;+!Microsoft.Design#CA1010;+!Microsoft.Design#CA1011;+!Microsoft.Design#CA1009;+!Microsoft.Design#CA1050;+!Microsoft.Design#CA1026;+!Microsoft.Design#CA1019;+!Microsoft.Design#CA1031;+!Microsoft.Design#CA1047;+!Microsoft.Design#CA1000;+!Microsoft.Design#CA1048;+!Microsoft.Design#CA1051;+!Microsoft.Design#CA1002;+!Microsoft.Design#CA1061;+!Microsoft.Design#CA1006;+!Microsoft.Design#CA1046;+!Microsoft.Design#CA1045;+!Microsoft.Design#CA1065;+!Microsoft.Design#CA1038;+!Microsoft.Design#CA1008;+!Microsoft.Design#CA1028;+!Microsoft.Design#CA1064;-!Microsoft.Design#CA1004;+!Microsoft.Design#CA1035;+!Microsoft.Design#CA1063;+!Microsoft.Design#CA1032;+!Microsoft.Design#CA1023;+!Microsoft.Design#CA1033;+!Microsoft.Design#CA1039;+!Microsoft.Design#CA1016;+!Microsoft.Design#CA1014;+!Microsoft.Design#CA1017;+!Microsoft.Design#CA1018;+!Microsoft.Design#CA1027;+!Microsoft.Design#CA1059;+!Microsoft.Design#CA1060;+!Microsoft.Design#CA1034;+!Microsoft.Design#CA1013;+!Microsoft.Design#CA1036;+!Microsoft.Design#CA1044;+!Microsoft.Design#CA1041;+!Microsoft.Design#CA1025;+!Microsoft.Design#CA1052;+!Microsoft.Design#CA1053;+!Microsoft.Design#CA1057;+!Microsoft.Design#CA1058;+!Microsoft.Design#CA1001;+!Microsoft.Design#CA1049;+!Microsoft.Design#CA1054;+!Microsoft.Design#CA1056;+!Microsoft.Design#CA1055;+!Microsoft.Design#CA1030;+!Microsoft.Design#CA1003;+!Microsoft.Design#CA1007;+!Microsoft.Design#CA1043;+!Microsoft.Design#CA1024;+!Microsoft.Globalization#CA1301;+!Microsoft.Globalization#CA1302;+!Microsoft.Globalization#CA1308;+!Microsoft.Globalization#CA1306;+!Microsoft.Globalization#CA1304;+!Microsoft.Globalization#CA1305;+!Microsoft.Globalization#CA2101;+!Microsoft.Globalization#CA1300;+!Microsoft.Globalization#CA1307;+!Microsoft.Globalization#CA1309;+!Microsoft.Interoperability#CA1403;+!Microsoft.Interoperability#CA1406;+!Microsoft.Interoperability#CA1413;+!Microsoft.Interoperability#CA1402;+!Microsoft.Interoperability#CA1407;+!Microsoft.Interoperability#CA1404;+!Microsoft.Interoperability#CA1410;+!Microsoft.Interoperability#CA1411;+!Microsoft.Interoperability#CA1405;+!Microsoft.Interoperability#CA1409;+!Microsoft.Interoperability#CA1415;+!Microsoft.Interoperability#CA1408;+!Microsoft.Interoperability#CA1414;+!Microsoft.Interoperability#CA1412;+!Microsoft.Interoperability#CA1400;+!Microsoft.Interoperability#CA1401;+!Microsoft.Maintainability#CA1506;+!Microsoft.Maintainability#CA1502;+!Microsoft.Maintainability#CA1501;+!Microsoft.Maintainability#CA1505;+!Microsoft.Maintainability#CA1504;+!Microsoft.Maintainability#CA1500;+!Microsoft.Mobility#CA1600;+!Microsoft.Mobility#CA1601;-!Microsoft.Naming#CA1702;+!Microsoft.Naming#CA1700;+!Microsoft.Naming#CA1712;+!Microsoft.Naming#CA1713;+!Microsoft.Naming#CA1714;+!Microsoft.Naming#CA1709;-!Microsoft.Naming#CA1704;+!Microsoft.Naming#CA1708;+!Microsoft.Naming#CA1715;-!Microsoft.Naming#CA1710;-!Microsoft.Naming#CA1720;+!Microsoft.Naming#CA1707;+!Microsoft.Naming#CA1722;-!Microsoft.Naming#CA1711;+!Microsoft.Naming#CA1716;+!Microsoft.Naming#CA1717;+!Microsoft.Naming#CA1725;+!Microsoft.Naming#CA1719;+!Microsoft.Naming#CA1721;+!Microsoft.Naming#CA1701;+!Microsoft.Naming#CA1703;+!Microsoft.Naming#CA1724;-!Microsoft.Naming#CA1726;+!Microsoft.Performance#CA1809;+!Microsoft.Performance#CA1811;+!Microsoft.Performance#CA1812;+!Microsoft.Performance#CA1813;+!Microsoft.Performance#CA1823;+!Microsoft.Performance#CA1800;+!Microsoft.Performance#CA1805;+!Microsoft.Performance#CA1810;+!Microsoft.Performance#CA1824;+!Microsoft.Performance#CA1822;+!Microsoft.Performance#CA1815;+!Microsoft.Performance#CA1814;+!Microsoft.Performance#CA1819;+!Microsoft.Performance#CA1821;+!Microsoft.Performance#CA1804;+!Microsoft.Performance#CA1820;+!Microsoft.Performance#CA1802;+!Microsoft.Portability#CA1901;+!Microsoft.Portability#CA1900;+!Microsoft.Reliability#CA2001;+!Microsoft.Reliability#CA2002;+!Microsoft.Reliability#CA2003;+!Microsoft.Reliability#CA2004;+!Microsoft.Reliability#CA2006;+!Microsoft.Security#CA2116;+!Microsoft.Security#CA2117;+!Microsoft.Security#CA2105;+!Microsoft.Security#CA2115;+!Microsoft.Security#CA2102;+!Microsoft.Security#CA2104;+!Microsoft.Security#CA2122;+!Microsoft.Security#CA2114;+!Microsoft.Security#CA2123;+!Microsoft.Security#CA2111;+!Microsoft.Security#CA2108;+!Microsoft.Security#CA2107;+!Microsoft.Security#CA2103;+!Microsoft.Security#CA2118;+!Microsoft.Security#CA2109;+!Microsoft.Security#CA2119;+!Microsoft.Security#CA2106;+!Microsoft.Security#CA2112;+!Microsoft.Security#CA2120;+!Microsoft.Security#CA2121;+!Microsoft.Security#CA2126;+!Microsoft.Security#CA2124;+!Microsoft.Security#CA2127;+!Microsoft.Security#CA2128;+!Microsoft.Security#CA2129;+!Microsoft.Usage#CA2243;+!Microsoft.Usage#CA2236;+!Microsoft.Usage#CA1816;+!Microsoft.Usage#CA2227;+!Microsoft.Usage#CA2213;+!Microsoft.Usage#CA2216;+!Microsoft.Usage#CA2214;+!Microsoft.Usage#CA2222;+!Microsoft.Usage#CA1806;+!Microsoft.Usage#CA2217;+!Microsoft.Usage#CA2212;+!Microsoft.Usage#CA2219;+!Microsoft.Usage#CA2201;+!Microsoft.Usage#CA2228;+!Microsoft.Usage#CA2221;+!Microsoft.Usage#CA2220;+!Microsoft.Usage#CA2240;+!Microsoft.Usage#CA2229;+!Microsoft.Usage#CA2238;+!Microsoft.Usage#CA2207;+!Microsoft.Usage#CA2208;+!Microsoft.Usage#CA2235;+!Microsoft.Usage#CA2237;+!Microsoft.Usage#CA2232;+!Microsoft.Usage#CA2223;+!Microsoft.Usage#CA2211;+!Microsoft.Usage#CA2233;+!Microsoft.Usage#CA2225;+!Microsoft.Usage#CA2226;+!Microsoft.Usage#CA2231;+!Microsoft.Usage#CA2224;+!Microsoft.Usage#CA2218;+!Microsoft.Usage#CA2234;+!Microsoft.Usage#CA2239;+!Microsoft.Usage#CA2200;+!Microsoft.Usage#CA1801;+!Microsoft.Usage#CA2242;+!Microsoft.Usage#CA2205;+!Microsoft.Usage#CA2230 - - - true - full - false -$(SolutionDir)..\Bin\Debug\ - DEBUG;TRACE;$(SignedSym) - prompt - 4 - true - false - - - pdbonly - true -$(SolutionDir)..\Bin\Release\ - TRACE;$(SignedSym) - prompt - 4 - true - false - 1929379840 - - - true -$(SolutionDir)..\Bin\Silverlight Debug\ - TRACE;DEBUG;SILVERLIGHT - true - full - AnyCPU - false - prompt - true - 1591,618 - true - - -$(SolutionDir)..\Bin\Silverlight Release\ - TRACE;SILVERLIGHT - true - 1591,618 - true - pdbonly - AnyCPU - prompt - true - - - - - False - $(SilverlightPath)\mscorlib.dll - - - False - $(SilverlightPath)\System.dll - - - - - Properties\SilverlightVersion.cs - - - - - - - - - - - - diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Properties/AssemblyInfo.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Properties/AssemblyInfo.cs deleted file mode 100644 index ef2378f2ce3..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Microsoft.Scripting")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Microsoft.Scripting")] -[assembly: AssemblyCopyright("© Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -[assembly: CLSCompliant(true)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("cabb8088-1370-43ca-ad47-1c32d3f7bd10")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: SecurityTransparent] - -[assembly: System.Resources.NeutralResourcesLanguage("en-US")] - -#if !SILVERLIGHT -[assembly: AssemblyVersion("1.1.0.30")] -[assembly: AssemblyFileVersion("1.1.0.30")] -[assembly: AssemblyInformationalVersion("1.1")] -#endif - -#if !SILVERLIGHT && !WP75 -[assembly: AllowPartiallyTrustedCallers] -#endif diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Properties/ExtensionAssemblyInfo.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Properties/ExtensionAssemblyInfo.cs deleted file mode 100644 index 2a2c1c0f76c..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Properties/ExtensionAssemblyInfo.cs +++ /dev/null @@ -1,62 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Microsoft Public License. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Microsoft Public License, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Microsoft Public License. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; -using System.Security; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Microsoft.Scripting.ExtensionAttribute")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Microsoft")] -[assembly: AssemblyProduct("Microsoft.Scripting.ExtensionAttribute")] -[assembly: AssemblyCopyright("� Microsoft Corporation. All rights reserved.")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -[assembly: CLSCompliant(true)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("b828a36d-f568-48a7-9bdd-412b0a1bfa32")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: -[assembly: SecurityTransparent] - -[assembly: System.Resources.NeutralResourcesLanguage("en-US")] - -#if !SILVERLIGHT -[assembly: AssemblyVersion("2.0.0.0")] // shouldn't change, this assembly is unchanged. This is the version it originally shipped as. -[assembly: AssemblyFileVersion("1.0.1.00")] -[assembly: AssemblyInformationalVersion("1.0.1")] -[assembly: AllowPartiallyTrustedCallers] -#endif diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Stubs.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Stubs.cs deleted file mode 100644 index 26ee3b4651b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Stubs.cs +++ /dev/null @@ -1,48 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Diagnostics; - -namespace Microsoft.Scripting.Utils { - -} - -#if !FEATURE_SERIALIZATION - -namespace System { - /// - /// The serializable attribute. - /// - [Conditional("STUB")] - internal class SerializableAttribute : Attribute { - } - - /// - /// Non serializable attribute. - /// - [Conditional("STUB")] - internal class NonSerializedAttribute : Attribute { - } - - namespace Runtime.Serialization { - /// - /// ISerializable interface. - /// - internal interface ISerializable { - } - } -} - -#endif diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/System.Core.csproj b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/System.Core.csproj deleted file mode 100644 index 87e0f80b87d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/System.Core.csproj +++ /dev/null @@ -1,245 +0,0 @@ - - - - - - Debug - AnyCPU - 10.0.20624 - 2.0 - {2AE75F5A-CD1F-4925-9647-AF4D1C282FB4} - Library - Properties - System.Scripting - System.Core -$(OutputPath)\System.Core.XML - 1591 - 2.0 - $(SolutionDir)..\Internal\MSSharedLibKey.snk - true - SIGNED - true - 855638016 - v4.0 - - - pdbonly - true -$(SolutionDir)..\bin\fxcop\ - TRACE;$(SignedSym) - prompt - 4 - true - true - -Microsoft.Usage#CA2209;+!Microsoft.Design#CA1012;-!Microsoft.Design#CA2210;+!Microsoft.Design#CA1040;+!Microsoft.Design#CA1005;+!Microsoft.Design#CA1020;-!Microsoft.Design#CA1021;+!Microsoft.Design#CA1010;+!Microsoft.Design#CA1011;+!Microsoft.Design#CA1009;+!Microsoft.Design#CA1050;+!Microsoft.Design#CA1026;+!Microsoft.Design#CA1019;+!Microsoft.Design#CA1031;+!Microsoft.Design#CA1047;+!Microsoft.Design#CA1000;+!Microsoft.Design#CA1048;+!Microsoft.Design#CA1051;+!Microsoft.Design#CA1002;+!Microsoft.Design#CA1061;+!Microsoft.Design#CA1006;+!Microsoft.Design#CA1046;+!Microsoft.Design#CA1045;+!Microsoft.Design#CA1065;+!Microsoft.Design#CA1038;+!Microsoft.Design#CA1008;+!Microsoft.Design#CA1028;+!Microsoft.Design#CA1064;-!Microsoft.Design#CA1004;+!Microsoft.Design#CA1035;+!Microsoft.Design#CA1063;+!Microsoft.Design#CA1032;+!Microsoft.Design#CA1023;+!Microsoft.Design#CA1033;+!Microsoft.Design#CA1039;+!Microsoft.Design#CA1016;+!Microsoft.Design#CA1014;+!Microsoft.Design#CA1017;+!Microsoft.Design#CA1018;+!Microsoft.Design#CA1027;+!Microsoft.Design#CA1059;+!Microsoft.Design#CA1060;+!Microsoft.Design#CA1034;+!Microsoft.Design#CA1013;+!Microsoft.Design#CA1036;+!Microsoft.Design#CA1044;+!Microsoft.Design#CA1041;+!Microsoft.Design#CA1025;+!Microsoft.Design#CA1052;+!Microsoft.Design#CA1053;+!Microsoft.Design#CA1057;+!Microsoft.Design#CA1058;+!Microsoft.Design#CA1001;+!Microsoft.Design#CA1049;+!Microsoft.Design#CA1054;+!Microsoft.Design#CA1056;+!Microsoft.Design#CA1055;+!Microsoft.Design#CA1030;+!Microsoft.Design#CA1003;+!Microsoft.Design#CA1007;+!Microsoft.Design#CA1043;+!Microsoft.Design#CA1024;+!Microsoft.Globalization#CA1301;+!Microsoft.Globalization#CA1302;+!Microsoft.Globalization#CA1308;+!Microsoft.Globalization#CA1306;+!Microsoft.Globalization#CA1304;+!Microsoft.Globalization#CA1305;+!Microsoft.Globalization#CA2101;+!Microsoft.Globalization#CA1300;+!Microsoft.Globalization#CA1307;+!Microsoft.Globalization#CA1309;+!Microsoft.Interoperability#CA1403;+!Microsoft.Interoperability#CA1406;+!Microsoft.Interoperability#CA1413;+!Microsoft.Interoperability#CA1402;+!Microsoft.Interoperability#CA1407;+!Microsoft.Interoperability#CA1404;+!Microsoft.Interoperability#CA1410;+!Microsoft.Interoperability#CA1411;+!Microsoft.Interoperability#CA1405;+!Microsoft.Interoperability#CA1409;+!Microsoft.Interoperability#CA1415;+!Microsoft.Interoperability#CA1408;+!Microsoft.Interoperability#CA1414;+!Microsoft.Interoperability#CA1412;+!Microsoft.Interoperability#CA1400;+!Microsoft.Interoperability#CA1401;+!Microsoft.Maintainability#CA1506;+!Microsoft.Maintainability#CA1502;+!Microsoft.Maintainability#CA1501;+!Microsoft.Maintainability#CA1505;+!Microsoft.Maintainability#CA1504;+!Microsoft.Maintainability#CA1500;+!Microsoft.Mobility#CA1600;+!Microsoft.Mobility#CA1601;-!Microsoft.Naming#CA1702;+!Microsoft.Naming#CA1700;+!Microsoft.Naming#CA1712;+!Microsoft.Naming#CA1713;+!Microsoft.Naming#CA1714;+!Microsoft.Naming#CA1709;-!Microsoft.Naming#CA1704;+!Microsoft.Naming#CA1708;+!Microsoft.Naming#CA1715;-!Microsoft.Naming#CA1710;-!Microsoft.Naming#CA1720;+!Microsoft.Naming#CA1707;+!Microsoft.Naming#CA1722;-!Microsoft.Naming#CA1711;+!Microsoft.Naming#CA1716;+!Microsoft.Naming#CA1717;+!Microsoft.Naming#CA1725;+!Microsoft.Naming#CA1719;+!Microsoft.Naming#CA1721;+!Microsoft.Naming#CA1701;+!Microsoft.Naming#CA1703;+!Microsoft.Naming#CA1724;-!Microsoft.Naming#CA1726;+!Microsoft.Performance#CA1809;+!Microsoft.Performance#CA1811;+!Microsoft.Performance#CA1812;+!Microsoft.Performance#CA1813;+!Microsoft.Performance#CA1823;+!Microsoft.Performance#CA1800;+!Microsoft.Performance#CA1805;+!Microsoft.Performance#CA1810;+!Microsoft.Performance#CA1824;+!Microsoft.Performance#CA1822;+!Microsoft.Performance#CA1815;+!Microsoft.Performance#CA1814;+!Microsoft.Performance#CA1819;+!Microsoft.Performance#CA1821;+!Microsoft.Performance#CA1804;+!Microsoft.Performance#CA1820;+!Microsoft.Performance#CA1802;+!Microsoft.Portability#CA1901;+!Microsoft.Portability#CA1900;+!Microsoft.Reliability#CA2001;+!Microsoft.Reliability#CA2002;+!Microsoft.Reliability#CA2003;+!Microsoft.Reliability#CA2004;+!Microsoft.Reliability#CA2006;+!Microsoft.Security#CA2116;+!Microsoft.Security#CA2117;+!Microsoft.Security#CA2105;+!Microsoft.Security#CA2115;+!Microsoft.Security#CA2102;+!Microsoft.Security#CA2104;+!Microsoft.Security#CA2122;+!Microsoft.Security#CA2114;+!Microsoft.Security#CA2123;+!Microsoft.Security#CA2111;+!Microsoft.Security#CA2108;+!Microsoft.Security#CA2107;+!Microsoft.Security#CA2103;+!Microsoft.Security#CA2118;+!Microsoft.Security#CA2109;+!Microsoft.Security#CA2119;+!Microsoft.Security#CA2106;+!Microsoft.Security#CA2112;+!Microsoft.Security#CA2120;+!Microsoft.Security#CA2121;+!Microsoft.Security#CA2126;+!Microsoft.Security#CA2124;+!Microsoft.Security#CA2127;+!Microsoft.Security#CA2128;+!Microsoft.Security#CA2129;+!Microsoft.Usage#CA2243;+!Microsoft.Usage#CA2236;+!Microsoft.Usage#CA1816;+!Microsoft.Usage#CA2227;+!Microsoft.Usage#CA2213;+!Microsoft.Usage#CA2216;+!Microsoft.Usage#CA2214;+!Microsoft.Usage#CA2222;+!Microsoft.Usage#CA1806;+!Microsoft.Usage#CA2217;+!Microsoft.Usage#CA2212;+!Microsoft.Usage#CA2219;+!Microsoft.Usage#CA2201;+!Microsoft.Usage#CA2228;+!Microsoft.Usage#CA2221;+!Microsoft.Usage#CA2220;+!Microsoft.Usage#CA2240;+!Microsoft.Usage#CA2229;+!Microsoft.Usage#CA2238;+!Microsoft.Usage#CA2207;+!Microsoft.Usage#CA2208;+!Microsoft.Usage#CA2235;+!Microsoft.Usage#CA2237;+!Microsoft.Usage#CA2232;+!Microsoft.Usage#CA2223;+!Microsoft.Usage#CA2211;+!Microsoft.Usage#CA2233;+!Microsoft.Usage#CA2225;+!Microsoft.Usage#CA2226;+!Microsoft.Usage#CA2231;+!Microsoft.Usage#CA2224;+!Microsoft.Usage#CA2218;+!Microsoft.Usage#CA2234;+!Microsoft.Usage#CA2239;+!Microsoft.Usage#CA2200;+!Microsoft.Usage#CA1801;+!Microsoft.Usage#CA2242;+!Microsoft.Usage#CA2205;+!Microsoft.Usage#CA2230 - - - v4.0 - - - true - full - false -$(SolutionDir)..\bin\v2Debug\ -$(OutputPath)\System.Core.xml - DEBUG;TRACE;$(SignedSym) - prompt - 4 - true - false - - - - - pdbonly - true -$(SolutionDir)..\Bin\v2Release\ -$(OutputPath)\System.Scripting.Core.xml - TRACE;$(SignedSym) - prompt - 4 - true - false - - - - - true -$(SolutionDir)..\bin\Silverlight3Debug\ - TRACE;DEBUG;SILVERLIGHT - true - full - AnyCPU - false - prompt - true -$(OutputPath)\System.Scripting.Core.xml - 618 - true - $(ProgramFiles)\Microsoft Silverlight\2.0.31005.0 - - -$(SolutionDir)..\bin\Silverlight3Release\ - TRACE;SILVERLIGHT -$(OutputPath)\System.Scripting.Core.xml - true - 618 - true - pdbonly - AnyCPU - prompt - true - $(ProgramFiles)\Microsoft Silverlight\2.0.31005.0 - - - - - - False - $(SilverlightSdkPath)\mscorlib.dll - - - False - $(SilverlightSdkPath)\System.dll - - - - - - - Properties\SilverlightVersion.cs - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Ast\System.Linq.Expressions.txt - - - - - - - - - - diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Action.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Action.cs deleted file mode 100644 index 3f1c1540564..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Action.cs +++ /dev/null @@ -1,609 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_FUNCS_5_16 -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Utils { -#else -namespace System { -#endif - - #region Generated Action Types - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_action_types from: generate_dynsites.py - -#if !FEATURE_VARIANCE - - /// - /// Encapsulates a method that takes five parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); - - /// - /// Encapsulates a method that takes six parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); - - /// - /// Encapsulates a method that takes seven parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); - - /// - /// Encapsulates a method that takes eight parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); - - /// - /// Encapsulates a method that takes nine parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9); - - /// - /// Encapsulates a method that takes ten parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10); - - /// - /// Encapsulates a method that takes eleven parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11); - - /// - /// Encapsulates a method that takes twelve parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12); - - /// - /// Encapsulates a method that takes thirteen parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13); - - /// - /// Encapsulates a method that takes fourteen parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14); - - /// - /// Encapsulates a method that takes fifteen parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the fifteenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The fifteenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15); - - /// - /// Encapsulates a method that takes sixteen parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the fifteenth parameter of the method that this delegate encapsulates. - /// The type of the sixteenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The fifteenth parameter of the method that this delegate encapsulates. - /// The sixteenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16); -#else - - /// - /// Encapsulates a method that takes nine parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9); - - /// - /// Encapsulates a method that takes ten parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10); - - /// - /// Encapsulates a method that takes eleven parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11); - - /// - /// Encapsulates a method that takes twelve parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12); - - /// - /// Encapsulates a method that takes thirteen parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13); - - /// - /// Encapsulates a method that takes fourteen parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14); - - /// - /// Encapsulates a method that takes fifteen parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the fifteenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The fifteenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15); - - /// - /// Encapsulates a method that takes sixteen parameters and does not return a value. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the fifteenth parameter of the method that this delegate encapsulates. - /// The type of the sixteenth parameter of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The fifteenth parameter of the method that this delegate encapsulates. - /// The sixteenth parameter of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate void Action(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16); - -#endif - - // *** END GENERATED CODE *** - - #endregion -} -#endif diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/CacheDict.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/CacheDict.cs deleted file mode 100644 index 81371c66e28..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/CacheDict.cs +++ /dev/null @@ -1,113 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; - -namespace System.Dynamic.Utils { - /// - /// Provides a dictionary-like object used for caches which holds onto a maximum - /// number of elements specified at construction time. - /// - /// This class is not thread safe. - /// - internal class CacheDict { - private readonly Dictionary _dict = new Dictionary(); - private readonly LinkedList _list = new LinkedList(); - private readonly int _maxSize; - - /// - /// Creates a dictionary-like object used for caches. - /// - /// The maximum number of elements to store. - internal CacheDict(int maxSize) { - _maxSize = maxSize; - } - - /// - /// Tries to get the value associated with 'key', returning true if it's found and - /// false if it's not present. - /// - internal bool TryGetValue(TKey key, out TValue value) { - KeyInfo storedValue; - if (_dict.TryGetValue(key, out storedValue)) { - LinkedListNode node = storedValue.List; - if (node.Previous != null) { - // move us to the head of the list... - _list.Remove(node); - _list.AddFirst(node); - } - - value = storedValue.Value; - return true; - } - - value = default(TValue); - return false; - } - - /// - /// Adds a new element to the cache, replacing and moving it to the front if the - /// element is already present. - /// - internal void Add(TKey key, TValue value) { - KeyInfo keyInfo; - if (_dict.TryGetValue(key, out keyInfo)) { - // remove original entry from the linked list - _list.Remove(keyInfo.List); - } else if (_list.Count == _maxSize) { - // we've reached capacity, remove the last used element... - LinkedListNode node = _list.Last; - _list.RemoveLast(); - bool res = _dict.Remove(node.Value); - Debug.Assert(res); - } - - // add the new entry to the head of the list and into the dictionary - LinkedListNode listNode = new LinkedListNode(key); - _list.AddFirst(listNode); - _dict[key] = new CacheDict.KeyInfo(value, listNode); - } - - /// - /// Returns the value associated with the given key, or throws KeyNotFoundException - /// if the key is not present. - /// - internal TValue this[TKey key] { - get { - TValue res; - if (TryGetValue(key, out res)) { - return res; - } - throw new KeyNotFoundException(); - } - set { - Add(key, value); - } - } - - private struct KeyInfo { - internal readonly TValue Value; - internal readonly LinkedListNode List; - - internal KeyInfo(TValue value, LinkedListNode list) { - Value = value; - List = list; - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/CollectionExtensions.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/CollectionExtensions.cs deleted file mode 100644 index d9dcd196ae9..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/CollectionExtensions.cs +++ /dev/null @@ -1,202 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Utils; -using Microsoft.Scripting.Ast; -#else -using System.Diagnostics.Contracts; -using System.Linq.Expressions; -#endif - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Diagnostics; -using System.Runtime.CompilerServices; - -namespace System.Dynamic.Utils { - internal static class CollectionExtensions { - /// - /// Wraps the provided enumerable into a ReadOnlyCollection{T} - /// - /// Copies all of the data into a new array, so the data can't be - /// changed after creation. The exception is if the enumerable is - /// already a ReadOnlyCollection{T}, in which case we just return it. - /// - internal static ReadOnlyCollection ToReadOnly(this IEnumerable enumerable) { - if (enumerable == null) { - return EmptyReadOnlyCollection.Instance; - } - -#if SILVERLIGHT - if (Expression.SilverlightQuirks) { - // Allow any ReadOnlyCollection to be stored directly - // (even though this is not safe) - var r = enumerable as ReadOnlyCollection; - if (r != null) { - return r; - } - } -#endif - - var troc = enumerable as TrueReadOnlyCollection; - if (troc != null) { - return troc; - } - - var builder = enumerable as ReadOnlyCollectionBuilder; - if (builder != null) { - return builder.ToReadOnlyCollection(); - } - - var collection = enumerable as ICollection; - if (collection != null) { - int count = collection.Count; - if (count == 0) { - return EmptyReadOnlyCollection.Instance; - } - - T[] clone = new T[count]; - collection.CopyTo(clone, 0); - return new TrueReadOnlyCollection(clone); - } - - // ToArray trims the excess space and speeds up access - return new TrueReadOnlyCollection(new List(enumerable).ToArray()); - } - - // We could probably improve the hashing here - internal static int ListHashCode(this IEnumerable list) { - var cmp = EqualityComparer.Default; - int h = 6551; - foreach (T t in list) { - h ^= (h << 5) ^ cmp.GetHashCode(t); - } - return h; - } - - internal static bool ListEquals(this ICollection first, ICollection second) { - if (first.Count != second.Count) { - return false; - } - var cmp = EqualityComparer.Default; - var f = first.GetEnumerator(); - var s = second.GetEnumerator(); - while (f.MoveNext()) { - s.MoveNext(); - - if (!cmp.Equals(f.Current, s.Current)) { - return false; - } - } - return true; - } - - internal static IEnumerable Select(this IEnumerable enumerable, Func select) { - foreach (T t in enumerable) { - yield return select(t); - } - } - - // Name needs to be different so it doesn't conflict with Enumerable.Select - internal static U[] Map(this ICollection collection, Func select) { - int count = collection.Count; - U[] result = new U[count]; - count = 0; - foreach (T t in collection) { - result[count++] = select(t); - } - return result; - } - - internal static IEnumerable Where(this IEnumerable enumerable, Func where) { - foreach (T t in enumerable) { - if (where(t)) { - yield return t; - } - } - } - - internal static bool Any(this IEnumerable source, Func predicate) { - foreach (T element in source) { - if (predicate(element)) { - return true; - } - } - return false; - } - - internal static bool All(this IEnumerable source, Func predicate) { - foreach (T element in source) { - if (!predicate(element)) { - return false; - } - } - return true; - } - - internal static T[] RemoveFirst(this T[] array) { - T[] result = new T[array.Length - 1]; - Array.Copy(array, 1, result, 0, result.Length); - return result; - } - - internal static T[] RemoveLast(this T[] array) { - T[] result = new T[array.Length - 1]; - Array.Copy(array, 0, result, 0, result.Length); - return result; - } - - internal static T[] AddFirst(this IList list, T item) { - T[] res = new T[list.Count + 1]; - res[0] = item; - list.CopyTo(res, 1); - return res; - } - - internal static T[] AddLast(this IList list, T item) { - T[] res = new T[list.Count + 1]; - list.CopyTo(res, 0); - res[list.Count] = item; - return res; - } - - internal static T First(this IEnumerable source) { - var list = source as IList; - if (list != null) { - return list[0]; - } - using (var e = source.GetEnumerator()) { - if (e.MoveNext()) return e.Current; - } - throw new InvalidOperationException(); - } - - internal static T Last(this IList list) { - return list[list.Count - 1]; - } - - internal static T[] Copy(this T[] array) { - T[] copy = new T[array.Length]; - Array.Copy(array, copy, array.Length); - return copy; - } - } - - - internal static class EmptyReadOnlyCollection { - internal static ReadOnlyCollection Instance = new TrueReadOnlyCollection(new T[0]); - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ContractUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ContractUtils.cs deleted file mode 100644 index 26f809e0359..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ContractUtils.cs +++ /dev/null @@ -1,97 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif -#if SILVERLIGHT -using System.Core; -#endif - -using System.Collections.Generic; -using System.Diagnostics; - -namespace System.Dynamic.Utils { - - // Will be replaced with CLRv4 managed contracts - internal static class ContractUtils { - - internal static Exception Unreachable { - get { - Debug.Assert(false, "Unreachable"); - return new InvalidOperationException("Code supposed to be unreachable"); - } - } - - internal static void Requires(bool precondition) { - if (!precondition) { - throw new ArgumentException(Strings.MethodPreconditionViolated); - } - } - - internal static void Requires(bool precondition, string paramName) { - Debug.Assert(!string.IsNullOrEmpty(paramName)); - - if (!precondition) { - throw new ArgumentException(Strings.InvalidArgumentValue, paramName); - } - } - - internal static void RequiresNotNull(object value, string paramName) { - Debug.Assert(!string.IsNullOrEmpty(paramName)); - - if (value == null) { - throw new ArgumentNullException(paramName); - } - } - - internal static void RequiresNotEmpty(ICollection collection, string paramName) { - RequiresNotNull(collection, paramName); - if (collection.Count == 0) { - throw new ArgumentException(Strings.NonEmptyCollectionRequired, paramName); - } - } - - /// - /// Requires the range [offset, offset + count] to be a subset of [0, array.Count]. - /// - /// Array is null. - /// Offset or count are out of range. - internal static void RequiresArrayRange(IList array, int offset, int count, string offsetName, string countName) { - Debug.Assert(!string.IsNullOrEmpty(offsetName)); - Debug.Assert(!string.IsNullOrEmpty(countName)); - Debug.Assert(array != null); - - if (count < 0) throw new ArgumentOutOfRangeException(countName); - if (offset < 0 || array.Count - offset < count) throw new ArgumentOutOfRangeException(offsetName); - } - - /// - /// Requires the array and all its items to be non-null. - /// - internal static void RequiresNotNullItems(IList array, string arrayName) { - Debug.Assert(arrayName != null); - RequiresNotNull(array, arrayName); - - for (int i = 0; i < array.Count; i++) { - if (array[i] == null) { - throw new ArgumentNullException(string.Format(System.Globalization.CultureInfo.CurrentCulture, "{0}[{1}]", arrayName, i)); - } - } - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ExceptionFactory.Generated.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ExceptionFactory.Generated.cs deleted file mode 100644 index 5cc9f88a4e5..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ExceptionFactory.Generated.cs +++ /dev/null @@ -1,2729 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; - -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Ast { -#else -namespace System.Linq.Expressions { -#endif - - internal static partial class Strings { - private static string FormatString(string format, params object[] args) { - return string.Format(System.Globalization.CultureInfo.CurrentCulture, format, args); - } - } - - #region Generated Exception Factory - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_expr_factory_core from: generate_exception_factory.py - - /// - /// Strongly-typed and parameterized string factory. - /// - - internal static partial class Strings { - /// - /// A string like "Method precondition violated" - /// - internal static string MethodPreconditionViolated { - get { - return "Method precondition violated"; - } - } - - /// - /// A string like "Invalid argument value" - /// - internal static string InvalidArgumentValue { - get { - return "Invalid argument value"; - } - } - - /// - /// A string like "Non-empty collection required" - /// - internal static string NonEmptyCollectionRequired { - get { - return "Non-empty collection required"; - } - } - - /// - /// A string like "Argument count must be greater than number of named arguments." - /// - internal static string ArgCntMustBeGreaterThanNameCnt { - get { - return "Argument count must be greater than number of named arguments."; - } - } - - /// - /// A string like "reducible nodes must override Expression.Reduce()" - /// - internal static string ReducibleMustOverrideReduce { - get { - return "reducible nodes must override Expression.Reduce()"; - } - } - - /// - /// A string like "node cannot reduce to itself or null" - /// - internal static string MustReduceToDifferent { - get { - return "node cannot reduce to itself or null"; - } - } - - /// - /// A string like "cannot assign from the reduced node type to the original node type" - /// - internal static string ReducedNotCompatible { - get { - return "cannot assign from the reduced node type to the original node type"; - } - } - - /// - /// A string like "Setter must have parameters." - /// - internal static string SetterHasNoParams { - get { - return "Setter must have parameters."; - } - } - - /// - /// A string like "Property cannot have a managed pointer type." - /// - internal static string PropertyCannotHaveRefType { - get { - return "Property cannot have a managed pointer type."; - } - } - - /// - /// A string like "Indexing parameters of getter and setter must match." - /// - internal static string IndexesOfSetGetMustMatch { - get { - return "Indexing parameters of getter and setter must match."; - } - } - - /// - /// A string like "Accessor method should not have VarArgs." - /// - internal static string AccessorsCannotHaveVarArgs { - get { - return "Accessor method should not have VarArgs."; - } - } - - /// - /// A string like "Accessor indexes cannot be passed ByRef." - /// - internal static string AccessorsCannotHaveByRefArgs { - get { - return "Accessor indexes cannot be passed ByRef."; - } - } - - /// - /// A string like "Bounds count cannot be less than 1" - /// - internal static string BoundsCannotBeLessThanOne { - get { - return "Bounds count cannot be less than 1"; - } - } - - /// - /// A string like "type must not be ByRef" - /// - internal static string TypeMustNotBeByRef { - get { - return "type must not be ByRef"; - } - } - - /// - /// A string like "Type doesn't have constructor with a given signature" - /// - internal static string TypeDoesNotHaveConstructorForTheSignature { - get { - return "Type doesn't have constructor with a given signature"; - } - } - - /// - /// A string like "Count must be non-negative." - /// - internal static string CountCannotBeNegative { - get { - return "Count must be non-negative."; - } - } - - /// - /// A string like "arrayType must be an array type" - /// - internal static string ArrayTypeMustBeArray { - get { - return "arrayType must be an array type"; - } - } - - /// - /// A string like "Setter should have void type." - /// - internal static string SetterMustBeVoid { - get { - return "Setter should have void type."; - } - } - - /// - /// A string like "Property type must match the value type of setter" - /// - internal static string PropertyTyepMustMatchSetter { - get { - return "Property type must match the value type of setter"; - } - } - - /// - /// A string like "Both accessors must be static." - /// - internal static string BothAccessorsMustBeStatic { - get { - return "Both accessors must be static."; - } - } - - /// - /// A string like "Static field requires null instance, non-static field requires non-null instance." - /// - internal static string OnlyStaticFieldsHaveNullInstance { - get { - return "Static field requires null instance, non-static field requires non-null instance."; - } - } - - /// - /// A string like "Static property requires null instance, non-static property requires non-null instance." - /// - internal static string OnlyStaticPropertiesHaveNullInstance { - get { - return "Static property requires null instance, non-static property requires non-null instance."; - } - } - - /// - /// A string like "Static method requires null instance, non-static method requires non-null instance." - /// - internal static string OnlyStaticMethodsHaveNullInstance { - get { - return "Static method requires null instance, non-static method requires non-null instance."; - } - } - - /// - /// A string like "Property cannot have a void type." - /// - internal static string PropertyTypeCannotBeVoid { - get { - return "Property cannot have a void type."; - } - } - - /// - /// A string like "Can only unbox from an object or interface type to a value type." - /// - internal static string InvalidUnboxType { - get { - return "Can only unbox from an object or interface type to a value type."; - } - } - - /// - /// A string like "Expression must be readable" - /// - internal static string ExpressionMustBeReadable { - get { - return "Expression must be readable"; - } - } - - /// - /// A string like "Expression must be writeable" - /// - internal static string ExpressionMustBeWriteable { - get { - return "Expression must be writeable"; - } - } - - /// - /// A string like "Argument must not have a value type." - /// - internal static string ArgumentMustNotHaveValueType { - get { - return "Argument must not have a value type."; - } - } - - /// - /// A string like "must be reducible node" - /// - internal static string MustBeReducible { - get { - return "must be reducible node"; - } - } - - /// - /// A string like "All test values must have the same type." - /// - internal static string AllTestValuesMustHaveSameType { - get { - return "All test values must have the same type."; - } - } - - /// - /// A string like "All case bodies and the default body must have the same type." - /// - internal static string AllCaseBodiesMustHaveSameType { - get { - return "All case bodies and the default body must have the same type."; - } - } - - /// - /// A string like "Default body must be supplied if case bodies are not System.Void." - /// - internal static string DefaultBodyMustBeSupplied { - get { - return "Default body must be supplied if case bodies are not System.Void."; - } - } - - /// - /// A string like "MethodBuilder does not have a valid TypeBuilder" - /// - internal static string MethodBuilderDoesNotHaveTypeBuilder { - get { - return "MethodBuilder does not have a valid TypeBuilder"; - } - } - - /// - /// A string like "Type must be derived from System.Delegate" - /// - internal static string TypeMustBeDerivedFromSystemDelegate { - get { - return "Type must be derived from System.Delegate"; - } - } - - /// - /// A string like "Argument type cannot be void" - /// - internal static string ArgumentTypeCannotBeVoid { - get { - return "Argument type cannot be void"; - } - } - - /// - /// A string like "Label type must be System.Void if an expression is not supplied" - /// - internal static string LabelMustBeVoidOrHaveExpression { - get { - return "Label type must be System.Void if an expression is not supplied"; - } - } - - /// - /// A string like "Type must be System.Void for this label argument" - /// - internal static string LabelTypeMustBeVoid { - get { - return "Type must be System.Void for this label argument"; - } - } - - /// - /// A string like "Quoted expression must be a lambda" - /// - internal static string QuotedExpressionMustBeLambda { - get { - return "Quoted expression must be a lambda"; - } - } - - /// - /// A string like "Variable '{0}' uses unsupported type '{1}'. Reference types are not supported for variables." - /// - internal static string VariableMustNotBeByRef(object p0, object p1) { - return FormatString("Variable '{0}' uses unsupported type '{1}'. Reference types are not supported for variables.", p0, p1); - } - - /// - /// A string like "Found duplicate parameter '{0}'. Each ParameterExpression in the list must be a unique object." - /// - internal static string DuplicateVariable(object p0) { - return FormatString("Found duplicate parameter '{0}'. Each ParameterExpression in the list must be a unique object.", p0); - } - - /// - /// A string like "Start and End must be well ordered" - /// - internal static string StartEndMustBeOrdered { - get { - return "Start and End must be well ordered"; - } - } - - /// - /// A string like "fault cannot be used with catch or finally clauses" - /// - internal static string FaultCannotHaveCatchOrFinally { - get { - return "fault cannot be used with catch or finally clauses"; - } - } - - /// - /// A string like "try must have at least one catch, finally, or fault clause" - /// - internal static string TryMustHaveCatchFinallyOrFault { - get { - return "try must have at least one catch, finally, or fault clause"; - } - } - - /// - /// A string like "Body of catch must have the same type as body of try." - /// - internal static string BodyOfCatchMustHaveSameTypeAsBodyOfTry { - get { - return "Body of catch must have the same type as body of try."; - } - } - - /// - /// A string like "Extension node must override the property {0}." - /// - internal static string ExtensionNodeMustOverrideProperty(object p0) { - return FormatString("Extension node must override the property {0}.", p0); - } - - /// - /// A string like "User-defined operator method '{0}' must be static." - /// - internal static string UserDefinedOperatorMustBeStatic(object p0) { - return FormatString("User-defined operator method '{0}' must be static.", p0); - } - - /// - /// A string like "User-defined operator method '{0}' must not be void." - /// - internal static string UserDefinedOperatorMustNotBeVoid(object p0) { - return FormatString("User-defined operator method '{0}' must not be void.", p0); - } - - /// - /// A string like "No coercion operator is defined between types '{0}' and '{1}'." - /// - internal static string CoercionOperatorNotDefined(object p0, object p1) { - return FormatString("No coercion operator is defined between types '{0}' and '{1}'.", p0, p1); - } - - /// - /// A string like "The result type '{0}' of the dynamic binding produced by binder '{1}' is not compatible with the result type '{2}' expected by the call site." - /// - internal static string DynamicBinderResultNotAssignable(object p0, object p1, object p2) { - return FormatString("The result type '{0}' of the dynamic binding produced by binder '{1}' is not compatible with the result type '{2}' expected by the call site.", p0, p1, p2); - } - - /// - /// A string like "The result type '{0}' of the dynamic binding produced by the object with type '{1}' for the binder '{2}' is not compatible with the result type '{3}' expected by the call site." - /// - internal static string DynamicObjectResultNotAssignable(object p0, object p1, object p2, object p3) { - return FormatString("The result type '{0}' of the dynamic binding produced by the object with type '{1}' for the binder '{2}' is not compatible with the result type '{3}' expected by the call site.", p0, p1, p2, p3); - } - - /// - /// A string like "The result of the dynamic binding produced by the object with type '{0}' for the binder '{1}' needs at least one restriction." - /// - internal static string DynamicBindingNeedsRestrictions(object p0, object p1) { - return FormatString("The result of the dynamic binding produced by the object with type '{0}' for the binder '{1}' needs at least one restriction.", p0, p1); - } - - /// - /// A string like "The result type '{0}' of the binder '{1}' is not compatible with the result type '{2}' expected by the call site." - /// - internal static string BinderNotCompatibleWithCallSite(object p0, object p1, object p2) { - return FormatString("The result type '{0}' of the binder '{1}' is not compatible with the result type '{2}' expected by the call site.", p0, p1, p2); - } - - /// - /// A string like "The unary operator {0} is not defined for the type '{1}'." - /// - internal static string UnaryOperatorNotDefined(object p0, object p1) { - return FormatString("The unary operator {0} is not defined for the type '{1}'.", p0, p1); - } - - /// - /// A string like "The binary operator {0} is not defined for the types '{1}' and '{2}'." - /// - internal static string BinaryOperatorNotDefined(object p0, object p1, object p2) { - return FormatString("The binary operator {0} is not defined for the types '{1}' and '{2}'.", p0, p1, p2); - } - - /// - /// A string like "Reference equality is not defined for the types '{0}' and '{1}'." - /// - internal static string ReferenceEqualityNotDefined(object p0, object p1) { - return FormatString("Reference equality is not defined for the types '{0}' and '{1}'.", p0, p1); - } - - /// - /// A string like "The operands for operator '{0}' do not match the parameters of method '{1}'." - /// - internal static string OperandTypesDoNotMatchParameters(object p0, object p1) { - return FormatString("The operands for operator '{0}' do not match the parameters of method '{1}'.", p0, p1); - } - - /// - /// A string like "The return type of overload method for operator '{0}' does not match the parameter type of conversion method '{1}'." - /// - internal static string OverloadOperatorTypeDoesNotMatchConversionType(object p0, object p1) { - return FormatString("The return type of overload method for operator '{0}' does not match the parameter type of conversion method '{1}'.", p0, p1); - } - - /// - /// A string like "Conversion is not supported for arithmetic types without operator overloading." - /// - internal static string ConversionIsNotSupportedForArithmeticTypes { - get { - return "Conversion is not supported for arithmetic types without operator overloading."; - } - } - - /// - /// A string like "Argument must be array" - /// - internal static string ArgumentMustBeArray { - get { - return "Argument must be array"; - } - } - - /// - /// A string like "Argument must be boolean" - /// - internal static string ArgumentMustBeBoolean { - get { - return "Argument must be boolean"; - } - } - - /// - /// A string like "The user-defined equality method '{0}' must return a boolean value." - /// - internal static string EqualityMustReturnBoolean(object p0) { - return FormatString("The user-defined equality method '{0}' must return a boolean value.", p0); - } - - /// - /// A string like "Argument must be either a FieldInfo or PropertyInfo" - /// - internal static string ArgumentMustBeFieldInfoOrPropertInfo { - get { - return "Argument must be either a FieldInfo or PropertyInfo"; - } - } - - /// - /// A string like "Argument must be either a FieldInfo, PropertyInfo or MethodInfo" - /// - internal static string ArgumentMustBeFieldInfoOrPropertInfoOrMethod { - get { - return "Argument must be either a FieldInfo, PropertyInfo or MethodInfo"; - } - } - - /// - /// A string like "Argument must be an instance member" - /// - internal static string ArgumentMustBeInstanceMember { - get { - return "Argument must be an instance member"; - } - } - - /// - /// A string like "Argument must be of an integer type" - /// - internal static string ArgumentMustBeInteger { - get { - return "Argument must be of an integer type"; - } - } - - /// - /// A string like "Argument for array index must be of type Int32" - /// - internal static string ArgumentMustBeArrayIndexType { - get { - return "Argument for array index must be of type Int32"; - } - } - - /// - /// A string like "Argument must be single dimensional array type" - /// - internal static string ArgumentMustBeSingleDimensionalArrayType { - get { - return "Argument must be single dimensional array type"; - } - } - - /// - /// A string like "Argument types do not match" - /// - internal static string ArgumentTypesMustMatch { - get { - return "Argument types do not match"; - } - } - - /// - /// A string like "Cannot auto initialize elements of value type through property '{0}', use assignment instead" - /// - internal static string CannotAutoInitializeValueTypeElementThroughProperty(object p0) { - return FormatString("Cannot auto initialize elements of value type through property '{0}', use assignment instead", p0); - } - - /// - /// A string like "Cannot auto initialize members of value type through property '{0}', use assignment instead" - /// - internal static string CannotAutoInitializeValueTypeMemberThroughProperty(object p0) { - return FormatString("Cannot auto initialize members of value type through property '{0}', use assignment instead", p0); - } - - /// - /// A string like "The type used in TypeAs Expression must be of reference or nullable type, {0} is neither" - /// - internal static string IncorrectTypeForTypeAs(object p0) { - return FormatString("The type used in TypeAs Expression must be of reference or nullable type, {0} is neither", p0); - } - - /// - /// A string like "Coalesce used with type that cannot be null" - /// - internal static string CoalesceUsedOnNonNullType { - get { - return "Coalesce used with type that cannot be null"; - } - } - - /// - /// A string like "An expression of type '{0}' cannot be used to initialize an array of type '{1}'" - /// - internal static string ExpressionTypeCannotInitializeArrayType(object p0, object p1) { - return FormatString("An expression of type '{0}' cannot be used to initialize an array of type '{1}'", p0, p1); - } - - /// - /// A string like "Expression of type '{0}' cannot be used for constructor parameter of type '{1}'" - /// - internal static string ExpressionTypeDoesNotMatchConstructorParameter(object p0, object p1) { - return FormatString("Expression of type '{0}' cannot be used for constructor parameter of type '{1}'", p0, p1); - } - - /// - /// A string like " Argument type '{0}' does not match the corresponding member type '{1}'" - /// - internal static string ArgumentTypeDoesNotMatchMember(object p0, object p1) { - return FormatString(" Argument type '{0}' does not match the corresponding member type '{1}'", p0, p1); - } - - /// - /// A string like " The member '{0}' is not declared on type '{1}' being created" - /// - internal static string ArgumentMemberNotDeclOnType(object p0, object p1) { - return FormatString(" The member '{0}' is not declared on type '{1}' being created", p0, p1); - } - - /// - /// A string like "Expression of type '{0}' cannot be used for parameter of type '{1}' of method '{2}'" - /// - internal static string ExpressionTypeDoesNotMatchMethodParameter(object p0, object p1, object p2) { - return FormatString("Expression of type '{0}' cannot be used for parameter of type '{1}' of method '{2}'", p0, p1, p2); - } - - /// - /// A string like "Expression of type '{0}' cannot be used for parameter of type '{1}'" - /// - internal static string ExpressionTypeDoesNotMatchParameter(object p0, object p1) { - return FormatString("Expression of type '{0}' cannot be used for parameter of type '{1}'", p0, p1); - } - - /// - /// A string like "Expression of type '{0}' cannot be used for return type '{1}'" - /// - internal static string ExpressionTypeDoesNotMatchReturn(object p0, object p1) { - return FormatString("Expression of type '{0}' cannot be used for return type '{1}'", p0, p1); - } - - /// - /// A string like "Expression of type '{0}' cannot be used for assignment to type '{1}'" - /// - internal static string ExpressionTypeDoesNotMatchAssignment(object p0, object p1) { - return FormatString("Expression of type '{0}' cannot be used for assignment to type '{1}'", p0, p1); - } - - /// - /// A string like "Expression of type '{0}' cannot be used for label of type '{1}'" - /// - internal static string ExpressionTypeDoesNotMatchLabel(object p0, object p1) { - return FormatString("Expression of type '{0}' cannot be used for label of type '{1}'", p0, p1); - } - - /// - /// A string like "Expression of type '{0}' cannot be invoked" - /// - internal static string ExpressionTypeNotInvocable(object p0) { - return FormatString("Expression of type '{0}' cannot be invoked", p0); - } - - /// - /// A string like "Field '{0}' is not defined for type '{1}'" - /// - internal static string FieldNotDefinedForType(object p0, object p1) { - return FormatString("Field '{0}' is not defined for type '{1}'", p0, p1); - } - - /// - /// A string like "Instance field '{0}' is not defined for type '{1}'" - /// - internal static string InstanceFieldNotDefinedForType(object p0, object p1) { - return FormatString("Instance field '{0}' is not defined for type '{1}'", p0, p1); - } - - /// - /// A string like "Field '{0}.{1}' is not defined for type '{2}'" - /// - internal static string FieldInfoNotDefinedForType(object p0, object p1, object p2) { - return FormatString("Field '{0}.{1}' is not defined for type '{2}'", p0, p1, p2); - } - - /// - /// A string like "Incorrect number of indexes" - /// - internal static string IncorrectNumberOfIndexes { - get { - return "Incorrect number of indexes"; - } - } - - /// - /// A string like "Incorrect number of arguments supplied for lambda invocation" - /// - internal static string IncorrectNumberOfLambdaArguments { - get { - return "Incorrect number of arguments supplied for lambda invocation"; - } - } - - /// - /// A string like "Incorrect number of parameters supplied for lambda declaration" - /// - internal static string IncorrectNumberOfLambdaDeclarationParameters { - get { - return "Incorrect number of parameters supplied for lambda declaration"; - } - } - - /// - /// A string like "Incorrect number of arguments supplied for call to method '{0}'" - /// - internal static string IncorrectNumberOfMethodCallArguments(object p0) { - return FormatString("Incorrect number of arguments supplied for call to method '{0}'", p0); - } - - /// - /// A string like "Incorrect number of arguments for constructor" - /// - internal static string IncorrectNumberOfConstructorArguments { - get { - return "Incorrect number of arguments for constructor"; - } - } - - /// - /// A string like " Incorrect number of members for constructor" - /// - internal static string IncorrectNumberOfMembersForGivenConstructor { - get { - return " Incorrect number of members for constructor"; - } - } - - /// - /// A string like "Incorrect number of arguments for the given members " - /// - internal static string IncorrectNumberOfArgumentsForMembers { - get { - return "Incorrect number of arguments for the given members "; - } - } - - /// - /// A string like "Lambda type parameter must be derived from System.Delegate" - /// - internal static string LambdaTypeMustBeDerivedFromSystemDelegate { - get { - return "Lambda type parameter must be derived from System.Delegate"; - } - } - - /// - /// A string like "Member '{0}' not field or property" - /// - internal static string MemberNotFieldOrProperty(object p0) { - return FormatString("Member '{0}' not field or property", p0); - } - - /// - /// A string like "Method {0} contains generic parameters" - /// - internal static string MethodContainsGenericParameters(object p0) { - return FormatString("Method {0} contains generic parameters", p0); - } - - /// - /// A string like "Method {0} is a generic method definition" - /// - internal static string MethodIsGeneric(object p0) { - return FormatString("Method {0} is a generic method definition", p0); - } - - /// - /// A string like "The method '{0}.{1}' is not a property accessor" - /// - internal static string MethodNotPropertyAccessor(object p0, object p1) { - return FormatString("The method '{0}.{1}' is not a property accessor", p0, p1); - } - - /// - /// A string like "The property '{0}' has no 'get' accessor" - /// - internal static string PropertyDoesNotHaveGetter(object p0) { - return FormatString("The property '{0}' has no 'get' accessor", p0); - } - - /// - /// A string like "The property '{0}' has no 'set' accessor" - /// - internal static string PropertyDoesNotHaveSetter(object p0) { - return FormatString("The property '{0}' has no 'set' accessor", p0); - } - - /// - /// A string like "The property '{0}' has no 'get' or 'set' accessors" - /// - internal static string PropertyDoesNotHaveAccessor(object p0) { - return FormatString("The property '{0}' has no 'get' or 'set' accessors", p0); - } - - /// - /// A string like "'{0}' is not a member of type '{1}'" - /// - internal static string NotAMemberOfType(object p0, object p1) { - return FormatString("'{0}' is not a member of type '{1}'", p0, p1); - } - - /// - /// A string like "The operator '{0}' is not implemented for type '{1}'" - /// - internal static string OperatorNotImplementedForType(object p0, object p1) { - return FormatString("The operator '{0}' is not implemented for type '{1}'", p0, p1); - } - - /// - /// A string like "ParameterExpression of type '{0}' cannot be used for delegate parameter of type '{1}'" - /// - internal static string ParameterExpressionNotValidAsDelegate(object p0, object p1) { - return FormatString("ParameterExpression of type '{0}' cannot be used for delegate parameter of type '{1}'", p0, p1); - } - - /// - /// A string like "Property '{0}' is not defined for type '{1}'" - /// - internal static string PropertyNotDefinedForType(object p0, object p1) { - return FormatString("Property '{0}' is not defined for type '{1}'", p0, p1); - } - - /// - /// A string like "Instance property '{0}' is not defined for type '{1}'" - /// - internal static string InstancePropertyNotDefinedForType(object p0, object p1) { - return FormatString("Instance property '{0}' is not defined for type '{1}'", p0, p1); - } - - /// - /// A string like "Instance property '{0}' that takes no argument is not defined for type '{1}'" - /// - internal static string InstancePropertyWithoutParameterNotDefinedForType(object p0, object p1) { - return FormatString("Instance property '{0}' that takes no argument is not defined for type '{1}'", p0, p1); - } - - /// - /// A string like "Instance property '{0}{1}' is not defined for type '{2}'" - /// - internal static string InstancePropertyWithSpecifiedParametersNotDefinedForType(object p0, object p1, object p2) { - return FormatString("Instance property '{0}{1}' is not defined for type '{2}'", p0, p1, p2); - } - - /// - /// A string like "Method '{0}' declared on type '{1}' cannot be called with instance of type '{2}'" - /// - internal static string InstanceAndMethodTypeMismatch(object p0, object p1, object p2) { - return FormatString("Method '{0}' declared on type '{1}' cannot be called with instance of type '{2}'", p0, p1, p2); - } - - /// - /// A string like "Type {0} contains generic parameters" - /// - internal static string TypeContainsGenericParameters(object p0) { - return FormatString("Type {0} contains generic parameters", p0); - } - - /// - /// A string like "Type {0} is a generic type definition" - /// - internal static string TypeIsGeneric(object p0) { - return FormatString("Type {0} is a generic type definition", p0); - } - - /// - /// A string like "Type '{0}' does not have a default constructor" - /// - internal static string TypeMissingDefaultConstructor(object p0) { - return FormatString("Type '{0}' does not have a default constructor", p0); - } - - /// - /// A string like "List initializers must contain at least one initializer" - /// - internal static string ListInitializerWithZeroMembers { - get { - return "List initializers must contain at least one initializer"; - } - } - - /// - /// A string like "Element initializer method must be named 'Add'" - /// - internal static string ElementInitializerMethodNotAdd { - get { - return "Element initializer method must be named 'Add'"; - } - } - - /// - /// A string like "Parameter '{0}' of element initializer method '{1}' must not be a pass by reference parameter" - /// - internal static string ElementInitializerMethodNoRefOutParam(object p0, object p1) { - return FormatString("Parameter '{0}' of element initializer method '{1}' must not be a pass by reference parameter", p0, p1); - } - - /// - /// A string like "Element initializer method must have at least 1 parameter" - /// - internal static string ElementInitializerMethodWithZeroArgs { - get { - return "Element initializer method must have at least 1 parameter"; - } - } - - /// - /// A string like "Element initializer method must be an instance method" - /// - internal static string ElementInitializerMethodStatic { - get { - return "Element initializer method must be an instance method"; - } - } - - /// - /// A string like "Type '{0}' is not IEnumerable" - /// - internal static string TypeNotIEnumerable(object p0) { - return FormatString("Type '{0}' is not IEnumerable", p0); - } - - /// - /// A string like "Type parameter is {0}. Expected a delegate." - /// - internal static string TypeParameterIsNotDelegate(object p0) { - return FormatString("Type parameter is {0}. Expected a delegate.", p0); - } - - /// - /// A string like "Unexpected coalesce operator." - /// - internal static string UnexpectedCoalesceOperator { - get { - return "Unexpected coalesce operator."; - } - } - - /// - /// A string like "Cannot cast from type '{0}' to type '{1}" - /// - internal static string InvalidCast(object p0, object p1) { - return FormatString("Cannot cast from type '{0}' to type '{1}", p0, p1); - } - - /// - /// A string like "Unhandled binary: {0}" - /// - internal static string UnhandledBinary(object p0) { - return FormatString("Unhandled binary: {0}", p0); - } - - /// - /// A string like "Unhandled binding " - /// - internal static string UnhandledBinding { - get { - return "Unhandled binding "; - } - } - - /// - /// A string like "Unhandled Binding Type: {0}" - /// - internal static string UnhandledBindingType(object p0) { - return FormatString("Unhandled Binding Type: {0}", p0); - } - - /// - /// A string like "Unhandled convert: {0}" - /// - internal static string UnhandledConvert(object p0) { - return FormatString("Unhandled convert: {0}", p0); - } - - /// - /// A string like "Unhandled Expression Type: {0}" - /// - internal static string UnhandledExpressionType(object p0) { - return FormatString("Unhandled Expression Type: {0}", p0); - } - - /// - /// A string like "Unhandled unary: {0}" - /// - internal static string UnhandledUnary(object p0) { - return FormatString("Unhandled unary: {0}", p0); - } - - /// - /// A string like "Unknown binding type" - /// - internal static string UnknownBindingType { - get { - return "Unknown binding type"; - } - } - - /// - /// A string like "The user-defined operator method '{1}' for operator '{0}' must have identical parameter and return types." - /// - internal static string UserDefinedOpMustHaveConsistentTypes(object p0, object p1) { - return FormatString("The user-defined operator method '{1}' for operator '{0}' must have identical parameter and return types.", p0, p1); - } - - /// - /// A string like "The user-defined operator method '{1}' for operator '{0}' must return the same type as its parameter or a derived type." - /// - internal static string UserDefinedOpMustHaveValidReturnType(object p0, object p1) { - return FormatString("The user-defined operator method '{1}' for operator '{0}' must return the same type as its parameter or a derived type.", p0, p1); - } - - /// - /// A string like "The user-defined operator method '{1}' for operator '{0}' must have associated boolean True and False operators." - /// - internal static string LogicalOperatorMustHaveBooleanOperators(object p0, object p1) { - return FormatString("The user-defined operator method '{1}' for operator '{0}' must have associated boolean True and False operators.", p0, p1); - } - - /// - /// A string like "No method '{0}' exists on type '{1}'." - /// - internal static string MethodDoesNotExistOnType(object p0, object p1) { - return FormatString("No method '{0}' exists on type '{1}'.", p0, p1); - } - - /// - /// A string like "No method '{0}' on type '{1}' is compatible with the supplied arguments." - /// - internal static string MethodWithArgsDoesNotExistOnType(object p0, object p1) { - return FormatString("No method '{0}' on type '{1}' is compatible with the supplied arguments.", p0, p1); - } - - /// - /// A string like "No generic method '{0}' on type '{1}' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. " - /// - internal static string GenericMethodWithArgsDoesNotExistOnType(object p0, object p1) { - return FormatString("No generic method '{0}' on type '{1}' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. ", p0, p1); - } - - /// - /// A string like "More than one method '{0}' on type '{1}' is compatible with the supplied arguments." - /// - internal static string MethodWithMoreThanOneMatch(object p0, object p1) { - return FormatString("More than one method '{0}' on type '{1}' is compatible with the supplied arguments.", p0, p1); - } - - /// - /// A string like "More than one property '{0}' on type '{1}' is compatible with the supplied arguments." - /// - internal static string PropertyWithMoreThanOneMatch(object p0, object p1) { - return FormatString("More than one property '{0}' on type '{1}' is compatible with the supplied arguments.", p0, p1); - } - - /// - /// A string like "An incorrect number of type args were specified for the declaration of a Func type." - /// - internal static string IncorrectNumberOfTypeArgsForFunc { - get { - return "An incorrect number of type args were specified for the declaration of a Func type."; - } - } - - /// - /// A string like "An incorrect number of type args were specified for the declaration of an Action type." - /// - internal static string IncorrectNumberOfTypeArgsForAction { - get { - return "An incorrect number of type args were specified for the declaration of an Action type."; - } - } - - /// - /// A string like "Argument type cannot be System.Void." - /// - internal static string ArgumentCannotBeOfTypeVoid { - get { - return "Argument type cannot be System.Void."; - } - } - - /// - /// A string like "More than one key matching '{0}' was found in the ExpandoObject." - /// - internal static string AmbiguousMatchInExpandoObject(object p0) { - return FormatString("More than one key matching '{0}' was found in the ExpandoObject.", p0); - } - - /// - /// A string like "An element with the same key '{0}' already exists in the ExpandoObject." - /// - internal static string SameKeyExistsInExpando(object p0) { - return FormatString("An element with the same key '{0}' already exists in the ExpandoObject.", p0); - } - - /// - /// A string like "The specified key '{0}' does not exist in the ExpandoObject." - /// - internal static string KeyDoesNotExistInExpando(object p0) { - return FormatString("The specified key '{0}' does not exist in the ExpandoObject.", p0); - } - - /// - /// A string like "No or Invalid rule produced" - /// - internal static string NoOrInvalidRuleProduced { - get { - return "No or Invalid rule produced"; - } - } - - /// - /// A string like "First argument of delegate must be CallSite" - /// - internal static string FirstArgumentMustBeCallSite { - get { - return "First argument of delegate must be CallSite"; - } - } - - /// - /// A string like "Bind cannot return null." - /// - internal static string BindingCannotBeNull { - get { - return "Bind cannot return null."; - } - } - - /// - /// A string like "Invalid operation: '{0}'" - /// - internal static string InvalidOperation(object p0) { - return FormatString("Invalid operation: '{0}'", p0); - } - - /// - /// A string like "{0} must be greater than or equal to {1}" - /// - internal static string OutOfRange(object p0, object p1) { - return FormatString("{0} must be greater than or equal to {1}", p0, p1); - } - - /// - /// A string like "Queue empty." - /// - internal static string QueueEmpty { - get { - return "Queue empty."; - } - } - - /// - /// A string like "Cannot redefine label '{0}' in an inner block." - /// - internal static string LabelTargetAlreadyDefined(object p0) { - return FormatString("Cannot redefine label '{0}' in an inner block.", p0); - } - - /// - /// A string like "Cannot jump to undefined label '{0}'." - /// - internal static string LabelTargetUndefined(object p0) { - return FormatString("Cannot jump to undefined label '{0}'.", p0); - } - - /// - /// A string like "Control cannot leave a finally block." - /// - internal static string ControlCannotLeaveFinally { - get { - return "Control cannot leave a finally block."; - } - } - - /// - /// A string like "Control cannot leave a filter test." - /// - internal static string ControlCannotLeaveFilterTest { - get { - return "Control cannot leave a filter test."; - } - } - - /// - /// A string like "Cannot jump to ambiguous label '{0}'." - /// - internal static string AmbiguousJump(object p0) { - return FormatString("Cannot jump to ambiguous label '{0}'.", p0); - } - - /// - /// A string like "Control cannot enter a try block." - /// - internal static string ControlCannotEnterTry { - get { - return "Control cannot enter a try block."; - } - } - - /// - /// A string like "Control cannot enter an expression--only statements can be jumped into." - /// - internal static string ControlCannotEnterExpression { - get { - return "Control cannot enter an expression--only statements can be jumped into."; - } - } - - /// - /// A string like "Cannot jump to non-local label '{0}' with a value. Only jumps to labels defined in outer blocks can pass values." - /// - internal static string NonLocalJumpWithValue(object p0) { - return FormatString("Cannot jump to non-local label '{0}' with a value. Only jumps to labels defined in outer blocks can pass values.", p0); - } - - /// - /// A string like "Extension should have been reduced." - /// - internal static string ExtensionNotReduced { - get { - return "Extension should have been reduced."; - } - } - - /// - /// A string like "CompileToMethod cannot compile constant '{0}' because it is a non-trivial value, such as a live object. Instead, create an expression tree that can construct this value." - /// - internal static string CannotCompileConstant(object p0) { - return FormatString("CompileToMethod cannot compile constant '{0}' because it is a non-trivial value, such as a live object. Instead, create an expression tree that can construct this value.", p0); - } - - /// - /// A string like "Dynamic expressions are not supported by CompileToMethod. Instead, create an expression tree that uses System.Runtime.CompilerServices.CallSite." - /// - internal static string CannotCompileDynamic { - get { - return "Dynamic expressions are not supported by CompileToMethod. Instead, create an expression tree that uses System.Runtime.CompilerServices.CallSite."; - } - } - - /// - /// A string like "Invalid lvalue for assignment: {0}." - /// - internal static string InvalidLvalue(object p0) { - return FormatString("Invalid lvalue for assignment: {0}.", p0); - } - - /// - /// A string like "Invalid member type: {0}." - /// - internal static string InvalidMemberType(object p0) { - return FormatString("Invalid member type: {0}.", p0); - } - - /// - /// A string like "unknown lift type: '{0}'." - /// - internal static string UnknownLiftType(object p0) { - return FormatString("unknown lift type: '{0}'.", p0); - } - - /// - /// A string like "Invalid output directory." - /// - internal static string InvalidOutputDir { - get { - return "Invalid output directory."; - } - } - - /// - /// A string like "Invalid assembly name or file extension." - /// - internal static string InvalidAsmNameOrExtension { - get { - return "Invalid assembly name or file extension."; - } - } - - /// - /// A string like "Collection is read-only." - /// - internal static string CollectionReadOnly { - get { - return "Collection is read-only."; - } - } - - /// - /// A string like "Cannot create instance of {0} because it contains generic parameters" - /// - internal static string IllegalNewGenericParams(object p0) { - return FormatString("Cannot create instance of {0} because it contains generic parameters", p0); - } - - /// - /// A string like "variable '{0}' of type '{1}' referenced from scope '{2}', but it is not defined" - /// - internal static string UndefinedVariable(object p0, object p1, object p2) { - return FormatString("variable '{0}' of type '{1}' referenced from scope '{2}', but it is not defined", p0, p1, p2); - } - - /// - /// A string like "Cannot close over byref parameter '{0}' referenced in lambda '{1}'" - /// - internal static string CannotCloseOverByRef(object p0, object p1) { - return FormatString("Cannot close over byref parameter '{0}' referenced in lambda '{1}'", p0, p1); - } - - /// - /// A string like "Unexpected VarArgs call to method '{0}'" - /// - internal static string UnexpectedVarArgsCall(object p0) { - return FormatString("Unexpected VarArgs call to method '{0}'", p0); - } - - /// - /// A string like "Rethrow statement is valid only inside a Catch block." - /// - internal static string RethrowRequiresCatch { - get { - return "Rethrow statement is valid only inside a Catch block."; - } - } - - /// - /// A string like "Try expression is not allowed inside a filter body." - /// - internal static string TryNotAllowedInFilter { - get { - return "Try expression is not allowed inside a filter body."; - } - } - - /// - /// A string like "When called from '{0}', rewriting a node of type '{1}' must return a non-null value of the same type. Alternatively, override '{2}' and change it to not visit children of this type." - /// - internal static string MustRewriteToSameNode(object p0, object p1, object p2) { - return FormatString("When called from '{0}', rewriting a node of type '{1}' must return a non-null value of the same type. Alternatively, override '{2}' and change it to not visit children of this type.", p0, p1, p2); - } - - /// - /// A string like "Rewriting child expression from type '{0}' to type '{1}' is not allowed, because it would change the meaning of the operation. If this is intentional, override '{2}' and change it to allow this rewrite." - /// - internal static string MustRewriteChildToSameType(object p0, object p1, object p2) { - return FormatString("Rewriting child expression from type '{0}' to type '{1}' is not allowed, because it would change the meaning of the operation. If this is intentional, override '{2}' and change it to allow this rewrite.", p0, p1, p2); - } - - /// - /// A string like "Rewritten expression calls operator method '{0}', but the original node had no operator method. If this is is intentional, override '{1}' and change it to allow this rewrite." - /// - internal static string MustRewriteWithoutMethod(object p0, object p1) { - return FormatString("Rewritten expression calls operator method '{0}', but the original node had no operator method. If this is is intentional, override '{1}' and change it to allow this rewrite.", p0, p1); - } - - /// - /// A string like "The value null is not of type '{0}' and cannot be used in this collection." - /// - internal static string InvalidNullValue(object p0) { - return FormatString("The value null is not of type '{0}' and cannot be used in this collection.", p0); - } - - /// - /// A string like "The value '{0}' is not of type '{1}' and cannot be used in this collection." - /// - internal static string InvalidObjectType(object p0, object p1) { - return FormatString("The value '{0}' is not of type '{1}' and cannot be used in this collection.", p0, p1); - } - - /// - /// A string like "TryExpression is not supported as an argument to method '{0}' because it has an argument with by-ref type. Construct the tree so the TryExpression is not nested inside of this expression." - /// - internal static string TryNotSupportedForMethodsWithRefArgs(object p0) { - return FormatString("TryExpression is not supported as an argument to method '{0}' because it has an argument with by-ref type. Construct the tree so the TryExpression is not nested inside of this expression.", p0); - } - - /// - /// A string like "TryExpression is not supported as a child expression when accessing a member on type '{0}' because it is a value type. Construct the tree so the TryExpression is not nested inside of this expression." - /// - internal static string TryNotSupportedForValueTypeInstances(object p0) { - return FormatString("TryExpression is not supported as a child expression when accessing a member on type '{0}' because it is a value type. Construct the tree so the TryExpression is not nested inside of this expression.", p0); - } - - /// - /// A string like "Collection was modified; enumeration operation may not execute." - /// - internal static string CollectionModifiedWhileEnumerating { - get { - return "Collection was modified; enumeration operation may not execute."; - } - } - - /// - /// A string like "Enumeration has either not started or has already finished." - /// - internal static string EnumerationIsDone { - get { - return "Enumeration has either not started or has already finished."; - } - } - - /// - /// A string like "Dynamic operations can only be performed in homogenous AppDomain." - /// - internal static string HomogenousAppDomainRequired { - get { - return "Dynamic operations can only be performed in homogenous AppDomain."; - } - } - - /// - /// A string like "Test value of type '{0}' cannot be used for the comparison method parameter of type '{1}'" - /// - internal static string TestValueTypeDoesNotMatchComparisonMethodParameter(object p0, object p1) { - return FormatString("Test value of type '{0}' cannot be used for the comparison method parameter of type '{1}'", p0, p1); - } - - /// - /// A string like "Switch value of type '{0}' cannot be used for the comparison method parameter of type '{1}'" - /// - internal static string SwitchValueTypeDoesNotMatchComparisonMethodParameter(object p0, object p1) { - return FormatString("Switch value of type '{0}' cannot be used for the comparison method parameter of type '{1}'", p0, p1); - } - - /// - /// A string like "An IDynamicMetaObjectProvider {0} created an invalid DynamicMetaObject instance." - /// - internal static string InvalidMetaObjectCreated(object p0) { - return FormatString("An IDynamicMetaObjectProvider {0} created an invalid DynamicMetaObject instance.", p0); - } - - /// - /// A string like "DebugInfoGenerator created by CreatePdbGenerator can only be used with LambdaExpression.CompileToMethod." - /// - internal static string PdbGeneratorNeedsExpressionCompiler { - get { - return "DebugInfoGenerator created by CreatePdbGenerator can only be used with LambdaExpression.CompileToMethod."; - } - } - - } - /// - /// Strongly-typed and parameterized exception factory. - /// - - internal static partial class Error { - /// - /// ArgumentException with message like "Argument count must be greater than number of named arguments." - /// - internal static Exception ArgCntMustBeGreaterThanNameCnt() { - return new ArgumentException(Strings.ArgCntMustBeGreaterThanNameCnt); - } - - /// - /// ArgumentException with message like "reducible nodes must override Expression.Reduce()" - /// - internal static Exception ReducibleMustOverrideReduce() { - return new ArgumentException(Strings.ReducibleMustOverrideReduce); - } - - /// - /// ArgumentException with message like "node cannot reduce to itself or null" - /// - internal static Exception MustReduceToDifferent() { - return new ArgumentException(Strings.MustReduceToDifferent); - } - - /// - /// ArgumentException with message like "cannot assign from the reduced node type to the original node type" - /// - internal static Exception ReducedNotCompatible() { - return new ArgumentException(Strings.ReducedNotCompatible); - } - - /// - /// ArgumentException with message like "Setter must have parameters." - /// - internal static Exception SetterHasNoParams() { - return new ArgumentException(Strings.SetterHasNoParams); - } - - /// - /// ArgumentException with message like "Property cannot have a managed pointer type." - /// - internal static Exception PropertyCannotHaveRefType() { - return new ArgumentException(Strings.PropertyCannotHaveRefType); - } - - /// - /// ArgumentException with message like "Indexing parameters of getter and setter must match." - /// - internal static Exception IndexesOfSetGetMustMatch() { - return new ArgumentException(Strings.IndexesOfSetGetMustMatch); - } - - /// - /// ArgumentException with message like "Accessor method should not have VarArgs." - /// - internal static Exception AccessorsCannotHaveVarArgs() { - return new ArgumentException(Strings.AccessorsCannotHaveVarArgs); - } - - /// - /// ArgumentException with message like "Accessor indexes cannot be passed ByRef." - /// - internal static Exception AccessorsCannotHaveByRefArgs() { - return new ArgumentException(Strings.AccessorsCannotHaveByRefArgs); - } - - /// - /// ArgumentException with message like "Bounds count cannot be less than 1" - /// - internal static Exception BoundsCannotBeLessThanOne() { - return new ArgumentException(Strings.BoundsCannotBeLessThanOne); - } - - /// - /// ArgumentException with message like "type must not be ByRef" - /// - internal static Exception TypeMustNotBeByRef() { - return new ArgumentException(Strings.TypeMustNotBeByRef); - } - - /// - /// ArgumentException with message like "Type doesn't have constructor with a given signature" - /// - internal static Exception TypeDoesNotHaveConstructorForTheSignature() { - return new ArgumentException(Strings.TypeDoesNotHaveConstructorForTheSignature); - } - - /// - /// ArgumentException with message like "Count must be non-negative." - /// - internal static Exception CountCannotBeNegative() { - return new ArgumentException(Strings.CountCannotBeNegative); - } - - /// - /// ArgumentException with message like "arrayType must be an array type" - /// - internal static Exception ArrayTypeMustBeArray() { - return new ArgumentException(Strings.ArrayTypeMustBeArray); - } - - /// - /// ArgumentException with message like "Setter should have void type." - /// - internal static Exception SetterMustBeVoid() { - return new ArgumentException(Strings.SetterMustBeVoid); - } - - /// - /// ArgumentException with message like "Property type must match the value type of setter" - /// - internal static Exception PropertyTyepMustMatchSetter() { - return new ArgumentException(Strings.PropertyTyepMustMatchSetter); - } - - /// - /// ArgumentException with message like "Both accessors must be static." - /// - internal static Exception BothAccessorsMustBeStatic() { - return new ArgumentException(Strings.BothAccessorsMustBeStatic); - } - - /// - /// ArgumentException with message like "Static method requires null instance, non-static method requires non-null instance." - /// - internal static Exception OnlyStaticMethodsHaveNullInstance() { - return new ArgumentException(Strings.OnlyStaticMethodsHaveNullInstance); - } - - /// - /// ArgumentException with message like "Property cannot have a void type." - /// - internal static Exception PropertyTypeCannotBeVoid() { - return new ArgumentException(Strings.PropertyTypeCannotBeVoid); - } - - /// - /// ArgumentException with message like "Can only unbox from an object or interface type to a value type." - /// - internal static Exception InvalidUnboxType() { - return new ArgumentException(Strings.InvalidUnboxType); - } - - /// - /// ArgumentException with message like "Argument must not have a value type." - /// - internal static Exception ArgumentMustNotHaveValueType() { - return new ArgumentException(Strings.ArgumentMustNotHaveValueType); - } - - /// - /// ArgumentException with message like "must be reducible node" - /// - internal static Exception MustBeReducible() { - return new ArgumentException(Strings.MustBeReducible); - } - - /// - /// ArgumentException with message like "Default body must be supplied if case bodies are not System.Void." - /// - internal static Exception DefaultBodyMustBeSupplied() { - return new ArgumentException(Strings.DefaultBodyMustBeSupplied); - } - - /// - /// ArgumentException with message like "MethodBuilder does not have a valid TypeBuilder" - /// - internal static Exception MethodBuilderDoesNotHaveTypeBuilder() { - return new ArgumentException(Strings.MethodBuilderDoesNotHaveTypeBuilder); - } - - /// - /// ArgumentException with message like "Type must be derived from System.Delegate" - /// - internal static Exception TypeMustBeDerivedFromSystemDelegate() { - return new ArgumentException(Strings.TypeMustBeDerivedFromSystemDelegate); - } - - /// - /// ArgumentException with message like "Argument type cannot be void" - /// - internal static Exception ArgumentTypeCannotBeVoid() { - return new ArgumentException(Strings.ArgumentTypeCannotBeVoid); - } - - /// - /// ArgumentException with message like "Label type must be System.Void if an expression is not supplied" - /// - internal static Exception LabelMustBeVoidOrHaveExpression() { - return new ArgumentException(Strings.LabelMustBeVoidOrHaveExpression); - } - - /// - /// ArgumentException with message like "Type must be System.Void for this label argument" - /// - internal static Exception LabelTypeMustBeVoid() { - return new ArgumentException(Strings.LabelTypeMustBeVoid); - } - - /// - /// ArgumentException with message like "Quoted expression must be a lambda" - /// - internal static Exception QuotedExpressionMustBeLambda() { - return new ArgumentException(Strings.QuotedExpressionMustBeLambda); - } - - /// - /// ArgumentException with message like "Variable '{0}' uses unsupported type '{1}'. Reference types are not supported for variables." - /// - internal static Exception VariableMustNotBeByRef(object p0, object p1) { - return new ArgumentException(Strings.VariableMustNotBeByRef(p0, p1)); - } - - /// - /// ArgumentException with message like "Found duplicate parameter '{0}'. Each ParameterExpression in the list must be a unique object." - /// - internal static Exception DuplicateVariable(object p0) { - return new ArgumentException(Strings.DuplicateVariable(p0)); - } - - /// - /// ArgumentException with message like "Start and End must be well ordered" - /// - internal static Exception StartEndMustBeOrdered() { - return new ArgumentException(Strings.StartEndMustBeOrdered); - } - - /// - /// ArgumentException with message like "fault cannot be used with catch or finally clauses" - /// - internal static Exception FaultCannotHaveCatchOrFinally() { - return new ArgumentException(Strings.FaultCannotHaveCatchOrFinally); - } - - /// - /// ArgumentException with message like "try must have at least one catch, finally, or fault clause" - /// - internal static Exception TryMustHaveCatchFinallyOrFault() { - return new ArgumentException(Strings.TryMustHaveCatchFinallyOrFault); - } - - /// - /// ArgumentException with message like "Body of catch must have the same type as body of try." - /// - internal static Exception BodyOfCatchMustHaveSameTypeAsBodyOfTry() { - return new ArgumentException(Strings.BodyOfCatchMustHaveSameTypeAsBodyOfTry); - } - - /// - /// InvalidOperationException with message like "Extension node must override the property {0}." - /// - internal static Exception ExtensionNodeMustOverrideProperty(object p0) { - return new InvalidOperationException(Strings.ExtensionNodeMustOverrideProperty(p0)); - } - - /// - /// ArgumentException with message like "User-defined operator method '{0}' must be static." - /// - internal static Exception UserDefinedOperatorMustBeStatic(object p0) { - return new ArgumentException(Strings.UserDefinedOperatorMustBeStatic(p0)); - } - - /// - /// ArgumentException with message like "User-defined operator method '{0}' must not be void." - /// - internal static Exception UserDefinedOperatorMustNotBeVoid(object p0) { - return new ArgumentException(Strings.UserDefinedOperatorMustNotBeVoid(p0)); - } - - /// - /// InvalidOperationException with message like "No coercion operator is defined between types '{0}' and '{1}'." - /// - internal static Exception CoercionOperatorNotDefined(object p0, object p1) { - return new InvalidOperationException(Strings.CoercionOperatorNotDefined(p0, p1)); - } - - /// - /// InvalidCastException with message like "The result type '{0}' of the dynamic binding produced by binder '{1}' is not compatible with the result type '{2}' expected by the call site." - /// - internal static Exception DynamicBinderResultNotAssignable(object p0, object p1, object p2) { - return new InvalidCastException(Strings.DynamicBinderResultNotAssignable(p0, p1, p2)); - } - - /// - /// InvalidCastException with message like "The result type '{0}' of the dynamic binding produced by the object with type '{1}' for the binder '{2}' is not compatible with the result type '{3}' expected by the call site." - /// - internal static Exception DynamicObjectResultNotAssignable(object p0, object p1, object p2, object p3) { - return new InvalidCastException(Strings.DynamicObjectResultNotAssignable(p0, p1, p2, p3)); - } - - /// - /// InvalidOperationException with message like "The result of the dynamic binding produced by the object with type '{0}' for the binder '{1}' needs at least one restriction." - /// - internal static Exception DynamicBindingNeedsRestrictions(object p0, object p1) { - return new InvalidOperationException(Strings.DynamicBindingNeedsRestrictions(p0, p1)); - } - - /// - /// InvalidOperationException with message like "The result type '{0}' of the binder '{1}' is not compatible with the result type '{2}' expected by the call site." - /// - internal static Exception BinderNotCompatibleWithCallSite(object p0, object p1, object p2) { - return new InvalidOperationException(Strings.BinderNotCompatibleWithCallSite(p0, p1, p2)); - } - - /// - /// InvalidOperationException with message like "The unary operator {0} is not defined for the type '{1}'." - /// - internal static Exception UnaryOperatorNotDefined(object p0, object p1) { - return new InvalidOperationException(Strings.UnaryOperatorNotDefined(p0, p1)); - } - - /// - /// InvalidOperationException with message like "The binary operator {0} is not defined for the types '{1}' and '{2}'." - /// - internal static Exception BinaryOperatorNotDefined(object p0, object p1, object p2) { - return new InvalidOperationException(Strings.BinaryOperatorNotDefined(p0, p1, p2)); - } - - /// - /// InvalidOperationException with message like "Reference equality is not defined for the types '{0}' and '{1}'." - /// - internal static Exception ReferenceEqualityNotDefined(object p0, object p1) { - return new InvalidOperationException(Strings.ReferenceEqualityNotDefined(p0, p1)); - } - - /// - /// InvalidOperationException with message like "The operands for operator '{0}' do not match the parameters of method '{1}'." - /// - internal static Exception OperandTypesDoNotMatchParameters(object p0, object p1) { - return new InvalidOperationException(Strings.OperandTypesDoNotMatchParameters(p0, p1)); - } - - /// - /// InvalidOperationException with message like "The return type of overload method for operator '{0}' does not match the parameter type of conversion method '{1}'." - /// - internal static Exception OverloadOperatorTypeDoesNotMatchConversionType(object p0, object p1) { - return new InvalidOperationException(Strings.OverloadOperatorTypeDoesNotMatchConversionType(p0, p1)); - } - - /// - /// InvalidOperationException with message like "Conversion is not supported for arithmetic types without operator overloading." - /// - internal static Exception ConversionIsNotSupportedForArithmeticTypes() { - return new InvalidOperationException(Strings.ConversionIsNotSupportedForArithmeticTypes); - } - - /// - /// ArgumentException with message like "Argument must be array" - /// - internal static Exception ArgumentMustBeArray() { - return new ArgumentException(Strings.ArgumentMustBeArray); - } - - /// - /// ArgumentException with message like "Argument must be boolean" - /// - internal static Exception ArgumentMustBeBoolean() { - return new ArgumentException(Strings.ArgumentMustBeBoolean); - } - - /// - /// ArgumentException with message like "The user-defined equality method '{0}' must return a boolean value." - /// - internal static Exception EqualityMustReturnBoolean(object p0) { - return new ArgumentException(Strings.EqualityMustReturnBoolean(p0)); - } - - /// - /// ArgumentException with message like "Argument must be either a FieldInfo or PropertyInfo" - /// - internal static Exception ArgumentMustBeFieldInfoOrPropertInfo() { - return new ArgumentException(Strings.ArgumentMustBeFieldInfoOrPropertInfo); - } - - /// - /// ArgumentException with message like "Argument must be either a FieldInfo, PropertyInfo or MethodInfo" - /// - internal static Exception ArgumentMustBeFieldInfoOrPropertInfoOrMethod() { - return new ArgumentException(Strings.ArgumentMustBeFieldInfoOrPropertInfoOrMethod); - } - - /// - /// ArgumentException with message like "Argument must be an instance member" - /// - internal static Exception ArgumentMustBeInstanceMember() { - return new ArgumentException(Strings.ArgumentMustBeInstanceMember); - } - - /// - /// ArgumentException with message like "Argument must be of an integer type" - /// - internal static Exception ArgumentMustBeInteger() { - return new ArgumentException(Strings.ArgumentMustBeInteger); - } - - /// - /// ArgumentException with message like "Argument for array index must be of type Int32" - /// - internal static Exception ArgumentMustBeArrayIndexType() { - return new ArgumentException(Strings.ArgumentMustBeArrayIndexType); - } - - /// - /// ArgumentException with message like "Argument must be single dimensional array type" - /// - internal static Exception ArgumentMustBeSingleDimensionalArrayType() { - return new ArgumentException(Strings.ArgumentMustBeSingleDimensionalArrayType); - } - - /// - /// ArgumentException with message like "Argument types do not match" - /// - internal static Exception ArgumentTypesMustMatch() { - return new ArgumentException(Strings.ArgumentTypesMustMatch); - } - - /// - /// InvalidOperationException with message like "Cannot auto initialize elements of value type through property '{0}', use assignment instead" - /// - internal static Exception CannotAutoInitializeValueTypeElementThroughProperty(object p0) { - return new InvalidOperationException(Strings.CannotAutoInitializeValueTypeElementThroughProperty(p0)); - } - - /// - /// InvalidOperationException with message like "Cannot auto initialize members of value type through property '{0}', use assignment instead" - /// - internal static Exception CannotAutoInitializeValueTypeMemberThroughProperty(object p0) { - return new InvalidOperationException(Strings.CannotAutoInitializeValueTypeMemberThroughProperty(p0)); - } - - /// - /// ArgumentException with message like "The type used in TypeAs Expression must be of reference or nullable type, {0} is neither" - /// - internal static Exception IncorrectTypeForTypeAs(object p0) { - return new ArgumentException(Strings.IncorrectTypeForTypeAs(p0)); - } - - /// - /// InvalidOperationException with message like "Coalesce used with type that cannot be null" - /// - internal static Exception CoalesceUsedOnNonNullType() { - return new InvalidOperationException(Strings.CoalesceUsedOnNonNullType); - } - - /// - /// InvalidOperationException with message like "An expression of type '{0}' cannot be used to initialize an array of type '{1}'" - /// - internal static Exception ExpressionTypeCannotInitializeArrayType(object p0, object p1) { - return new InvalidOperationException(Strings.ExpressionTypeCannotInitializeArrayType(p0, p1)); - } - - /// - /// ArgumentException with message like "Expression of type '{0}' cannot be used for constructor parameter of type '{1}'" - /// - internal static Exception ExpressionTypeDoesNotMatchConstructorParameter(object p0, object p1) { - return new ArgumentException(Strings.ExpressionTypeDoesNotMatchConstructorParameter(p0, p1)); - } - - /// - /// ArgumentException with message like " Argument type '{0}' does not match the corresponding member type '{1}'" - /// - internal static Exception ArgumentTypeDoesNotMatchMember(object p0, object p1) { - return new ArgumentException(Strings.ArgumentTypeDoesNotMatchMember(p0, p1)); - } - - /// - /// ArgumentException with message like " The member '{0}' is not declared on type '{1}' being created" - /// - internal static Exception ArgumentMemberNotDeclOnType(object p0, object p1) { - return new ArgumentException(Strings.ArgumentMemberNotDeclOnType(p0, p1)); - } - - /// - /// ArgumentException with message like "Expression of type '{0}' cannot be used for parameter of type '{1}' of method '{2}'" - /// - internal static Exception ExpressionTypeDoesNotMatchMethodParameter(object p0, object p1, object p2) { - return new ArgumentException(Strings.ExpressionTypeDoesNotMatchMethodParameter(p0, p1, p2)); - } - - /// - /// ArgumentException with message like "Expression of type '{0}' cannot be used for parameter of type '{1}'" - /// - internal static Exception ExpressionTypeDoesNotMatchParameter(object p0, object p1) { - return new ArgumentException(Strings.ExpressionTypeDoesNotMatchParameter(p0, p1)); - } - - /// - /// ArgumentException with message like "Expression of type '{0}' cannot be used for return type '{1}'" - /// - internal static Exception ExpressionTypeDoesNotMatchReturn(object p0, object p1) { - return new ArgumentException(Strings.ExpressionTypeDoesNotMatchReturn(p0, p1)); - } - - /// - /// ArgumentException with message like "Expression of type '{0}' cannot be used for assignment to type '{1}'" - /// - internal static Exception ExpressionTypeDoesNotMatchAssignment(object p0, object p1) { - return new ArgumentException(Strings.ExpressionTypeDoesNotMatchAssignment(p0, p1)); - } - - /// - /// ArgumentException with message like "Expression of type '{0}' cannot be used for label of type '{1}'" - /// - internal static Exception ExpressionTypeDoesNotMatchLabel(object p0, object p1) { - return new ArgumentException(Strings.ExpressionTypeDoesNotMatchLabel(p0, p1)); - } - - /// - /// ArgumentException with message like "Expression of type '{0}' cannot be invoked" - /// - internal static Exception ExpressionTypeNotInvocable(object p0) { - return new ArgumentException(Strings.ExpressionTypeNotInvocable(p0)); - } - - /// - /// ArgumentException with message like "Field '{0}' is not defined for type '{1}'" - /// - internal static Exception FieldNotDefinedForType(object p0, object p1) { - return new ArgumentException(Strings.FieldNotDefinedForType(p0, p1)); - } - - /// - /// ArgumentException with message like "Instance field '{0}' is not defined for type '{1}'" - /// - internal static Exception InstanceFieldNotDefinedForType(object p0, object p1) { - return new ArgumentException(Strings.InstanceFieldNotDefinedForType(p0, p1)); - } - - /// - /// ArgumentException with message like "Field '{0}.{1}' is not defined for type '{2}'" - /// - internal static Exception FieldInfoNotDefinedForType(object p0, object p1, object p2) { - return new ArgumentException(Strings.FieldInfoNotDefinedForType(p0, p1, p2)); - } - - /// - /// ArgumentException with message like "Incorrect number of indexes" - /// - internal static Exception IncorrectNumberOfIndexes() { - return new ArgumentException(Strings.IncorrectNumberOfIndexes); - } - - /// - /// InvalidOperationException with message like "Incorrect number of arguments supplied for lambda invocation" - /// - internal static Exception IncorrectNumberOfLambdaArguments() { - return new InvalidOperationException(Strings.IncorrectNumberOfLambdaArguments); - } - - /// - /// ArgumentException with message like "Incorrect number of parameters supplied for lambda declaration" - /// - internal static Exception IncorrectNumberOfLambdaDeclarationParameters() { - return new ArgumentException(Strings.IncorrectNumberOfLambdaDeclarationParameters); - } - - /// - /// ArgumentException with message like "Incorrect number of arguments supplied for call to method '{0}'" - /// - internal static Exception IncorrectNumberOfMethodCallArguments(object p0) { - return new ArgumentException(Strings.IncorrectNumberOfMethodCallArguments(p0)); - } - - /// - /// ArgumentException with message like "Incorrect number of arguments for constructor" - /// - internal static Exception IncorrectNumberOfConstructorArguments() { - return new ArgumentException(Strings.IncorrectNumberOfConstructorArguments); - } - - /// - /// ArgumentException with message like " Incorrect number of members for constructor" - /// - internal static Exception IncorrectNumberOfMembersForGivenConstructor() { - return new ArgumentException(Strings.IncorrectNumberOfMembersForGivenConstructor); - } - - /// - /// ArgumentException with message like "Incorrect number of arguments for the given members " - /// - internal static Exception IncorrectNumberOfArgumentsForMembers() { - return new ArgumentException(Strings.IncorrectNumberOfArgumentsForMembers); - } - - /// - /// ArgumentException with message like "Lambda type parameter must be derived from System.Delegate" - /// - internal static Exception LambdaTypeMustBeDerivedFromSystemDelegate() { - return new ArgumentException(Strings.LambdaTypeMustBeDerivedFromSystemDelegate); - } - - /// - /// ArgumentException with message like "Member '{0}' not field or property" - /// - internal static Exception MemberNotFieldOrProperty(object p0) { - return new ArgumentException(Strings.MemberNotFieldOrProperty(p0)); - } - - /// - /// ArgumentException with message like "Method {0} contains generic parameters" - /// - internal static Exception MethodContainsGenericParameters(object p0) { - return new ArgumentException(Strings.MethodContainsGenericParameters(p0)); - } - - /// - /// ArgumentException with message like "Method {0} is a generic method definition" - /// - internal static Exception MethodIsGeneric(object p0) { - return new ArgumentException(Strings.MethodIsGeneric(p0)); - } - - /// - /// ArgumentException with message like "The method '{0}.{1}' is not a property accessor" - /// - internal static Exception MethodNotPropertyAccessor(object p0, object p1) { - return new ArgumentException(Strings.MethodNotPropertyAccessor(p0, p1)); - } - - /// - /// ArgumentException with message like "The property '{0}' has no 'get' accessor" - /// - internal static Exception PropertyDoesNotHaveGetter(object p0) { - return new ArgumentException(Strings.PropertyDoesNotHaveGetter(p0)); - } - - /// - /// ArgumentException with message like "The property '{0}' has no 'set' accessor" - /// - internal static Exception PropertyDoesNotHaveSetter(object p0) { - return new ArgumentException(Strings.PropertyDoesNotHaveSetter(p0)); - } - - /// - /// ArgumentException with message like "The property '{0}' has no 'get' or 'set' accessors" - /// - internal static Exception PropertyDoesNotHaveAccessor(object p0) { - return new ArgumentException(Strings.PropertyDoesNotHaveAccessor(p0)); - } - - /// - /// ArgumentException with message like "'{0}' is not a member of type '{1}'" - /// - internal static Exception NotAMemberOfType(object p0, object p1) { - return new ArgumentException(Strings.NotAMemberOfType(p0, p1)); - } - - /// - /// NotImplementedException with message like "The operator '{0}' is not implemented for type '{1}'" - /// - internal static Exception OperatorNotImplementedForType(object p0, object p1) { - return new NotImplementedException(Strings.OperatorNotImplementedForType(p0, p1)); - } - - /// - /// ArgumentException with message like "ParameterExpression of type '{0}' cannot be used for delegate parameter of type '{1}'" - /// - internal static Exception ParameterExpressionNotValidAsDelegate(object p0, object p1) { - return new ArgumentException(Strings.ParameterExpressionNotValidAsDelegate(p0, p1)); - } - - /// - /// ArgumentException with message like "Property '{0}' is not defined for type '{1}'" - /// - internal static Exception PropertyNotDefinedForType(object p0, object p1) { - return new ArgumentException(Strings.PropertyNotDefinedForType(p0, p1)); - } - - /// - /// ArgumentException with message like "Instance property '{0}' is not defined for type '{1}'" - /// - internal static Exception InstancePropertyNotDefinedForType(object p0, object p1) { - return new ArgumentException(Strings.InstancePropertyNotDefinedForType(p0, p1)); - } - - /// - /// ArgumentException with message like "Instance property '{0}' that takes no argument is not defined for type '{1}'" - /// - internal static Exception InstancePropertyWithoutParameterNotDefinedForType(object p0, object p1) { - return new ArgumentException(Strings.InstancePropertyWithoutParameterNotDefinedForType(p0, p1)); - } - - /// - /// ArgumentException with message like "Instance property '{0}{1}' is not defined for type '{2}'" - /// - internal static Exception InstancePropertyWithSpecifiedParametersNotDefinedForType(object p0, object p1, object p2) { - return new ArgumentException(Strings.InstancePropertyWithSpecifiedParametersNotDefinedForType(p0, p1, p2)); - } - - /// - /// ArgumentException with message like "Method '{0}' declared on type '{1}' cannot be called with instance of type '{2}'" - /// - internal static Exception InstanceAndMethodTypeMismatch(object p0, object p1, object p2) { - return new ArgumentException(Strings.InstanceAndMethodTypeMismatch(p0, p1, p2)); - } - - /// - /// ArgumentException with message like "Type {0} contains generic parameters" - /// - internal static Exception TypeContainsGenericParameters(object p0) { - return new ArgumentException(Strings.TypeContainsGenericParameters(p0)); - } - - /// - /// ArgumentException with message like "Type {0} is a generic type definition" - /// - internal static Exception TypeIsGeneric(object p0) { - return new ArgumentException(Strings.TypeIsGeneric(p0)); - } - - /// - /// ArgumentException with message like "Type '{0}' does not have a default constructor" - /// - internal static Exception TypeMissingDefaultConstructor(object p0) { - return new ArgumentException(Strings.TypeMissingDefaultConstructor(p0)); - } - - /// - /// ArgumentException with message like "List initializers must contain at least one initializer" - /// - internal static Exception ListInitializerWithZeroMembers() { - return new ArgumentException(Strings.ListInitializerWithZeroMembers); - } - - /// - /// ArgumentException with message like "Element initializer method must be named 'Add'" - /// - internal static Exception ElementInitializerMethodNotAdd() { - return new ArgumentException(Strings.ElementInitializerMethodNotAdd); - } - - /// - /// ArgumentException with message like "Parameter '{0}' of element initializer method '{1}' must not be a pass by reference parameter" - /// - internal static Exception ElementInitializerMethodNoRefOutParam(object p0, object p1) { - return new ArgumentException(Strings.ElementInitializerMethodNoRefOutParam(p0, p1)); - } - - /// - /// ArgumentException with message like "Element initializer method must have at least 1 parameter" - /// - internal static Exception ElementInitializerMethodWithZeroArgs() { - return new ArgumentException(Strings.ElementInitializerMethodWithZeroArgs); - } - - /// - /// ArgumentException with message like "Element initializer method must be an instance method" - /// - internal static Exception ElementInitializerMethodStatic() { - return new ArgumentException(Strings.ElementInitializerMethodStatic); - } - - /// - /// ArgumentException with message like "Type '{0}' is not IEnumerable" - /// - internal static Exception TypeNotIEnumerable(object p0) { - return new ArgumentException(Strings.TypeNotIEnumerable(p0)); - } - - /// - /// InvalidOperationException with message like "Type parameter is {0}. Expected a delegate." - /// - internal static Exception TypeParameterIsNotDelegate(object p0) { - return new InvalidOperationException(Strings.TypeParameterIsNotDelegate(p0)); - } - - /// - /// InvalidOperationException with message like "Unexpected coalesce operator." - /// - internal static Exception UnexpectedCoalesceOperator() { - return new InvalidOperationException(Strings.UnexpectedCoalesceOperator); - } - - /// - /// InvalidOperationException with message like "Cannot cast from type '{0}' to type '{1}" - /// - internal static Exception InvalidCast(object p0, object p1) { - return new InvalidOperationException(Strings.InvalidCast(p0, p1)); - } - - /// - /// ArgumentException with message like "Unhandled binary: {0}" - /// - internal static Exception UnhandledBinary(object p0) { - return new ArgumentException(Strings.UnhandledBinary(p0)); - } - - /// - /// ArgumentException with message like "Unhandled binding " - /// - internal static Exception UnhandledBinding() { - return new ArgumentException(Strings.UnhandledBinding); - } - - /// - /// ArgumentException with message like "Unhandled Binding Type: {0}" - /// - internal static Exception UnhandledBindingType(object p0) { - return new ArgumentException(Strings.UnhandledBindingType(p0)); - } - - /// - /// ArgumentException with message like "Unhandled convert: {0}" - /// - internal static Exception UnhandledConvert(object p0) { - return new ArgumentException(Strings.UnhandledConvert(p0)); - } - - /// - /// ArgumentException with message like "Unhandled Expression Type: {0}" - /// - internal static Exception UnhandledExpressionType(object p0) { - return new ArgumentException(Strings.UnhandledExpressionType(p0)); - } - - /// - /// ArgumentException with message like "Unhandled unary: {0}" - /// - internal static Exception UnhandledUnary(object p0) { - return new ArgumentException(Strings.UnhandledUnary(p0)); - } - - /// - /// ArgumentException with message like "Unknown binding type" - /// - internal static Exception UnknownBindingType() { - return new ArgumentException(Strings.UnknownBindingType); - } - - /// - /// ArgumentException with message like "The user-defined operator method '{1}' for operator '{0}' must have identical parameter and return types." - /// - internal static Exception UserDefinedOpMustHaveConsistentTypes(object p0, object p1) { - return new ArgumentException(Strings.UserDefinedOpMustHaveConsistentTypes(p0, p1)); - } - - /// - /// ArgumentException with message like "The user-defined operator method '{1}' for operator '{0}' must return the same type as its parameter or a derived type." - /// - internal static Exception UserDefinedOpMustHaveValidReturnType(object p0, object p1) { - return new ArgumentException(Strings.UserDefinedOpMustHaveValidReturnType(p0, p1)); - } - - /// - /// ArgumentException with message like "The user-defined operator method '{1}' for operator '{0}' must have associated boolean True and False operators." - /// - internal static Exception LogicalOperatorMustHaveBooleanOperators(object p0, object p1) { - return new ArgumentException(Strings.LogicalOperatorMustHaveBooleanOperators(p0, p1)); - } - - /// - /// InvalidOperationException with message like "No method '{0}' exists on type '{1}'." - /// - internal static Exception MethodDoesNotExistOnType(object p0, object p1) { - return new InvalidOperationException(Strings.MethodDoesNotExistOnType(p0, p1)); - } - - /// - /// InvalidOperationException with message like "No method '{0}' on type '{1}' is compatible with the supplied arguments." - /// - internal static Exception MethodWithArgsDoesNotExistOnType(object p0, object p1) { - return new InvalidOperationException(Strings.MethodWithArgsDoesNotExistOnType(p0, p1)); - } - - /// - /// InvalidOperationException with message like "No generic method '{0}' on type '{1}' is compatible with the supplied type arguments and arguments. No type arguments should be provided if the method is non-generic. " - /// - internal static Exception GenericMethodWithArgsDoesNotExistOnType(object p0, object p1) { - return new InvalidOperationException(Strings.GenericMethodWithArgsDoesNotExistOnType(p0, p1)); - } - - /// - /// InvalidOperationException with message like "More than one method '{0}' on type '{1}' is compatible with the supplied arguments." - /// - internal static Exception MethodWithMoreThanOneMatch(object p0, object p1) { - return new InvalidOperationException(Strings.MethodWithMoreThanOneMatch(p0, p1)); - } - - /// - /// InvalidOperationException with message like "More than one property '{0}' on type '{1}' is compatible with the supplied arguments." - /// - internal static Exception PropertyWithMoreThanOneMatch(object p0, object p1) { - return new InvalidOperationException(Strings.PropertyWithMoreThanOneMatch(p0, p1)); - } - - /// - /// ArgumentException with message like "An incorrect number of type args were specified for the declaration of a Func type." - /// - internal static Exception IncorrectNumberOfTypeArgsForFunc() { - return new ArgumentException(Strings.IncorrectNumberOfTypeArgsForFunc); - } - - /// - /// ArgumentException with message like "An incorrect number of type args were specified for the declaration of an Action type." - /// - internal static Exception IncorrectNumberOfTypeArgsForAction() { - return new ArgumentException(Strings.IncorrectNumberOfTypeArgsForAction); - } - - /// - /// ArgumentException with message like "Argument type cannot be System.Void." - /// - internal static Exception ArgumentCannotBeOfTypeVoid() { - return new ArgumentException(Strings.ArgumentCannotBeOfTypeVoid); - } - - /// - /// System.Reflection.AmbiguousMatchException with message like "More than one key matching '{0}' was found in the ExpandoObject." - /// - internal static Exception AmbiguousMatchInExpandoObject(object p0) { - return new System.Reflection.AmbiguousMatchException(Strings.AmbiguousMatchInExpandoObject(p0)); - } - - /// - /// ArgumentException with message like "An element with the same key '{0}' already exists in the ExpandoObject." - /// - internal static Exception SameKeyExistsInExpando(object p0) { - return new ArgumentException(Strings.SameKeyExistsInExpando(p0)); - } - - /// - /// System.Collections.Generic.KeyNotFoundException with message like "The specified key '{0}' does not exist in the ExpandoObject." - /// - internal static Exception KeyDoesNotExistInExpando(object p0) { - return new System.Collections.Generic.KeyNotFoundException(Strings.KeyDoesNotExistInExpando(p0)); - } - - /// - /// InvalidOperationException with message like "No or Invalid rule produced" - /// - internal static Exception NoOrInvalidRuleProduced() { - return new InvalidOperationException(Strings.NoOrInvalidRuleProduced); - } - - /// - /// ArgumentException with message like "First argument of delegate must be CallSite" - /// - internal static Exception FirstArgumentMustBeCallSite() { - return new ArgumentException(Strings.FirstArgumentMustBeCallSite); - } - - /// - /// InvalidOperationException with message like "Bind cannot return null." - /// - internal static Exception BindingCannotBeNull() { - return new InvalidOperationException(Strings.BindingCannotBeNull); - } - - /// - /// ArgumentException with message like "Invalid operation: '{0}'" - /// - internal static Exception InvalidOperation(object p0) { - return new ArgumentException(Strings.InvalidOperation(p0)); - } - - /// - /// ArgumentOutOfRangeException with message like "{0} must be greater than or equal to {1}" - /// - internal static Exception OutOfRange(object p0, object p1) { - return new ArgumentOutOfRangeException(Strings.OutOfRange(p0, p1)); - } - - /// - /// InvalidOperationException with message like "Queue empty." - /// - internal static Exception QueueEmpty() { - return new InvalidOperationException(Strings.QueueEmpty); - } - - /// - /// InvalidOperationException with message like "Cannot redefine label '{0}' in an inner block." - /// - internal static Exception LabelTargetAlreadyDefined(object p0) { - return new InvalidOperationException(Strings.LabelTargetAlreadyDefined(p0)); - } - - /// - /// InvalidOperationException with message like "Cannot jump to undefined label '{0}'." - /// - internal static Exception LabelTargetUndefined(object p0) { - return new InvalidOperationException(Strings.LabelTargetUndefined(p0)); - } - - /// - /// InvalidOperationException with message like "Control cannot leave a finally block." - /// - internal static Exception ControlCannotLeaveFinally() { - return new InvalidOperationException(Strings.ControlCannotLeaveFinally); - } - - /// - /// InvalidOperationException with message like "Control cannot leave a filter test." - /// - internal static Exception ControlCannotLeaveFilterTest() { - return new InvalidOperationException(Strings.ControlCannotLeaveFilterTest); - } - - /// - /// InvalidOperationException with message like "Cannot jump to ambiguous label '{0}'." - /// - internal static Exception AmbiguousJump(object p0) { - return new InvalidOperationException(Strings.AmbiguousJump(p0)); - } - - /// - /// InvalidOperationException with message like "Control cannot enter a try block." - /// - internal static Exception ControlCannotEnterTry() { - return new InvalidOperationException(Strings.ControlCannotEnterTry); - } - - /// - /// InvalidOperationException with message like "Control cannot enter an expression--only statements can be jumped into." - /// - internal static Exception ControlCannotEnterExpression() { - return new InvalidOperationException(Strings.ControlCannotEnterExpression); - } - - /// - /// InvalidOperationException with message like "Cannot jump to non-local label '{0}' with a value. Only jumps to labels defined in outer blocks can pass values." - /// - internal static Exception NonLocalJumpWithValue(object p0) { - return new InvalidOperationException(Strings.NonLocalJumpWithValue(p0)); - } - - /// - /// InvalidOperationException with message like "Extension should have been reduced." - /// - internal static Exception ExtensionNotReduced() { - return new InvalidOperationException(Strings.ExtensionNotReduced); - } - - /// - /// InvalidOperationException with message like "CompileToMethod cannot compile constant '{0}' because it is a non-trivial value, such as a live object. Instead, create an expression tree that can construct this value." - /// - internal static Exception CannotCompileConstant(object p0) { - return new InvalidOperationException(Strings.CannotCompileConstant(p0)); - } - - /// - /// NotSupportedException with message like "Dynamic expressions are not supported by CompileToMethod. Instead, create an expression tree that uses System.Runtime.CompilerServices.CallSite." - /// - internal static Exception CannotCompileDynamic() { - return new NotSupportedException(Strings.CannotCompileDynamic); - } - - /// - /// InvalidOperationException with message like "Invalid lvalue for assignment: {0}." - /// - internal static Exception InvalidLvalue(object p0) { - return new InvalidOperationException(Strings.InvalidLvalue(p0)); - } - - /// - /// InvalidOperationException with message like "Invalid member type: {0}." - /// - internal static Exception InvalidMemberType(object p0) { - return new InvalidOperationException(Strings.InvalidMemberType(p0)); - } - - /// - /// InvalidOperationException with message like "unknown lift type: '{0}'." - /// - internal static Exception UnknownLiftType(object p0) { - return new InvalidOperationException(Strings.UnknownLiftType(p0)); - } - - /// - /// ArgumentException with message like "Invalid output directory." - /// - internal static Exception InvalidOutputDir() { - return new ArgumentException(Strings.InvalidOutputDir); - } - - /// - /// ArgumentException with message like "Invalid assembly name or file extension." - /// - internal static Exception InvalidAsmNameOrExtension() { - return new ArgumentException(Strings.InvalidAsmNameOrExtension); - } - - /// - /// NotSupportedException with message like "Collection is read-only." - /// - internal static Exception CollectionReadOnly() { - return new NotSupportedException(Strings.CollectionReadOnly); - } - - /// - /// ArgumentException with message like "Cannot create instance of {0} because it contains generic parameters" - /// - internal static Exception IllegalNewGenericParams(object p0) { - return new ArgumentException(Strings.IllegalNewGenericParams(p0)); - } - - /// - /// InvalidOperationException with message like "variable '{0}' of type '{1}' referenced from scope '{2}', but it is not defined" - /// - internal static Exception UndefinedVariable(object p0, object p1, object p2) { - return new InvalidOperationException(Strings.UndefinedVariable(p0, p1, p2)); - } - - /// - /// InvalidOperationException with message like "Cannot close over byref parameter '{0}' referenced in lambda '{1}'" - /// - internal static Exception CannotCloseOverByRef(object p0, object p1) { - return new InvalidOperationException(Strings.CannotCloseOverByRef(p0, p1)); - } - - /// - /// InvalidOperationException with message like "Unexpected VarArgs call to method '{0}'" - /// - internal static Exception UnexpectedVarArgsCall(object p0) { - return new InvalidOperationException(Strings.UnexpectedVarArgsCall(p0)); - } - - /// - /// InvalidOperationException with message like "Rethrow statement is valid only inside a Catch block." - /// - internal static Exception RethrowRequiresCatch() { - return new InvalidOperationException(Strings.RethrowRequiresCatch); - } - - /// - /// InvalidOperationException with message like "Try expression is not allowed inside a filter body." - /// - internal static Exception TryNotAllowedInFilter() { - return new InvalidOperationException(Strings.TryNotAllowedInFilter); - } - - /// - /// InvalidOperationException with message like "When called from '{0}', rewriting a node of type '{1}' must return a non-null value of the same type. Alternatively, override '{2}' and change it to not visit children of this type." - /// - internal static Exception MustRewriteToSameNode(object p0, object p1, object p2) { - return new InvalidOperationException(Strings.MustRewriteToSameNode(p0, p1, p2)); - } - - /// - /// InvalidOperationException with message like "Rewriting child expression from type '{0}' to type '{1}' is not allowed, because it would change the meaning of the operation. If this is intentional, override '{2}' and change it to allow this rewrite." - /// - internal static Exception MustRewriteChildToSameType(object p0, object p1, object p2) { - return new InvalidOperationException(Strings.MustRewriteChildToSameType(p0, p1, p2)); - } - - /// - /// InvalidOperationException with message like "Rewritten expression calls operator method '{0}', but the original node had no operator method. If this is is intentional, override '{1}' and change it to allow this rewrite." - /// - internal static Exception MustRewriteWithoutMethod(object p0, object p1) { - return new InvalidOperationException(Strings.MustRewriteWithoutMethod(p0, p1)); - } - - /// - /// NotSupportedException with message like "TryExpression is not supported as an argument to method '{0}' because it has an argument with by-ref type. Construct the tree so the TryExpression is not nested inside of this expression." - /// - internal static Exception TryNotSupportedForMethodsWithRefArgs(object p0) { - return new NotSupportedException(Strings.TryNotSupportedForMethodsWithRefArgs(p0)); - } - - /// - /// NotSupportedException with message like "TryExpression is not supported as a child expression when accessing a member on type '{0}' because it is a value type. Construct the tree so the TryExpression is not nested inside of this expression." - /// - internal static Exception TryNotSupportedForValueTypeInstances(object p0) { - return new NotSupportedException(Strings.TryNotSupportedForValueTypeInstances(p0)); - } - - /// - /// InvalidOperationException with message like "Collection was modified; enumeration operation may not execute." - /// - internal static Exception CollectionModifiedWhileEnumerating() { - return new InvalidOperationException(Strings.CollectionModifiedWhileEnumerating); - } - - /// - /// InvalidOperationException with message like "Enumeration has either not started or has already finished." - /// - internal static Exception EnumerationIsDone() { - return new InvalidOperationException(Strings.EnumerationIsDone); - } - - /// - /// InvalidOperationException with message like "Dynamic operations can only be performed in homogenous AppDomain." - /// - internal static Exception HomogenousAppDomainRequired() { - return new InvalidOperationException(Strings.HomogenousAppDomainRequired); - } - - /// - /// ArgumentException with message like "Test value of type '{0}' cannot be used for the comparison method parameter of type '{1}'" - /// - internal static Exception TestValueTypeDoesNotMatchComparisonMethodParameter(object p0, object p1) { - return new ArgumentException(Strings.TestValueTypeDoesNotMatchComparisonMethodParameter(p0, p1)); - } - - /// - /// ArgumentException with message like "Switch value of type '{0}' cannot be used for the comparison method parameter of type '{1}'" - /// - internal static Exception SwitchValueTypeDoesNotMatchComparisonMethodParameter(object p0, object p1) { - return new ArgumentException(Strings.SwitchValueTypeDoesNotMatchComparisonMethodParameter(p0, p1)); - } - - /// - /// InvalidOperationException with message like "An IDynamicMetaObjectProvider {0} created an invalid DynamicMetaObject instance." - /// - internal static Exception InvalidMetaObjectCreated(object p0) { - return new InvalidOperationException(Strings.InvalidMetaObjectCreated(p0)); - } - - /// - /// NotSupportedException with message like "DebugInfoGenerator created by CreatePdbGenerator can only be used with LambdaExpression.CompileToMethod." - /// - internal static Exception PdbGeneratorNeedsExpressionCompiler() { - return new NotSupportedException(Strings.PdbGeneratorNeedsExpressionCompiler); - } - - } - - // *** END GENERATED CODE *** - - #endregion - -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Extension.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Extension.cs deleted file mode 100644 index 81a0312c6bb..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Extension.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; - -namespace System.Runtime.CompilerServices -{ - /// - /// Indicates that a method is an extension method, or that a class or assembly contains extension methods. - /// - [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class | AttributeTargets.Assembly)] - public sealed class ExtensionAttribute : Attribute { } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Function.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Function.cs deleted file mode 100644 index c33521a254b..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Function.cs +++ /dev/null @@ -1,649 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_FUNCS_5_16 -#if !FEATURE_CORE_DLR -namespace Microsoft.Scripting.Utils { -#else -namespace System { -#endif - - #region Generated Func Types - - // *** BEGIN GENERATED CODE *** - // generated by function: gen_func_types from: generate_dynsites.py - -#if !FEATURE_VARIANCE - - /// - /// Encapsulates a method that has five parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5); - - /// - /// Encapsulates a method that has six parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6); - - /// - /// Encapsulates a method that has seven parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7); - - /// - /// Encapsulates a method that has eight parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8); - - /// - /// Encapsulates a method that has nine parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9); - - /// - /// Encapsulates a method that has ten parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10); - - /// - /// Encapsulates a method that has eleven parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11); - - /// - /// Encapsulates a method that has twelve parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12); - - /// - /// Encapsulates a method that has thirteen parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13); - - /// - /// Encapsulates a method that has fourteen parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14); - - /// - /// Encapsulates a method that has fifteen parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the fifteenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The fifteenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15); - - /// - /// Encapsulates a method that has sixteen parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the fifteenth parameter of the method that this delegate encapsulates. - /// The type of the sixteenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The fifteenth parameter of the method that this delegate encapsulates. - /// The sixteenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16); -#else - - /// - /// Encapsulates a method that has nine parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9); - - /// - /// Encapsulates a method that has ten parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10); - - /// - /// Encapsulates a method that has eleven parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11); - - /// - /// Encapsulates a method that has twelve parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12); - - /// - /// Encapsulates a method that has thirteen parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13); - - /// - /// Encapsulates a method that has fourteen parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14); - - /// - /// Encapsulates a method that has fifteen parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the fifteenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The fifteenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15); - - /// - /// Encapsulates a method that has sixteen parameters and returns a value of the type specified by the TResult parameter. - /// - /// The type of the first parameter of the method that this delegate encapsulates. - /// The type of the second parameter of the method that this delegate encapsulates. - /// The type of the third parameter of the method that this delegate encapsulates. - /// The type of the fourth parameter of the method that this delegate encapsulates. - /// The type of the fifth parameter of the method that this delegate encapsulates. - /// The type of the sixth parameter of the method that this delegate encapsulates. - /// The type of the seventh parameter of the method that this delegate encapsulates. - /// The type of the eighth parameter of the method that this delegate encapsulates. - /// The type of the ninth parameter of the method that this delegate encapsulates. - /// The type of the tenth parameter of the method that this delegate encapsulates. - /// The type of the eleventh parameter of the method that this delegate encapsulates. - /// The type of the twelfth parameter of the method that this delegate encapsulates. - /// The type of the thirteenth parameter of the method that this delegate encapsulates. - /// The type of the fourteenth parameter of the method that this delegate encapsulates. - /// The type of the fifteenth parameter of the method that this delegate encapsulates. - /// The type of the sixteenth parameter of the method that this delegate encapsulates. - /// The type of the return value of the method that this delegate encapsulates. - /// The first parameter of the method that this delegate encapsulates. - /// The second parameter of the method that this delegate encapsulates. - /// The third parameter of the method that this delegate encapsulates. - /// The fourth parameter of the method that this delegate encapsulates. - /// The fifth parameter of the method that this delegate encapsulates. - /// The sixth parameter of the method that this delegate encapsulates. - /// The seventh parameter of the method that this delegate encapsulates. - /// The eighth parameter of the method that this delegate encapsulates. - /// The ninth parameter of the method that this delegate encapsulates. - /// The tenth parameter of the method that this delegate encapsulates. - /// The eleventh parameter of the method that this delegate encapsulates. - /// The twelfth parameter of the method that this delegate encapsulates. - /// The thirteenth parameter of the method that this delegate encapsulates. - /// The fourteenth parameter of the method that this delegate encapsulates. - /// The fifteenth parameter of the method that this delegate encapsulates. - /// The sixteenth parameter of the method that this delegate encapsulates. - /// The return value of the method that this delegate encapsulates. - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1005:AvoidExcessiveParametersOnGenericTypes")] - public delegate TResult Func(T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8, T9 arg9, T10 arg10, T11 arg11, T12 arg12, T13 arg13, T14 arg14, T15 arg15, T16 arg16); - -#endif - - // *** END GENERATED CODE *** - - #endregion -} -#endif diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Helpers.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Helpers.cs deleted file mode 100644 index d8827d16968..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/Helpers.cs +++ /dev/null @@ -1,53 +0,0 @@ - -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -using Microsoft.Scripting.Utils; -#else -using System.Linq.Expressions; -#endif - -using System.Collections.Generic; - -namespace System.Dynamic.Utils { - // Miscellaneous helpers that don't belong anywhere else - internal static class Helpers { - - internal static T CommonNode(T first, T second, Func parent) where T : class { - var cmp = EqualityComparer.Default; - if (cmp.Equals(first, second)) { - return first; - } - var set = new Set(cmp); - for (T t = first; t != null; t = parent(t)) { - set.Add(t); - } - for (T t = second; t != null; t = parent(t)) { - if (set.Contains(t)) { - return t; - } - } - return null; - } - - internal static void IncrementCount(T key, Dictionary dict) { - int count; - dict.TryGetValue(key, out count); - dict[key] = count + 1; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/IRuntimeVariables.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/IRuntimeVariables.cs deleted file mode 100644 index 126763ea03f..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/IRuntimeVariables.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -namespace System.Runtime.CompilerServices { - /// - /// An interface to represent values of runtime variables. - /// - public interface IRuntimeVariables { - /// - /// Count of the variables. - /// - int Count { get; } - - /// - /// An indexer to get/set the values of the runtime variables. - /// - /// An index of the runtime variable. - /// The value of the runtime variable. - object this[int index] { get; set; } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyCollectionBuilder.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyCollectionBuilder.cs deleted file mode 100644 index c5bb77cc03e..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyCollectionBuilder.cs +++ /dev/null @@ -1,523 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif -#if SILVERLIGHT -using System.Core; -#endif - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Dynamic.Utils; - -namespace System.Runtime.CompilerServices { - /// - /// The builder for read only collection. - /// - /// The type of the collection element. - [Serializable] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix")] - public sealed class ReadOnlyCollectionBuilder : IList, System.Collections.IList { - private const int DefaultCapacity = 4; - - private T[] _items; - private int _size; - private int _version; - - [NonSerialized] - private Object _syncRoot; - - static readonly T[] _emptyArray = new T[0]; - - /// - /// Constructs a ReadOnlyCollectionBuilder. - /// - public ReadOnlyCollectionBuilder() { - _items = _emptyArray; - } - - /// - /// Constructs a ReadOnlyCollectionBuilder with a given initial capacity. - /// The contents are empty but builder will have reserved room for the given - /// number of elements before any reallocations are required. - /// - public ReadOnlyCollectionBuilder(int capacity) { - ContractUtils.Requires(capacity >= 0, "capacity"); - _items = new T[capacity]; - } - - /// - /// Constructs a ReadOnlyCollectionBuilder, copying contents of the given collection. - /// - /// - public ReadOnlyCollectionBuilder(IEnumerable collection) { - ContractUtils.Requires(collection != null, "collection"); - - ICollection c = collection as ICollection; - if (c != null) { - int count = c.Count; - _items = new T[count]; - c.CopyTo(_items, 0); - _size = count; - } else { - _size = 0; - _items = new T[DefaultCapacity]; - - using (IEnumerator en = collection.GetEnumerator()) { - while (en.MoveNext()) { - Add(en.Current); - } - } - } - } - - /// - /// Gets and sets the capacity of this ReadOnlyCollectionBuilder - /// - public int Capacity { - get { return _items.Length; } - set { - ContractUtils.Requires(value >= _size, "value"); - - if (value != _items.Length) { - if (value > 0) { - T[] newItems = new T[value]; - if (_size > 0) { - Array.Copy(_items, 0, newItems, 0, _size); - } - _items = newItems; - } else { - _items = _emptyArray; - } - } - } - } - - /// - /// Returns number of elements in the ReadOnlyCollectionBuilder. - /// - public int Count { - get { return _size; } - } - - #region IList Members - - /// - /// Returns the index of the first occurrence of a given value in the builder. - /// - /// An item to search for. - /// The index of the first occurrence of an item. - public int IndexOf(T item) { - return Array.IndexOf(_items, item, 0, _size); - } - - /// - /// Inserts an item to the at the specified index. - /// - /// The zero-based index at which item should be inserted. - /// The object to insert into the . - public void Insert(int index, T item) { - ContractUtils.Requires(index <= _size, "index"); - - if (_size == _items.Length) { - EnsureCapacity(_size + 1); - } - if (index < _size) { - Array.Copy(_items, index, _items, index + 1, _size - index); - } - _items[index] = item; - _size++; - _version++; - } - - /// - /// Removes the item at the specified index. - /// - /// The zero-based index of the item to remove. - public void RemoveAt(int index) { - ContractUtils.Requires(index >= 0 && index < _size, "index"); - - _size--; - if (index < _size) { - Array.Copy(_items, index + 1, _items, index, _size - index); - } - _items[_size] = default(T); - _version++; - } - - /// - /// Gets or sets the element at the specified index. - /// - /// The zero-based index of the element to get or set. - /// The element at the specified index. - public T this[int index] { - get { - ContractUtils.Requires(index < _size, "index"); - return _items[index]; - } - set { - ContractUtils.Requires(index < _size, "index"); - _items[index] = value; - _version++; - } - } - - #endregion - - #region ICollection Members - - /// - /// Adds an item to the . - /// - /// The object to add to the . - public void Add(T item) { - if (_size == _items.Length) { - EnsureCapacity(_size + 1); - } - _items[_size++] = item; - _version++; - } - - /// - /// Removes all items from the . - /// - public void Clear() { - if (_size > 0) { - Array.Clear(_items, 0, _size); - _size = 0; - } - _version++; - } - - /// - /// Determines whether the contains a specific value - /// - /// the object to locate in the . - /// true if item is found in the ; otherwise, false. - public bool Contains(T item) { - if ((Object)item == null) { - for (int i = 0; i < _size; i++) { - if ((Object)_items[i] == null) { - return true; - } - } - return false; - } else { - EqualityComparer c = EqualityComparer.Default; - for (int i = 0; i < _size; i++) { - if (c.Equals(_items[i], item)) { - return true; - } - } - return false; - } - } - - /// - /// Copies the elements of the to an , - /// starting at particular index. - /// - /// The one-dimensional that is the destination of the elements copied from . - /// The zero-based index in array at which copying begins. - public void CopyTo(T[] array, int arrayIndex) { - Array.Copy(_items, 0, array, arrayIndex, _size); - } - - bool ICollection.IsReadOnly { - get { return false; } - } - - /// - /// Removes the first occurrence of a specific object from the . - /// - /// The object to remove from the . - /// true if item was successfully removed from the ; - /// otherwise, false. This method also returns false if item is not found in the original . - /// - public bool Remove(T item) { - int index = IndexOf(item); - if (index >= 0) { - RemoveAt(index); - return true; - } - - return false; - } - - #endregion - - #region IEnumerable Members - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// A that can be used to iterate through the collection. - public IEnumerator GetEnumerator() { - return new Enumerator(this); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return GetEnumerator(); - } - - #endregion - - #region IList Members - - bool System.Collections.IList.IsReadOnly { - get { return false; } - } - - int System.Collections.IList.Add(object value) { - ValidateNullValue(value, "value"); - try { - Add((T)value); - } catch (InvalidCastException) { - ThrowInvalidTypeException(value, "value"); - } - return Count - 1; - } - - bool System.Collections.IList.Contains(object value) { - if (IsCompatibleObject(value)) { - return Contains((T)value); - } else return false; - } - - int System.Collections.IList.IndexOf(object value) { - if (IsCompatibleObject(value)) { - return IndexOf((T)value); - } - return -1; - } - - void System.Collections.IList.Insert(int index, object value) { - ValidateNullValue(value, "value"); - try { - Insert(index, (T)value); - } catch (InvalidCastException) { - ThrowInvalidTypeException(value, "value"); - } - } - - bool System.Collections.IList.IsFixedSize { - get { return false; } - } - - void System.Collections.IList.Remove(object value) { - if (IsCompatibleObject(value)) { - Remove((T)value); - } - } - - object System.Collections.IList.this[int index] { - get { - return this[index]; - } - set { - ValidateNullValue(value, "value"); - - try { - this[index] = (T)value; - } catch (InvalidCastException) { - ThrowInvalidTypeException(value, "value"); - } - } - } - - #endregion - - #region ICollection Members - - void System.Collections.ICollection.CopyTo(Array array, int index) { - ContractUtils.RequiresNotNull(array, "array"); - ContractUtils.Requires(array.Rank == 1, "array"); - Array.Copy(_items, 0, array, index, _size); - } - - bool System.Collections.ICollection.IsSynchronized { - get { return false; } - } - - object System.Collections.ICollection.SyncRoot { - get { - if (_syncRoot == null) { - System.Threading.Interlocked.CompareExchange(ref _syncRoot, new Object(), null); - } - return _syncRoot; - } - } - - #endregion - - /// - /// Reverses the order of the elements in the entire . - /// - public void Reverse() { - Reverse(0, Count); - } - - /// - /// Reverses the order of the elements in the specified range. - /// - /// The zero-based starting index of the range to reverse. - /// The number of elements in the range to reverse. - public void Reverse(int index, int count) { - ContractUtils.Requires(index >= 0, "index"); - ContractUtils.Requires(count >= 0, "count"); - - Array.Reverse(_items, index, count); - _version++; - } - - /// - /// Copies the elements of the to a new array. - /// - /// An array containing copies of the elements of the . - public T[] ToArray() { - T[] array = new T[_size]; - Array.Copy(_items, 0, array, 0, _size); - return array; - } - - /// - /// Creates a containing all of the the elements of the , - /// avoiding copying the elements to the new array if possible. Resets the after the - /// has been created. - /// - /// A new instance of . - public ReadOnlyCollection ToReadOnlyCollection() { - // Can we use the stored array? - T[] items; - if (_size == _items.Length) { - items = _items; - } else { - items = ToArray(); - } - _items = _emptyArray; - _size = 0; - _version++; - - return new TrueReadOnlyCollection(items); - } - - private void EnsureCapacity(int min) { - if (_items.Length < min) { - int newCapacity = DefaultCapacity; - if (_items.Length > 0) { - newCapacity = _items.Length * 2; - } - if (newCapacity < min) { - newCapacity = min; - } - Capacity = newCapacity; - } - } - - private static bool IsCompatibleObject(object value) { - return ((value is T) || (value == null && default(T) == null)); - } - - private static void ValidateNullValue(object value, string argument) { - if (value == null && !(default(T) == null)) { - throw new ArgumentException(Strings.InvalidNullValue(typeof(T)), argument); - } - } - - private static void ThrowInvalidTypeException(object value, string argument) { - throw new ArgumentException(Strings.InvalidObjectType(value != null ? value.GetType() : (object)"null", typeof(T)), argument); - } - - [Serializable] - private class Enumerator : IEnumerator, System.Collections.IEnumerator { - private readonly ReadOnlyCollectionBuilder _builder; - private readonly int _version; - - private int _index; - private T _current; - - internal Enumerator(ReadOnlyCollectionBuilder builder) { - _builder = builder; - _version = builder._version; - _index = 0; - _current = default(T); - } - - #region IEnumerator Members - - public T Current { - get { return _current; } - } - - #endregion - - #region IDisposable Members - - public void Dispose() { - GC.SuppressFinalize(this); - } - - #endregion - - #region IEnumerator Members - - object System.Collections.IEnumerator.Current { - get { - if (_index == 0 || _index > _builder._size) { - throw Error.EnumerationIsDone(); - } - return _current; - } - } - - public bool MoveNext() { - if (_version == _builder._version) { - if (_index < _builder._size) { - _current = _builder._items[_index++]; - return true; - } else { - _index = _builder._size + 1; - _current = default(T); - return false; - } - } else { - throw Error.CollectionModifiedWhileEnumerating(); - } - } - - #endregion - - #region IEnumerator Members - - void System.Collections.IEnumerator.Reset() { - if (_version != _builder._version) { - throw Error.CollectionModifiedWhileEnumerating(); - } - _index = 0; - _current = default(T); - } - - #endregion - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyDictionary.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyDictionary.cs deleted file mode 100644 index 33194716d1f..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReadOnlyDictionary.cs +++ /dev/null @@ -1,203 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if !FEATURE_CORE_DLR -using Microsoft.Scripting.Ast; -#else -using System.Linq.Expressions; -#endif -#if SILVERLIGHT -using System.Core; -#endif - -using System.Collections.Generic; - -namespace System.Dynamic.Utils { - - // Like ReadOnlyCollection: wraps an IDictionary in a read-only wrapper - internal sealed class ReadOnlyDictionary : IDictionary { - - // For wrapping non-readonly Keys, Values collections - // Not used for standard dictionaries, which return read-only Keys and Values - private sealed class ReadOnlyWrapper : ICollection { - // no idea why this warning is here - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1823:AvoidUnusedPrivateFields")] - private readonly ICollection _collection; - - internal ReadOnlyWrapper(ICollection collection) { - _collection = collection; - } - - #region ICollection Members - - public void Add(T item) { - throw Error.CollectionReadOnly(); - } - - public void Clear() { - throw Error.CollectionReadOnly(); - } - - public bool Contains(T item) { - return _collection.Contains(item); - } - - public void CopyTo(T[] array, int arrayIndex) { - _collection.CopyTo(array, arrayIndex); - } - - public int Count { - get { return _collection.Count; } - } - - public bool IsReadOnly { - get { return true; } - } - - public bool Remove(T item) { - throw Error.CollectionReadOnly(); - } - - #endregion - - #region IEnumerable Members - - public IEnumerator GetEnumerator() { - return _collection.GetEnumerator(); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return _collection.GetEnumerator(); - } - - #endregion - } - - private readonly IDictionary _dict; - - internal ReadOnlyDictionary(IDictionary dict) { - ReadOnlyDictionary rodict = dict as ReadOnlyDictionary; - _dict = (rodict != null) ? rodict._dict : dict; - } - - #region IDictionary Members - - public bool ContainsKey(K key) { - return _dict.ContainsKey(key); - } - - public ICollection Keys { - get { - ICollection keys = _dict.Keys; - if (!keys.IsReadOnly) { - return new ReadOnlyWrapper(keys); - } - return keys; - } - } - - public bool TryGetValue(K key, out V value) { - return _dict.TryGetValue(key, out value); - } - - public ICollection Values { - get { - ICollection values = _dict.Values; - if (!values.IsReadOnly) { - return new ReadOnlyWrapper(values); - } - return values; - } - } - - public V this[K key] { - get { - return _dict[key]; - } - } - - - void IDictionary.Add(K key, V value) { - throw Error.CollectionReadOnly(); - } - - bool IDictionary.Remove(K key) { - throw Error.CollectionReadOnly(); - } - - V IDictionary.this[K key] { - get { - return _dict[key]; - } - set { - throw Error.CollectionReadOnly(); - } - } - - #endregion - - #region ICollection> Members - - public bool Contains(KeyValuePair item) { - return _dict.Contains(item); - } - - public void CopyTo(KeyValuePair[] array, int arrayIndex) { - _dict.CopyTo(array, arrayIndex); - } - - public int Count { - get { return _dict.Count; } - } - - public bool IsReadOnly { - get { return true; } - } - - void ICollection>.Add(KeyValuePair item) { - throw Error.CollectionReadOnly(); - } - - void ICollection>.Clear() { - throw Error.CollectionReadOnly(); - } - - bool ICollection>.Remove(KeyValuePair item) { - throw Error.CollectionReadOnly(); - } - - #endregion - - #region IEnumerable> Members - - public IEnumerator> GetEnumerator() { - return _dict.GetEnumerator(); - } - - #endregion - - #region IEnumerable Members - - System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { - return _dict.GetEnumerator(); - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReferenceEqualityComparer.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReferenceEqualityComparer.cs deleted file mode 100644 index 6b7d1fc1e68..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReferenceEqualityComparer.cs +++ /dev/null @@ -1,34 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections.Generic; -using System.Runtime.CompilerServices; - -namespace System.Dynamic.Utils { - internal sealed class ReferenceEqualityComparer : IEqualityComparer { - internal static readonly ReferenceEqualityComparer Instance = new ReferenceEqualityComparer(); - - private ReferenceEqualityComparer() { } - - public bool Equals(T x, T y) { - return object.ReferenceEquals(x, y); - } - - public int GetHashCode(T obj) { - // CF RH.GetHashCode throws NullReferenceException if the argument is null - return obj != null ? RuntimeHelpers.GetHashCode(obj) : 0; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReflectionUtils.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReflectionUtils.cs deleted file mode 100644 index a4df5d651b5..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/ReflectionUtils.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System; - -namespace Microsoft.Scripting.Utils { - internal static class ReflectionUtils { - public static readonly Type[] EmptyTypes = new Type[0]; - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/StrongBox.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/StrongBox.cs deleted file mode 100644 index baee2988755..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/StrongBox.cs +++ /dev/null @@ -1,63 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -namespace System.Runtime.CompilerServices { - - /// - /// Holds a reference to a value. - /// - /// The type of the value that the references. - public class StrongBox : IStrongBox { - /// - /// Gets the strongly typed value associated with the - /// This is explicitly exposed as a field instead of a property to enable loading the address of the field. - /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")] - public T Value; - - /// - /// Initializes a new StrongBox which can receive a value when used in a reference call. - /// - public StrongBox() { - } - - /// - /// Initializes a new with the specified value. - /// - /// A value that the will reference. - public StrongBox(T value) { - Value = value; - } - - object IStrongBox.Value { - get { - return Value; - } - set { - Value = (T)value; - } - } - } - - /// - /// Defines a property for accessing the value that an object references. - /// - public interface IStrongBox { - /// - /// Gets or sets the value the object references. - /// - object Value { get; set; } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TrueReadOnlyCollection.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TrueReadOnlyCollection.cs deleted file mode 100644 index fc0ed6b3676..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TrueReadOnlyCollection.cs +++ /dev/null @@ -1,30 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Dynamic.Utils; - -namespace System.Runtime.CompilerServices { - sealed class TrueReadOnlyCollection : ReadOnlyCollection { - /// - /// Creates instnace of TrueReadOnlyCollection, wrapping passed in array. - /// !!! DOES NOT COPY THE ARRAY !!! - /// - internal TrueReadOnlyCollection(T[] list) - : base(list) { - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs deleted file mode 100644 index 5b219237f66..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting.Core/Utils/TypeExtensions.cs +++ /dev/null @@ -1,114 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System.Diagnostics; -using System.Reflection; -#if FEATURE_REFEMIT -using System.Reflection.Emit; -#endif -using System.Text; - -namespace System.Dynamic.Utils { - - // Extensions on System.Type and friends - internal static class TypeExtensions { - - /// - /// Creates a closed delegate for the given (dynamic)method. - /// - internal static Delegate CreateDelegate(this MethodInfo methodInfo, Type delegateType, object target) { - Debug.Assert(methodInfo != null && delegateType != null); -#if FEATURE_REFEMIT - var dm = methodInfo as DynamicMethod; - if (dm != null) - return dm.CreateDelegate(delegateType, target); -#endif - return Delegate.CreateDelegate(delegateType, target, methodInfo); - } - - internal static Type GetReturnType(this MethodBase mi) { - return (mi.IsConstructor) ? mi.DeclaringType : ((MethodInfo)mi).ReturnType; - } - - private static readonly CacheDict _ParamInfoCache = new CacheDict(75); - - internal static ParameterInfo[] GetParametersCached(this MethodBase method) { - ParameterInfo[] pis; - lock (_ParamInfoCache) { - if (!_ParamInfoCache.TryGetValue(method, out pis)) { - pis = method.GetParameters(); - - Type t = method.DeclaringType; - if (t != null && TypeUtils.CanCache(t)) { - _ParamInfoCache[method] = pis; - } - } - } - return pis; - } - - // Expression trees/compiler just use IsByRef, why do we need this? - // (see LambdaCompiler.EmitArguments for usage in the compiler) - internal static bool IsByRefParameter(this ParameterInfo pi) { - // not using IsIn/IsOut properties as they are not available in Silverlight: - if (pi.ParameterType.IsByRef) return true; - - return (pi.Attributes & (ParameterAttributes.Out)) == ParameterAttributes.Out; - } - - // Returns the matching method if the parameter types are reference - // assignable from the provided type arguments, otherwise null. - internal static MethodInfo GetMethodValidated( - this Type type, - string name, - BindingFlags bindingAttr, - Binder binder, - Type[] types, - ParameterModifier[] modifiers) { - - var method = type.GetMethod(name, bindingAttr, binder, types, modifiers); - - return method.MatchesArgumentTypes(types) ? method : null; - } - - /// - /// Returns true if the method's parameter types are reference assignable from - /// the argument types, otherwise false. - /// - /// An example that can make the method return false is that - /// typeof(double).GetMethod("op_Equality", ..., new[] { typeof(double), typeof(int) }) - /// returns a method with two double parameters, which doesn't match the provided - /// argument types. - /// - /// - private static bool MatchesArgumentTypes(this MethodInfo mi, Type[] argTypes) { - if (mi == null || argTypes == null) { - return false; - } - var ps = mi.GetParameters(); - - if (ps.Length != argTypes.Length) { - return false; - } - - for (int i = 0; i < ps.Length; i++) { - if (!TypeUtils.AreReferenceAssignable(ps[i].ParameterType, argTypes[i])) { - return false; - } - } - return true; - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting/ArgumentTypeException.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting/ArgumentTypeException.cs deleted file mode 100644 index 5d1e9e2d726..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting/ArgumentTypeException.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Runtime.Serialization; - -namespace Microsoft.Scripting { - [Serializable] - public class ArgumentTypeException : Exception { - public ArgumentTypeException() - : base() { - } - - public ArgumentTypeException(string message) - : base(message) { - } - - public ArgumentTypeException(string message, Exception innerException) - : base(message, innerException) { - } - -#if FEATURE_SERIALIZATION - protected ArgumentTypeException(SerializationInfo info, StreamingContext context) : base(info, context) { } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting/InvalidImplementationException.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting/InvalidImplementationException.cs deleted file mode 100644 index dff8c291a41..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting/InvalidImplementationException.cs +++ /dev/null @@ -1,38 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; -using System.Runtime.Serialization; - -namespace Microsoft.Scripting { - [Serializable] - public class InvalidImplementationException : Exception { - public InvalidImplementationException() - : base() { - } - - public InvalidImplementationException(string message) - : base(message) { - } - - public InvalidImplementationException(string message, Exception e) - : base(message, e) { - } - -#if FEATURE_SERIALIZATION - protected InvalidImplementationException(SerializationInfo info, StreamingContext context) : base(info, context) { } -#endif - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting/PlatformAdaptationLayer.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting/PlatformAdaptationLayer.cs deleted file mode 100644 index 4659f3d0f39..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting/PlatformAdaptationLayer.cs +++ /dev/null @@ -1,476 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if FEATURE_CORE_DLR -using System.Linq.Expressions; -#else -using Microsoft.Scripting.Ast; -#endif - -using System; -using System.Collections.Generic; -using System.IO; -using System.Reflection; -using System.Runtime.InteropServices; -using System.Security; -using Microsoft.Scripting.Utils; -using System.Runtime.CompilerServices; -using System.Collections; - -namespace Microsoft.Scripting { - -#if !FEATURE_PROCESS - public class ExitProcessException : Exception { - - public int ExitCode { get { return exitCode; } } - int exitCode; - - public ExitProcessException(int exitCode) { - this.exitCode = exitCode; - } - } -#endif - - /// - /// Abstracts system operations that are used by DLR and could potentially be platform specific. - /// The host can implement its PAL to adapt DLR to the platform it is running on. - /// For example, the Silverlight host adapts some file operations to work against files on the server. - /// - [Serializable] - public class PlatformAdaptationLayer { - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2104:DoNotDeclareReadOnlyMutableReferenceTypes")] - public static readonly PlatformAdaptationLayer Default = new PlatformAdaptationLayer(); - -#if MONO_INTERPRETER - public const bool IsCompactFramework = false; -#else - public static readonly bool IsCompactFramework = -#if WIN8 - false; -#else - Environment.OSVersion.Platform == PlatformID.WinCE || - Environment.OSVersion.Platform == PlatformID.Xbox; -#endif - -#endif - -#if SILVERLIGHT - - // this dictionary is readonly after initialization: - private Dictionary _assemblyFullNames = new Dictionary(); - - public PlatformAdaptationLayer() { - LoadSilverlightAssemblyNameMapping(); - } - - // TODO: remove the need for this - private void LoadSilverlightAssemblyNameMapping() { - // non-trasparent assemblies - AssemblyName platformKeyVer = new AssemblyName(typeof(object).Assembly.FullName); - AddAssemblyMappings(platformKeyVer, - "mscorlib", - "System", - "System.Core", - "System.Net", - "System.Runtime.Serialization", - "System.ServiceModel.Web", - "System.Windows", - "System.Windows.Browser", - "System.Xml", - "Microsoft.VisualBasic" - ); - - // DLR + language assemblies - AssemblyName languageKeyVer = new AssemblyName(typeof(PlatformAdaptationLayer).Assembly.FullName); - AddAssemblyMappings(languageKeyVer, - "Microsoft.Scripting", - "Microsoft.Dynamic", - "Microsoft.Scripting.Core", - "Microsoft.Scripting.Silverlight", - "IronPython", - "IronPython.Modules", - "IronRuby", - "IronRuby.Libraries" - ); - - // transparent assemblies => same version as mscorlib but uses transparent key (same as languages) - AssemblyName transparentKeyVer = new AssemblyName(typeof(object).Assembly.FullName); - transparentKeyVer.SetPublicKeyToken(languageKeyVer.GetPublicKeyToken()); - AddAssemblyMappings(transparentKeyVer, - "System.ServiceModel", - "System.ServiceModel.Syndication", - "System.Windows.Controls", - "System.Windows.Controls.Data", - "System.Windows.Controls.Data.Design", - "System.Windows.Controls.Design", - "System.Windows.Controls.Extended", - "System.Windows.Controls.Extended.Design", - "System.Xml.Linq", - "System.Xml.Serialization" - ); - } - - private void AddAssemblyMappings(AssemblyName keyVersion, params string[] names) { - foreach (string asm in names) { - keyVersion.Name = asm; - _assemblyFullNames.Add(asm.ToLower(), keyVersion.FullName); - } - } - - protected string LookupFullName(string name) { - AssemblyName asm = new AssemblyName(name); - if (asm.Version != null || asm.GetPublicKeyToken() != null || asm.GetPublicKey() != null) { - return name; - } - return _assemblyFullNames.ContainsKey(name.ToLower()) ? _assemblyFullNames[name.ToLower()] : name; - } -#endif - #region Assembly Loading - - public virtual Assembly LoadAssembly(string name) { -#if WIN8 - throw new NotImplementedException(); -#elif !SILVERLIGHT - return Assembly.Load(name); -#else - return Assembly.Load(LookupFullName(name)); -#endif - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Reliability", "CA2001:AvoidCallingProblematicMethods", MessageId = "System.Reflection.Assembly.LoadFile")] - public virtual Assembly LoadAssemblyFromPath(string path) { -#if FEATURE_FILESYSTEM - return Assembly.LoadFile(path); -#else - throw new NotImplementedException(); -#endif - } - - public virtual void TerminateScriptExecution(int exitCode) { -#if FEATURE_PROCESS - System.Environment.Exit(exitCode); -#else - throw new ExitProcessException(exitCode); -#endif - } - - #endregion - - #region Virtual File System - - public virtual bool IsSingleRootFileSystem { - get { -#if FEATURE_FILESYSTEM - return Environment.OSVersion.Platform == PlatformID.Unix - || Environment.OSVersion.Platform == PlatformID.MacOSX; -#elif WIN8 - return false; -#else - return true; -#endif - } - } - - public virtual StringComparer PathComparer { - get { -#if FEATURE_FILESYSTEM - return Environment.OSVersion.Platform == PlatformID.Unix ? StringComparer.Ordinal : StringComparer.OrdinalIgnoreCase; -#else - return StringComparer.OrdinalIgnoreCase; -#endif - } - } - - public virtual bool FileExists(string path) { -#if FEATURE_FILESYSTEM - return File.Exists(path); -#else - throw new NotImplementedException(); -#endif - } - - public virtual bool DirectoryExists(string path) { -#if FEATURE_FILESYSTEM - return Directory.Exists(path); -#else - throw new NotImplementedException(); -#endif - } - -#if !CLR2 - // TODO: better APIs - public virtual Stream OpenFileStream(string path, FileMode mode = FileMode.OpenOrCreate, FileAccess access = FileAccess.ReadWrite, FileShare share = FileShare.Read, int bufferSize = 8192) { -#if FEATURE_FILESYSTEM - if (string.Equals("nul", path, StringComparison.InvariantCultureIgnoreCase)) { - return Stream.Null; - } - return new FileStream(path, mode, access, share, bufferSize); -#else - throw new NotImplementedException(); -#endif - } - - // TODO: better APIs - public virtual Stream OpenInputFileStream(string path, FileMode mode = FileMode.Open, FileAccess access = FileAccess.Read, FileShare share = FileShare.Read, int bufferSize = 8192) { - return OpenFileStream(path, mode, access, share, bufferSize); - } - - // TODO: better APIs - public virtual Stream OpenOutputFileStream(string path) { - return OpenFileStream(path, FileMode.Create, FileAccess.Write); - } -#else - public virtual Stream OpenFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize) { -#if FEATURE_FILESYSTEM - if (string.Equals("nul", path, StringComparison.InvariantCultureIgnoreCase)) { - return Stream.Null; - } - return new FileStream(path, mode, access, share, bufferSize); -#else - throw new NotImplementedException(); -#endif - } - - // TODO: better APIs - public virtual Stream OpenInputFileStream(string path, FileMode mode, FileAccess access, FileShare share) { - return OpenFileStream(path, mode, access, share, 8912); - } - - // TODO: better APIs - public virtual Stream OpenInputFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize) { - return OpenFileStream(path, mode, access, share, bufferSize); - } - - // TODO: better APIs - public virtual Stream OpenInputFileStream(string path) { - return OpenFileStream(path, FileMode.Open, FileAccess.Read, FileShare.None, 8912); - } - - // TODO: better APIs - public virtual Stream OpenOutputFileStream(string path) { - return OpenFileStream(path, FileMode.Create, FileAccess.Write, FileShare.None, 8912); - } -#endif - - public virtual void DeleteFile(string path, bool deleteReadOnly) { -#if FEATURE_FILESYSTEM - FileInfo info = new FileInfo(path); -#if !ANDROID - if (deleteReadOnly && info.IsReadOnly) { - info.IsReadOnly = false; - } -#endif - info.Delete(); -#else - throw new NotImplementedException(); -#endif - } - - public string[] GetFiles(string path, string searchPattern) { - return GetFileSystemEntries(path, searchPattern, true, false); - } - - public string[] GetDirectories(string path, string searchPattern) { - return GetFileSystemEntries(path, searchPattern, false, true); - } - - public string[] GetFileSystemEntries(string path, string searchPattern) { - return GetFileSystemEntries(path, searchPattern, true, true); - } - - public virtual string[] GetFileSystemEntries(string path, string searchPattern, bool includeFiles, bool includeDirectories) { -#if FEATURE_FILESYSTEM - if (includeFiles && includeDirectories) { - return Directory.GetFileSystemEntries(path, searchPattern); - } - if (includeFiles) { - return Directory.GetFiles(path, searchPattern); - } - if (includeDirectories) { - return Directory.GetDirectories(path, searchPattern); - } - return ArrayUtils.EmptyStrings; -#else - throw new NotImplementedException(); -#endif - } - - /// Invalid path. - public virtual string GetFullPath(string path) { -#if FEATURE_FILESYSTEM - try { - return Path.GetFullPath(path); - } catch (Exception) { - throw Error.InvalidPath(); - } -#else - throw new NotImplementedException(); -#endif - } - - public virtual string CombinePaths(string path1, string path2) { - return Path.Combine(path1, path2); - } - - public virtual string GetFileName(string path) { - return Path.GetFileName(path); - } - - public virtual string GetDirectoryName(string path) { - return Path.GetDirectoryName(path); - } - - public virtual string GetExtension(string path) { - return Path.GetExtension(path); - } - - public virtual string GetFileNameWithoutExtension(string path) { - return Path.GetFileNameWithoutExtension(path); - } - - /// Invalid path. - public virtual bool IsAbsolutePath(string path) { - if (String.IsNullOrEmpty(path)) { - return false; - } - - // no drives, no UNC: - if (IsSingleRootFileSystem) { - return IsDirectorySeparator(path[0]); - } - - if (IsDirectorySeparator(path[0])) { - // UNC path - return path.Length > 1 && IsDirectorySeparator(path[1]); - } - - if (path.Length > 2 && path[1] == ':' && IsDirectorySeparator(path[2])) { - return true; - } - - return false; - } - -#if FEATURE_FILESYSTEM - private bool IsDirectorySeparator(char c) { - return c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar; - } -#else - private bool IsDirectorySeparator(char c) { - return c == '\\' || c == '/'; - } -#endif - - public virtual string CurrentDirectory { - get { -#if FEATURE_FILESYSTEM - return Directory.GetCurrentDirectory(); -#else - throw new NotImplementedException(); -#endif - } - set { -#if FEATURE_FILESYSTEM - Directory.SetCurrentDirectory(value); -#else - throw new NotImplementedException(); -#endif - } - } - - public virtual void CreateDirectory(string path) { -#if FEATURE_FILESYSTEM - Directory.CreateDirectory(path); -#else - throw new NotImplementedException(); -#endif - } - - public virtual void DeleteDirectory(string path, bool recursive) { -#if FEATURE_FILESYSTEM - Directory.Delete(path, recursive); -#else - throw new NotImplementedException(); -#endif - } - - public virtual void MoveFileSystemEntry(string sourcePath, string destinationPath) { -#if FEATURE_FILESYSTEM - Directory.Move(sourcePath, destinationPath); -#else - throw new NotImplementedException(); -#endif - } - - #endregion - - #region Environmental Variables - - public virtual string GetEnvironmentVariable(string key) { -#if FEATURE_PROCESS - return Environment.GetEnvironmentVariable(key); -#else - throw new NotImplementedException(); -#endif - } - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] - public virtual void SetEnvironmentVariable(string key, string value) { -#if FEATURE_PROCESS - if (value != null && value.Length == 0) { - SetEmptyEnvironmentVariable(key); - } else { - Environment.SetEnvironmentVariable(key, value); - } -#else - throw new NotImplementedException(); -#endif - } - -#if FEATURE_PROCESS - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2201:DoNotRaiseReservedExceptionTypes")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2149:TransparentMethodsMustNotCallNativeCodeFxCopRule")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2140:TransparentMethodsMustNotReferenceCriticalCodeFxCopRule")] - [MethodImpl(MethodImplOptions.NoInlining)] - private static void SetEmptyEnvironmentVariable(string key) { - // System.Environment.SetEnvironmentVariable interprets an empty value string as - // deleting the environment variable. So we use the native SetEnvironmentVariable - // function here which allows setting of the value to an empty string. - // This will require high trust and will fail in sandboxed environments - if (!NativeMethods.SetEnvironmentVariable(key, String.Empty)) { - throw new ExternalException("SetEnvironmentVariable failed", Marshal.GetLastWin32Error()); - } - } -#endif - - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")] - public virtual Dictionary GetEnvironmentVariables() { -#if FEATURE_PROCESS - var result = new Dictionary(); - - foreach (DictionaryEntry entry in Environment.GetEnvironmentVariables()) - { - result.Add((string)entry.Key, (string)entry.Value); - } - - return result; -#else - throw new NotImplementedException(); -#endif - } - - #endregion - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting/Runtime/NotNullAttribute.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting/Runtime/NotNullAttribute.cs deleted file mode 100644 index 43cc1af4653..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting/Runtime/NotNullAttribute.cs +++ /dev/null @@ -1,40 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; - -namespace Microsoft.Scripting.Runtime { - /// - /// This attribute marks a parameter that is not allowed to be null. - /// It is used by the method binding infrastructure to generate better error - /// messages and method selection. - /// - [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] - public sealed class NotNullAttribute : Attribute { - public NotNullAttribute() { - } - } - - /// - /// This attribute marks a parameter whose type is an array that is not allowed to have null items. - /// It is used by the method binding infrastructure to generate better error - /// messages and method selection. - /// - [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] - public sealed class NotNullItemsAttribute : Attribute { - public NotNullItemsAttribute() { - } - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting/Runtime/ParamDictionaryAttribute.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting/Runtime/ParamDictionaryAttribute.cs deleted file mode 100644 index 3f0a081ea1c..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting/Runtime/ParamDictionaryAttribute.cs +++ /dev/null @@ -1,55 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -using System; - -namespace Microsoft.Scripting { - /// - /// This attribute is used to mark a parameter that can accept any keyword parameters that - /// are not bound to normal arguments. The extra keyword parameters will be - /// passed in a dictionary which is created for the call. - /// - /// Most languages which support params dictionaries will support the following types: - /// IDictionary<string, anything> - /// IDictionary<object, anything> - /// Dictionary<string, anything> - /// Dictionary<object, anything> - /// IDictionary - /// IAttributesCollection (deprecated) - /// - /// For languages which don't have language level support the user will be required to - /// create and populate the dictionary by hand. - /// - /// This attribute is the dictionary equivalent of the System.ParamArrayAttribute. - /// - /// - /// public static void KeywordArgFunction([ParamsDictionary]IDictionary<string, object> dict) { - /// foreach (var v in dict) { - /// Console.WriteLine("Key: {0} Value: {1}", v.Key, v.Value); - /// } - /// } - /// - /// Called from Python: - /// - /// KeywordArgFunction(a = 2, b = "abc") - /// - /// will print: - /// Key: a Value = 2 - /// Key: b Value = abc - /// - [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] - public sealed class ParamDictionaryAttribute : Attribute { - } -} diff --git a/mcs/class/dlr/Runtime/Microsoft.Scripting/Stubs.cs b/mcs/class/dlr/Runtime/Microsoft.Scripting/Stubs.cs deleted file mode 100644 index ff378fff15d..00000000000 --- a/mcs/class/dlr/Runtime/Microsoft.Scripting/Stubs.cs +++ /dev/null @@ -1,116 +0,0 @@ -/* **************************************************************************** - * - * Copyright (c) Microsoft Corporation. - * - * This source code is subject to terms and conditions of the Apache License, Version 2.0. A - * copy of the license can be found in the License.html file at the root of this distribution. If - * you cannot locate the Apache License, Version 2.0, please send an email to - * dlr@microsoft.com. By using this source code in any fashion, you are agreeing to be bound - * by the terms of the Apache License, Version 2.0. - * - * You must not remove this notice, or any other, from this software. - * - * - * ***************************************************************************/ - -#if WIN8 - -// When compiled with Dev10 VS CSC reports errors if this is not defined -// error CS0656: Missing compiler required member 'System.Threading.Thread.get_ManagedThreadId' -// error CS0656: Missing compiler required member 'System.Threading.Thread.get_CurrentThread' -namespace System.Threading { - internal class Thread { - public int ManagedThreadId { get { throw new NotImplementedException(); } } - public static Thread CurrentThread { get { throw new NotImplementedException(); } } - } -} - -namespace System.IO { - [Serializable] - public enum FileMode { - CreateNew = 1, - Create, - Open, - OpenOrCreate, - Truncate, - Append - } - - [Serializable] - public enum FileAccess { - Read = 1, - Write = 2, - ReadWrite = 3 - } - - [Serializable] - public enum FileShare { - None = 0, - Read = 1, - Write = 2, - ReadWrite = 3, - Delete = 4, - Inheritable = 16 - } -} -#else -namespace System { - public static class TypeExtensions { -#if !FEATURE_GET_TYPE_INFO - public static Type GetTypeInfo(this Type type) { - return type; - } -#endif - - public static Type AsType(this Type type) { - return type; - } - } -} -#endif - -#if !FEATURE_SERIALIZATION - -namespace System { - using System.Diagnostics; - - [Conditional("STUB")] - public class SerializableAttribute : Attribute { - } - - [Conditional("STUB")] - public class NonSerializedAttribute : Attribute { - } - - namespace Runtime.Serialization { - public interface ISerializable { - } - - public interface IDeserializationCallback { - } - } - - public class SerializationException : Exception { - } -} - -#endif - -#if SILVERLIGHT && !CLR2 - -namespace System { - namespace Runtime.InteropServices { - /// - /// The Default Parameter Value Attribute. - /// - public sealed class DefaultParameterValueAttribute : Attribute { - /// - /// The constructor - /// - /// The value. - public DefaultParameterValueAttribute(object value) { } - } - } -} - -#endif diff --git a/mcs/class/dlr/sync.sh b/mcs/class/dlr/sync.sh deleted file mode 100755 index 133bb21ff31..00000000000 --- a/mcs/class/dlr/sync.sh +++ /dev/null @@ -1,5 +0,0 @@ - -# git clone git://github.com/IronLanguages/main.git - -rsync -r /home/marek/git/dlr/main/Runtime/Microsoft.Dynamic/ Runtime/Microsoft.Dynamic --exclude=".*/" --exclude="*.snk" -rsync -r /home/marek/git/dlr/main/Runtime/Microsoft.Scripting.Core/ Runtime/Microsoft.Scripting.Core --exclude=".*/" --exclude="*.snk" diff --git a/mcs/class/referencesource/System.Core/System/Linq/Expressions/ExpressionVisitor.cs b/mcs/class/referencesource/System.Core/System/Linq/Expressions/ExpressionVisitor.cs index 37eba199ff0..ba677a6eea4 100644 --- a/mcs/class/referencesource/System.Core/System/Linq/Expressions/ExpressionVisitor.cs +++ b/mcs/class/referencesource/System.Core/System/Linq/Expressions/ExpressionVisitor.cs @@ -80,10 +80,14 @@ namespace System.Linq.Expressions { case ExpressionType.ListInit: return this.VisitListInit((ListInitExpression)exp); default: - throw Error.UnhandledExpressionType(exp.NodeType); + throw UnhandledExpressionType(exp.NodeType); } } + static Exception UnhandledExpressionType(object p0) { + return new ArgumentException(string.Format ("Unhandled Expression Type: {0}", p0)); + } + internal virtual MemberBinding VisitBinding(MemberBinding binding) { switch (binding.BindingType) { case MemberBindingType.Assignment: @@ -93,9 +97,13 @@ namespace System.Linq.Expressions { case MemberBindingType.ListBinding: return this.VisitMemberListBinding((MemberListBinding)binding); default: - throw Error.UnhandledBindingType(binding.BindingType); + throw UnhandledBindingType(binding.BindingType); } } + + static Exception UnhandledBindingType(object p0) { + return new ArgumentException(string.Format ("Unhandled Binding Type: {0}", p0)); + } internal virtual ElementInit VisitElementInitializer(ElementInit initializer) { ReadOnlyCollection arguments = this.VisitExpressionList(initializer.Arguments); diff --git a/mcs/class/referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XsltFunctions.cs b/mcs/class/referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XsltFunctions.cs index 473cef5a4d3..3459ae30e46 100644 --- a/mcs/class/referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XsltFunctions.cs +++ b/mcs/class/referencesource/System.Data.SqlXml/System/Xml/Xsl/Runtime/XsltFunctions.cs @@ -291,7 +291,7 @@ namespace System.Xml.Xsl.Runtime { } return d; } - +#if !MONO // CharSet.Auto is needed to work on Windows 98 and Windows Me [DllImport("kernel32.dll", CharSet=CharSet.Auto, BestFitMapping=false)] // SxS: Time formatting does not expose any system resource hence Resource Exposure scope is None. @@ -325,7 +325,7 @@ namespace System.Xml.Xsl.Runtime { this.Milliseconds = (ushort)dateTime.Millisecond; } } - +#endif // string ms:format-date(string datetime[, string format[, string language]]) // string ms:format-time(string datetime[, string format[, string language]]) // @@ -339,12 +339,24 @@ namespace System.Xml.Xsl.Runtime { // passed, the current culture is used. If language is not recognized, a runtime error happens. public static string MSFormatDateTime(string dateTime, string format, string lang, bool isDate) { try { - int locale = GetCultureInfo(lang).LCID; - XsdDateTime xdt; if (! XsdDateTime.TryParse(dateTime, XsdDateTimeFlags.AllXsd | XsdDateTimeFlags.XdrDateTime | XsdDateTimeFlags.XdrTimeNoTz, out xdt)) { return string.Empty; } +#if MONO + string locale = GetCultureInfo(lang).Name; + + DateTime dt = xdt.ToZulu(); + + // If format is the empty string or not specified, use the default format for the given locale + if (format.Length == 0) + { + format = null; + } + return dt.ToString(format, new CultureInfo(locale)); +#else + int locale = GetCultureInfo(lang).LCID; + SystemTime st = new SystemTime(xdt.ToZulu()); StringBuilder sb = new StringBuilder(format.Length + 16); @@ -373,6 +385,7 @@ namespace System.Xml.Xsl.Runtime { } } return sb.ToString(); +#endif } catch (ArgumentException) { // Operations with DateTime can throw this exception eventualy return string.Empty; } diff --git a/mcs/class/referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Compiler.cs b/mcs/class/referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Compiler.cs index 055962a3252..5ce6ea5efec 100644 --- a/mcs/class/referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Compiler.cs +++ b/mcs/class/referencesource/System.Data.SqlXml/System/Xml/Xsl/XsltOld/Compiler.cs @@ -800,7 +800,7 @@ namespace System.Xml.Xsl.XsltOld { compilParams.Evidence = evidence; #pragma warning restore 618 compilParams.ReferencedAssemblies.Add(typeof(XPathNavigator).Module.FullyQualifiedName); - compilParams.ReferencedAssemblies.Add("system.dll"); + compilParams.ReferencedAssemblies.Add("System.dll"); #if !FEATURE_PAL // visualbasic if (lang == ScriptingLanguage.VisualBasic) { compilParams.ReferencedAssemblies.Add("microsoft.visualbasic.dll"); diff --git a/mcs/class/referencesource/System/net/System/Net/webproxy.cs b/mcs/class/referencesource/System/net/System/Net/webproxy.cs index 15840cd7022..e433783951c 100644 --- a/mcs/class/referencesource/System/net/System/Net/webproxy.cs +++ b/mcs/class/referencesource/System/net/System/Net/webproxy.cs @@ -513,15 +513,17 @@ namespace System.Net { var data = AndroidPlatform.GetDefaultProxy (); if (data != null) return data; + + return new WebProxy (true); #else if (Platform.IsMacOS) { var data = Mono.Net.CFNetwork.GetDefaultProxy (); if (data != null) return data; } -#endif return new WebProxy (true); +#endif } #endif diff --git a/mcs/class/referencesource/mscorlib/system/io/filesystemenumerable.cs b/mcs/class/referencesource/mscorlib/system/io/filesystemenumerable.cs index 3f088037db0..4889350563b 100644 --- a/mcs/class/referencesource/mscorlib/system/io/filesystemenumerable.cs +++ b/mcs/class/referencesource/mscorlib/system/io/filesystemenumerable.cs @@ -186,7 +186,9 @@ namespace System.IO private SearchOption searchOption; private String fullPath; private String normalizedSearchPath; +#if !MONO private int oldMode; +#endif private bool _checkHost; [System.Security.SecuritySafeCritical] diff --git a/mcs/ilasm/Driver.cs b/mcs/ilasm/Driver.cs index 6f38e9d67be..af7120dce58 100644 --- a/mcs/ilasm/Driver.cs +++ b/mcs/ilasm/Driver.cs @@ -44,8 +44,8 @@ namespace Mono.ILASM { private Target target = Target.Exe; private string target_string = "exe"; private bool show_tokens = false; - private bool show_method_def = false; - private bool show_method_ref = false; +// private bool show_method_def = false; +// private bool show_method_ref = false; private bool show_parser = false; private bool scan_only = false; private bool debugging_info = false; @@ -189,7 +189,7 @@ namespace Mono.ILASM { ie.FilePath = file_path; ie.Location = scanner.Reader.Location; throw; - } catch (Exception e){ + } catch (Exception){ Console.Write ("{0} ({1}, {2}): ",file_path, scanner.Reader.Location.line, scanner.Reader.Location.column); throw; } finally { @@ -277,10 +277,10 @@ namespace Mono.ILASM { show_tokens = true; break; case "show_method_def": - show_method_def = true; +// show_method_def = true; break; case "show_method_ref": - show_method_ref = true; +// show_method_ref = true; break; case "show_parser": show_parser = true; diff --git a/mcs/ilasm/Makefile b/mcs/ilasm/Makefile index 6b24d0d0536..090d1cc3231 100644 --- a/mcs/ilasm/Makefile +++ b/mcs/ilasm/Makefile @@ -4,7 +4,7 @@ include ../build/rules.make PROGRAM = ilasm.exe BUILT_SOURCES = ILParser.cs -LOCAL_MCS_FLAGS = /lib:../class/lib/$(PROFILE) /r:../class/lib/$(PROFILE)/PEAPI.dll /r:Mono.CompilerServices.SymbolWriter.dll /r:Mono.Security.dll +LIB_REFS = PEAPI Mono.CompilerServices.SymbolWriter Mono.Security CLEAN_FILES = parser/y.output diff --git a/mcs/ilasm/codegen/CodeGen.cs b/mcs/ilasm/codegen/CodeGen.cs index b0b1803c180..6b9aadfc80e 100644 --- a/mcs/ilasm/codegen/CodeGen.cs +++ b/mcs/ilasm/codegen/CodeGen.cs @@ -29,7 +29,7 @@ namespace Mono.ILASM { private PEFile pefile; private ExternAssembly current_assemblyref; - private ExternModule current_moduleref; +// private ExternModule current_moduleref; private string current_namespace; private TypeDef current_typedef; private MethodDef current_methoddef; @@ -61,7 +61,6 @@ namespace Mono.ILASM { private long stack_reserve; private string output_file; - private string debug_file; private bool is_dll; private bool entry_point; @@ -119,9 +118,9 @@ namespace Mono.ILASM { get { return current_assemblyref; } } - public ExternModule CurrentModuleRef { - get { return current_moduleref; } - } +// public ExternModule CurrentModuleRef { +// get { return current_moduleref; } +// } public ICustomAttrTarget CurrentCustomAttrTarget { get { return current_customattrtarget; } diff --git a/mcs/ilasm/codegen/FieldDef.cs b/mcs/ilasm/codegen/FieldDef.cs index 19c23b9bfef..456b9a5ee23 100644 --- a/mcs/ilasm/codegen/FieldDef.cs +++ b/mcs/ilasm/codegen/FieldDef.cs @@ -23,7 +23,7 @@ namespace Mono.ILASM { private PEAPI.NativeType native_type; private bool offset_set; - private bool datavalue_set; +// private bool datavalue_set; private bool value_set; private bool is_resolved; @@ -40,7 +40,7 @@ namespace Mono.ILASM { this.type = type; offset_set = false; - datavalue_set = false; +// datavalue_set = false; value_set = false; at_data_id = null; diff --git a/mcs/ilasm/codegen/GenericTypeInst.cs b/mcs/ilasm/codegen/GenericTypeInst.cs index 6634f418b63..5510500749b 100644 --- a/mcs/ilasm/codegen/GenericTypeInst.cs +++ b/mcs/ilasm/codegen/GenericTypeInst.cs @@ -19,7 +19,7 @@ namespace Mono.ILASM { private BaseClassRef class_ref; private PEAPI.GenericTypeInst p_gen_inst; - private bool is_valuetypeinst; + const bool is_valuetypeinst = false; private GenericArguments gen_args; private bool is_added; /* Added to PEFile (to TypeSpec table) ? */ /* Note: Using static hashtable here as GenericTypeInsts is not cached */ diff --git a/mcs/ilasm/parser/ILParser.jay b/mcs/ilasm/parser/ILParser.jay index a6b861903b6..56f37d06ea3 100644 --- a/mcs/ilasm/parser/ILParser.jay +++ b/mcs/ilasm/parser/ILParser.jay @@ -32,7 +32,7 @@ namespace Mono.ILASM { private string pinvoke_meth; private PEAPI.PInvokeAttr pinvoke_attr; private ILTokenizer tokenizer; - static int yacc_verbose_flag; + const int yacc_verbose_flag = 0; KeyValuePair current_extern; class NameValuePair { @@ -59,13 +59,14 @@ namespace Mono.ILASM { public bool CheckSecurityActionValidity (System.Security.Permissions.SecurityAction action, bool for_assembly) { +#pragma warning disable 618 if ((action == System.Security.Permissions.SecurityAction.RequestMinimum || action == System.Security.Permissions.SecurityAction.RequestOptional || action == System.Security.Permissions.SecurityAction.RequestRefuse) && !for_assembly) { Report.Warning (String.Format ("System.Security.Permissions.SecurityAction '{0}' is not valid for this declaration", action)); return false; } - +#pragma warning restore 618 return true; } diff --git a/mcs/ilasm/scanner/InstrToken.cs b/mcs/ilasm/scanner/InstrToken.cs index bc78f97fd18..f4d996aeb10 100644 --- a/mcs/ilasm/scanner/InstrToken.cs +++ b/mcs/ilasm/scanner/InstrToken.cs @@ -56,10 +56,11 @@ namespace Mono.ILASM { case OperandType.InlineNone: token = Token.INSTR_NONE; break; - +#pragma warning disable 618 case OperandType.InlinePhi: token = Token.INSTR_PHI; break; +#pragma warning restore 618 case OperandType.InlineR: case OperandType.ShortInlineR: diff --git a/mcs/mcs/cs-parser.jay b/mcs/mcs/cs-parser.jay index bb2bd6e1971..a9748379086 100644 --- a/mcs/mcs/cs-parser.jay +++ b/mcs/mcs/cs-parser.jay @@ -3924,7 +3924,10 @@ array_creation_expression $$ = new ArrayCreation ((FullNamedExpression) $2, (List) $4, new ComposedTypeSpecifier (((List) $4).Count, GetLocation ($3)) { Next = (ComposedTypeSpecifier) $6 - }, (ArrayInitializer) $7, GetLocation ($1)); + }, (ArrayInitializer) $7, GetLocation ($1)) { + NoEmptyInterpolation = true + }; + lbag.AddLocation ($$, GetLocation ($3), GetLocation ($5)); } | NEW new_expr_type rank_specifiers opt_array_initializer diff --git a/mcs/packages/Makefile b/mcs/packages/Makefile index 22026f58078..34a4d83fa9c 100644 --- a/mcs/packages/Makefile +++ b/mcs/packages/Makefile @@ -12,10 +12,6 @@ ROSLYN_FILES = \ $(ROSLYN_CSC_DIR)/System.Collections.Immutable.dll \ $(ROSLYN_CSC_DIR)/System.Reflection.Metadata.dll -ROSLYN_AOT_FILES = \ - $(ROSLYN_CSC_DIR)/csc.exe$(PLATFORM_AOT_SUFFIX) \ - $(ROSLYN_CSC_DIR)/System.Reflection.Metadata.dll$(PLATFORM_AOT_SUFFIX) - DISTFILES = $(ROSLYN_FILES) ifeq ($(PROFILE), $(DEFAULT_PROFILE)) @@ -25,7 +21,6 @@ TARGET_DIR = $(DESTDIR)$(mono_libdir)/mono/$(FRAMEWORK_VERSION) install-local: $(MKINSTALLDIRS) $(TARGET_DIR) $(INSTALL_LIB) $(ROSLYN_FILES) $(TARGET_DIR) - $(INSTALL_LIB) $(ROSLYN_AOT_FILES) $(TARGET_DIR) endif diff --git a/mcs/tests/gtest-etree-07.cs b/mcs/tests/gtest-etree-07.cs index 6e46735c818..266cb45a8b4 100644 --- a/mcs/tests/gtest-etree-07.cs +++ b/mcs/tests/gtest-etree-07.cs @@ -27,13 +27,13 @@ class C int TestInstance () { Expression> e = () => M; - if (e.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, value(C)))") + if (e.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, value(C)), EmptyDelegate)") return 1; e.Compile () (); Expression> e2 = (l) => l.M; - if (e2.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, l))") + if (e2.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, l), EmptyDelegate)") return 2; e2.Compile () (this); @@ -43,7 +43,7 @@ class C public static int Main () { Expression> e = () => new EmptyDelegate (Test); - if (e.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null))") + if (e.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null), EmptyDelegate)") return 1; var v = e.Compile (); @@ -53,7 +53,7 @@ class C return 2; Expression> e2 = () => Test; - if (e2.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null))") + if (e2.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null), EmptyDelegate)") return 3; var v2 = e2.Compile (); @@ -64,7 +64,7 @@ class C unsafe { Expression> e3 = () => new UnsafeDelegate (Foo); - if (e3.Body.ToString () != "Convert(Int32* Foo().CreateDelegate(UnsafeDelegate, null))") + if (e3.Body.ToString () != "Convert(Int32* Foo().CreateDelegate(UnsafeDelegate, null), UnsafeDelegate)") return 5; var v3 = e3.Compile (); diff --git a/mcs/tests/test-934.cs b/mcs/tests/test-934.cs index ba464e35e49..62b300d6054 100644 --- a/mcs/tests/test-934.cs +++ b/mcs/tests/test-934.cs @@ -10,6 +10,7 @@ class X if (ReferenceEquals (a, b)) return 2; + a = new byte[0]; b = new byte[0]; if (a.Equals (b)) return 3; diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml index b5fc91cb5f0..d8a0e06eab7 100644 --- a/mcs/tests/ver-il-net_4_x.xml +++ b/mcs/tests/ver-il-net_4_x.xml @@ -436,7 +436,7 @@ - 92 + 93 7 @@ -444,7 +444,7 @@ - 109 + 110 7 @@ -452,7 +452,7 @@ - 119 + 120 7 @@ -460,7 +460,7 @@ - 119 + 120 7 @@ -601,52 +601,52 @@ 67 - 92 + 93 - 111 + 112 75 - 101 + 102 - 72 + 74 128 - 91 + 92 94 - 92 + 93 - 110 + 111 - 111 + 112 - 110 + 111 - 89 + 91 - 111 + 112 - 124 + 125 - 139 + 140 102 @@ -2599,7 +2599,7 @@ - 867 + 868 7 @@ -6941,7 +6941,7 @@ 23 - 212 + 213 7 @@ -6969,7 +6969,7 @@ 84 - 19 + 20 15 @@ -10929,7 +10929,7 @@ - 14 + 15 7 @@ -11407,7 +11407,7 @@ - 21 + 22 7 @@ -11514,7 +11514,7 @@ - 38 + 39 7 @@ -13009,7 +13009,7 @@ - 14 + 15 10 @@ -14814,7 +14814,7 @@ - 19 + 20 @@ -14868,7 +14868,7 @@ 10 - 50 + 51 7 @@ -16438,7 +16438,7 @@ - 12 + 13 7 @@ -17316,7 +17316,7 @@ 2 - 37 + 38 7 @@ -18559,7 +18559,7 @@ - 78 + 80 7 @@ -18821,7 +18821,7 @@ 2 - 48 + 51 7 @@ -19324,7 +19324,7 @@ - 22 + 24 9 @@ -21415,10 +21415,10 @@ 123 - 126 + 127 - 99 + 100 92 @@ -21946,7 +21946,7 @@ 92 - 62 + 63 137 @@ -22090,7 +22090,7 @@ 74 - 74 + 76 74 @@ -23460,7 +23460,7 @@ - 13 + 14 2 @@ -23551,7 +23551,7 @@ - 17 + 18 7 @@ -23874,7 +23874,7 @@ - 12 + 13 7 @@ -24104,7 +24104,7 @@ 23 - 87 + 88 52 @@ -24306,7 +24306,7 @@ - 20 + 21 7 @@ -25322,7 +25322,7 @@ - 19 + 20 @@ -27719,7 +27719,7 @@ 10 - 52 + 53 7 @@ -27974,7 +27974,7 @@ - 2179 + 2181 16 @@ -29103,7 +29103,7 @@ - 78 + 79 7 @@ -29784,10 +29784,10 @@ - 159 + 162 - 14 + 15 16 @@ -31345,7 +31345,7 @@ - 17 + 18 7 @@ -31525,7 +31525,7 @@ - 12 + 13 7 @@ -36257,7 +36257,7 @@ - 977 + 978 43 @@ -40215,7 +40215,7 @@ - 14 + 15 2 @@ -43458,7 +43458,7 @@ - 21 + 22 7 @@ -49549,7 +49549,7 @@ 7 - 19 + 20 @@ -49585,7 +49585,7 @@ 12 - 65 + 66 2 @@ -51811,7 +51811,7 @@ 2 - 284 + 288 7 @@ -52288,7 +52288,7 @@ - 106 + 114 7 @@ -63746,7 +63746,7 @@ - 12 + 13 7 @@ -65399,7 +65399,7 @@ - 22 + 23 7 diff --git a/mcs/tools/mkbundle/mkbundle.cs b/mcs/tools/mkbundle/mkbundle.cs index 3351fd24d0b..603af9458a8 100755 --- a/mcs/tools/mkbundle/mkbundle.cs +++ b/mcs/tools/mkbundle/mkbundle.cs @@ -372,7 +372,7 @@ class MakeBundle { if (fetch_target != null){ var directory = Path.Combine (targets_dir, fetch_target); var zip_download = Path.Combine (directory, "sdk.zip"); - Directory.CreateDirectory (Path.GetDirectoryName (directory)); + Directory.CreateDirectory (directory); var wc = new WebClient (); var uri = new Uri ($"{target_server}{fetch_target}"); try { diff --git a/mcs/tools/mono-symbolicate/LocationProvider.cs b/mcs/tools/mono-symbolicate/LocationProvider.cs index 68387807a59..f03adfdee58 100644 --- a/mcs/tools/mono-symbolicate/LocationProvider.cs +++ b/mcs/tools/mono-symbolicate/LocationProvider.cs @@ -32,7 +32,12 @@ namespace Mono return false; TypeDefinition type = null; - var nested = sfData.TypeFullName.Split ('+'); + string[] nested; + if (sfData.TypeFullName.IndexOf ('/') >= 0) + nested = sfData.TypeFullName.Split ('/'); + else + nested = sfData.TypeFullName.Split ('+'); + var types = assembly.MainModule.Types; foreach (var ntype in nested) { if (type == null) { @@ -53,11 +58,16 @@ namespace Mono var parensStart = sfData.MethodSignature.IndexOf ('('); var methodName = sfData.MethodSignature.Substring (0, parensStart).TrimEnd (); var methodParameters = sfData.MethodSignature.Substring (parensStart); - var method = type.Methods.FirstOrDefault (m => CompareName (m, methodName) && CompareParameters (m.Parameters, methodParameters)); - if (method == null) { + var methods = type.Methods.Where (m => CompareName (m, methodName) && CompareParameters (m.Parameters, methodParameters)).ToArray (); + if (methods.Length == 0) { logger.LogWarning ("Could not find method: {0}", methodName); return false; } + if (methods.Length > 1) { + logger.LogWarning ("Ambiguous match for method: {0}", sfData.MethodSignature); + return false; + } + var method = methods [0]; int ilOffset; if (sfData.IsILOffset) { @@ -100,8 +110,11 @@ namespace Mono if (!candidate.HasGenericParameters) return false; - + var genStart = expected.IndexOf ('['); + if (genStart < 0) + genStart = expected.IndexOf ('<'); + if (genStart < 0) return false; @@ -117,6 +130,36 @@ namespace Mono return candidate.GenericParameters.Count == arity; } + static string RemoveGenerics (string expected, char open, char close) + { + if (expected.IndexOf (open) < 0) + return expected; + + var sb = new StringBuilder (); + for (int i = 0; i < expected.Length;) { + int start = expected.IndexOf (open, i); + int end = expected.IndexOf (close, i); + if (start < 0 || end < 0) { + sb.Append (expected, i, expected.Length - i); + break; + } + + bool is_ginst = false; + for (int j = start + 1; j < end; ++j) { + if (expected [j] != ',') + is_ginst = true; + } + + if (is_ginst) //discard the the generic args + sb.Append (expected, i, start - i); + else //include array arity + sb.Append (expected, i, end + 1 - i); + i = end + 1; + + } + return sb.ToString (); + } + static bool CompareParameters (Collection candidate, string expected) { var builder = new StringBuilder (); @@ -131,11 +174,6 @@ namespace Mono builder.Append ("...,"); var pt = parameter.ParameterType; - if (!string.IsNullOrEmpty (pt.Namespace)) { - builder.Append (pt.Namespace); - builder.Append ("."); - } - FormatElementType (pt, builder); builder.Append (" "); @@ -144,7 +182,150 @@ namespace Mono builder.Append (")"); - return builder.ToString () == expected; + if (builder.ToString () == RemoveGenerics (expected, '[', ']')) + return true; + + //now try the compact runtime format. + + builder.Clear (); + + builder.Append ("("); + + for (int i = 0; i < candidate.Count; i++) { + var parameter = candidate [i]; + if (i > 0) + builder.Append (","); + + if (parameter.ParameterType.IsSentinel) + builder.Append ("...,"); + + var pt = parameter.ParameterType; + + RuntimeFormatElementType (pt, builder); + } + + builder.Append (")"); + + if (builder.ToString () == RemoveGenerics (expected, '<', '>')) + return true; + return false; + + } + + static void RuntimeFormatElementType (TypeReference tr, StringBuilder builder) + { + var ts = tr as TypeSpecification; + if (ts != null) { + if (ts.IsByReference) { + RuntimeFormatElementType (ts.ElementType, builder); + builder.Append ("&"); + return; + } + } + + switch (tr.MetadataType) { + case MetadataType.Void: + builder.Append ("void"); + break; + case MetadataType.Boolean: + builder.Append ("bool"); + break; + case MetadataType.Char: + builder.Append ("char"); + break; + case MetadataType.SByte: + builder.Append ("sbyte"); + break; + case MetadataType.Byte: + builder.Append ("byte"); + break; + case MetadataType.Int16: + builder.Append ("int16"); + break; + case MetadataType.UInt16: + builder.Append ("uint16"); + break; + case MetadataType.Int32: + builder.Append ("int"); + break; + case MetadataType.UInt32: + builder.Append ("uint"); + break; + case MetadataType.Int64: + builder.Append ("long"); + break; + case MetadataType.UInt64: + builder.Append ("ulong"); + break; + case MetadataType.Single: + builder.Append ("single"); + break; + case MetadataType.Double: + builder.Append ("double"); + break; + case MetadataType.String: + builder.Append ("string"); + break; + case MetadataType.Pointer: + builder.Append (((TypeSpecification)tr).ElementType); + builder.Append ("*"); + break; + case MetadataType.ValueType: + case MetadataType.Class: + case MetadataType.GenericInstance: { + FormatName (tr, builder, '/'); + break; + } + case MetadataType.Var: + case MetadataType.MVar: + builder.Append (tr.Name); + builder.Append ("_REF"); + break; + case MetadataType.Array: { + var array = (ArrayType)tr; + RuntimeFormatElementType (array.ElementType, builder); + builder.Append ("["); + + for (int i = 0; i < array.Rank - 1; ++i) + builder.Append (","); + + builder.Append ("]"); + break; + } + + case MetadataType.TypedByReference: + builder.Append ("typedbyref"); + break; + case MetadataType.IntPtr: + builder.Append ("intptr"); + break; + case MetadataType.UIntPtr: + builder.Append ("uintptr"); + break; + case MetadataType.FunctionPointer: + builder.Append ("*()"); + break; + case MetadataType.Object: + builder.Append ("object"); + break; + default: + builder.Append ("-unknown-"); + break; + } + } + + static void FormatName (TypeReference tr, StringBuilder builder, char sep) + { + if (tr.IsNested && !(tr.MetadataType == MetadataType.Var || tr.MetadataType == MetadataType.MVar)) { + FormatName (tr.DeclaringType, builder, sep); + builder.Append (sep); + } + if (!string.IsNullOrEmpty (tr.Namespace)) { + builder.Append (tr.Namespace); + builder.Append ("."); + } + + builder.Append (tr.Name); } static void FormatElementType (TypeReference tr, StringBuilder builder) @@ -170,8 +351,7 @@ namespace Mono return; } } - - builder.Append (tr.Name); + FormatName (tr, builder, '+'); } } } diff --git a/mcs/tools/mono-symbolicate/StackFrameData.cs b/mcs/tools/mono-symbolicate/StackFrameData.cs index 0177fcd6106..646cf3a9a40 100644 --- a/mcs/tools/mono-symbolicate/StackFrameData.cs +++ b/mcs/tools/mono-symbolicate/StackFrameData.cs @@ -84,7 +84,8 @@ namespace Mono typeFullName = str.Substring (0, typeNameEnd); // Remove generic parameters - typeFullName = Regex.Replace (typeFullName, @"\[[^\[\]]*\]", ""); + typeFullName = Regex.Replace (typeFullName, @"\[[^\[\]]*\]$", ""); + typeFullName = Regex.Replace (typeFullName, @"\<[^\[\]]*\>$", ""); methodSignature = str.Substring (typeNameEnd + 1); diff --git a/mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs b/mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs index 726997d2134..c1a425afc46 100644 --- a/mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs +++ b/mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs @@ -47,10 +47,23 @@ class StackTraceDumper { Catch (() => InnerGenericClass.InnerInnerGenericClass.ThrowException ("Stack trace with 2 inner generic class and generic overload")); + Catch (() => InnerGenericClass.ThrowException ("Stack trace with nested type argument", "string", null)); + Catch (() => { var d = new Dictionary (); d.ContainsKey (null); // ArgumentNullException }); + + /* + The following test include ambiguous methods we can't resolve. Testing this is hard, so I'm leaving a test behind but disabling it for the time being + In this case the ambiguous methods are: + public static void Foo (int a, bool hard_crash, GenClass arg, List zz) + public static void Foo (int a, bool hard_crash, GenClass arg, List zz) + + The are ambiguous because the only difference is the instantiation on the last parameter which we can't + figure out from a stacktrace. + */ + //Catch (() => ComplicatedTestCase.Run ()); } public static void Catch (Action action) @@ -137,6 +150,11 @@ class StackTraceDumper { throw new Exception (message); } + public static void ThrowException (string message, T1 arg, InnerGenericClass _ignore) + { + throw new Exception (message as string); + } + public class InnerInnerGenericClass { public static void ThrowException (T message) { @@ -149,4 +167,41 @@ class StackTraceDumper { } } } + + class GenClass { + public static void Foo (int a, bool hard_crash) { + GenPair.Foo (a, hard_crash, new GenClass (), new List ()); + } + } + + class GenPair { + public static void Foo (int a, bool hard_crash, GenClass arg, List zz) { + Foo (a, hard_crash, null, null); + } + + public static void Foo (int a, bool hard_crash, GenClass arg, List zz) { + Foo (a, hard_crash, null, new List ()); + } + + public static void Foo (int a, bool hard_crash, GenClass arg, List zz) { + ComplicatedTestCase.ArrayAndRef (a, new int[2], new int[2,2], ref hard_crash); + } + } + + class ComplicatedTestCase { + public static int ArrayAndRef (int a, int[] b, int[,] c, ref bool hard_crash) { + Object o = null; + for (int x = 0; x < a; ++x) + throw new Exception ("Stack trace with ambiguity"); + return 99; + } + + public static void Foo (int a, bool hard_crash) { + GenClass.Foo (a, hard_crash); + } + + public static void Run () { + Foo (10, false); + } + } } \ No newline at end of file diff --git a/mcs/tools/mono-symbolicate/Test/symbolicate.expected b/mcs/tools/mono-symbolicate/Test/symbolicate.expected index 63da2bd7c90..1ad44cec5cc 100644 --- a/mcs/tools/mono-symbolicate/Test/symbolicate.expected +++ b/mcs/tools/mono-symbolicate/Test/symbolicate.expected @@ -5,141 +5,150 @@ Stacktrace: System.Exception: Stacktrace with 2 frames at StackTraceDumper+<>c.
b__0_0 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:16 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: at StackTraceDumper+<>c.
b__0_0 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:16 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stacktrace with 3 frames - at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 + at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:96 at StackTraceDumper+<>c.
b__0_1 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:18 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 + at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:96 at StackTraceDumper+<>c.
b__0_1 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:18 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stacktrace with 4 frames - at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 - at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:81 + at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:96 + at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:94 at StackTraceDumper+<>c.
b__0_2 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:20 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:83 - at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:81 + at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:96 + at StackTraceDumper.ThrowException (System.String message, System.Int32 i) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:94 at StackTraceDumper+<>c.
b__0_2 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:20 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack frame with method overload using ref parameter - at StackTraceDumper.ThrowException (System.String& message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:75 + at StackTraceDumper.ThrowException (System.String& message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:88 at StackTraceDumper+<>c.
b__0_3 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:24 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper.ThrowException (System.String& message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:75 + at StackTraceDumper.ThrowException (System.String& message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:88 at StackTraceDumper+<>c.
b__0_3 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:24 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack frame with method overload using out parameter - at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:88 + at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:101 at StackTraceDumper+<>c.
b__0_4 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:29 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:88 + at StackTraceDumper.ThrowException (System.String message, System.Int32& o) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:101 at StackTraceDumper+<>c.
b__0_4 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:29 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack frame with 1 generic parameter - at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:93 + at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:106 at StackTraceDumper+<>c.
b__0_5 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:32 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:93 + at StackTraceDumper.ThrowExceptionGeneric[T] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:106 at StackTraceDumper+<>c.
b__0_5 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:32 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack frame with 2 generic parameters - at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:113 + at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:126 at StackTraceDumper+<>c.
b__0_6 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:34 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:113 + at StackTraceDumper.ThrowExceptionGeneric[T1,T2] (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:126 at StackTraceDumper+<>c.
b__0_6 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:34 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack frame with generic method overload - at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:98 + at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:111 at StackTraceDumper+<>c.
b__0_7 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:36 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:98 + at StackTraceDumper.ThrowExceptionGeneric[T] (T a1) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:111 at StackTraceDumper+<>c.
b__0_7 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:36 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack trace with inner class - at StackTraceDumper+InnerClass.ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:119 + at StackTraceDumper+InnerClass.ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:132 at StackTraceDumper+<>c.
b__0_8 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:38 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper+InnerClass.ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:119 + at StackTraceDumper+InnerClass.ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:132 at StackTraceDumper+<>c.
b__0_8 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:38 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack trace with inner generic class - at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:126 + at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:139 at StackTraceDumper+<>c.
b__0_9 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:40 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:126 + at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:139 at StackTraceDumper+<>c.
b__0_9 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:40 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Generic to string:string System.Exception: Stack trace with inner generic class and method generic parameter - at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:132 + at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:145 at StackTraceDumper+<>c.
b__0_10 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:42 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:132 + at StackTraceDumper+InnerGenericClass`1[T].ThrowException (System.String message, T arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:145 at StackTraceDumper+<>c.
b__0_10 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:42 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack trace with inner generic class and generic overload - at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:137 + at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:150 at StackTraceDumper+<>c.
b__0_11 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:44 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:137 + at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:150 at StackTraceDumper+<>c.
b__0_11 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:44 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack trace with 2 inner generic class and generic overload - at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:143 + at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:161 at StackTraceDumper+<>c.
b__0_12 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:46 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:143 + at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:161 at StackTraceDumper+<>c.
b__0_12 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:46 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.Exception: Stack trace with 2 inner generic class and generic overload - at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:148 + at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:166 at StackTraceDumper+<>c.
b__0_13 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:48 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: - at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:148 + at StackTraceDumper+InnerGenericClass`1+InnerInnerGenericClass`1[T,T2].ThrowException (T2 message) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:166 at StackTraceDumper+<>c.
b__0_13 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:48 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 + +System.Exception: Stack trace with nested type argument + at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg, StackTraceDumper+InnerGenericClass`1[T] _ignore) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:155 + at StackTraceDumper+<>c.
b__0_14 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:50 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 +Stacktrace: + at StackTraceDumper+InnerGenericClass`1[T].ThrowException[T1] (System.String message, T1 arg, StackTraceDumper+InnerGenericClass`1[T] _ignore) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:155 + at StackTraceDumper+<>c.
b__0_14 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:50 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 System.ArgumentNullException: Value cannot be null. Parameter name: key at System.ThrowHelper.ThrowArgumentNullException (System.ExceptionArgument argument) in mcs/class/referencesource/mscorlib/system/throwhelper.cs:80 at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:299 at System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:228 - at StackTraceDumper+<>c.
b__0_14 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:52 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper+<>c.
b__0_15 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:54 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 Stacktrace: at System.ThrowHelper.ThrowArgumentNullException (System.ExceptionArgument argument) in mcs/class/referencesource/mscorlib/system/throwhelper.cs:80 at System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:299 at System.Collections.Generic.Dictionary`2[TKey,TValue].ContainsKey (TKey key) in mcs/class/referencesource/mscorlib/system/collections/generic/dictionary.cs:228 - at StackTraceDumper+<>c.
b__0_14 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:52 - at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:59 + at StackTraceDumper+<>c.
b__0_15 () in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:54 + at StackTraceDumper.Catch (System.Action action) in mcs/tools/mono-symbolicate/Test/StackTraceDumper.cs:72 diff --git a/mcs/tools/security/sn.cs b/mcs/tools/security/sn.cs index 4f666007705..8dac86944b2 100644 --- a/mcs/tools/security/sn.cs +++ b/mcs/tools/security/sn.cs @@ -195,7 +195,7 @@ namespace Mono.Tools { return signed; } - Console.WriteLine ("Couldn't sign the assembly {0} with this key pair.", assemblyName); + Console.WriteLine ("Couldn't sign the assembly {0} with this key pair. Public key of assembly did not match signing public key.", assemblyName); return false; } diff --git a/mono/metadata/class.c b/mono/metadata/class.c index 59020bde769..24747e95159 100644 --- a/mono/metadata/class.c +++ b/mono/metadata/class.c @@ -3077,62 +3077,6 @@ print_implemented_interfaces (MonoClass *klass) } } -static MonoClass* -inflate_class_one_arg (MonoClass *gtype, MonoClass *arg0) -{ - MonoType *args [1]; - args [0] = &arg0->byval_arg; - - return mono_class_bind_generic_parameters (gtype, 1, args, FALSE); -} - -static MonoClass* -array_class_get_if_rank (MonoClass *klass, guint rank) -{ - return rank ? mono_array_class_get (klass, rank) : klass; -} - -static void -fill_valuetype_array_derived_types (MonoClass **valuetype_types, MonoClass *eclass, int rank) -{ - valuetype_types [0] = eclass; - if (eclass == mono_defaults.int16_class) - valuetype_types [1] = mono_defaults.uint16_class; - else if (eclass == mono_defaults.uint16_class) - valuetype_types [1] = mono_defaults.int16_class; - else if (eclass == mono_defaults.int32_class) - valuetype_types [1] = mono_defaults.uint32_class; - else if (eclass == mono_defaults.uint32_class) - valuetype_types [1] = mono_defaults.int32_class; - else if (eclass == mono_defaults.int64_class) - valuetype_types [1] = mono_defaults.uint64_class; - else if (eclass == mono_defaults.uint64_class) - valuetype_types [1] = mono_defaults.int64_class; - else if (eclass == mono_defaults.byte_class) - valuetype_types [1] = mono_defaults.sbyte_class; - else if (eclass == mono_defaults.sbyte_class) - valuetype_types [1] = mono_defaults.byte_class; - else if (eclass->enumtype && mono_class_enum_basetype (eclass)) - valuetype_types [1] = mono_class_from_mono_type (mono_class_enum_basetype (eclass)); -} - -static GENERATE_GET_CLASS_WITH_CACHE (generic_icollection, System.Collections.Generic, ICollection`1) -static GENERATE_GET_CLASS_WITH_CACHE (generic_ienumerable, System.Collections.Generic, IEnumerable`1) -static GENERATE_GET_CLASS_WITH_CACHE (generic_ienumerator, System.Collections.Generic, IEnumerator`1) -static GENERATE_GET_CLASS_WITH_CACHE (generic_ireadonlylist, System.Collections.Generic, IReadOnlyList`1) -static GENERATE_GET_CLASS_WITH_CACHE (generic_ireadonlycollection, System.Collections.Generic, IReadOnlyCollection`1) - -static int -find_array_interface (MonoClass *klass, const char *name) -{ - int i; - for (i = 0; i < klass->interface_count; ++i) { - if (strcmp (klass->interfaces [i]->name, name) == 0) - return i; - } - return -1; -} - /* * Return the number of virtual methods. * Even for interfaces we can't simply return the number of methods as all CLR types are allowed to have static methods. @@ -3192,15 +3136,6 @@ find_interface (int num_ifaces, MonoClass **interfaces_full, MonoClass *ic) } } -static int -find_interface_offset (int num_ifaces, MonoClass **interfaces_full, int *interface_offsets_full, MonoClass *ic) -{ - int i = find_interface (num_ifaces, interfaces_full, ic); - if (i >= 0) - return interface_offsets_full [i]; - return -1; -} - static mono_bool set_interface_and_offset (int num_ifaces, MonoClass **interfaces_full, int *interface_offsets_full, MonoClass *ic, int offset, mono_bool force_set) { @@ -4537,6 +4472,8 @@ mono_class_setup_vtable_general (MonoClass *klass, MonoMethod **overrides, int o g_slist_free (virt_methods); virt_methods = NULL; + g_assert (cur_slot <= max_vtsize); + /* Ensure that all vtable slots are filled with concrete instance methods */ if (!mono_class_is_abstract (klass)) { for (i = 0; i < cur_slot; ++i) { diff --git a/mono/metadata/debug-helpers.c b/mono/metadata/debug-helpers.c index 449895a5610..d0937fdf70a 100644 --- a/mono/metadata/debug-helpers.c +++ b/mono/metadata/debug-helpers.c @@ -163,7 +163,10 @@ mono_type_get_desc (GString *res, MonoType *type, gboolean include_namespace) break; case MONO_TYPE_ARRAY: mono_type_get_desc (res, &type->data.array->eklass->byval_arg, include_namespace); - g_string_append_printf (res, "[%d]", type->data.array->rank); + g_string_append_c (res, '['); + for (i = 1; i < type->data.array->rank; ++i) + g_string_append_c (res, ','); + g_string_append_c (res, ']'); break; case MONO_TYPE_SZARRAY: mono_type_get_desc (res, &type->data.klass->byval_arg, include_namespace); diff --git a/mono/metadata/exception-internals.h b/mono/metadata/exception-internals.h index a0f4c783fa1..e36e5ef9e76 100644 --- a/mono/metadata/exception-internals.h +++ b/mono/metadata/exception-internals.h @@ -26,4 +26,10 @@ mono_exception_from_token_two_strings_checked (MonoImage *image, uint32_t token, MonoString *a1, MonoString *a2, MonoError *error); + +typedef int (*MonoGetSeqPointFunc) (MonoDomain *domain, MonoMethod *method, gint32 native_offset); + +void +mono_install_get_seq_point (MonoGetSeqPointFunc func); + #endif diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c index 3a694a4b8e9..1a452c083ee 100644 --- a/mono/metadata/gc.c +++ b/mono/metadata/gc.c @@ -1019,11 +1019,12 @@ mono_gc_cleanup (void) if (mono_thread_internal_current () != gc_thread) { int ret; gint64 start_ticks = mono_msec_ticks (); - gint64 end_ticks = start_ticks + 2000; + gint64 end_ticks = start_ticks + 40000; mono_gc_finalize_notify (); /* Finishing the finalizer thread, so wait a little bit... */ - /* MS seems to wait for about 2 seconds */ + /* MS seems to wait for about 2 seconds per finalizer thread */ + /* and 40 seconds for all finalizers to finish */ while (!finalizer_thread_exited) { gint64 current_ticks = mono_msec_ticks (); guint32 timeout; diff --git a/mono/metadata/handle.c b/mono/metadata/handle.c index d62426a7190..372ca0b56c0 100644 --- a/mono/metadata/handle.c +++ b/mono/metadata/handle.c @@ -72,9 +72,25 @@ const MonoObjectHandle mono_null_value_handle = NULL; #define THIS_IS_AN_OK_NUMBER_OF_HANDLES 100 +static MonoObject** +chunk_element_objslot (HandleChunk *chunk, int idx) +{ + return &chunk->objects[idx].o; +} + +#ifdef MONO_HANDLE_TRACK_OWNER +#define SET_OWNER(chunk,idx) do { (chunk)->objects[(idx)].owner = owner; } while (0) +#else +#define SET_OWNER(chunk,idx) do { } while (0) +#endif + /* Actual handles implementation */ MonoRawHandle +#ifndef MONO_HANDLE_TRACK_OWNER mono_handle_new (MonoObject *object) +#else +mono_handle_new (MonoObject *object, const char *owner) +#endif { MonoThreadInfo *info = mono_thread_info_current (); HandleStack *handles = (HandleStack *)info->handle_stack; @@ -83,6 +99,7 @@ mono_handle_new (MonoObject *object) retry: if (G_LIKELY (top->size < OBJECTS_PER_HANDLES_CHUNK)) { int idx = top->size; + MonoObject** objslot = chunk_element_objslot (top, idx); /* can be interrupted anywhere here, so: * 1. make sure the new slot is null * 2. make the new slot scannable (increment size) @@ -91,13 +108,13 @@ retry: * (have to do 1 then 3 so that if we're interrupted * between 1 and 2, the object is still live) */ - top->objects [idx] = NULL; + *objslot = NULL; mono_memory_write_barrier (); top->size++; mono_memory_write_barrier (); - MonoObject **h = &top->objects [idx]; - *h = object; - return h; + *objslot = object; + SET_OWNER (top,idx); + return objslot; } if (G_LIKELY (top->next)) { top->next->size = 0; @@ -164,8 +181,9 @@ mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data) while (cur) { int i; for (i = 0; i < cur->size; ++i) { - if (cur->objects [i] != NULL) - func ((gpointer*)&cur->objects [i], gc_data); + MonoObject **obj_slot = chunk_element_objslot (cur, i); + if (*obj_slot != NULL) + func ((gpointer*)obj_slot, gc_data); } if (cur == last) break; @@ -200,7 +218,11 @@ mono_stack_mark_pop_value (MonoThreadInfo *info, HandleStackMark *stackmark, Mon { MonoObject *obj = value ? *((MonoObject**)value) : NULL; mono_stack_mark_pop (info, stackmark); +#ifndef MONO_HANDLE_TRACK_OWNER return mono_handle_new (obj); +#else + return mono_handle_new (obj, ""); +#endif } /* Temporary place for some of the handle enabled wrapper functions*/ @@ -260,3 +282,9 @@ mono_array_handle_memcpy_refs (MonoArrayHandle dest, uintptr_t dest_idx, MonoArr { mono_array_memcpy_refs (MONO_HANDLE_RAW (dest), dest_idx, MONO_HANDLE_RAW (src), src_idx, len); } + +gboolean +mono_handle_stack_is_empty (HandleStack *stack) +{ + return (stack->top == stack->bottom && stack->top->size == 0); +} diff --git a/mono/metadata/handle.h b/mono/metadata/handle.h index 85f08c468e0..6481f0ee202 100644 --- a/mono/metadata/handle.h +++ b/mono/metadata/handle.h @@ -50,10 +50,22 @@ Whether this config needs stack watermark recording to know where to start scann typedef struct _HandleChunk HandleChunk; +/* define MONO_HANDLE_TRACK_OWNER to store the file and line number of each call to MONO_HANDLE_NEW + * in the handle stack. (This doubles the amount of memory used for handles, so it's only useful for debugging). + */ +/* #define MONO_HANDLE_TRACK_OWNER */ + +typedef struct { + MonoObject *o; +#ifdef MONO_HANDLE_TRACK_OWNER + const char *owner; +#endif +} HandleChunkElem; + struct _HandleChunk { int size; //number of bytes HandleChunk *prev, *next; - MonoObject *objects [OBJECTS_PER_HANDLES_CHUNK]; + HandleChunkElem objects [OBJECTS_PER_HANDLES_CHUNK]; }; typedef struct { @@ -71,9 +83,14 @@ typedef void *MonoRawHandle; typedef void (*GcScanFunc) (gpointer*, gpointer); +#ifndef MONO_HANDLE_TRACK_OWNER MonoRawHandle mono_handle_new (MonoObject *object); +#else +MonoRawHandle mono_handle_new (MonoObject *object, const char* owner); +#endif void mono_handle_stack_scan (HandleStack *stack, GcScanFunc func, gpointer gc_data); +gboolean mono_handle_stack_is_empty (HandleStack *stack); HandleStack* mono_handle_stack_alloc (void); void mono_handle_stack_free (HandleStack *handlestack); MonoRawHandle mono_stack_mark_pop_value (MonoThreadInfo *info, HandleStackMark *stackmark, MonoRawHandle value); @@ -223,6 +240,12 @@ void mono_handle_verify (MonoRawHandle handle); #define TYPED_HANDLE_NAME(TYPE) TYPE ## Handle #define TYPED_OUT_HANDLE_NAME(TYPE) TYPE ## HandleOut +#ifdef MONO_HANDLE_TRACK_OWNER +#define STRINGIFY_(x) #x +#define STRINGIFY(x) STRINGIFY_(x) +#define HANDLE_OWNER_STRINGIFY(file,lineno) (const char*) (file ":" STRINGIFY(lineno)) +#endif + /* * TYPED_HANDLE_DECL(SomeType): @@ -250,8 +273,14 @@ void mono_handle_verify (MonoRawHandle handle); //XXX add functions to get/set raw, set field, set field to null, set array, set array to null #define MONO_HANDLE_RAW(HANDLE) (HANDLE_INVARIANTS (HANDLE), ((HANDLE)->__obj)) -#define MONO_HANDLE_DCL(TYPE, NAME) TYPED_HANDLE_NAME(TYPE) NAME = (TYPED_HANDLE_NAME(TYPE))(mono_handle_new ((MonoObject*)(NAME ## _raw))) +#define MONO_HANDLE_DCL(TYPE, NAME) TYPED_HANDLE_NAME(TYPE) NAME = MONO_HANDLE_NEW (TYPE, (NAME ## _raw)) + +#ifndef MONO_HANDLE_TRACK_OWNER #define MONO_HANDLE_NEW(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( mono_handle_new ((MonoObject*)(VALUE)) ) +#else +#define MONO_HANDLE_NEW(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( mono_handle_new ((MonoObject*)(VALUE), HANDLE_OWNER_STRINGIFY(__FILE__, __LINE__))) +#endif + #define MONO_HANDLE_CAST(TYPE, VALUE) (TYPED_HANDLE_NAME(TYPE))( VALUE ) #define MONO_HANDLE_IS_NULL(HANDLE) (MONO_HANDLE_RAW(HANDLE) == NULL) diff --git a/mono/metadata/icall-def.h b/mono/metadata/icall-def.h index 1cdc9493387..10eda0d8a71 100644 --- a/mono/metadata/icall-def.h +++ b/mono/metadata/icall-def.h @@ -567,19 +567,19 @@ ICALL_TYPE(TYPEB, "System.Reflection.Emit.TypeBuilder", TYPEB_1) ICALL(TYPEB_1, "create_runtime_class", ves_icall_TypeBuilder_create_runtime_class) ICALL_TYPE(EVENTI, "System.Reflection.EventInfo", EVENTI_1) -ICALL(EVENTI_1, "internal_from_handle_type", ves_icall_System_Reflection_EventInfo_internal_from_handle_type) +HANDLES(ICALL(EVENTI_1, "internal_from_handle_type", ves_icall_System_Reflection_EventInfo_internal_from_handle_type)) ICALL_TYPE(FIELDI, "System.Reflection.FieldInfo", FILEDI_1) -ICALL(FILEDI_1, "GetTypeModifiers", ves_icall_System_Reflection_FieldInfo_GetTypeModifiers) -ICALL(FILEDI_2, "get_marshal_info", ves_icall_System_Reflection_FieldInfo_get_marshal_info) -ICALL(FILEDI_3, "internal_from_handle_type", ves_icall_System_Reflection_FieldInfo_internal_from_handle_type) +HANDLES(ICALL(FILEDI_1, "GetTypeModifiers", ves_icall_System_Reflection_FieldInfo_GetTypeModifiers)) +HANDLES(ICALL(FILEDI_2, "get_marshal_info", ves_icall_System_Reflection_FieldInfo_get_marshal_info)) +HANDLES(ICALL(FILEDI_3, "internal_from_handle_type", ves_icall_System_Reflection_FieldInfo_internal_from_handle_type)) ICALL_TYPE(MEMBERI, "System.Reflection.MemberInfo", MEMBERI_1) ICALL(MEMBERI_1, "get_MetadataToken", ves_icall_reflection_get_token) ICALL_TYPE(MBASE, "System.Reflection.MethodBase", MBASE_1) ICALL(MBASE_1, "GetCurrentMethod", ves_icall_GetCurrentMethod) -ICALL(MBASE_2, "GetMethodBodyInternal", ves_icall_System_Reflection_MethodBase_GetMethodBodyInternal) +HANDLES(ICALL(MBASE_2, "GetMethodBodyInternal", ves_icall_System_Reflection_MethodBase_GetMethodBodyInternal)) ICALL(MBASE_4, "GetMethodFromHandleInternalType_native", ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType_native) ICALL_TYPE(MODULE, "System.Reflection.Module", MODULE_1) @@ -590,12 +590,12 @@ HANDLES(ICALL(MODULE_14, "GetHINSTANCE", ves_icall_System_Reflection_Module_GetH HANDLES(ICALL(MODULE_4, "GetMDStreamVersion", ves_icall_System_Reflection_Module_GetMDStreamVersion)) HANDLES(ICALL(MODULE_5, "GetPEKind", ves_icall_System_Reflection_Module_GetPEKind)) HANDLES(ICALL(MODULE_6, "InternalGetTypes", ves_icall_System_Reflection_Module_InternalGetTypes)) -ICALL(MODULE_7, "ResolveFieldToken", ves_icall_System_Reflection_Module_ResolveFieldToken) -ICALL(MODULE_8, "ResolveMemberToken", ves_icall_System_Reflection_Module_ResolveMemberToken) -ICALL(MODULE_9, "ResolveMethodToken", ves_icall_System_Reflection_Module_ResolveMethodToken) +HANDLES(ICALL(MODULE_7, "ResolveFieldToken", ves_icall_System_Reflection_Module_ResolveFieldToken)) +HANDLES(ICALL(MODULE_8, "ResolveMemberToken", ves_icall_System_Reflection_Module_ResolveMemberToken)) +HANDLES(ICALL(MODULE_9, "ResolveMethodToken", ves_icall_System_Reflection_Module_ResolveMethodToken)) ICALL(MODULE_10, "ResolveSignature", ves_icall_System_Reflection_Module_ResolveSignature) ICALL(MODULE_11, "ResolveStringToken", ves_icall_System_Reflection_Module_ResolveStringToken) -ICALL(MODULE_12, "ResolveTypeToken", ves_icall_System_Reflection_Module_ResolveTypeToken) +HANDLES(ICALL(MODULE_12, "ResolveTypeToken", ves_icall_System_Reflection_Module_ResolveTypeToken)) ICALL(MODULE_13, "get_MetadataToken", ves_icall_reflection_get_token) ICALL_TYPE(MCMETH, "System.Reflection.MonoCMethod", MCMETH_1) @@ -630,20 +630,20 @@ ICALL(MMETH_9, "get_name", ves_icall_MonoMethod_get_name) ICALL_TYPE(MMETHI, "System.Reflection.MonoMethodInfo", MMETHI_4) ICALL(MMETHI_4, "get_method_attributes", vell_icall_get_method_attributes) ICALL(MMETHI_1, "get_method_info", ves_icall_get_method_info) -ICALL(MMETHI_2, "get_parameter_info", ves_icall_get_parameter_info) -ICALL(MMETHI_3, "get_retval_marshal", ves_icall_System_MonoMethodInfo_get_retval_marshal) +HANDLES(ICALL(MMETHI_2, "get_parameter_info", ves_icall_System_Reflection_MonoMethodInfo_get_parameter_info)) +HANDLES(ICALL(MMETHI_3, "get_retval_marshal", ves_icall_System_MonoMethodInfo_get_retval_marshal)) ICALL_TYPE(MPROPI, "System.Reflection.MonoPropertyInfo", MPROPI_1) -ICALL(MPROPI_1, "GetTypeModifiers", ves_icall_MonoPropertyInfo_GetTypeModifiers) +HANDLES(ICALL(MPROPI_1, "GetTypeModifiers", ves_icall_MonoPropertyInfo_GetTypeModifiers)) ICALL(MPROPI_3, "get_default_value", property_info_get_default_value) ICALL(MPROPI_2, "get_property_info", ves_icall_MonoPropertyInfo_get_property_info) ICALL_TYPE(PARAMI, "System.Reflection.ParameterInfo", PARAMI_1) ICALL(PARAMI_1, "GetMetadataToken", ves_icall_reflection_get_token) -ICALL(PARAMI_2, "GetTypeModifiers", ves_icall_ParameterInfo_GetTypeModifiers) +HANDLES(ICALL(PARAMI_2, "GetTypeModifiers", ves_icall_ParameterInfo_GetTypeModifiers)) ICALL_TYPE(PROPI, "System.Reflection.PropertyInfo", PROPI_1) -ICALL(PROPI_1, "internal_from_handle_type", ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type) +HANDLES(ICALL(PROPI_1, "internal_from_handle_type", ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type)) ICALL_TYPE(RTFIELD, "System.Reflection.RtFieldInfo", RTFIELD_1) ICALL(RTFIELD_1, "UnsafeGetValue", ves_icall_MonoField_GetValueInternal) diff --git a/mono/metadata/icall.c b/mono/metadata/icall.c index c11cbad5228..60f33b92ea0 100644 --- a/mono/metadata/icall.c +++ b/mono/metadata/icall.c @@ -117,7 +117,7 @@ static GENERATE_GET_CLASS_WITH_CACHE (property_info, System.Reflection, Property static GENERATE_GET_CLASS_WITH_CACHE (event_info, System.Reflection, EventInfo) static GENERATE_GET_CLASS_WITH_CACHE (module, System.Reflection, Module) -static MonoArray* +static MonoArrayHandle type_array_from_modifiers (MonoImage *image, MonoType *type, int optional, MonoError *error); static inline MonoBoolean @@ -1666,77 +1666,71 @@ ves_icall_RuntimeTypeHandle_GetAttributes (MonoReflectionType *type) return mono_class_get_flags (klass); } -ICALL_EXPORT MonoReflectionMarshalAsAttribute* -ves_icall_System_Reflection_FieldInfo_get_marshal_info (MonoReflectionField *field) +ICALL_EXPORT MonoReflectionMarshalAsAttributeHandle +ves_icall_System_Reflection_FieldInfo_get_marshal_info (MonoReflectionFieldHandle field_h, MonoError *error) { - MonoError error; - MonoClass *klass = field->field->parent; - MonoMarshalType *info; - MonoType *ftype; - int i; + mono_error_init (error); + MonoDomain *domain = MONO_HANDLE_DOMAIN (field_h); + MonoClassField *field = MONO_HANDLE_GETVAL (field_h, field); + MonoClass *klass = field->parent; MonoGenericClass *gklass = mono_class_try_get_generic_class (klass); if (mono_class_is_gtd (klass) || (gklass && gklass->context.class_inst->is_open)) - return NULL; + return MONO_HANDLE_CAST (MonoReflectionMarshalAsAttribute, NULL_HANDLE); - ftype = mono_field_get_type (field->field); + MonoType *ftype = mono_field_get_type (field); if (ftype && !(ftype->attrs & FIELD_ATTRIBUTE_HAS_FIELD_MARSHAL)) - return NULL; + return MONO_HANDLE_CAST (MonoReflectionMarshalAsAttribute, NULL_HANDLE); - info = mono_marshal_load_type_info (klass); + MonoMarshalType *info = mono_marshal_load_type_info (klass); - for (i = 0; i < info->num_fields; ++i) { - if (info->fields [i].field == field->field) { + for (int i = 0; i < info->num_fields; ++i) { + if (info->fields [i].field == field) { if (!info->fields [i].mspec) - return NULL; + return MONO_HANDLE_CAST (MonoReflectionMarshalAsAttribute, NULL_HANDLE); else { - MonoReflectionMarshalAsAttribute* obj; - obj = mono_reflection_marshal_as_attribute_from_marshal_spec (field->object.vtable->domain, klass, info->fields [i].mspec, &error); - if (!mono_error_ok (&error)) - mono_error_set_pending_exception (&error); - return obj; + return mono_reflection_marshal_as_attribute_from_marshal_spec (domain, klass, info->fields [i].mspec, error); } } } - return NULL; + return MONO_HANDLE_CAST (MonoReflectionMarshalAsAttribute, NULL_HANDLE); } -ICALL_EXPORT MonoReflectionField* -ves_icall_System_Reflection_FieldInfo_internal_from_handle_type (MonoClassField *handle, MonoType *type) +ICALL_EXPORT MonoReflectionFieldHandle +ves_icall_System_Reflection_FieldInfo_internal_from_handle_type (MonoClassField *handle, MonoType *type, MonoError *error) { - MonoError error; - gboolean found = FALSE; MonoClass *klass; g_assert (handle); + mono_error_init (error); + if (!type) { klass = handle->parent; } else { klass = mono_class_from_mono_type (type); - found = klass == handle->parent || mono_class_has_parent (klass, handle->parent); + gboolean found = klass == handle->parent || mono_class_has_parent (klass, handle->parent); if (!found) /* The managed code will throw the exception */ - return NULL; + return MONO_HANDLE_CAST (MonoReflectionField, NULL_HANDLE); } - MonoReflectionField *result = mono_field_get_object_checked (mono_domain_get (), klass, handle, &error); - mono_error_set_pending_exception (&error); - return result; + return mono_field_get_object_handle (mono_domain_get (), klass, handle, error); } -ICALL_EXPORT MonoReflectionEvent* -ves_icall_System_Reflection_EventInfo_internal_from_handle_type (MonoEvent *handle, MonoType *type) +ICALL_EXPORT MonoReflectionEventHandle +ves_icall_System_Reflection_EventInfo_internal_from_handle_type (MonoEvent *handle, MonoType *type, MonoError *error) { - MonoError error; MonoClass *klass; g_assert (handle); + mono_error_init (error); + if (!type) { klass = handle->parent; } else { @@ -1745,19 +1739,17 @@ ves_icall_System_Reflection_EventInfo_internal_from_handle_type (MonoEvent *hand gboolean found = klass == handle->parent || mono_class_has_parent (klass, handle->parent); if (!found) /* Managed code will throw an exception */ - return NULL; + return MONO_HANDLE_CAST (MonoReflectionEvent, NULL_HANDLE); } - MonoReflectionEvent *result = mono_event_get_object_checked (mono_domain_get (), klass, handle, &error); - mono_error_set_pending_exception (&error); - return result; + return mono_event_get_object_handle (mono_domain_get (), klass, handle, error); } -ICALL_EXPORT MonoReflectionProperty* -ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type (MonoProperty *handle, MonoType *type) +ICALL_EXPORT MonoReflectionPropertyHandle +ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type (MonoProperty *handle, MonoType *type, MonoError *error) { - MonoError error; + mono_error_init (error); MonoClass *klass; g_assert (handle); @@ -1770,29 +1762,23 @@ ves_icall_System_Reflection_PropertyInfo_internal_from_handle_type (MonoProperty gboolean found = klass == handle->parent || mono_class_has_parent (klass, handle->parent); if (!found) /* Managed code will throw an exception */ - return NULL; + return MONO_HANDLE_CAST (MonoReflectionProperty, NULL_HANDLE); } - MonoReflectionProperty *result = mono_property_get_object_checked (mono_domain_get (), klass, handle, &error); - mono_error_set_pending_exception (&error); - return result; + return mono_property_get_object_handle (mono_domain_get (), klass, handle, error); } -ICALL_EXPORT MonoArray* -ves_icall_System_Reflection_FieldInfo_GetTypeModifiers (MonoReflectionField *field, MonoBoolean optional) +ICALL_EXPORT MonoArrayHandle +ves_icall_System_Reflection_FieldInfo_GetTypeModifiers (MonoReflectionFieldHandle field_h, MonoBoolean optional, MonoError *error) { - MonoError error; - MonoType *type = mono_field_get_type_checked (field->field, &error); - MonoArray *res; + mono_error_init (error); + MonoClassField *field = MONO_HANDLE_GETVAL (field_h, field); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); - return NULL; - } + MonoType *type = mono_field_get_type_checked (field, error); + if (!is_ok (error)) + return MONO_HANDLE_CAST (MonoArray, NULL_HANDLE); - res = type_array_from_modifiers (field->field->parent->image, type, optional, &error); - mono_error_set_pending_exception (&error); - return res; + return type_array_from_modifiers (field->parent->image, type, optional, error); } ICALL_EXPORT int @@ -1844,38 +1830,38 @@ ves_icall_get_method_info (MonoMethod *method, MonoMethodInfo *info) info->callconv |= (sig->hasthis << 5) | (sig->explicit_this << 6); } -ICALL_EXPORT MonoArray* -ves_icall_get_parameter_info (MonoMethod *method, MonoReflectionMethod *member) +ICALL_EXPORT MonoArrayHandle +ves_icall_System_Reflection_MonoMethodInfo_get_parameter_info (MonoMethod *method, MonoReflectionMethodHandle member, MonoError *error) { - MonoError error; + mono_error_init (error); MonoDomain *domain = mono_domain_get (); - MonoArray *result = mono_param_get_objects_internal (domain, method, member->reftype ? mono_class_from_mono_type (member->reftype->type) : NULL, &error); - mono_error_set_pending_exception (&error); - return result; + MonoReflectionTypeHandle reftype = MONO_HANDLE_NEW (MonoReflectionType, NULL); + MONO_HANDLE_GET (reftype, member, reftype); + MonoClass *klass = NULL; + if (!MONO_HANDLE_IS_NULL (reftype)) + klass = mono_class_from_mono_type (MONO_HANDLE_GETVAL (reftype, type)); + return mono_param_get_objects_internal (domain, method, klass, error); } -ICALL_EXPORT MonoReflectionMarshalAsAttribute* -ves_icall_System_MonoMethodInfo_get_retval_marshal (MonoMethod *method) +ICALL_EXPORT MonoReflectionMarshalAsAttributeHandle +ves_icall_System_MonoMethodInfo_get_retval_marshal (MonoMethod *method, MonoError *error) { - MonoError error; + mono_error_init (error); MonoDomain *domain = mono_domain_get (); - MonoReflectionMarshalAsAttribute* res = NULL; - MonoMarshalSpec **mspecs; - int i; + MonoReflectionMarshalAsAttributeHandle res = MONO_HANDLE_NEW (MonoReflectionMarshalAsAttribute, NULL); - mspecs = g_new (MonoMarshalSpec*, mono_method_signature (method)->param_count + 1); + MonoMarshalSpec **mspecs = g_new (MonoMarshalSpec*, mono_method_signature (method)->param_count + 1); mono_method_get_marshal_info (method, mspecs); if (mspecs [0]) { - res = mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspecs [0], &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); - return NULL; - } + MONO_HANDLE_ASSIGN (res, mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspecs [0], error)); + if (!is_ok (error)) + goto leave; } - for (i = mono_method_signature (method)->param_count; i >= 0; i--) +leave: + for (int i = mono_method_signature (method)->param_count; i >= 0; i--) if (mspecs [i]) mono_metadata_free_marshal_spec (mspecs [i]); g_free (mspecs); @@ -4688,23 +4674,10 @@ fail: ICALL_EXPORT MonoStringHandle ves_icall_System_Reflection_Assembly_GetAotId (MonoError *error) { - int i; - guint8 aotid_sum = 0; - MonoDomain* domain = mono_domain_get (); - - if (!domain->entry_assembly || !domain->entry_assembly->image) - return NULL; - - guint8 (*aotid)[16] = &domain->entry_assembly->image->aotid; - - for (i = 0; i < 16; ++i) - aotid_sum |= (*aotid)[i]; - - if (aotid_sum == 0) + char *guid = mono_runtime_get_aotid (); + if (guid == NULL) return NULL; - - gchar *guid = mono_guid_to_string((guint8*) aotid); - MonoStringHandle res = mono_string_new_handle (domain, guid, error); + MonoStringHandle res = mono_string_new_handle (mono_domain_get (), guid, error); g_free (guid); return res; } @@ -5165,13 +5138,11 @@ ves_icall_System_Reflection_MethodBase_GetMethodFromHandleInternalType_native (M return res; } -ICALL_EXPORT MonoReflectionMethodBody* -ves_icall_System_Reflection_MethodBase_GetMethodBodyInternal (MonoMethod *method) +ICALL_EXPORT MonoReflectionMethodBodyHandle +ves_icall_System_Reflection_MethodBase_GetMethodBodyInternal (MonoMethod *method, MonoError *error) { - MonoError error; - MonoReflectionMethodBody *result = mono_method_body_get_object_checked (mono_domain_get (), method, &error); - mono_error_set_pending_exception (&error); - return result; + mono_error_init (error); + return mono_method_body_get_object_handle (mono_domain_get (), method, error); } ICALL_EXPORT MonoReflectionAssemblyHandle @@ -5738,29 +5709,55 @@ mono_memberref_is_method (MonoImage *image, guint32 token) } } +static MonoGenericInst * +get_generic_inst_from_array_handle (MonoArrayHandle type_args) +{ + int type_argc = mono_array_handle_length (type_args); + int size = MONO_SIZEOF_GENERIC_INST + type_argc * sizeof (MonoType *); + + MonoGenericInst *ginst = (MonoGenericInst *)g_alloca (size); + memset (ginst, 0, sizeof (MonoGenericInst)); + ginst->type_argc = type_argc; + for (int i = 0; i < type_argc; i++) { + MONO_HANDLE_ARRAY_GETVAL (ginst->type_argv[i], type_args, MonoType*, i); + } + ginst->is_open = FALSE; + for (int i = 0; i < type_argc; i++) { + if (mono_class_is_open_constructed_type (ginst->type_argv[i])) { + ginst->is_open = TRUE; + break; + } + } + + return mono_metadata_get_canonical_generic_inst (ginst); +} + static void -init_generic_context_from_args (MonoGenericContext *context, MonoArray *type_args, MonoArray *method_args) +init_generic_context_from_args_handles (MonoGenericContext *context, MonoArrayHandle type_args, MonoArrayHandle method_args) { - if (type_args) - context->class_inst = mono_metadata_get_generic_inst (mono_array_length (type_args), - mono_array_addr (type_args, MonoType*, 0)); - else + if (!MONO_HANDLE_IS_NULL (type_args)) { + context->class_inst = get_generic_inst_from_array_handle (type_args); + } else { context->class_inst = NULL; - if (method_args) - context->method_inst = mono_metadata_get_generic_inst (mono_array_length (method_args), - mono_array_addr (method_args, MonoType*, 0)); - else + } + if (!MONO_HANDLE_IS_NULL (method_args)) { + context->method_inst = get_generic_inst_from_array_handle (method_args); + } else { context->method_inst = NULL; + } } -ICALL_EXPORT MonoType* -ves_icall_System_Reflection_Module_ResolveTypeToken (MonoImage *image, guint32 token, MonoArray *type_args, MonoArray *method_args, MonoResolveTokenError *resolve_error) + +static MonoType* +module_resolve_type_token (MonoImage *image, guint32 token, MonoArrayHandle type_args, MonoArrayHandle method_args, MonoResolveTokenError *resolve_error, MonoError *error) { + HANDLE_FUNCTION_ENTER (); + mono_error_init (error); + MonoType *result = NULL; MonoClass *klass; int table = mono_metadata_token_table (token); int index = mono_metadata_token_index (token); MonoGenericContext context; - MonoError error; *resolve_error = ResolveTokenError_Other; @@ -5768,50 +5765,59 @@ ves_icall_System_Reflection_Module_ResolveTypeToken (MonoImage *image, guint32 t if ((table != MONO_TABLE_TYPEDEF) && (table != MONO_TABLE_TYPEREF) && (table != MONO_TABLE_TYPESPEC)) { *resolve_error = ResolveTokenError_BadTable; - return NULL; + goto leave; } if (image_is_dynamic (image)) { if ((table == MONO_TABLE_TYPEDEF) || (table == MONO_TABLE_TYPEREF)) { - klass = (MonoClass *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &error); - mono_error_cleanup (&error); - return klass ? &klass->byval_arg : NULL; + MonoError inner_error; + klass = (MonoClass *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &inner_error); + mono_error_cleanup (&inner_error); + result = klass ? &klass->byval_arg : NULL; + goto leave; } - init_generic_context_from_args (&context, type_args, method_args); - klass = (MonoClass *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context, &error); - mono_error_cleanup (&error); - return klass ? &klass->byval_arg : NULL; + init_generic_context_from_args_handles (&context, type_args, method_args); + MonoError inner_error; + klass = (MonoClass *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context, &inner_error); + mono_error_cleanup (&inner_error); + result = klass ? &klass->byval_arg : NULL; + goto leave; } if ((index <= 0) || (index > image->tables [table].rows)) { *resolve_error = ResolveTokenError_OutOfRange; - return NULL; + goto leave; } - init_generic_context_from_args (&context, type_args, method_args); - klass = mono_class_get_checked (image, token, &error); + init_generic_context_from_args_handles (&context, type_args, method_args); + klass = mono_class_get_checked (image, token, error); if (klass) - klass = mono_class_inflate_generic_class_checked (klass, &context, &error); - if (!mono_error_ok (&error)) { - mono_error_set_pending_exception (&error); - return NULL; - } + klass = mono_class_inflate_generic_class_checked (klass, &context, error); + if (!is_ok (error)) + goto leave; if (klass) - return &klass->byval_arg; - else - return NULL; + result = &klass->byval_arg; +leave: + HANDLE_FUNCTION_RETURN_VAL (result); + +} +ICALL_EXPORT MonoType* +ves_icall_System_Reflection_Module_ResolveTypeToken (MonoImage *image, guint32 token, MonoArrayHandle type_args, MonoArrayHandle method_args, MonoResolveTokenError *resolve_error, MonoError *error) +{ + return module_resolve_type_token (image, token, type_args, method_args, resolve_error, error); } -ICALL_EXPORT MonoMethod* -ves_icall_System_Reflection_Module_ResolveMethodToken (MonoImage *image, guint32 token, MonoArray *type_args, MonoArray *method_args, MonoResolveTokenError *resolve_error) +static MonoMethod* +module_resolve_method_token (MonoImage *image, guint32 token, MonoArrayHandle type_args, MonoArrayHandle method_args, MonoResolveTokenError *resolve_error, MonoError *error) { - MonoError error; + HANDLE_FUNCTION_ENTER (); + mono_error_init (error); + MonoMethod *method = NULL; int table = mono_metadata_token_table (token); int index = mono_metadata_token_index (token); MonoGenericContext context; - MonoMethod *method; *resolve_error = ResolveTokenError_Other; @@ -5819,41 +5825,49 @@ ves_icall_System_Reflection_Module_ResolveMethodToken (MonoImage *image, guint32 if ((table != MONO_TABLE_METHOD) && (table != MONO_TABLE_METHODSPEC) && (table != MONO_TABLE_MEMBERREF)) { *resolve_error = ResolveTokenError_BadTable; - return NULL; + goto leave; } if (image_is_dynamic (image)) { if (table == MONO_TABLE_METHOD) { - method = (MonoMethod *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &error); - mono_error_cleanup (&error); - return method; + MonoError inner_error; + method = (MonoMethod *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &inner_error); + mono_error_cleanup (&inner_error); + goto leave; } if ((table == MONO_TABLE_MEMBERREF) && !(mono_memberref_is_method (image, token))) { *resolve_error = ResolveTokenError_BadTable; - return NULL; + goto leave; } - init_generic_context_from_args (&context, type_args, method_args); - method = (MonoMethod *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context, &error); - mono_error_cleanup (&error); - return method; + init_generic_context_from_args_handles (&context, type_args, method_args); + MonoError inner_error; + method = (MonoMethod *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context, &inner_error); + mono_error_cleanup (&inner_error); + goto leave; } if ((index <= 0) || (index > image->tables [table].rows)) { *resolve_error = ResolveTokenError_OutOfRange; - return NULL; + goto leave; } if ((table == MONO_TABLE_MEMBERREF) && (!mono_memberref_is_method (image, token))) { *resolve_error = ResolveTokenError_BadTable; - return NULL; + goto leave; } - init_generic_context_from_args (&context, type_args, method_args); - method = mono_get_method_checked (image, token, NULL, &context, &error); - mono_error_set_pending_exception (&error); + init_generic_context_from_args_handles (&context, type_args, method_args); + method = mono_get_method_checked (image, token, NULL, &context, error); + +leave: + HANDLE_FUNCTION_RETURN_VAL (method); +} - return method; +ICALL_EXPORT MonoMethod* +ves_icall_System_Reflection_Module_ResolveMethodToken (MonoImage *image, guint32 token, MonoArrayHandle type_args, MonoArrayHandle method_args, MonoResolveTokenError *resolve_error, MonoError *error) +{ + return module_resolve_method_token (image, token, type_args, method_args, resolve_error, error); } ICALL_EXPORT MonoString* @@ -5888,123 +5902,117 @@ ves_icall_System_Reflection_Module_ResolveStringToken (MonoImage *image, guint32 return result; } -ICALL_EXPORT MonoClassField* -ves_icall_System_Reflection_Module_ResolveFieldToken (MonoImage *image, guint32 token, MonoArray *type_args, MonoArray *method_args, MonoResolveTokenError *resolve_error) +static MonoClassField* +module_resolve_field_token (MonoImage *image, guint32 token, MonoArrayHandle type_args, MonoArrayHandle method_args, MonoResolveTokenError *resolve_error, MonoError *error) { - MonoError error; + HANDLE_FUNCTION_ENTER (); MonoClass *klass; int table = mono_metadata_token_table (token); int index = mono_metadata_token_index (token); MonoGenericContext context; - MonoClassField *field; + MonoClassField *field = NULL; + mono_error_init (error); *resolve_error = ResolveTokenError_Other; /* Validate token */ if ((table != MONO_TABLE_FIELD) && (table != MONO_TABLE_MEMBERREF)) { *resolve_error = ResolveTokenError_BadTable; - return NULL; + goto leave; } if (image_is_dynamic (image)) { if (table == MONO_TABLE_FIELD) { - field = (MonoClassField *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &error); - mono_error_cleanup (&error); - return field; + MonoError inner_error; + field = (MonoClassField *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, NULL, &inner_error); + mono_error_cleanup (&inner_error); + goto leave; } if (mono_memberref_is_method (image, token)) { *resolve_error = ResolveTokenError_BadTable; - return NULL; + goto leave; } - init_generic_context_from_args (&context, type_args, method_args); - field = (MonoClassField *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context, &error); - mono_error_cleanup (&error); - return field; + init_generic_context_from_args_handles (&context, type_args, method_args); + MonoError inner_error; + field = (MonoClassField *)mono_lookup_dynamic_token_class (image, token, FALSE, NULL, &context, &inner_error); + mono_error_cleanup (&inner_error); + goto leave; } if ((index <= 0) || (index > image->tables [table].rows)) { *resolve_error = ResolveTokenError_OutOfRange; - return NULL; + goto leave; } if ((table == MONO_TABLE_MEMBERREF) && (mono_memberref_is_method (image, token))) { *resolve_error = ResolveTokenError_BadTable; - return NULL; + goto leave; } - init_generic_context_from_args (&context, type_args, method_args); - field = mono_field_from_token_checked (image, token, &klass, &context, &error); - mono_error_set_pending_exception (&error); + init_generic_context_from_args_handles (&context, type_args, method_args); + field = mono_field_from_token_checked (image, token, &klass, &context, error); - return field; +leave: + HANDLE_FUNCTION_RETURN_VAL (field); } +ICALL_EXPORT MonoClassField* +ves_icall_System_Reflection_Module_ResolveFieldToken (MonoImage *image, guint32 token, MonoArrayHandle type_args, MonoArrayHandle method_args, MonoResolveTokenError *resolve_error, MonoError *error) +{ + return module_resolve_field_token (image, token, type_args, method_args, resolve_error, error); +} -ICALL_EXPORT MonoObject* -ves_icall_System_Reflection_Module_ResolveMemberToken (MonoImage *image, guint32 token, MonoArray *type_args, MonoArray *method_args, MonoResolveTokenError *error) +ICALL_EXPORT MonoObjectHandle +ves_icall_System_Reflection_Module_ResolveMemberToken (MonoImage *image, guint32 token, MonoArrayHandle type_args, MonoArrayHandle method_args, MonoResolveTokenError *error, MonoError *merror) { - MonoError merror; - MonoObject *ret; int table = mono_metadata_token_table (token); + mono_error_init (merror); *error = ResolveTokenError_Other; switch (table) { case MONO_TABLE_TYPEDEF: case MONO_TABLE_TYPEREF: case MONO_TABLE_TYPESPEC: { - MonoType *t = ves_icall_System_Reflection_Module_ResolveTypeToken (image, token, type_args, method_args, error); + MonoType *t = module_resolve_type_token (image, token, type_args, method_args, error, merror); if (t) { - ret = (MonoObject*) mono_type_get_object_checked (mono_domain_get (), t, &merror); - mono_error_set_pending_exception (&merror); - - return ret; + return MONO_HANDLE_CAST (MonoObject, mono_type_get_object_handle (mono_domain_get (), t, merror)); } else - return NULL; + return NULL_HANDLE; } case MONO_TABLE_METHOD: case MONO_TABLE_METHODSPEC: { - MonoMethod *m = ves_icall_System_Reflection_Module_ResolveMethodToken (image, token, type_args, method_args, error); + MonoMethod *m = module_resolve_method_token (image, token, type_args, method_args, error, merror); if (m) { - ret = (MonoObject*)mono_method_get_object_checked (mono_domain_get (), m, m->klass, &merror); - mono_error_set_pending_exception (&merror); - - return ret; + return MONO_HANDLE_CAST (MonoObject, mono_method_get_object_handle (mono_domain_get (), m, m->klass, merror)); } else - return NULL; + return NULL_HANDLE; } case MONO_TABLE_FIELD: { - MonoClassField *f = ves_icall_System_Reflection_Module_ResolveFieldToken (image, token, type_args, method_args, error); + MonoClassField *f = module_resolve_field_token (image, token, type_args, method_args, error, merror); if (f) { - ret =(MonoObject*)mono_field_get_object_checked (mono_domain_get (), f->parent, f, &merror); - mono_error_set_pending_exception (&merror); - return ret; + return MONO_HANDLE_CAST (MonoObject, mono_field_get_object_handle (mono_domain_get (), f->parent, f, merror)); } else - return NULL; + return NULL_HANDLE; } case MONO_TABLE_MEMBERREF: if (mono_memberref_is_method (image, token)) { - MonoMethod *m = ves_icall_System_Reflection_Module_ResolveMethodToken (image, token, type_args, method_args, error); + MonoMethod *m = module_resolve_method_token (image, token, type_args, method_args, error, merror); if (m) { - ret = (MonoObject*)mono_method_get_object_checked (mono_domain_get (), m, m->klass, &merror); - mono_error_set_pending_exception (&merror); - - return ret; + return MONO_HANDLE_CAST (MonoObject, mono_method_get_object_handle (mono_domain_get (), m, m->klass, merror)); } else - return NULL; + return NULL_HANDLE; } else { - MonoClassField *f = ves_icall_System_Reflection_Module_ResolveFieldToken (image, token, type_args, method_args, error); + MonoClassField *f = module_resolve_field_token (image, token, type_args, method_args, error, merror); if (f) { - ret = (MonoObject*)mono_field_get_object_checked (mono_domain_get (), f->parent, f, &merror); - mono_error_set_pending_exception (&merror); - return ret; + return MONO_HANDLE_CAST (MonoObject, mono_field_get_object_handle (mono_domain_get (), f->parent, f, merror)); } else - return NULL; + return NULL_HANDLE; } break; @@ -6012,7 +6020,7 @@ ves_icall_System_Reflection_Module_ResolveMemberToken (MonoImage *image, guint32 *error = ResolveTokenError_BadTable; } - return NULL; + return NULL_HANDLE; } ICALL_EXPORT MonoArray* @@ -7652,16 +7660,33 @@ ves_icall_System_NumberFormatter_GetFormatterTables (guint64 const **mantissas, *decHexDigits = Formatter_DecHexDigits; } +static gboolean +add_modifier_to_array (MonoDomain *domain, MonoImage *image, MonoCustomMod *modifier, MonoArrayHandle dest, int dest_idx, MonoError *error) +{ + HANDLE_FUNCTION_ENTER (); + mono_error_init (error); + MonoClass *klass = mono_class_get_checked (image, modifier->token, error); + if (!is_ok (error)) + goto leave; + + MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, &klass->byval_arg, error); + if (!is_ok (error)) + goto leave; + + MONO_HANDLE_ARRAY_SETREF (dest, dest_idx, rt); +leave: + HANDLE_FUNCTION_RETURN_VAL (is_ok (error)); +} + /* * We return NULL for no modifiers so the corlib code can return Type.EmptyTypes * and avoid useless allocations. */ -static MonoArray* +static MonoArrayHandle type_array_from_modifiers (MonoImage *image, MonoType *type, int optional, MonoError *error) { - MonoReflectionType *rt; - MonoArray *res; int i, count = 0; + MonoDomain *domain = mono_domain_get (); mono_error_init (error); for (i = 0; i < type->num_mods; ++i) { @@ -7669,66 +7694,62 @@ type_array_from_modifiers (MonoImage *image, MonoType *type, int optional, MonoE count++; } if (!count) - return NULL; - res = mono_array_new_checked (mono_domain_get (), mono_defaults.systemtype_class, count, error); - return_val_if_nok (error, NULL); + return MONO_HANDLE_NEW (MonoArray, NULL); + + MonoArrayHandle res = mono_array_new_handle (domain, mono_defaults.systemtype_class, count, error); + if (!is_ok (error)) + goto fail; count = 0; for (i = 0; i < type->num_mods; ++i) { if ((optional && !type->modifiers [i].required) || (!optional && type->modifiers [i].required)) { - MonoClass *klass = mono_class_get_checked (image, type->modifiers [i].token, error); - return_val_if_nok (error, NULL); - - rt = mono_type_get_object_checked (mono_domain_get (), &klass->byval_arg, error); - return_val_if_nok (error, NULL); - - mono_array_setref (res, count, rt); + if (!add_modifier_to_array (domain, image, &type->modifiers[i], res, count , error)) + goto fail; count++; } } return res; +fail: + return MONO_HANDLE_NEW (MonoArray, NULL); } -ICALL_EXPORT MonoArray* -ves_icall_ParameterInfo_GetTypeModifiers (MonoReflectionParameter *param, MonoBoolean optional) +ICALL_EXPORT MonoArrayHandle +ves_icall_ParameterInfo_GetTypeModifiers (MonoReflectionParameterHandle param, MonoBoolean optional, MonoError *error) { - MonoError error; - MonoType *type = param->ClassImpl->type; - MonoClass *member_class = mono_object_class (param->MemberImpl); + mono_error_init (error); + MonoReflectionTypeHandle rt = MONO_HANDLE_NEW (MonoReflectionType, NULL); + MONO_HANDLE_GET (rt, param, ClassImpl); + MonoType *type = MONO_HANDLE_GETVAL (rt, type); + MonoObjectHandle member = MONO_HANDLE_NEW (MonoObject, NULL); + MONO_HANDLE_GET (member, param, MemberImpl); + MonoClass *member_class = mono_handle_class (member); MonoMethod *method = NULL; MonoImage *image; int pos; MonoMethodSignature *sig; - MonoArray *res; if (mono_class_is_reflection_method_or_constructor (member_class)) { - MonoReflectionMethod *rmethod = (MonoReflectionMethod*)param->MemberImpl; - method = rmethod->method; + method = MONO_HANDLE_GETVAL (MONO_HANDLE_CAST (MonoReflectionMethod, member), method); } else if (member_class->image == mono_defaults.corlib && !strcmp ("MonoProperty", member_class->name)) { - MonoReflectionProperty *prop = (MonoReflectionProperty *)param->MemberImpl; - if (!(method = prop->property->get)) - method = prop->property->set; + MonoProperty *prop = MONO_HANDLE_GETVAL (MONO_HANDLE_CAST (MonoReflectionProperty, member), property); + if (!(method = prop->get)) + method = prop->set; g_assert (method); } else { char *type_name = mono_type_get_full_name (member_class); - char *msg = g_strdup_printf ("Custom modifiers on a ParamInfo with member %s are not supported", type_name); - MonoException *ex = mono_get_exception_not_supported (msg); + mono_error_set_not_supported (error, "Custom modifiers on a ParamInfo with member %s are not supported", type_name); g_free (type_name); - g_free (msg); - mono_set_pending_exception (ex); - return NULL; + return MONO_HANDLE_CAST (MonoArray, NULL_HANDLE); } image = method->klass->image; - pos = param->PositionImpl; + pos = MONO_HANDLE_GETVAL (param, PositionImpl); sig = mono_method_signature (method); if (pos == -1) type = sig->ret; else type = sig->params [pos]; - res = type_array_from_modifiers (image, type, optional, &error); - mono_error_set_pending_exception (&error); - return res; + return type_array_from_modifiers (image, type, optional, error); } static MonoType* @@ -7745,19 +7766,18 @@ get_property_type (MonoProperty *prop) return NULL; } -ICALL_EXPORT MonoArray* -ves_icall_MonoPropertyInfo_GetTypeModifiers (MonoReflectionProperty *property, MonoBoolean optional) +ICALL_EXPORT MonoArrayHandle +ves_icall_MonoPropertyInfo_GetTypeModifiers (MonoReflectionPropertyHandle property, MonoBoolean optional, MonoError *error) { - MonoError error; - MonoType *type = get_property_type (property->property); - MonoImage *image = property->klass->image; - MonoArray *res; + mono_error_init (error); + MonoProperty *prop = MONO_HANDLE_GETVAL (property, property); + MonoClass *klass = MONO_HANDLE_GETVAL (property, klass); + MonoType *type = get_property_type (prop); + MonoImage *image = klass->image; if (!type) - return NULL; - res = type_array_from_modifiers (image, type, optional, &error); - mono_error_set_pending_exception (&error); - return res; + return MONO_HANDLE_CAST (MonoArray, NULL_HANDLE); + return type_array_from_modifiers (image, type, optional, error); } /* diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c index e376d860f85..360938c244a 100644 --- a/mono/metadata/marshal.c +++ b/mono/metadata/marshal.c @@ -2624,6 +2624,9 @@ mono_marshal_get_ptr_to_string_conv (MonoMethodPInvoke *piinfo, MonoMarshalSpec case MONO_NATIVE_VBBYREFSTR: return MONO_MARSHAL_CONV_LPSTR_STR; case MONO_NATIVE_LPTSTR: +#ifdef TARGET_WIN32 + *need_free = FALSE; +#endif return MONO_MARSHAL_CONV_LPTSTR_STR; case MONO_NATIVE_BSTR: return MONO_MARSHAL_CONV_BSTR_STR; diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h index da262e4cfe3..60b34a1880d 100644 --- a/mono/metadata/metadata-internals.h +++ b/mono/metadata/metadata-internals.h @@ -775,6 +775,9 @@ MonoGenericInst * mono_metadata_get_generic_inst (int type_argc, MonoType **type_argv); +MonoGenericInst * +mono_metadata_get_canonical_generic_inst (MonoGenericInst *candidate); + MonoGenericClass * mono_metadata_lookup_generic_class (MonoClass *gclass, MonoGenericInst *inst, diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c index 86fea9155ce..2fdcb1f6bff 100644 --- a/mono/metadata/metadata.c +++ b/mono/metadata/metadata.c @@ -2891,8 +2891,6 @@ mono_metadata_get_generic_inst (int type_argc, MonoType **type_argv) gboolean is_open; int i; int size = MONO_SIZEOF_GENERIC_INST + type_argc * sizeof (MonoType *); - CollectData data; - MonoImageSet *set; for (i = 0; i < type_argc; ++i) if (mono_class_is_open_constructed_type (type_argv [i])) @@ -2905,9 +2903,34 @@ mono_metadata_get_generic_inst (int type_argc, MonoType **type_argv) ginst->type_argc = type_argc; memcpy (ginst->type_argv, type_argv, type_argc * sizeof (MonoType *)); + return mono_metadata_get_canonical_generic_inst (ginst); +} + + +/** + * mono_metadata_get_canonical_generic_inst: + * @candidate: an arbitrary generic instantiation + * + * Returns the canonical generic instantiation that represents the given + * candidate by identifying the image set for the candidate instantiation and + * finding the instance in the image set or adding a copy of the given instance + * to the image set. + * + * The returned MonoGenericInst has its own copy of the list of types. The list + * passed in the argument can be freed, modified or disposed of. + * + */ +MonoGenericInst * +mono_metadata_get_canonical_generic_inst (MonoGenericInst *candidate) +{ + CollectData data; + int type_argc = candidate->type_argc; + gboolean is_open = candidate->is_open; + MonoImageSet *set; + collect_data_init (&data); - collect_ginst_images (ginst, &data); + collect_ginst_images (candidate, &data); set = get_image_set (data.images, data.nimages); @@ -2915,8 +2938,9 @@ mono_metadata_get_generic_inst (int type_argc, MonoType **type_argv) mono_image_set_lock (set); - ginst = (MonoGenericInst *)g_hash_table_lookup (set->ginst_cache, ginst); + MonoGenericInst *ginst = (MonoGenericInst *)g_hash_table_lookup (set->ginst_cache, candidate); if (!ginst) { + int size = MONO_SIZEOF_GENERIC_INST + type_argc * sizeof (MonoType *); ginst = (MonoGenericInst *)mono_image_set_alloc0 (set, size); #ifndef MONO_SMALL_CONFIG ginst->id = ++next_generic_inst_id; @@ -2924,8 +2948,8 @@ mono_metadata_get_generic_inst (int type_argc, MonoType **type_argv) ginst->is_open = is_open; ginst->type_argc = type_argc; - for (i = 0; i < type_argc; ++i) - ginst->type_argv [i] = mono_metadata_type_dup (NULL, type_argv [i]); + for (int i = 0; i < type_argc; ++i) + ginst->type_argv [i] = mono_metadata_type_dup (NULL, candidate->type_argv [i]); g_hash_table_insert (set->ginst_cache, ginst, ginst); } diff --git a/mono/metadata/mono-debug.c b/mono/metadata/mono-debug.c index b139ce9f3e6..4d81eefb8d1 100644 --- a/mono/metadata/mono-debug.c +++ b/mono/metadata/mono-debug.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #define ALIGN_TO(val,align) ((((guint64)val) + ((align) - 1)) & ~((align) - 1)) @@ -861,6 +863,14 @@ mono_debug_free_source_location (MonoDebugSourceLocation *location) } } +static int (*get_seq_point) (MonoDomain *domain, MonoMethod *method, gint32 native_offset); + +void +mono_install_get_seq_point (MonoGetSeqPointFunc func) +{ + get_seq_point = func; +} + /** * mono_debug_print_stack_frame: * @native_offset: Native offset within the @method's machine code. @@ -891,10 +901,22 @@ mono_debug_print_stack_frame (MonoMethod *method, guint32 native_offset, MonoDom offset = -1; } + if (offset < 0 && get_seq_point) + offset = get_seq_point (domain, method, native_offset); + if (offset < 0) res = g_strdup_printf ("at %s <0x%05x>", fname, native_offset); - else - res = g_strdup_printf ("at %s ", fname, offset, native_offset); + else { + char *mvid = mono_guid_to_string_minimal ((uint8_t*)method->klass->image->heap_guid.data); + char *aotid = mono_runtime_get_aotid (); + if (aotid) + res = g_strdup_printf ("at %s [0x%05x] in <%s#%s>:0" , fname, offset, mvid, aotid); + else + res = g_strdup_printf ("at %s [0x%05x] in <%s>:0" , fname, offset, mvid); + + g_free (aotid); + g_free (mvid); + } g_free (fname); return res; } diff --git a/mono/metadata/object-internals.h b/mono/metadata/object-internals.h index f7beb015da8..935e676ff62 100644 --- a/mono/metadata/object-internals.h +++ b/mono/metadata/object-internals.h @@ -730,11 +730,6 @@ struct _MonoReflectionMethod { /* Safely access System.Reflection.MonoMethod from native code */ TYPED_HANDLE_DECL (MonoReflectionMethod); -typedef struct _MonoReflectionGenericMethod MonoReflectionGenericMethod; -struct _MonoReflectionGenericMethod { - MonoReflectionMethod method; -}; - struct _MonoDelegate { MonoObject object; /* The compiled code of the target method */ @@ -772,24 +767,36 @@ struct _MonoReflectionField { guint32 attrs; }; +/* Safely access System.Reflection.MonoField from native code */ +TYPED_HANDLE_DECL (MonoReflectionField); + struct _MonoReflectionProperty { MonoObject object; MonoClass *klass; MonoProperty *property; }; +/* Safely access System.Reflection.MonoProperty from native code */ +TYPED_HANDLE_DECL (MonoReflectionProperty); + /*This is System.EventInfo*/ struct _MonoReflectionEvent { MonoObject object; MonoObject *cached_add_event; }; +/* Safely access System.Reflection.EventInfo from native code */ +TYPED_HANDLE_DECL (MonoReflectionEvent); + typedef struct { MonoReflectionEvent object; MonoClass *klass; MonoEvent *event; } MonoReflectionMonoEvent; +/* Safely access Systme.Reflection.MonoEvent from native code */ +TYPED_HANDLE_DECL (MonoReflectionMonoEvent); + typedef struct { MonoObject object; MonoReflectionType *ClassImpl; @@ -801,6 +808,9 @@ typedef struct { MonoObject *MarshalAsImpl; } MonoReflectionParameter; +/* Safely access System.Reflection.ParameterInfo from native code */ +TYPED_HANDLE_DECL (MonoReflectionParameter); + struct _MonoReflectionMethodBody { MonoObject object; MonoArray *clauses; @@ -811,6 +821,9 @@ struct _MonoReflectionMethodBody { guint32 max_stack; }; +/* Safely access System.Reflection.MethodBody from native code */ +TYPED_HANDLE_DECL (MonoReflectionMethodBody); + struct _MonoReflectionAssembly { MonoObject object; MonoAssembly *assembly; @@ -917,6 +930,10 @@ typedef struct { gint32 handler_length; } MonoReflectionExceptionHandlingClause; + +/* Safely access System.Reflection.ExceptionHandlingClause from native code */ +TYPED_HANDLE_DECL (MonoReflectionExceptionHandlingClause); + typedef struct { MonoObject object; MonoReflectionType *local_type; @@ -924,6 +941,9 @@ typedef struct { guint16 local_index; } MonoReflectionLocalVariableInfo; +/* Safely access System.Reflection.LocalVariableInfo from native code */ +TYPED_HANDLE_DECL (MonoReflectionLocalVariableInfo); + typedef struct { /* * Must have the same layout as MonoReflectionLocalVariableInfo, since @@ -1258,6 +1278,9 @@ typedef struct { gint16 size_param_index; } MonoReflectionMarshalAsAttribute; +/* Safely access System.Runtime.InteropServices.MarshalAsAttribute */ +TYPED_HANDLE_DECL (MonoReflectionMarshalAsAttribute); + typedef struct { MonoObject object; gint32 call_conv; @@ -1372,7 +1395,7 @@ void mono_reflection_register_with_runtime (MonoReflectionType *type); void mono_reflection_create_custom_attr_data_args (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len, MonoArray **typed_args, MonoArray **named_args, CattrNamedArg **named_arg_info, MonoError *error); MonoMethodSignature * mono_reflection_lookup_signature (MonoImage *image, MonoMethod *method, guint32 token, MonoError *error); -MonoArray* mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error); +MonoArrayHandle mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error); MonoClass* mono_class_bind_generic_parameters (MonoClass *klass, int type_argc, MonoType **types, gboolean is_dynamic); @@ -1390,7 +1413,8 @@ ves_icall_SignatureHelper_get_signature_local (MonoReflectionSigHelper *sig); MonoArray * ves_icall_SignatureHelper_get_signature_field (MonoReflectionSigHelper *sig); -MonoReflectionMarshalAsAttribute* mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec, MonoError *error); +MonoReflectionMarshalAsAttributeHandle +mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec, MonoError *error); gpointer mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error); diff --git a/mono/metadata/object-offsets.h b/mono/metadata/object-offsets.h index fdddc7f5783..d403bd731aa 100644 --- a/mono/metadata/object-offsets.h +++ b/mono/metadata/object-offsets.h @@ -204,6 +204,9 @@ DECL_OFFSET(MonoLMF, fp) DECL_OFFSET(MonoLMF, ip) DECL_OFFSET(MonoLMF, iregs) DECL_OFFSET(MonoLMF, fregs) +DECL_OFFSET(DynCallArgs, fpregs) +DECL_OFFSET(DynCallArgs, has_fpregs) +DECL_OFFSET(SeqPointInfo, ss_tramp_addr) #elif defined(TARGET_ARM64) DECL_OFFSET(MonoLMF, pc) DECL_OFFSET(MonoLMF, gregs) diff --git a/mono/metadata/reflection-cache.h b/mono/metadata/reflection-cache.h index 8f68929c2a3..5799b620e72 100644 --- a/mono/metadata/reflection-cache.h +++ b/mono/metadata/reflection-cache.h @@ -86,24 +86,8 @@ cache_object_handle (MonoDomain *domain, MonoClass *klass, gpointer item, MonoOb return obj; } - #define CACHE_OBJECT(t,p,o,k) ((t) (cache_object (domain, (k), (p), (o)))) - -static inline MonoObject* -check_object (MonoDomain* domain, MonoClass *klass, gpointer item) -{ - ReflectedEntry e; - e.item = item; - e.refclass = klass; - mono_domain_lock (domain); - if (!domain->refobject_hash) - domain->refobject_hash = mono_g_hash_table_new_type (reflected_hash, reflected_equal, MONO_HASH_VALUE_GC, MONO_ROOT_SOURCE_DOMAIN, "domain reflection objects table"); - MonoObject *obj = (MonoObject*) mono_g_hash_table_lookup (domain->refobject_hash, &e); - mono_domain_unlock (domain); - return obj; -} - static inline MonoObjectHandle check_object_handle (MonoDomain* domain, MonoClass *klass, gpointer item) { @@ -119,24 +103,8 @@ check_object_handle (MonoDomain* domain, MonoClass *klass, gpointer item) } -typedef MonoObject* (*ReflectionCacheConstructFunc) (MonoDomain*, MonoClass*, gpointer, gpointer, MonoError *); - typedef MonoObjectHandle (*ReflectionCacheConstructFunc_handle) (MonoDomain*, MonoClass*, gpointer, gpointer, MonoError *); - -static inline MonoObject* -check_or_construct (MonoDomain *domain, MonoClass *klass, gpointer item, gpointer user_data, MonoError *error, ReflectionCacheConstructFunc construct) -{ - mono_error_init (error); - MonoObject *obj = check_object (domain, klass, item); - if (obj) - return obj; - obj = construct (domain, klass, item, user_data, error); - return_val_if_nok (error, NULL); - /* note no caching if there was an error in construction */ - return cache_object (domain, klass, item, obj); -} - static inline MonoObjectHandle check_or_construct_handle (MonoDomain *domain, MonoClass *klass, gpointer item, gpointer user_data, MonoError *error, ReflectionCacheConstructFunc_handle construct) { @@ -151,8 +119,6 @@ check_or_construct_handle (MonoDomain *domain, MonoClass *klass, gpointer item, } -#define CHECK_OR_CONSTRUCT(t,p,k,construct,ud) ((t) check_or_construct (domain, (k), (p), (ud), error, (ReflectionCacheConstructFunc) (construct))) - #define CHECK_OR_CONSTRUCT_HANDLE(t,p,k,construct,ud) ((t) check_or_construct_handle (domain, (k), (p), (ud), error, (ReflectionCacheConstructFunc_handle) (construct))) diff --git a/mono/metadata/reflection-internals.h b/mono/metadata/reflection-internals.h index 0f2af6bd9da..27fbba80a15 100644 --- a/mono/metadata/reflection-internals.h +++ b/mono/metadata/reflection-internals.h @@ -76,6 +76,9 @@ mono_type_get_object_handle (MonoDomain *domain, MonoType *type, MonoError *erro MonoReflectionField* mono_field_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoClassField *field, MonoError *error); +MonoReflectionFieldHandle +mono_field_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoClassField *field, MonoError *error); + MonoReflectionMethod* mono_method_get_object_checked (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error); @@ -85,8 +88,11 @@ mono_method_get_object_handle (MonoDomain *domain, MonoMethod *method, MonoClass MonoReflectionProperty* mono_property_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error); -MonoReflectionEvent* -mono_event_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoEvent *event, MonoError *error); +MonoReflectionPropertyHandle +mono_property_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error); + +MonoReflectionEventHandle +mono_event_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoEvent *event, MonoError *error); MonoReflectionModuleHandle mono_module_get_object_handle (MonoDomain *domain, MonoImage *image, MonoError *error); @@ -94,8 +100,8 @@ mono_module_get_object_handle (MonoDomain *domain, MonoImage *image, MonoError * MonoReflectionModuleHandle mono_module_file_get_object_handle (MonoDomain *domain, MonoImage *image, int table_index, MonoError *error); -MonoReflectionMethodBody* -mono_method_body_get_object_checked (MonoDomain *domain, MonoMethod *method, MonoError *error); +MonoReflectionMethodBodyHandle +mono_method_body_get_object_handle (MonoDomain *domain, MonoMethod *method, MonoError *error); MonoClass * mono_class_from_mono_type_handle (MonoReflectionTypeHandle h); diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c index 45b5a54274b..b627a9f6820 100644 --- a/mono/metadata/reflection.c +++ b/mono/metadata/reflection.c @@ -576,18 +576,20 @@ method_object_construct (MonoDomain *domain, MonoClass *refclass, MonoMethod *me klass = mono_class_get_mono_method_class (); } MonoReflectionMethodHandle ret = MONO_HANDLE_NEW (MonoReflectionMethod, mono_object_new_checked (domain, klass, error)); - if (!mono_error_ok (error)) - goto leave; + if (!is_ok (error)) + goto fail; MONO_HANDLE_SETVAL (ret, method, MonoMethod*, method); MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, &refclass->byval_arg, error); - if (!mono_error_ok (error)) - goto leave; + if (!is_ok (error)) + goto fail; MONO_HANDLE_SET (ret, reftype, rt); -leave: return ret; + +fail: + return MONO_HANDLE_CAST (MonoReflectionMethod, NULL_HANDLE); } /* @@ -623,7 +625,6 @@ MonoReflectionMethod* mono_method_get_object_checked (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error) { HANDLE_FUNCTION_ENTER (); - mono_error_init (error); MonoReflectionMethodHandle result = mono_method_get_object_handle (domain, method, refclass, error); HANDLE_FUNCTION_RETURN_OBJ (result); } @@ -665,39 +666,59 @@ mono_method_clear_object (MonoDomain *domain, MonoMethod *method) MonoReflectionField* mono_field_get_object (MonoDomain *domain, MonoClass *klass, MonoClassField *field) { + HANDLE_FUNCTION_ENTER (); MonoError error; - MonoReflectionField *result; - result = mono_field_get_object_checked (domain, klass, field, &error); + MonoReflectionFieldHandle result = mono_field_get_object_handle (domain, klass, field, &error); mono_error_cleanup (&error); - return result; + HANDLE_FUNCTION_RETURN_OBJ (result); } -static MonoReflectionField* +static MonoReflectionFieldHandle field_object_construct (MonoDomain *domain, MonoClass *klass, MonoClassField *field, gpointer user_data, MonoError *error) { - MonoReflectionType *rt; - MonoReflectionField *res; - mono_error_init (error); - res = (MonoReflectionField *)mono_object_new_checked (domain, mono_class_get_mono_field_class (), error); - if (!res) - return NULL; - res->klass = klass; - res->field = field; - MONO_OBJECT_SETREF (res, name, mono_string_new (domain, mono_field_get_name (field))); + MonoReflectionFieldHandle res = MONO_HANDLE_NEW (MonoReflectionField, mono_object_new_checked (domain, mono_class_get_mono_field_class (), error)); + if (!is_ok (error)) + goto fail; + MONO_HANDLE_SETVAL (res, klass, MonoClass *, klass); + MONO_HANDLE_SETVAL (res, field, MonoClassField *, field); + MonoStringHandle name = mono_string_new_handle (domain, mono_field_get_name (field), error); + if (!is_ok (error)) + goto fail; + MONO_HANDLE_SET (res, name, name); if (field->type) { - rt = mono_type_get_object_checked (domain, field->type, error); - if (!mono_error_ok (error)) - return NULL; + MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, field->type, error); + if (!is_ok (error)) + goto fail; - MONO_OBJECT_SETREF (res, type, rt); + MONO_HANDLE_SET (res, type, rt); } - res->attrs = mono_field_get_flags (field); + MONO_HANDLE_SETVAL (res, attrs, guint32, mono_field_get_flags (field)); return res; +fail: + return MONO_HANDLE_CAST (MonoReflectionField, NULL_HANDLE); } +/* + * mono_field_get_object_handle: + * @domain: an app domain + * @klass: a type + * @field: a field + * @error: set on error + * + * Return an System.Reflection.MonoField object representing the field @field + * in class @klass. On error, returns NULL and sets @error. + */ +MonoReflectionFieldHandle +mono_field_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoClassField *field, MonoError *error) +{ + mono_error_init (error); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionFieldHandle, field, klass, field_object_construct, NULL); +} + + /* * mono_field_get_object_checked: * @domain: an app domain @@ -711,8 +732,9 @@ field_object_construct (MonoDomain *domain, MonoClass *klass, MonoClassField *fi MonoReflectionField* mono_field_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoClassField *field, MonoError *error) { - mono_error_init (error); - return CHECK_OR_CONSTRUCT (MonoReflectionField*, field, klass, field_object_construct, NULL); + HANDLE_FUNCTION_ENTER (); + MonoReflectionFieldHandle result = mono_field_get_object_handle (domain, klass, field, error); + HANDLE_FUNCTION_RETURN_OBJ (result); } /* @@ -727,26 +749,42 @@ mono_field_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoClassFi MonoReflectionProperty* mono_property_get_object (MonoDomain *domain, MonoClass *klass, MonoProperty *property) { + HANDLE_FUNCTION_ENTER (); MonoError error; - MonoReflectionProperty *result; - result = mono_property_get_object_checked (domain, klass, property, &error); + MonoReflectionPropertyHandle result = mono_property_get_object_handle (domain, klass, property, &error); mono_error_cleanup (&error); - return result; + HANDLE_FUNCTION_RETURN_OBJ (result); } -static MonoReflectionProperty* +static MonoReflectionPropertyHandle property_object_construct (MonoDomain *domain, MonoClass *klass, MonoProperty *property, gpointer user_data, MonoError *error) { - MonoReflectionProperty *res; - mono_error_init (error); - res = (MonoReflectionProperty *)mono_object_new_checked (domain, mono_class_get_mono_property_class (), error); - if (!res) - return NULL; - res->klass = klass; - res->property = property; + MonoReflectionPropertyHandle res = MONO_HANDLE_NEW (MonoReflectionProperty, mono_object_new_checked (domain, mono_class_get_mono_property_class (), error)); + if (!is_ok (error)) + goto fail; + MONO_HANDLE_SETVAL (res, klass, MonoClass *, klass); + MONO_HANDLE_SETVAL (res, property, MonoProperty *, property); return res; +fail: + return MONO_HANDLE_CAST (MonoReflectionProperty, NULL_HANDLE); +} + +/** + * mono_property_get_object_handle: + * @domain: an app domain + * @klass: a type + * @property: a property + * @error: set on error + * + * Return an System.Reflection.MonoProperty object representing the property @property + * in class @klass. On error returns NULL and sets @error. + */ +MonoReflectionPropertyHandle +mono_property_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error) +{ + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionPropertyHandle, property, klass, property_object_construct, NULL); } /** @@ -762,8 +800,9 @@ property_object_construct (MonoDomain *domain, MonoClass *klass, MonoProperty *p MonoReflectionProperty* mono_property_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoProperty *property, MonoError *error) { - mono_error_init (error); - return CHECK_OR_CONSTRUCT (MonoReflectionProperty*, property, klass, property_object_construct, NULL); + HANDLE_FUNCTION_ENTER (); + MonoReflectionPropertyHandle res = mono_property_get_object_handle (domain, klass, property, error); + HANDLE_FUNCTION_RETURN_OBJ (res); } /* @@ -778,29 +817,28 @@ mono_property_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoProp MonoReflectionEvent* mono_event_get_object (MonoDomain *domain, MonoClass *klass, MonoEvent *event) { + HANDLE_FUNCTION_ENTER (); MonoError error; - MonoReflectionEvent *result; - result = mono_event_get_object_checked (domain, klass, event, &error); + MonoReflectionEventHandle result = mono_event_get_object_handle (domain, klass, event, &error); mono_error_cleanup (&error); - return result; + HANDLE_FUNCTION_RETURN_OBJ (result); } -static MonoReflectionEvent* +static MonoReflectionEventHandle event_object_construct (MonoDomain *domain, MonoClass *klass, MonoEvent *event, gpointer user_data, MonoError *error) { - MonoReflectionMonoEvent *mono_event; mono_error_init (error); - mono_event = (MonoReflectionMonoEvent *)mono_object_new_checked (domain, mono_class_get_mono_event_class (), error); - if (!mono_event) - return NULL; - mono_event->klass = klass; - mono_event->event = event; - return &mono_event->object; + MonoReflectionMonoEventHandle mono_event = MONO_HANDLE_NEW (MonoReflectionMonoEvent, mono_object_new_checked (domain, mono_class_get_mono_event_class (), error)); + if (!is_ok (error)) + return MONO_HANDLE_CAST (MonoReflectionEvent, NULL_HANDLE); + MONO_HANDLE_SETVAL (mono_event, klass, MonoClass* , klass); + MONO_HANDLE_SETVAL (mono_event, event, MonoEvent* , event); + return MONO_HANDLE_CAST (MonoReflectionEvent, mono_event); } /** - * mono_event_get_object_checked: + * mono_event_get_object_handle: * @domain: an app domain * @klass: a type * @event: a event @@ -809,13 +847,14 @@ event_object_construct (MonoDomain *domain, MonoClass *klass, MonoEvent *event, * Return an System.Reflection.MonoEvent object representing the event @event * in class @klass. On failure sets @error and returns NULL */ -MonoReflectionEvent* -mono_event_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoEvent *event, MonoError *error) +MonoReflectionEventHandle +mono_event_get_object_handle (MonoDomain *domain, MonoClass *klass, MonoEvent *event, MonoError *error) { mono_error_init (error); - return CHECK_OR_CONSTRUCT (MonoReflectionEvent*, event, klass, event_object_construct, NULL); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionEventHandle, event, klass, event_object_construct, NULL); } + /** * mono_get_reflection_missing_object: * @domain: Domain where the object lives @@ -826,11 +865,10 @@ mono_event_get_object_checked (MonoDomain *domain, MonoClass *klass, MonoEvent * * Used as the value for ParameterInfo.DefaultValue when Optional * is present */ -static MonoObject * +static MonoObjectHandle mono_get_reflection_missing_object (MonoDomain *domain) { MonoError error; - MonoObject *obj; static MonoClassField *missing_value_field = NULL; if (!missing_value_field) { @@ -840,15 +878,15 @@ mono_get_reflection_missing_object (MonoDomain *domain) missing_value_field = mono_class_get_field_from_name (missing_klass, "Value"); g_assert (missing_value_field); } - obj = mono_field_get_value_object_checked (domain, missing_value_field, NULL, &error); + /* FIXME change mono_field_get_value_object_checked to return a handle */ + MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_field_get_value_object_checked (domain, missing_value_field, NULL, &error)); mono_error_assert_ok (&error); return obj; } -static MonoObject* +static MonoObjectHandle get_dbnull_object (MonoDomain *domain, MonoError *error) { - MonoObject *obj; static MonoClassField *dbnull_value_field = NULL; mono_error_init (error); @@ -859,61 +897,123 @@ get_dbnull_object (MonoDomain *domain, MonoError *error) dbnull_value_field = mono_class_get_field_from_name (dbnull_klass, "Value"); g_assert (dbnull_value_field); } - obj = mono_field_get_value_object_checked (domain, dbnull_value_field, NULL, error); + /* FIXME change mono_field_get_value_object_checked to return a handle */ + MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_field_get_value_object_checked (domain, dbnull_value_field, NULL, error)); return obj; } -static MonoObject* -get_dbnull (MonoDomain *domain, MonoObject **dbnull, MonoError *error) +static MonoObjectHandle +get_dbnull (MonoDomain *domain, MonoObjectHandle dbnull, MonoError *error) { mono_error_init (error); - if (!*dbnull) - *dbnull = get_dbnull_object (domain, error); - return *dbnull; + if (MONO_HANDLE_IS_NULL (dbnull)) + MONO_HANDLE_ASSIGN (dbnull, get_dbnull_object (domain, error)); + return dbnull; } -static MonoObject* -get_reflection_missing (MonoDomain *domain, MonoObject **reflection_missing) +static MonoObjectHandle +get_reflection_missing (MonoDomain *domain, MonoObjectHandleOut reflection_missing) { - if (!*reflection_missing) - *reflection_missing = mono_get_reflection_missing_object (domain); - return *reflection_missing; + if (MONO_HANDLE_IS_NULL (reflection_missing)) + MONO_HANDLE_ASSIGN (reflection_missing, mono_get_reflection_missing_object (domain)); + return reflection_missing; } -static MonoArray* -param_objects_construct (MonoDomain *domain, MonoClass *refclass, MonoMethodSignature **addr_of_sig, gpointer user_data, MonoError *error) +static gboolean +add_parameter_object_to_array (MonoDomain *domain, MonoMethod *method, MonoObjectHandle member, int idx, const char *name, MonoType *sig_param, guint32 blob_type_enum, const char *blob, MonoMarshalSpec *mspec, MonoObjectHandle missing, MonoObjectHandle dbnull, MonoArrayHandle dest, MonoError *error) { - static MonoClass *System_Reflection_ParameterInfo; - static MonoClass *System_Reflection_ParameterInfo_array; + HANDLE_FUNCTION_ENTER (); + mono_error_init (error); + MonoReflectionParameterHandle param = MONO_HANDLE_NEW (MonoReflectionParameter, mono_object_new_checked (domain, mono_class_get_mono_parameter_info_class (), error)); + if (!is_ok (error)) + goto leave; + + MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, sig_param, error); + if (!is_ok (error)) + goto leave; + + MONO_HANDLE_SET (param, ClassImpl, rt); + + MONO_HANDLE_SET (param, MemberImpl, member); + + MonoStringHandle name_str = mono_string_new_handle (domain, name, error); + if (!is_ok (error)) + goto leave; + + MONO_HANDLE_SET (param, NameImpl, name_str); + + MONO_HANDLE_SETVAL (param, PositionImpl, gint32, idx); + + MONO_HANDLE_SETVAL (param, AttrsImpl, guint32, sig_param->attrs); + + if (!(sig_param->attrs & PARAM_ATTRIBUTE_HAS_DEFAULT)) { + if (sig_param->attrs & PARAM_ATTRIBUTE_OPTIONAL) + MONO_HANDLE_SET (param, DefaultValueImpl, get_reflection_missing (domain, missing)); + else + MONO_HANDLE_SET (param, DefaultValueImpl, get_dbnull (domain, dbnull, error)); + if (!is_ok (error)) + goto leave; + } else { + + MonoType blob_type; + + blob_type.type = (MonoTypeEnum)blob_type_enum; + blob_type.data.klass = NULL; + if (blob_type_enum == MONO_TYPE_CLASS) + blob_type.data.klass = mono_defaults.object_class; + else if ((sig_param->type == MONO_TYPE_VALUETYPE) && sig_param->data.klass->enumtype) { + /* For enums, types [i] contains the base type */ + + blob_type.type = MONO_TYPE_VALUETYPE; + blob_type.data.klass = mono_class_from_mono_type (sig_param); + } else + blob_type.data.klass = mono_class_from_mono_type (&blob_type); + + MonoObjectHandle default_val_obj = MONO_HANDLE_NEW (MonoObject, mono_get_object_from_blob (domain, &blob_type, blob, error)); /* FIXME make mono_get_object_from_blob return a handle */ + if (!is_ok (error)) + goto leave; + MONO_HANDLE_SET (param, DefaultValueImpl, default_val_obj); + + /* Type in the Constant table is MONO_TYPE_CLASS for nulls */ + if (blob_type_enum != MONO_TYPE_CLASS && MONO_HANDLE_IS_NULL(default_val_obj)) { + if (sig_param->attrs & PARAM_ATTRIBUTE_OPTIONAL) + MONO_HANDLE_SET (param, DefaultValueImpl, get_reflection_missing (domain, missing)); + else + MONO_HANDLE_SET (param, DefaultValueImpl, get_dbnull (domain, dbnull, error)); + if (!is_ok (error)) + goto leave; + } + } + if (mspec) { + MonoReflectionMarshalAsAttributeHandle mobj = mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspec, error); + if (!is_ok (error)) + goto leave; + MONO_HANDLE_SET (param, MarshalAsImpl, mobj); + } + + MONO_HANDLE_ARRAY_SETREF (dest, idx, param); + +leave: + HANDLE_FUNCTION_RETURN_VAL (is_ok (error)); +} + +static MonoArrayHandle +param_objects_construct (MonoDomain *domain, MonoClass *refclass, MonoMethodSignature **addr_of_sig, gpointer user_data, MonoError *error) +{ MonoMethod *method = (MonoMethod*)user_data; MonoMethodSignature *sig = *addr_of_sig; /* see note in mono_param_get_objects_internal */ - MonoArray *res = NULL; - MonoReflectionMethod *member = NULL; - MonoReflectionParameter *param = NULL; + MonoArrayHandle res = MONO_HANDLE_NEW (MonoArray, NULL); char **names = NULL, **blobs = NULL; guint32 *types = NULL; - MonoType *type = NULL; - MonoObject *dbnull = NULL; - MonoObject *missing = NULL; MonoMarshalSpec **mspecs = NULL; - MonoVTable *pinfo_vtable; - MonoReflectionType *rt; int i; mono_error_init (error); - if (!System_Reflection_ParameterInfo_array) { - MonoClass *klass; - klass = mono_class_get_mono_parameter_info_class (); - System_Reflection_ParameterInfo = klass; - klass = mono_array_class_get (klass, 1); - System_Reflection_ParameterInfo_array = klass; - } - - member = mono_method_get_object_checked (domain, method, refclass, error); - if (!member) + MonoReflectionMethodHandle member = mono_method_get_object_handle (domain, method, refclass, error); + if (!is_ok (error)) goto leave; names = g_new (char *, sig->param_count); mono_method_get_param_names (method, (const char **) names); @@ -921,93 +1021,37 @@ param_objects_construct (MonoDomain *domain, MonoClass *refclass, MonoMethodSign mspecs = g_new (MonoMarshalSpec*, sig->param_count + 1); mono_method_get_marshal_info (method, mspecs); - res = mono_array_new_specific_checked (mono_class_vtable (domain, System_Reflection_ParameterInfo_array), sig->param_count, error); + res = mono_array_new_handle (domain, mono_class_get_mono_parameter_info_class (), sig->param_count, error); if (!res) goto leave; - pinfo_vtable = mono_class_vtable (domain, System_Reflection_ParameterInfo); + gboolean any_default_value = FALSE; for (i = 0; i < sig->param_count; ++i) { - param = (MonoReflectionParameter *) mono_object_new_specific_checked (pinfo_vtable, error); - if (!param) - goto leave; - - rt = mono_type_get_object_checked (domain, sig->params [i], error); - if (!rt) - goto leave; - - MONO_OBJECT_SETREF (param, ClassImpl, rt); - - MONO_OBJECT_SETREF (param, MemberImpl, (MonoObject*)member); - - MONO_OBJECT_SETREF (param, NameImpl, mono_string_new (domain, names [i])); - - param->PositionImpl = i; - param->AttrsImpl = sig->params [i]->attrs; - - if (!(param->AttrsImpl & PARAM_ATTRIBUTE_HAS_DEFAULT)) { - if (param->AttrsImpl & PARAM_ATTRIBUTE_OPTIONAL) - MONO_OBJECT_SETREF (param, DefaultValueImpl, get_reflection_missing (domain, &missing)); - else - MONO_OBJECT_SETREF (param, DefaultValueImpl, get_dbnull (domain, &dbnull, error)); - if (!is_ok (error)) - goto leave; - } else { - - if (!blobs) { - blobs = g_new0 (char *, sig->param_count); - types = g_new0 (guint32, sig->param_count); - get_default_param_value_blobs (method, blobs, types); - } - - /* Build MonoType for the type from the Constant Table */ - if (!type) - type = g_new0 (MonoType, 1); - type->type = (MonoTypeEnum)types [i]; - type->data.klass = NULL; - if (types [i] == MONO_TYPE_CLASS) - type->data.klass = mono_defaults.object_class; - else if ((sig->params [i]->type == MONO_TYPE_VALUETYPE) && sig->params [i]->data.klass->enumtype) { - /* For enums, types [i] contains the base type */ - - type->type = MONO_TYPE_VALUETYPE; - type->data.klass = mono_class_from_mono_type (sig->params [i]); - } else - type->data.klass = mono_class_from_mono_type (type); - - MonoObject *default_val_obj = mono_get_object_from_blob (domain, type, blobs [i], error); - if (!is_ok (error)) - goto leave; - MONO_OBJECT_SETREF (param, DefaultValueImpl, default_val_obj); - - /* Type in the Constant table is MONO_TYPE_CLASS for nulls */ - if (types [i] != MONO_TYPE_CLASS && !param->DefaultValueImpl) { - if (param->AttrsImpl & PARAM_ATTRIBUTE_OPTIONAL) - MONO_OBJECT_SETREF (param, DefaultValueImpl, get_reflection_missing (domain, &missing)); - else - MONO_OBJECT_SETREF (param, DefaultValueImpl, get_dbnull (domain, &dbnull, error)); - if (!is_ok (error)) - goto leave; - } + if ((sig->params [i]->attrs & PARAM_ATTRIBUTE_HAS_DEFAULT) != 0) { + any_default_value = TRUE; + break; } + } + if (any_default_value) { + blobs = g_new0 (char *, sig->param_count); + types = g_new0 (guint32, sig->param_count); + get_default_param_value_blobs (method, blobs, types); + } - if (mspecs [i + 1]) { - MonoReflectionMarshalAsAttribute* mobj; - mobj = mono_reflection_marshal_as_attribute_from_marshal_spec (domain, method->klass, mspecs [i + 1], error); - if (!mobj) - goto leave; - MONO_OBJECT_SETREF (param, MarshalAsImpl, (MonoObject*)mobj); - } - - mono_array_setref (res, i, param); + /* Handles missing and dbnull are assigned in add_parameter_object_to_array when needed */ + MonoObjectHandle missing = MONO_HANDLE_NEW (MonoObject, NULL); + MonoObjectHandle dbnull = MONO_HANDLE_NEW (MonoObject, NULL); + for (i = 0; i < sig->param_count; ++i) { + if (!add_parameter_object_to_array (domain, method, MONO_HANDLE_CAST(MonoObject, member), i, names[i], sig->params[i], types ? types[i] : 0, blobs ? blobs[i] : NULL, mspecs [i + 1], missing, dbnull, res, error)) + goto leave; } leave: g_free (names); g_free (blobs); g_free (types); - g_free (type); - if (sig) { + if (sig && mspecs) { for (i = sig->param_count; i >= 0; i--) { if (mspecs [i]) mono_metadata_free_marshal_spec (mspecs [i]); @@ -1029,19 +1073,20 @@ leave: * Return an System.Reflection.ParameterInfo array object representing the parameters * in the method @method. */ -MonoArray* +MonoArrayHandle mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoClass *refclass, MonoError *error) { mono_error_init (error); + /* side-effect: sets method->signature non-NULL on success */ MonoMethodSignature *sig = mono_method_signature_checked (method, error); - if (!mono_error_ok (error)) - goto leave; + if (!is_ok (error)) + goto fail; if (!sig->param_count) { - MonoArray *res = mono_array_new_checked (domain, mono_class_get_mono_parameter_info_class (), 0, error); - if (!res) - goto leave; + MonoArrayHandle res = mono_array_new_handle (domain, mono_class_get_mono_parameter_info_class (), 0, error); + if (!is_ok (error)) + goto fail; return res; } @@ -1049,18 +1094,73 @@ mono_param_get_objects_internal (MonoDomain *domain, MonoMethod *method, MonoCla /* Note: the cache is based on the address of the signature into the method * since we already cache MethodInfos with the method as keys. */ - return CHECK_OR_CONSTRUCT (MonoArray*, &method->signature, refclass, param_objects_construct, method); -leave: - return NULL; + return CHECK_OR_CONSTRUCT_HANDLE (MonoArrayHandle, &method->signature, refclass, param_objects_construct, method); +fail: + return MONO_HANDLE_NEW (MonoArray, NULL_HANDLE); } MonoArray* mono_param_get_objects (MonoDomain *domain, MonoMethod *method) { + HANDLE_FUNCTION_ENTER (); MonoError error; - MonoArray *result = mono_param_get_objects_internal (domain, method, NULL, &error); + MonoArrayHandle result = mono_param_get_objects_internal (domain, method, NULL, &error); mono_error_assert_ok (&error); - return result; + HANDLE_FUNCTION_RETURN_OBJ (result); +} + +static gboolean +add_local_var_info_to_array (MonoDomain *domain, MonoMethodHeader *header, int idx, MonoArrayHandle dest, MonoError *error) +{ + HANDLE_FUNCTION_ENTER (); + mono_error_init (error); + MonoReflectionLocalVariableInfoHandle info = MONO_HANDLE_NEW (MonoReflectionLocalVariableInfo, mono_object_new_checked (domain, mono_class_get_local_variable_info_class (), error)); + if (!is_ok (error)) + goto leave; + + MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, header->locals [idx], error); + if (!is_ok (error)) + goto leave; + + MONO_HANDLE_SET (info, local_type, rt); + + MONO_HANDLE_SETVAL (info, is_pinned, MonoBoolean, header->locals [idx]->pinned); + MONO_HANDLE_SETVAL (info, local_index, guint16, idx); + + MONO_HANDLE_ARRAY_SETREF (dest, idx, info); + +leave: + HANDLE_FUNCTION_RETURN_VAL (is_ok (error)); +} + +static gboolean +add_exception_handling_clause_to_array (MonoDomain *domain, MonoMethodHeader *header, int idx, MonoArrayHandle dest, MonoError *error) +{ + HANDLE_FUNCTION_ENTER (); + mono_error_init (error); + MonoReflectionExceptionHandlingClauseHandle info = MONO_HANDLE_NEW (MonoReflectionExceptionHandlingClause, mono_object_new_checked (domain, mono_class_get_exception_handling_clause_class (), error)); + if (!is_ok (error)) + goto leave; + MonoExceptionClause *clause = &header->clauses [idx]; + + MONO_HANDLE_SETVAL (info, flags, gint32, clause->flags); + MONO_HANDLE_SETVAL (info, try_offset, gint32, clause->try_offset); + MONO_HANDLE_SETVAL (info, try_length, gint32, clause->try_len); + MONO_HANDLE_SETVAL (info, handler_offset, gint32, clause->handler_offset); + MONO_HANDLE_SETVAL (info, handler_length, gint32, clause->handler_len); + if (clause->flags == MONO_EXCEPTION_CLAUSE_FILTER) + MONO_HANDLE_SETVAL (info, filter_offset, gint32, clause->data.filter_offset); + else if (clause->data.catch_class) { + MonoReflectionTypeHandle rt = mono_type_get_object_handle (mono_domain_get (), &clause->data.catch_class->byval_arg, error); + if (!is_ok (error)) + goto leave; + + MONO_HANDLE_SET (info, catch_type, rt); + } + + MONO_HANDLE_ARRAY_SETREF (dest, idx, info); +leave: + HANDLE_FUNCTION_RETURN_VAL (is_ok (error)); } /* @@ -1073,19 +1173,18 @@ mono_param_get_objects (MonoDomain *domain, MonoMethod *method) MonoReflectionMethodBody* mono_method_body_get_object (MonoDomain *domain, MonoMethod *method) { + HANDLE_FUNCTION_ENTER (); MonoError error; - MonoReflectionMethodBody *result = mono_method_body_get_object_checked (domain, method, &error); + MonoReflectionMethodBodyHandle result = mono_method_body_get_object_handle (domain, method, &error); mono_error_cleanup (&error); - return result; + HANDLE_FUNCTION_RETURN_OBJ (result); } -static MonoReflectionMethodBody* +static MonoReflectionMethodBodyHandle method_body_object_construct (MonoDomain *domain, MonoClass *unused_class, MonoMethod *method, gpointer user_data, MonoError *error) { - MonoReflectionMethodBody *ret; - MonoMethodHeader *header; + MonoMethodHeader *header = NULL; MonoImage *image; - MonoReflectionType *rt; guint32 method_rva, local_var_sig_token; char *ptr; unsigned char format, flags; @@ -1096,7 +1195,7 @@ method_body_object_construct (MonoDomain *domain, MonoClass *unused_class, MonoM /* for compatibility with .net */ if (method_is_dynamic (method)) { mono_error_set_generic_error (error, "System", "InvalidOperationException", ""); - return NULL; + goto fail; } if ((method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) || @@ -1104,11 +1203,12 @@ method_body_object_construct (MonoDomain *domain, MonoClass *unused_class, MonoM (method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) || (method->klass->image->raw_data && method->klass->image->raw_data [1] != 'Z') || (method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME)) - return NULL; + return MONO_HANDLE_CAST (MonoReflectionMethodBody, NULL_HANDLE); image = method->klass->image; header = mono_method_get_header_checked (method, error); - return_val_if_nok (error, NULL); + if (!is_ok (error)) + goto fail; if (!image_is_dynamic (image)) { /* Obtain local vars signature token */ @@ -1132,78 +1232,52 @@ method_body_object_construct (MonoDomain *domain, MonoClass *unused_class, MonoM } else local_var_sig_token = 0; //FIXME - ret = (MonoReflectionMethodBody*)mono_object_new_checked (domain, mono_class_get_method_body_class (), error); + MonoReflectionMethodBodyHandle ret = MONO_HANDLE_NEW (MonoReflectionMethodBody, mono_object_new_checked (domain, mono_class_get_method_body_class (), error)); if (!is_ok (error)) goto fail; - ret->init_locals = header->init_locals; - ret->max_stack = header->max_stack; - ret->local_var_sig_token = local_var_sig_token; - MonoArray *il_arr = mono_array_new_cached (domain, mono_defaults.byte_class, header->code_size, error); + MONO_HANDLE_SETVAL (ret, init_locals, MonoBoolean, header->init_locals); + MONO_HANDLE_SETVAL (ret, max_stack, guint32, header->max_stack); + MONO_HANDLE_SETVAL (ret, local_var_sig_token, guint32, local_var_sig_token); + MonoArrayHandle il_arr = mono_array_new_handle (domain, mono_defaults.byte_class, header->code_size, error); if (!is_ok (error)) goto fail; - MONO_OBJECT_SETREF (ret, il, il_arr); - memcpy (mono_array_addr (ret->il, guint8, 0), header->code, header->code_size); + MONO_HANDLE_SET (ret, il, il_arr); + uint32_t il_gchandle; + guint8* il_data = MONO_ARRAY_HANDLE_PIN (il_arr, guint8, 0, &il_gchandle); + memcpy (il_data, header->code, header->code_size); + mono_gchandle_free (il_gchandle); /* Locals */ - MonoArray *locals_arr = mono_array_new_cached (domain, mono_class_get_local_variable_info_class (), header->num_locals, error); + MonoArrayHandle locals_arr = mono_array_new_handle (domain, mono_class_get_local_variable_info_class (), header->num_locals, error); if (!is_ok (error)) goto fail; - MONO_OBJECT_SETREF (ret, locals, locals_arr); + MONO_HANDLE_SET (ret, locals, locals_arr); for (i = 0; i < header->num_locals; ++i) { - MonoReflectionLocalVariableInfo *info = (MonoReflectionLocalVariableInfo*)mono_object_new_checked (domain, mono_class_get_local_variable_info_class (), error); - if (!is_ok (error)) - goto fail; - - rt = mono_type_get_object_checked (domain, header->locals [i], error); - if (!is_ok (error)) + if (!add_local_var_info_to_array (domain, header, i, locals_arr, error)) goto fail; - - MONO_OBJECT_SETREF (info, local_type, rt); - - info->is_pinned = header->locals [i]->pinned; - info->local_index = i; - mono_array_setref (ret->locals, i, info); } /* Exceptions */ - MonoArray *exn_clauses = mono_array_new_cached (domain, mono_class_get_exception_handling_clause_class (), header->num_clauses, error); + MonoArrayHandle exn_clauses = mono_array_new_handle (domain, mono_class_get_exception_handling_clause_class (), header->num_clauses, error); if (!is_ok (error)) goto fail; - MONO_OBJECT_SETREF (ret, clauses, exn_clauses); + MONO_HANDLE_SET (ret, clauses, exn_clauses); for (i = 0; i < header->num_clauses; ++i) { - MonoReflectionExceptionHandlingClause *info = (MonoReflectionExceptionHandlingClause*)mono_object_new_checked (domain, mono_class_get_exception_handling_clause_class (), error); - if (!is_ok (error)) + if (!add_exception_handling_clause_to_array (domain, header, i, exn_clauses, error)) goto fail; - MonoExceptionClause *clause = &header->clauses [i]; - - info->flags = clause->flags; - info->try_offset = clause->try_offset; - info->try_length = clause->try_len; - info->handler_offset = clause->handler_offset; - info->handler_length = clause->handler_len; - if (clause->flags == MONO_EXCEPTION_CLAUSE_FILTER) - info->filter_offset = clause->data.filter_offset; - else if (clause->data.catch_class) { - rt = mono_type_get_object_checked (mono_domain_get (), &clause->data.catch_class->byval_arg, error); - if (!is_ok (error)) - goto fail; - - MONO_OBJECT_SETREF (info, catch_type, rt); - } - - mono_array_setref (ret->clauses, i, info); } mono_metadata_free_mh (header); return ret; fail: - mono_metadata_free_mh (header); + if (header) + mono_metadata_free_mh (header); return NULL; } /** - * mono_method_body_get_object_checked: + * mono_method_body_get_object_handle: * @domain: an app domain * @method: a method * @error: set on error @@ -1211,13 +1285,14 @@ fail: * Return an System.Reflection.MethodBody object representing the * method @method. On failure, returns NULL and sets @error. */ -MonoReflectionMethodBody* -mono_method_body_get_object_checked (MonoDomain *domain, MonoMethod *method, MonoError *error) +MonoReflectionMethodBodyHandle +mono_method_body_get_object_handle (MonoDomain *domain, MonoMethod *method, MonoError *error) { mono_error_init (error); - return CHECK_OR_CONSTRUCT (MonoReflectionMethodBody *, method, NULL, method_body_object_construct, NULL); + return CHECK_OR_CONSTRUCT_HANDLE (MonoReflectionMethodBodyHandle, method, NULL, method_body_object_construct, NULL); } + /** * mono_get_dbnull_object: * @domain: Domain where the object lives @@ -1229,12 +1304,11 @@ mono_method_body_get_object_checked (MonoDomain *domain, MonoMethod *method, Mon MonoObject * mono_get_dbnull_object (MonoDomain *domain) { + HANDLE_FUNCTION_ENTER (); MonoError error; - MonoObject *obj; - - obj = get_dbnull_object (domain, &error); + MonoObjectHandle obj = get_dbnull_object (domain, &error); mono_error_assert_ok (&error); - return obj; + HANDLE_FUNCTION_RETURN_OBJ (obj); } static void diff --git a/mono/metadata/runtime.c b/mono/metadata/runtime.c index d2928e9306a..4e6e08c2b3e 100644 --- a/mono/metadata/runtime.c +++ b/mono/metadata/runtime.c @@ -139,3 +139,24 @@ mono_runtime_init_tls (void) { mono_marshal_init_tls (); } + +char* +mono_runtime_get_aotid (void) +{ + int i; + guint8 aotid_sum = 0; + MonoDomain* domain = mono_domain_get (); + + if (!domain->entry_assembly || !domain->entry_assembly->image) + return NULL; + + guint8 (*aotid)[16] = &domain->entry_assembly->image->aotid; + + for (i = 0; i < 16; ++i) + aotid_sum |= (*aotid)[i]; + + if (aotid_sum == 0) + return NULL; + + return mono_guid_to_string ((guint8*) aotid); +} \ No newline at end of file diff --git a/mono/metadata/runtime.h b/mono/metadata/runtime.h index ef14453ceb2..65cb5daa4a5 100644 --- a/mono/metadata/runtime.h +++ b/mono/metadata/runtime.h @@ -21,6 +21,8 @@ gboolean mono_runtime_is_critical_method (MonoMethod *method); gboolean mono_runtime_try_shutdown (void); void mono_runtime_init_tls (void); + +char* mono_runtime_get_aotid (void); MONO_END_DECLS #endif /* _MONO_METADATA_RUNTIME_H_ */ diff --git a/mono/metadata/sgen-mono.c b/mono/metadata/sgen-mono.c index af0dd65c290..a76e2e6306e 100644 --- a/mono/metadata/sgen-mono.c +++ b/mono/metadata/sgen-mono.c @@ -2301,6 +2301,14 @@ mono_gc_set_skip_thread (gboolean skip) LOCK_GC; info->client_info.gc_disabled = skip; UNLOCK_GC; + + if (skip) { + /* If we skip scanning a thread with a non-empty handle stack, we may move an + * object but fail to update the reference in the handle. + */ + HandleStack *stack = info->client_info.info.handle_stack; + g_assert (stack == NULL || mono_handle_stack_is_empty (stack)); + } } static gboolean @@ -2398,8 +2406,17 @@ sgen_client_scan_thread_data (void *start_nursery, void *end_nursery, gboolean p binary_protocol_scan_stack ((gpointer)mono_thread_info_get_tid (info), info->client_info.stack_start, info->client_info.stack_end, skip_reason); - if (skip_reason) + if (skip_reason) { + if (precise) { + /* If we skip a thread with a non-empty handle stack and then it + * resumes running we may potentially move an object but fail to + * update the reference in the handle. + */ + HandleStack *stack = info->client_info.info.handle_stack; + g_assert (stack == NULL || mono_handle_stack_is_empty (stack)); + } continue; + } g_assert (info->client_info.stack_start); g_assert (info->client_info.stack_end); diff --git a/mono/metadata/sre.c b/mono/metadata/sre.c index d899b2b3b89..62e7f9be7c6 100644 --- a/mono/metadata/sre.c +++ b/mono/metadata/sre.c @@ -2523,51 +2523,56 @@ mono_marshal_spec_from_builder (MonoImage *image, MonoAssembly *assembly, } #endif /* !DISABLE_REFLECTION_EMIT */ -MonoReflectionMarshalAsAttribute* +MonoReflectionMarshalAsAttributeHandle mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, MonoClass *klass, MonoMarshalSpec *spec, MonoError *error) { - MonoReflectionType *rt; - MonoReflectionMarshalAsAttribute *minfo; - MonoType *mtype; - mono_error_init (error); - minfo = (MonoReflectionMarshalAsAttribute*)mono_object_new_checked (domain, mono_class_get_marshal_as_attribute_class (), error); - if (!minfo) - return NULL; - minfo->utype = spec->native; + MonoReflectionMarshalAsAttributeHandle minfo = MONO_HANDLE_NEW (MonoReflectionMarshalAsAttribute, mono_object_new_checked (domain, mono_class_get_marshal_as_attribute_class (), error)); + if (!is_ok (error)) + goto fail; + guint32 utype = spec->native; + MONO_HANDLE_SETVAL (minfo, utype, guint32, utype); - switch (minfo->utype) { + switch (utype) { case MONO_NATIVE_LPARRAY: - minfo->array_subtype = spec->data.array_data.elem_type; - minfo->size_const = spec->data.array_data.num_elem; + MONO_HANDLE_SETVAL (minfo, array_subtype, guint32, spec->data.array_data.elem_type); + MONO_HANDLE_SETVAL (minfo, size_const, gint32, spec->data.array_data.num_elem); if (spec->data.array_data.param_num != -1) - minfo->size_param_index = spec->data.array_data.param_num; + MONO_HANDLE_SETVAL (minfo, size_param_index, gint16, spec->data.array_data.param_num); break; case MONO_NATIVE_BYVALTSTR: case MONO_NATIVE_BYVALARRAY: - minfo->size_const = spec->data.array_data.num_elem; + MONO_HANDLE_SETVAL (minfo, size_const, gint32, spec->data.array_data.num_elem); break; case MONO_NATIVE_CUSTOM: if (spec->data.custom_data.custom_name) { - mtype = mono_reflection_type_from_name_checked (spec->data.custom_data.custom_name, klass->image, error); - return_val_if_nok (error, NULL); + MonoType *mtype = mono_reflection_type_from_name_checked (spec->data.custom_data.custom_name, klass->image, error); + if (!is_ok (error)) + goto fail; if (mtype) { - rt = mono_type_get_object_checked (domain, mtype, error); - if (!rt) - return NULL; + MonoReflectionTypeHandle rt = mono_type_get_object_handle (domain, mtype, error); + if (!is_ok (error)) + goto fail; - MONO_OBJECT_SETREF (minfo, marshal_type_ref, rt); + MONO_HANDLE_SET (minfo, marshal_type_ref, rt); } - MONO_OBJECT_SETREF (minfo, marshal_type, mono_string_new (domain, spec->data.custom_data.custom_name)); + MonoStringHandle custom_name = mono_string_new_handle (domain, spec->data.custom_data.custom_name, error); + if (!is_ok (error)) + goto fail; + MONO_HANDLE_SET (minfo, marshal_type, custom_name); + } + if (spec->data.custom_data.cookie) { + MonoStringHandle cookie = mono_string_new_handle (domain, spec->data.custom_data.cookie, error); + if (!is_ok (error)) + goto fail; + MONO_HANDLE_SET (minfo, marshal_cookie, cookie); } - if (spec->data.custom_data.cookie) - MONO_OBJECT_SETREF (minfo, marshal_cookie, mono_string_new (domain, spec->data.custom_data.cookie)); break; default: @@ -2575,6 +2580,8 @@ mono_reflection_marshal_as_attribute_from_marshal_spec (MonoDomain *domain, Mono } return minfo; +fail: + return MONO_HANDLE_NEW (MonoReflectionMarshalAsAttribute, NULL); } #ifndef DISABLE_REFLECTION_EMIT diff --git a/mono/metadata/threadpool-worker-default.c b/mono/metadata/threadpool-worker-default.c index 89f159d6651..fa8f850ea66 100644 --- a/mono/metadata/threadpool-worker-default.c +++ b/mono/metadata/threadpool-worker-default.c @@ -604,6 +604,8 @@ worker_thread (gpointer data) mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_THREADPOOL, "[%p] worker finishing", mono_native_thread_id_get ()); mono_refcount_dec (worker); + + return 0; } static gboolean @@ -854,6 +856,8 @@ monitor_thread (gpointer data) // printf ("monitor_thread: stop\n"); mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_THREADPOOL, "[%p] monitor thread, finished", mono_native_thread_id_get ()); + + return 0; } static void diff --git a/mono/metadata/threadpool.c b/mono/metadata/threadpool.c index cfe2892b375..84165e226b1 100644 --- a/mono/metadata/threadpool.c +++ b/mono/metadata/threadpool.c @@ -187,17 +187,12 @@ cleanup (void) mono_coop_mutex_lock (&threadpool->threads_lock); for (;;) { - ThreadPoolCounter counter; - - counter = COUNTER_READ (threadpool); - if (counter._.working == 0) + if (threadpool->threads->len == 0) break; - if (counter._.working == 1) { - if (threadpool->threads->len == 1 && g_ptr_array_index (threadpool->threads, 0) == current) { - /* We are waiting on ourselves */ - break; - } + if (threadpool->threads->len == 1 && g_ptr_array_index (threadpool->threads, 0) == current) { + /* We are waiting on ourselves */ + break; } mono_coop_cond_wait (&threadpool->threads_exit_cond, &threadpool->threads_lock); @@ -345,6 +340,15 @@ tpdomain_get_next (ThreadPoolDomain *current) return tpdomain; } +static MonoObject* +try_invoke_perform_wait_callback (MonoObject** exc, MonoError *error) +{ + HANDLE_FUNCTION_ENTER (); + mono_error_init (error); + MonoObject *res = mono_runtime_try_invoke (mono_defaults.threadpool_perform_wait_callback_method, NULL, NULL, exc, error); + HANDLE_FUNCTION_RETURN_VAL (res); +} + static void worker_callback (gpointer unused) { @@ -418,7 +422,7 @@ worker_callback (gpointer unused) if (mono_domain_set (tpdomain->domain, FALSE)) { MonoObject *exc = NULL, *res; - res = mono_runtime_try_invoke (mono_defaults.threadpool_perform_wait_callback_method, NULL, NULL, &exc, &error); + res = try_invoke_perform_wait_callback (&exc, &error); if (exc || !mono_error_ok(&error)) { if (exc == NULL) exc = (MonoObject *) mono_error_convert_to_exception (&error); @@ -458,16 +462,16 @@ worker_callback (gpointer unused) mono_coop_mutex_lock (&threadpool->threads_lock); - COUNTER_ATOMIC (threadpool, counter, { - counter._.working --; - }); - g_ptr_array_remove_fast (threadpool->threads, thread); mono_coop_cond_signal (&threadpool->threads_exit_cond); mono_coop_mutex_unlock (&threadpool->threads_lock); + COUNTER_ATOMIC (threadpool, counter, { + counter._.working --; + }); + mono_refcount_dec (threadpool); } @@ -806,18 +810,18 @@ ves_icall_System_Threading_ThreadPool_RequestWorkerThread (void) tpdomain->outstanding_request ++; g_assert (tpdomain->outstanding_request >= 1); - mono_refcount_inc (threadpool); + domains_unlock (); COUNTER_ATOMIC (threadpool, counter, { - if (!(counter._.starting < 32767 /* G_MAXINT16 */)) - g_error ("%s: counter._.starting = %d, but should be < 32767", __func__, counter._.starting); + if (counter._.starting == 16) + return TRUE; counter._.starting ++; }); - mono_threadpool_worker_enqueue (threadpool->worker, worker_callback, NULL); + mono_refcount_inc (threadpool); - domains_unlock (); + mono_threadpool_worker_enqueue (threadpool->worker, worker_callback, NULL); return TRUE; } diff --git a/mono/metadata/threads.c b/mono/metadata/threads.c index d874b5664c7..fd424bdfb90 100644 --- a/mono/metadata/threads.c +++ b/mono/metadata/threads.c @@ -1086,6 +1086,8 @@ mono_thread_detach_internal (MonoInternalThread *thread) if (mono_thread_cleanup_fn) mono_thread_cleanup_fn (thread_get_tid (thread)); + mono_memory_barrier (); + if (mono_gc_is_moving ()) { MONO_GC_UNREGISTER_ROOT (thread->thread_pinning_ref); thread->thread_pinning_ref = NULL; diff --git a/mono/metadata/w32process-unix-default.c b/mono/metadata/w32process-unix-default.c index 0b48370f369..2bb37261ef6 100644 --- a/mono/metadata/w32process-unix-default.c +++ b/mono/metadata/w32process-unix-default.c @@ -17,6 +17,13 @@ #endif #endif +/* makedev() macro */ +#ifdef MAJOR_IN_MKDEV +#include +#elif defined MAJOR_IN_SYSMACROS +#include +#endif + #include "utils/mono-logger-internals.h" #ifndef MAXPATHLEN diff --git a/mono/metadata/w32process-unix.c b/mono/metadata/w32process-unix.c index f9072f2e8da..8be10017ab6 100644 --- a/mono/metadata/w32process-unix.c +++ b/mono/metadata/w32process-unix.c @@ -136,25 +136,25 @@ typedef struct { } ProcessTime; /* - * MonoProcess describes processes we create. + * Process describes processes we create. * It contains a semaphore that can be waited on in order to wait * for process termination. It's accessed in our SIGCHLD handler, * when status is updated (and pid cleared, to not clash with * subsequent processes that may get executed). */ -typedef struct _MonoProcess MonoProcess; -struct _MonoProcess { +typedef struct _Process { pid_t pid; /* the pid of the process. This value is only valid until the process has exited. */ MonoSemType exit_sem; /* this semaphore will be released when the process exits */ int status; /* the exit status */ - gint32 handle_count; /* the number of handles to this mono_process instance */ + gint32 handle_count; /* the number of handles to this process instance */ /* we keep a ref to the creating _WapiHandle_process handle until * the process has exited, so that the information there isn't lost. */ gpointer handle; gboolean freeable; - MonoProcess *next; -}; + gboolean signalled; + struct _Process *next; +} Process; /* MonoW32HandleProcess is a structure containing all the required information for process handling. */ typedef struct { @@ -167,7 +167,7 @@ typedef struct { size_t min_working_set; size_t max_working_set; gboolean exited; - MonoProcess *mono_process; + Process *process; } MonoW32HandleProcess; /* @@ -549,7 +549,7 @@ static gchar *cli_launcher; * We also need to lock when adding and cleaning up so that those two * operations don't mess with eachother. (This lock is not used in the * signal handler) */ -static MonoProcess *processes; +static Process *processes; static mono_mutex_t processes_mutex; static gpointer current_process; @@ -586,7 +586,7 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) pid_t pid G_GNUC_UNUSED, ret; int status; gint64 start, now; - MonoProcess *mp; + Process *process; gboolean res; /* FIXME: We can now easily wait on processes that aren't our own children, @@ -616,8 +616,8 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) /* We don't need to lock processes here, the entry * has a handle_count > 0 which means it will not be freed. */ - mp = process_handle->mono_process; - if (!mp) { + process = process_handle->process; + if (!process) { pid_t res; if (pid == mono_process_current_pid ()) { @@ -653,16 +653,16 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) if (timeout != MONO_INFINITE_WAIT) { mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on semaphore for %li ms...", __func__, handle, timeout, (long)(timeout - (now - start))); - ret = mono_os_sem_timedwait (&mp->exit_sem, (timeout - (now - start)), alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE); + ret = mono_os_sem_timedwait (&process->exit_sem, (timeout - (now - start)), alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE); } else { mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): waiting on semaphore forever...", __func__, handle, timeout); - ret = mono_os_sem_wait (&mp->exit_sem, alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE); + ret = mono_os_sem_wait (&process->exit_sem, alerted ? MONO_SEM_FLAGS_ALERTABLE : MONO_SEM_FLAGS_NONE); } if (ret == MONO_SEM_TIMEDWAIT_RET_SUCCESS) { /* Success, process has exited */ - mono_os_sem_post (&mp->exit_sem); + mono_os_sem_post (&process->exit_sem); break; } @@ -687,7 +687,7 @@ process_wait (gpointer handle, guint32 timeout, gboolean *alerted) /* Process must have exited */ mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s (%p, %u): Waited successfully", __func__, handle, timeout); - status = mp->status; + status = process->status; if (WIFSIGNALED (status)) process_handle->exitstatus = 128 + WTERMSIG (status); else @@ -709,11 +709,10 @@ static void processes_cleanup (void) { static gint32 cleaning_up; - MonoProcess *mp; - MonoProcess *prev = NULL; + Process *process; + Process *prev = NULL; GSList *finished = NULL; GSList *l; - gpointer unref_handle; mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_IO_LAYER, "%s", __func__); @@ -721,16 +720,12 @@ processes_cleanup (void) if (InterlockedCompareExchange (&cleaning_up, 1, 0) != 0) return; - for (mp = processes; mp; mp = mp->next) { - if (mp->pid == 0 && mp->handle) { + for (process = processes; process; process = process->next) { + if (process->signalled && process->handle) { /* This process has exited and we need to remove the artifical ref * on the handle */ - mono_os_mutex_lock (&processes_mutex); - unref_handle = mp->handle; - mp->handle = NULL; - mono_os_mutex_unlock (&processes_mutex); - if (unref_handle) - mono_w32handle_unref (unref_handle); + mono_w32handle_unref (process->handle); + process->handle = NULL; } } @@ -742,24 +737,20 @@ processes_cleanup (void) */ mono_os_mutex_lock (&processes_mutex); - mp = processes; - while (mp) { - if (mp->handle_count == 0 && mp->freeable) { + for (process = processes; process; process = process->next) { + if (process->handle_count == 0 && process->freeable) { /* * Unlink the entry. * This code can run parallel with the sigchld handler, but the * modifications it makes are safe. */ - if (mp == processes) - processes = mp->next; + if (process == processes) + processes = process->next; else - prev->next = mp->next; - finished = g_slist_prepend (finished, mp); - - mp = mp->next; + prev->next = process->next; + finished = g_slist_prepend (finished, process); } else { - prev = mp; - mp = mp->next; + prev = process; } } @@ -771,9 +762,9 @@ processes_cleanup (void) * they have the 'finished' flag set, which means the sigchld handler is done * accessing them. */ - mp = (MonoProcess *)l->data; - mono_os_sem_destroy (&mp->exit_sem); - g_free (mp); + process = (Process *)l->data; + mono_os_sem_destroy (&process->exit_sem); + g_free (process); } g_slist_free (finished); @@ -794,8 +785,8 @@ process_close (gpointer handle, gpointer data) process_handle = (MonoW32HandleProcess *) data; g_free (process_handle->pname); process_handle->pname = NULL; - if (process_handle->mono_process) - InterlockedDecrement (&process_handle->mono_process->handle_count); + if (process_handle->process) + InterlockedDecrement (&process_handle->process->handle_count); processes_cleanup (); } @@ -1386,7 +1377,7 @@ MONO_SIGNAL_HANDLER_FUNC (static, mono_sigchld_signal_handler, (int _dummy, sigi { int status; int pid; - MonoProcess *p; + Process *process; do { do { @@ -1399,16 +1390,18 @@ MONO_SIGNAL_HANDLER_FUNC (static, mono_sigchld_signal_handler, (int _dummy, sigi /* * This can run concurrently with the code in the rest of this module. */ - for (p = processes; p; p = p->next) { - if (p->pid != pid) + for (process = processes; process; process = process->next) { + if (process->pid != pid) + continue; + if (process->signalled) continue; - p->pid = 0; /* this pid doesn't exist anymore, clear it */ - p->status = status; - mono_os_sem_post (&p->exit_sem); + process->signalled = TRUE; + process->status = status; + mono_os_sem_post (&process->exit_sem); mono_memory_barrier (); /* Mark this as freeable, the pointer becomes invalid afterwards */ - p->freeable = TRUE; + process->freeable = TRUE; break; } } while (1); @@ -1600,7 +1593,7 @@ process_create (const gunichar2 *appname, const gunichar2 *cmdline, pid_t pid = 0; int startup_pipe [2] = {-1, -1}; int dummy; - MonoProcess *mono_process; + Process *process; #if HAVE_SIGACTION mono_lazy_initialize (&process_sig_chld_once, process_add_sigchld_handler); @@ -2017,20 +2010,20 @@ process_create (const gunichar2 *appname, const gunichar2 *cmdline, process_handle.pname = g_strdup (prog); process_set_defaults (&process_handle); - /* Add our mono_process into the linked list of processes */ - mono_process = (MonoProcess *) g_malloc0 (sizeof (MonoProcess)); - mono_process->pid = pid; - mono_process->handle_count = 1; - mono_os_sem_init (&mono_process->exit_sem, 0); + /* Add our process into the linked list of processes */ + process = (Process *) g_malloc0 (sizeof (Process)); + process->pid = pid; + process->handle_count = 1; + mono_os_sem_init (&process->exit_sem, 0); - process_handle.mono_process = mono_process; + process_handle.process = process; handle = mono_w32handle_new (MONO_W32HANDLE_PROCESS, &process_handle); if (handle == INVALID_HANDLE_VALUE) { g_warning ("%s: error creating process handle", __func__); - mono_os_sem_destroy (&mono_process->exit_sem); - g_free (mono_process); + mono_os_sem_destroy (&process->exit_sem); + g_free (process); SetLastError (ERROR_OUTOFMEMORY); ret = FALSE; @@ -2040,11 +2033,12 @@ process_create (const gunichar2 *appname, const gunichar2 *cmdline, /* Keep the process handle artificially alive until the process * exits so that the information in the handle isn't lost. */ mono_w32handle_ref (handle); - mono_process->handle = handle; + process->handle = handle; mono_os_mutex_lock (&processes_mutex); - mono_process->next = processes; - processes = mono_process; + process->next = processes; + mono_memory_barrier (); + processes = process; mono_os_mutex_unlock (&processes_mutex); if (process_info != NULL) { diff --git a/mono/mini/Makefile.am.in b/mono/mini/Makefile.am.in index eab2cd3db49..56b437acbc2 100755 --- a/mono/mini/Makefile.am.in +++ b/mono/mini/Makefile.am.in @@ -437,7 +437,6 @@ common_sources = \ graph.c \ mini-codegen.c \ mini-exceptions.c \ - mini-exceptions-native-unwinder.c \ mini-trampolines.c \ branch-opts.c \ mini-generic-sharing.c \ @@ -490,7 +489,7 @@ test_sources = \ regtests_UNIVERSAL=basic.exe basic-float.exe basic-long.exe basic-calls.exe objects.exe arrays.exe basic-math.exe exceptions.exe iltests.exe devirtualization.exe generics.exe basic-simd.exe basic-vectors.exe -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL regtests= \ $(regtests_UNIVERSAL) @@ -502,7 +501,7 @@ endif else regtests= \ $(regtests_UNIVERSAL) \ - $(regtests_AOT_ONLY_BLACKLIST) + $(regtests_TESTING_AOT_FULL_BLACKLIST) endif if X86 @@ -622,7 +621,7 @@ basic-simd.exe: basic-simd.cs TestDriver.dll $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll basic-vectors.exe: basic-vectors.cs TestDriver.dll - $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/System.Numerics.dll + $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/System.Numerics.dll -r:$(CLASS)/System.Numerics.Vectors.dll nacl.exe: nacl.cs TestDriver.dll $(MCS) -out:$@ $(CSFLAGS) $< -r:TestDriver.dll -r:$(CLASS)/Mono.Simd.dll @@ -745,9 +744,9 @@ gsharedvtcheck: fullaot_regtests = $(regtests) aot-tests.exe $(if $(GSHAREDVT),gshared.exe) # Skip aoting the tests that aren't compiled -# on the aot_only profile because they're skipped +# on the testing_aot_full profile because they're skipped # on mobile profiles -FULLAOT_LIBS_AOT_ONLY_BLACKLIST = \ +FULLAOT_LIBS_TESTING_AOT_FULL_BLACKLIST = \ Mono.Posix.dll \ System.Configuration.dll @@ -758,16 +757,17 @@ FULLAOT_LIBS_UNIVERSAL = \ System.Xml.dll \ System.Security.dll \ Mono.Simd.dll \ - Mono.Security.dll + Mono.Security.dll \ + System.Numerics.Vectors.dll -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL FULLAOT_LIBS= \ Mono.Dynamic.Interpreter.dll \ $(FULLAOT_LIBS_UNIVERSAL) else FULLAOT_LIBS= \ $(FULLAOT_LIBS_UNIVERSAL) \ - $(FULLAOT_LIBS_AOT_ONLY_BLACKLIST) + $(FULLAOT_LIBS_TESTING_AOT_FULL_BLACKLIST) endif FULLAOT_TMP_DIR=$(top_builddir)/mono/mini/fullaot-tmp diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c index 23a3357d335..17eaafe95ec 100644 --- a/mono/mini/aot-runtime.c +++ b/mono/mini/aot-runtime.c @@ -1918,7 +1918,7 @@ init_amodule_got (MonoAotModule *amodule) static void load_aot_module (MonoAssembly *assembly, gpointer user_data) { - char *aot_name; + char *aot_name, *found_aot_name; MonoAotModule *amodule; MonoDl *sofile; gboolean usable = TRUE; @@ -1953,6 +1953,8 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data) sofile = NULL; + found_aot_name = NULL; + if (info) { /* Statically linked AOT module */ aot_name = g_strdup_printf ("%s", assembly->aname.name); @@ -1962,34 +1964,59 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data) g_assert (globals); } } else { + char *err; + if (enable_aot_cache) sofile = aot_cache_load_module (assembly, &aot_name); if (!sofile) { - char *err; aot_name = g_strdup_printf ("%s%s", assembly->image->name, MONO_SOLIB_EXT); sofile = mono_dl_open (aot_name, MONO_DL_LAZY, &err); - + if (sofile) { + found_aot_name = g_strdup (aot_name); + } else { + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: image '%s' not found: %s", aot_name, err); + g_free (err); + } + g_free (aot_name); + } + if (!sofile) { + char *basename = g_path_get_basename (assembly->image->name); + aot_name = g_strdup_printf ("%s/mono/aot-cache/%s/%s%s", mono_assembly_getrootdir(), MONO_ARCHITECTURE, basename, MONO_SOLIB_EXT); + g_free (basename); + sofile = mono_dl_open (aot_name, MONO_DL_LAZY, &err); if (!sofile) { - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT module '%s' not found: %s", aot_name, err); + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: image '%s' not found: %s", aot_name, err); g_free (err); + } + } + if (!sofile) { + GList *l; + + for (l = mono_aot_paths; l; l = l->next) { + char *path = l->data; - g_free (aot_name); char *basename = g_path_get_basename (assembly->image->name); - aot_name = g_strdup_printf ("%s/mono/aot-cache/%s/%s%s", mono_assembly_getrootdir(), MONO_ARCHITECTURE, basename, MONO_SOLIB_EXT); - g_free (basename); + aot_name = g_strdup_printf ("%s/%s%s", path, basename, MONO_SOLIB_EXT); sofile = mono_dl_open (aot_name, MONO_DL_LAZY, &err); - if (!sofile) { - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT module '%s' not found: %s", aot_name, err); + if (sofile) { + found_aot_name = g_strdup (aot_name); + } else { + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: image '%s' not found: %s", aot_name, err); g_free (err); } - + g_free (basename); + g_free (aot_name); + if (sofile) + break; } } if (!sofile) { - if (mono_aot_only && assembly->image->tables [MONO_TABLE_METHOD].rows) + if (mono_aot_only && assembly->image->tables [MONO_TABLE_METHOD].rows) { + aot_name = g_strdup_printf ("%s%s", assembly->image->name, MONO_SOLIB_EXT); g_error ("Failed to load AOT module '%s' in aot-only mode.\n", aot_name); - g_free (aot_name); + g_free (aot_name); + } return; } } @@ -2030,12 +2057,12 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data) if (!usable) { if (mono_aot_only) { - g_error ("Failed to load AOT module '%s' while running in aot-only mode: %s.\n", aot_name, msg); + g_error ("Failed to load AOT module '%s' while running in aot-only mode: %s.\n", found_aot_name, msg); } else { - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable: %s.", aot_name, msg); + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: module %s is unusable: %s.", found_aot_name, msg); } g_free (msg); - g_free (aot_name); + g_free (found_aot_name); if (sofile) mono_dl_close (sofile); assembly->image->aot_module = NULL; @@ -2050,7 +2077,7 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data) g_assert (info->generic_tramp_num == MONO_TRAMPOLINE_NUM); amodule = g_new0 (MonoAotModule, 1); - amodule->aot_name = aot_name; + amodule->aot_name = found_aot_name; amodule->assembly = assembly; memcpy (&amodule->info, info, sizeof (*info)); @@ -2272,10 +2299,10 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data) if (amodule->out_of_date) { mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: Module %s is unusable because a dependency is out-of-date.", assembly->image->name); if (mono_aot_only) - g_error ("Failed to load AOT module '%s' while running in aot-only mode because a dependency cannot be found or it is out of date.\n", aot_name); + g_error ("Failed to load AOT module '%s' while running in aot-only mode because a dependency cannot be found or it is out of date.\n", found_aot_name); + } else { + mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: image '%s' found.", found_aot_name); } - else - mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_AOT, "AOT: loaded AOT Module for %s.", assembly->image->name); } /* diff --git a/mono/mini/basic-vectors.cs b/mono/mini/basic-vectors.cs index 1830fd9a8bc..a2cf101450e 100644 --- a/mono/mini/basic-vectors.cs +++ b/mono/mini/basic-vectors.cs @@ -717,7 +717,6 @@ public class VectorTests { return 0; } -#if FALSE // // Vector // @@ -1045,10 +1044,17 @@ public class VectorTests { public static int test_0_vector_t_cast_vector_int32 () { var v1 = new Vector (new long [] { 0x123456789abcdef0L, 0x23456789abcdef01L }); var v = (Vector)v1; - if ((uint)v [0] != 0x9abcdef0 || (uint)v [1] != 0x12345678) - return 1; - if ((uint)v [2] != 0xabcdef01 || (uint)v [3] != 0x23456789) - return 2; + if (BitConverter.IsLittleEndian) { + if ((uint)v [0] != 0x9abcdef0 || (uint)v [1] != 0x12345678) + return 1; + if ((uint)v [2] != 0xabcdef01 || (uint)v [3] != 0x23456789) + return 2; + } else { + if ((uint)v [1] != 0x9abcdef0 || (uint)v [0] != 0x12345678) + return 1; + if ((uint)v [3] != 0xabcdef01 || (uint)v [2] != 0x23456789) + return 2; + } return 0; } @@ -1410,11 +1416,8 @@ public class VectorTests { try { vector_copyto (v1, arr, 241); return 1; - } catch (IndexOutOfRangeException) { + } catch (ArgumentException) { } return 0; } - -#endif - } diff --git a/mono/mini/cfgdump.c b/mono/mini/cfgdump.c index fb4f06fb9be..7d83d6480a2 100644 --- a/mono/mini/cfgdump.c +++ b/mono/mini/cfgdump.c @@ -438,15 +438,15 @@ constant_pool_hash (ConstantPoolEntry *entry) return instruction_hash ((MonoInst *) entry->data); case PT_SIGNATURE: { MonoMethodSignature *sig = (MonoMethodSignature *) entry->data; - guint ret = (guint) sig->ret; + guint ret = GPOINTER_TO_UINT (sig->ret); for (int i = 0; i < sig->param_count; i++) { - ret ^= (guint) sig->params [i] << (i + 1); + ret ^= GPOINTER_TO_UINT (sig->params [i]) << (i + 1); } return ret; } case PT_INPUTTYPE: // TODO: singleton. case PT_ENUMKLASS: - return (guint) entry->data; + return GPOINTER_TO_UINT (entry->data); } g_assert (FALSE); return FALSE; diff --git a/mono/mini/cpu-s390x.md b/mono/mini/cpu-s390x.md index b7653f85df3..8dabb43234f 100644 --- a/mono/mini/cpu-s390x.md +++ b/mono/mini/cpu-s390x.md @@ -203,6 +203,8 @@ sub_ovf_carry: dest:i src1:1 src2:i len:28 sub_ovf_un_carry: dest:i src1:1 src2:i len:12 subcc: dest:i src1:i src2:i len:12 throw: src1:i len:26 +tls_get: dest:1 len:32 +tls_set: src1:1 len:32 vcall: len:22 clob:c vcall_membase: src1:b len:12 clob:c vcall_reg: src1:i len:8 clob:c diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 9b188eeb2af..7402923f8ba 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -569,6 +569,8 @@ typedef struct { GSList *bps; /* The number of frames at the start of a step-over */ int nframes; + /* If set, don't stop in methods that are not part of user assemblies */ + MonoAssembly** user_assemblies; } SingleStepReq; /* @@ -4910,6 +4912,22 @@ process_single_step_inner (DebuggerTlsData *tls, gboolean from_signal) if (method->klass == mono_defaults.string_class && (!strcmp (method->name, "memset") || strstr (method->name, "memcpy"))) return; + /* + * This could be in ss_update method, but mono_find_next_seq_point_for_native_offset is pretty expensive method, + * hence we prefer this check here. + */ + if (ss_req->user_assemblies) { + gboolean found = FALSE; + for (int k = 0; ss_req->user_assemblies[k]; k++) + if (ss_req->user_assemblies[k] == method->klass->image->assembly) { + found = TRUE; + break; + } + if (!found) + return; + } + + /* * The ip points to the instruction causing the single step event, which is before * the offset recorded in the seq point map, so find the next seq point after ip. @@ -5392,6 +5410,13 @@ ss_create (MonoInternalThread *thread, StepSize size, StepDepth depth, StepFilte ss_req->filter = filter; req->info = ss_req; + for (int i = 0; i < req->nmodifiers; i++) { + if (req->modifiers[i].kind == MOD_KIND_ASSEMBLY_ONLY) { + ss_req->user_assemblies = req->modifiers[i].data.assemblies; + break; + } + } + mono_loader_lock (); tls = (DebuggerTlsData *)mono_g_hash_table_lookup (thread_to_tls, thread); mono_loader_unlock (); @@ -6484,7 +6509,8 @@ clear_assembly_from_modifier (EventRequest *req, Modifier *m, MonoAssembly *asse } if (match_count) { - newassemblies = g_new0 (MonoAssembly*, count - match_count); + // +1 because we don't know length and we use last element to check for end + newassemblies = g_new0 (MonoAssembly*, count - match_count + 1); pos = 0; for (i = 0; i < count; ++i) @@ -7494,7 +7520,8 @@ event_commands (int command, guint8 *p, guint8 *end, Buffer *buf) int n = decode_int (p, &p, end); int j; - req->modifiers [i].data.assemblies = g_new0 (MonoAssembly*, n); + // +1 because we don't know length and we use last element to check for end + req->modifiers [i].data.assemblies = g_new0 (MonoAssembly*, n + 1); for (j = 0; j < n; ++j) { req->modifiers [i].data.assemblies [j] = decode_assemblyid (p, &p, end, &domain, &err); if (err != ERR_NONE) { diff --git a/mono/mini/driver.c b/mono/mini/driver.c index 7d0716dad90..02c2ca86816 100644 --- a/mono/mini/driver.c +++ b/mono/mini/driver.c @@ -1276,6 +1276,7 @@ mini_usage (void) " --mixed-mode Enable mixed-mode image support.\n" #endif " --handlers Install custom handlers, use --help-handlers for details.\n" + " --aot-path=PATH List of additional directories to search for AOT images.\n" ); } @@ -1779,6 +1780,16 @@ mono_main (int argc, char* argv[]) mono_compile_aot = TRUE; aot_options = &argv [i][6]; #endif + } else if (strncmp (argv [i], "--aot-path=", 11) == 0) { + char **splitted; + + splitted = g_strsplit (argv [i] + 11, G_SEARCHPATH_SEPARATOR_S, 1000); + while (*splitted) { + char *tmp = *splitted; + mono_aot_paths = g_list_append (mono_aot_paths, g_strdup (tmp)); + g_free (tmp); + splitted++; + } } else if (strncmp (argv [i], "--compile-all=", 14) == 0) { action = DO_COMPILE; recompilation_times = atoi (argv [i] + 14); diff --git a/mono/mini/llvm-jit.cpp b/mono/mini/llvm-jit.cpp index 2011fddafaf..868097e6170 100644 --- a/mono/mini/llvm-jit.cpp +++ b/mono/mini/llvm-jit.cpp @@ -27,12 +27,12 @@ #include #include #include +#include #include #include "llvm/ExecutionEngine/Orc/CompileUtils.h" #include "llvm/ExecutionEngine/Orc/IRCompileLayer.h" #include "llvm/ExecutionEngine/Orc/LambdaResolver.h" #include "llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h" -#include "llvm/ExecutionEngine/Orc/OrcArchitectureSupport.h" #include diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c index 2193d5f3272..6a72b4cad07 100644 --- a/mono/mini/method-to-ir.c +++ b/mono/mini/method-to-ir.c @@ -10862,7 +10862,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b guint32 offset; int idx, static_data_reg, array_reg, dreg; - GSHAREDVT_FAILURE (op); + if (context_used && cfg->gsharedvt && mini_is_gsharedvt_klass (klass)) + GSHAREDVT_FAILURE (op); static_data_reg = alloc_ireg (cfg); MONO_EMIT_NEW_LOAD_MEMBASE (cfg, static_data_reg, thread_ins->dreg, MONO_STRUCT_OFFSET (MonoInternalThread, static_data)); diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c index 34843ef95ae..1269d5d5c7c 100644 --- a/mono/mini/mini-amd64.c +++ b/mono/mini/mini-amd64.c @@ -3492,6 +3492,17 @@ mono_arch_have_fast_tls (void) #endif } +int +mono_amd64_get_tls_gs_offset (void) +{ +#ifdef TARGET_OSX + return tls_gs_offset; +#else + g_assert_not_reached (); + return -1; +#endif +} + /* * mono_amd64_emit_tls_get: * @code: buffer to store code to @@ -6354,7 +6365,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) break; case OP_ICONV_TO_R4_RAW: amd64_movd_xreg_reg_size (code, ins->dreg, ins->sreg1, 4); - amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg); + if (!cfg->r4fp) + amd64_sse_cvtss2sd_reg_reg (code, ins->dreg, ins->dreg); break; case OP_FCONV_TO_R8_X: diff --git a/mono/mini/mini-amd64.h b/mono/mini/mini-amd64.h index 43ef2674dd1..e34ec40036f 100644 --- a/mono/mini/mini-amd64.h +++ b/mono/mini/mini-amd64.h @@ -467,12 +467,12 @@ mono_amd64_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpoi guint64 mono_amd64_get_original_ip (void); -gboolean -mono_amd64_have_fast_tls (void); - GSList* mono_amd64_get_exception_trampolines (gboolean aot); +int +mono_amd64_get_tls_gs_offset (void) MONO_LLVM_INTERNAL; + gpointer mono_amd64_handler_block_trampoline_helper (void); diff --git a/mono/mini/mini-arm.c b/mono/mini/mini-arm.c index cfbbd02cec1..78858d00b02 100644 --- a/mono/mini/mini-arm.c +++ b/mono/mini/mini-arm.c @@ -2139,6 +2139,11 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) linfo->ret.nslots = cinfo->ret.nregs; break; #endif + case RegTypeHFA: + linfo->ret.storage = LLVMArgFpStruct; + linfo->ret.nslots = cinfo->ret.nregs; + linfo->ret.esize = cinfo->ret.esize; + break; default: cfg->exception_message = g_strdup_printf ("unknown ret conv (%d)", cinfo->ret.storage); cfg->disable_llvm = TRUE; @@ -2167,6 +2172,16 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) case RegTypeStructByAddrOnStack: lainfo->storage = LLVMArgVtypeByRef; break; + case RegTypeHFA: { + int j; + + lainfo->storage = LLVMArgAsFpArgs; + lainfo->nslots = ainfo->nregs; + lainfo->esize = ainfo->esize; + for (j = 0; j < ainfo->nregs; ++j) + lainfo->pair_storage [j] = LLVMArgInFPReg; + break; + } default: cfg->exception_message = g_strdup_printf ("ainfo->storage (%d)", ainfo->storage); cfg->disable_llvm = TRUE; diff --git a/mono/mini/mini-arm.h b/mono/mini/mini-arm.h index 9a09ce51ff0..cd3ac2ca8b0 100644 --- a/mono/mini/mini-arm.h +++ b/mono/mini/mini-arm.h @@ -400,9 +400,6 @@ mono_arm_patchable_bl (guint8 *code, int cond); gboolean mono_arm_is_hard_float (void); -gboolean -mono_arm_have_fast_tls (void); - void mono_arm_unaligned_stack (MonoMethod *method); diff --git a/mono/mini/mini-arm64.c b/mono/mini/mini-arm64.c index 31b07e6faff..200036dddd5 100644 --- a/mono/mini/mini-arm64.c +++ b/mono/mini/mini-arm64.c @@ -4300,6 +4300,7 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) mono_add_patch_info_rel (cfg, offset, MONO_PATCH_INFO_BB, ins->inst_target_bb, MONO_R_ARM64_BL); arm_bl (code, 0); cfg->thunk_area += THUNK_SIZE; + mono_cfg_add_try_hole (cfg, ins->inst_eh_block, code, bb); break; case OP_START_HANDLER: { MonoInst *spvar = mono_find_spvar_for_region (cfg, bb->region); diff --git a/mono/mini/mini-arm64.h b/mono/mini/mini-arm64.h index c794d3ea0bc..28745040b6b 100644 --- a/mono/mini/mini-arm64.h +++ b/mono/mini/mini-arm64.h @@ -166,7 +166,6 @@ typedef struct { #else #define MONO_ARCH_REDZONE_SIZE 0 -#define MONO_ARCH_HAVE_FAST_TLS 1 #endif diff --git a/mono/mini/mini-darwin.c b/mono/mini/mini-darwin.c index 05adf306e53..d40d6dc8736 100644 --- a/mono/mini/mini-darwin.c +++ b/mono/mini/mini-darwin.c @@ -95,74 +95,6 @@ mono_runtime_install_handlers (void) #endif } -pid_t -mono_runtime_syscall_fork () -{ -#ifdef HAVE_FORK - return (pid_t) fork (); -#else - g_assert_not_reached (); -#endif -} - -void -mono_gdb_render_native_backtraces (pid_t crashed_pid) -{ -#ifdef HAVE_EXECV - const char *argv [6]; - char template [] = "/tmp/mono-gdb-commands.XXXXXX"; - FILE *commands; - gboolean using_lldb = FALSE; - - using_lldb = TRUE; - - argv [0] = g_find_program_in_path ("gdb"); - if (argv [0]) - using_lldb = FALSE; - - if (using_lldb) - argv [0] = g_find_program_in_path ("lldb"); - - if (argv [0] == NULL) - return; - - if (mkstemp (template) == -1) - return; - - commands = fopen (template, "w"); - if (using_lldb) { - fprintf (commands, "process attach --pid %ld\n", (long) crashed_pid); - fprintf (commands, "thread list\n"); - fprintf (commands, "thread backtrace all\n"); - fprintf (commands, "detach\n"); - fprintf (commands, "quit\n"); - argv [1] = "--source"; - argv [2] = template; - argv [3] = 0; - - } else { - fprintf (commands, "attach %ld\n", (long) crashed_pid); - fprintf (commands, "info threads\n"); - fprintf (commands, " t a a info thread\n"); - fprintf (commands, "thread apply all bt\n"); - argv [1] = "-batch"; - argv [2] = "-x"; - argv [3] = template; - argv [4] = "-nx"; - argv [5] = 0; - } - fflush (commands); - fclose (commands); - - fclose (stdin); - - execv (argv [0], (char**)argv); - unlink (template); -#else - fprintf (stderr, "mono_gdb_render_native_backtraces not supported on this platform\n"); -#endif // HAVE_EXECV -} - gboolean mono_thread_state_init_from_handle (MonoThreadUnwindState *tctx, MonoThreadInfo *info) { diff --git a/mono/mini/mini-exceptions-native-unwinder.c b/mono/mini/mini-exceptions-native-unwinder.c deleted file mode 100644 index 08fa26bb1ab..00000000000 --- a/mono/mini/mini-exceptions-native-unwinder.c +++ /dev/null @@ -1,247 +0,0 @@ -/* - * mini-exceptions-native-unwinder.c: libcorkscrew-based native unwinder - * - * Authors: - * Alex Rønne Petersen (alexrp@xamarin.com) - * - * Copyright 2015 Xamarin, Inc (http://www.xamarin.com) - * Licensed under the MIT license. See LICENSE file in the project root for full license information. - */ -#include - -#include - -/* - * Attempt to handle native SIGSEGVs with libunwind or libcorkscrew. - */ - -#ifdef HAVE_SIGNAL_H -#include -#endif - -#include -#include "mini.h" - -#if defined (PLATFORM_ANDROID) - -#include -#include -#include - -#define UNW_LOCAL_ONLY -#undef _U /* ctype.h apparently defines this and it screws up the libunwind headers. */ -#include "../../external/android-libunwind/include/libunwind.h" -#define _U 0x01 - -#define FUNC_NAME_LENGTH 512 -#define FRAMES_TO_UNWIND 256 - -/* Expand the SYM argument. */ -#define LOAD_SYM(DL, ERR, SYM, VAR) _LOAD_SYM(DL, ERR, SYM, VAR) -#define _LOAD_SYM(DL, ERR, SYM, VAR) \ - do { \ - if ((ERR = mono_dl_symbol (DL, #SYM, (void **) &VAR))) { \ - mono_dl_close (DL); \ - return ERR; \ - } \ - } while (0) - -typedef int (*unw_init_local_t) (unw_cursor_t *, unw_context_t *); -typedef int (*unw_get_reg_t) (unw_cursor_t *, int, unw_word_t *); -typedef int (*unw_get_proc_name_t) (unw_cursor_t *, char *, size_t, unw_word_t *); -typedef int (*unw_step_t) (unw_cursor_t *); - -static char * -mono_extension_handle_native_sigsegv_libunwind (void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info) -{ - char *dl_err; - int unw_err; - - unw_init_local_t unw_init_local_fn; - unw_get_reg_t unw_get_reg_fn; - unw_get_proc_name_t unw_get_proc_name_fn; - unw_step_t unw_step_fn; - - unw_cursor_t cursor; - - size_t frames = 0; - - MonoDl *dl = mono_dl_open ("libunwind.so", MONO_DL_LAZY, &dl_err); - - if (!dl) - return dl_err; - - LOAD_SYM (dl, dl_err, UNW_OBJ (init_local), unw_init_local_fn); - LOAD_SYM (dl, dl_err, UNW_OBJ (get_reg), unw_get_reg_fn); - LOAD_SYM (dl, dl_err, UNW_OBJ (get_proc_name), unw_get_proc_name_fn); - LOAD_SYM (dl, dl_err, UNW_OBJ (step), unw_step_fn); - - if ((unw_err = unw_init_local_fn (&cursor, ctx))) { - mono_dl_close (dl); - - return g_strdup_printf ("unw_init_local () returned %d", unw_err); - } - - do { - int reg_err; - - unw_word_t ip, off; - char name [FUNC_NAME_LENGTH]; - - if ((reg_err = unw_get_reg_fn (&cursor, UNW_REG_IP, &ip))) { - mono_runtime_printf_err ("unw_get_reg (UNW_REG_IP) returned %d", reg_err); - break; - } - - reg_err = unw_get_proc_name_fn (&cursor, name, FUNC_NAME_LENGTH, &off); - - if (reg_err == -UNW_ENOINFO) - strcpy (name, "???"); - - mono_runtime_printf_err (" at %s+%zu [0x%zx]", name, off, ip); - - unw_err = unw_step_fn (&cursor); - frames++; - } while (unw_err > 0 && frames < FRAMES_TO_UNWIND); - - if (unw_err < 0) - mono_runtime_printf_err ("unw_step () returned %d", unw_err); - - mono_dl_close (dl); - - return NULL; -} - -/* - * This code is based on the AOSP header system/core/include/corkscrew/backtrace.h. - * - * This is copied here because libcorkscrew is not a stable library and the header (and - * other headers that it depends on) will eventually go away. - * - * We can probably remove this one day when libunwind becomes the norm. - */ - -typedef struct { - uintptr_t absolute_pc; - uintptr_t stack_top; - size_t stack_size; -} backtrace_frame_t; - -typedef struct { - uintptr_t relative_pc; - uintptr_t relative_symbol_addr; - char *map_name; - char *symbol_name; - char *demangled_name; -} backtrace_symbol_t; - -typedef void (*get_backtrace_symbols_t) (const backtrace_frame_t *backtrace, size_t frames, backtrace_symbol_t *backtrace_symbols); -typedef void (*free_backtrace_symbols_t) (backtrace_symbol_t *backtrace_symbols, size_t frames); - -enum { - MAX_BACKTRACE_LINE_LENGTH = 800, -}; - -/* Internals that we're exploiting to work in a signal handler. Only works on ARM/x86. */ - -typedef struct map_info_t map_info_t; - -typedef ssize_t (*unwind_backtrace_signal_arch_t) (siginfo_t *si, void *sc, const map_info_t *lst, backtrace_frame_t *bt, size_t ignore_depth, size_t max_depth); -typedef map_info_t *(*acquire_my_map_info_list_t) (void); -typedef void (*release_my_map_info_list_t) (map_info_t *milist); - -static char * -mono_extension_handle_native_sigsegv_libcorkscrew (void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info) -{ -#if defined (__arm__) || defined (__i386__) - char *dl_err; - - get_backtrace_symbols_t get_backtrace_symbols; - free_backtrace_symbols_t free_backtrace_symbols; - unwind_backtrace_signal_arch_t unwind_backtrace_signal_arch; - acquire_my_map_info_list_t acquire_my_map_info_list; - release_my_map_info_list_t release_my_map_info_list; - - backtrace_frame_t frames [FRAMES_TO_UNWIND]; - backtrace_symbol_t symbols [FRAMES_TO_UNWIND]; - - map_info_t *map_info; - ssize_t frames_unwound; - size_t i; - - MonoDl *dl = mono_dl_open ("libcorkscrew.so", MONO_DL_LAZY, &dl_err); - - if (!dl) - return dl_err; - - LOAD_SYM (dl, dl_err, get_backtrace_symbols, get_backtrace_symbols); - LOAD_SYM (dl, dl_err, free_backtrace_symbols, free_backtrace_symbols); - LOAD_SYM (dl, dl_err, unwind_backtrace_signal_arch, unwind_backtrace_signal_arch); - LOAD_SYM (dl, dl_err, acquire_my_map_info_list, acquire_my_map_info_list); - LOAD_SYM (dl, dl_err, release_my_map_info_list, release_my_map_info_list); - - map_info = acquire_my_map_info_list (); - frames_unwound = unwind_backtrace_signal_arch (info, ctx, map_info, frames, 0, FRAMES_TO_UNWIND); - release_my_map_info_list (map_info); - - if (frames_unwound == -1) { - mono_dl_close (dl); - - return g_strdup ("unwind_backtrace_signal_arch () returned -1"); - } - - get_backtrace_symbols (frames, frames_unwound, symbols); - - for (i = 0; i < frames_unwound; i++) { - backtrace_frame_t *frame = frames + i; - backtrace_symbol_t *symbol = symbols + i; - - const char *name = symbol->demangled_name ? symbol->demangled_name : (symbol->symbol_name ? symbol->symbol_name : "???"); - uintptr_t off = symbol->relative_pc - symbol->relative_symbol_addr; - uintptr_t ip = frame->absolute_pc; - - mono_runtime_printf_err (" at %s+%zu [0x%zx]", name, off, ip); - } - - free_backtrace_symbols (symbols, frames_unwound); - - mono_dl_close (dl); - - return NULL; -#else - return g_strdup ("libcorkscrew is only supported on 32-bit ARM/x86"); -#endif -} - -void -mono_exception_native_unwind (void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info) -{ - char *unwind_err, *corkscrew_err; - - mono_runtime_printf_err ("\nAttempting native Android stacktrace:\n"); - - unwind_err = mono_extension_handle_native_sigsegv_libunwind (ctx, info); - - if (unwind_err) { - corkscrew_err = mono_extension_handle_native_sigsegv_libcorkscrew (ctx, info); - - if (corkscrew_err) { - mono_runtime_printf_err ("\tCould not unwind with `libunwind.so`: %s", unwind_err); - mono_runtime_printf_err ("\tCould not unwind with `libcorkscrew.so`: %s", corkscrew_err); - mono_runtime_printf_err ("\n\tNo options left to get a native stacktrace :-("); - - g_free (corkscrew_err); - } - - g_free (unwind_err); - } -} - -#else - -void -mono_exception_native_unwind (void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info) -{ -} - -#endif diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c index c69678b593d..567a48022ed 100644 --- a/mono/mini/mini-exceptions.c +++ b/mono/mini/mini-exceptions.c @@ -180,6 +180,15 @@ mini_above_abort_threshold (void) return above_threshold; } +static int +mono_get_seq_point_for_native_offset (MonoDomain *domain, MonoMethod *method, gint32 native_offset) +{ + SeqPoint sp; + if (mono_find_prev_seq_point_for_native_offset (domain, method, native_offset, NULL, &sp)) + return sp.il_offset; + return -1; +} + void mono_exceptions_init (void) { @@ -225,6 +234,7 @@ mono_exceptions_init (void) cbs.mono_clear_abort_threshold = mini_clear_abort_threshold; cbs.mono_above_abort_threshold = mini_above_abort_threshold; mono_install_eh_callbacks (&cbs); + mono_install_get_seq_point (mono_get_seq_point_for_native_offset); } gpointer @@ -2422,6 +2432,34 @@ print_stack_frame_to_string (StackFrameInfo *frame, MonoContext *ctx, gpointer d #ifndef MONO_CROSS_COMPILE +static void print_process_map (void) +{ +#ifdef __linux__ + FILE *fp = fopen ("/proc/self/maps", "r"); + char line [256]; + + if (fp == NULL) { + mono_runtime_printf_err ("no /proc/self/maps, not on linux?\n"); + return; + } + + mono_runtime_printf_err ("/proc/self/maps:"); + + while (fgets (line, sizeof (line), fp)) { + // strip newline + size_t len = strlen (line) - 1; + if (len >= 0 && line [len] == '\n') + line [len] = '\0'; + + mono_runtime_printf_err ("%s", line); + } + + fclose (fp); +#else + /* do nothing */ +#endif +} + static gboolean handling_sigsegv = FALSE; /* @@ -2438,10 +2476,12 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T #endif MonoJitTlsData *jit_tls = (MonoJitTlsData *)mono_tls_get_jit_tls (); - if (handling_sigsegv) + gboolean is_sigsegv = !strcmp ("SIGSEGV", signal); + + if (handling_sigsegv && is_sigsegv) return; - if (mini_get_debug_options ()->suspend_on_sigsegv) { + if (mini_get_debug_options ()->suspend_on_sigsegv && is_sigsegv) { mono_runtime_printf_err ("Received %s, suspending...", signal); #ifdef HOST_WIN32 while (1) @@ -2454,7 +2494,8 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T } /* To prevent infinite loops when the stack walk causes a crash */ - handling_sigsegv = TRUE; + if (is_sigsegv) + handling_sigsegv = TRUE; /* !jit_tls means the thread was not registered with the runtime */ if (jit_tls && mono_thread_internal_current ()) { @@ -2464,6 +2505,8 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T mono_walk_stack (print_stack_frame_to_stderr, MONO_UNWIND_LOOKUP_IL_OFFSET, NULL); } + print_process_map (); + #ifdef HAVE_BACKTRACE_SYMBOLS { void *array [256]; @@ -2488,12 +2531,21 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T int status; pid_t crashed_pid = getpid (); - //pid = fork (); /* * glibc fork acquires some locks, so if the crash happened inside malloc/free, * it will deadlock. Call the syscall directly instead. */ - pid = mono_runtime_syscall_fork (); +#if defined(PLATFORM_ANDROID) + /* SYS_fork is defined to be __NR_fork which is not defined in some ndk versions */ + g_assert_not_reached (); +#elif !defined(PLATFORM_MACOSX) && defined(SYS_fork) + pid = (pid_t) syscall (SYS_fork); +#elif defined(PLATFORM_MACOSX) && HAVE_FORK + pid = (pid_t) fork (); +#else + g_assert_not_reached (); +#endif + #if defined (HAVE_PRCTL) && defined(PR_SET_PTRACER) if (pid > 0) { // Allow gdb to attach to the process even if ptrace_scope sysctl variable is set to @@ -2516,7 +2568,15 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T #endif } #else - mono_exception_native_unwind (ctx, info); +#ifdef PLATFORM_ANDROID + /* set DUMPABLE for this process so debuggerd can attach with ptrace(2), see: + * https://android.googlesource.com/platform/bionic/+/151da681000c07da3c24cd30a3279b1ca017f452/linker/debugger.cpp#206 + * this has changed on later versions of Android. Also, we don't want to + * set this on start-up as DUMPABLE has security implications. */ + prctl (PR_SET_DUMPABLE, 1); + + mono_runtime_printf_err ("\nNo native Android stacktrace (see debuggerd output).\n"); +#endif #endif /* @@ -2533,16 +2593,17 @@ mono_handle_native_crash (const char *signal, void *ctx, MONO_SIG_HANDLER_INFO_T "=================================================================\n", signal); - #ifdef MONO_ARCH_USE_SIGACTION - - /* Remove our SIGABRT handler */ sa.sa_handler = SIG_DFL; sigemptyset (&sa.sa_mask); sa.sa_flags = 0; + /* Remove our SIGABRT handler */ g_assert (sigaction (SIGABRT, &sa, NULL) != -1); + /* On some systems we get a SIGILL when calling abort (), because it might + * fail to raise SIGABRT */ + g_assert (sigaction (SIGILL, &sa, NULL) != -1); #endif if (!mono_do_crash_chaining) { diff --git a/mono/mini/mini-generic-sharing.c b/mono/mini/mini-generic-sharing.c index 563a3a5b5de..3c37a4e0e80 100644 --- a/mono/mini/mini-generic-sharing.c +++ b/mono/mini/mini-generic-sharing.c @@ -2365,6 +2365,7 @@ fill_runtime_generic_context (MonoVTable *class_vtable, MonoRuntimeGenericContex method_inst ? method_inst->type_argc : 0, slot, TRUE, TRUE, &do_free); /* This might take the loader lock */ info = instantiate_info (domain, &oti, &context, klass, error); + return_val_if_nok (error, NULL); g_assert (info); /* diff --git a/mono/mini/mini-llvm-cpp.cpp b/mono/mini/mini-llvm-cpp.cpp index a93ee9d9111..8ac2da6b607 100644 --- a/mono/mini/mini-llvm-cpp.cpp +++ b/mono/mini/mini-llvm-cpp.cpp @@ -35,6 +35,13 @@ using namespace llvm; +#if LLVM_API_VERSION > 100 +// These are c++11 scoped enums in recent llvm versions +#define Acquire AtomicOrdering::Acquire +#define Release AtomicOrdering::Release +#define SequentiallyConsistent AtomicOrdering::SequentiallyConsistent +#endif + void mono_llvm_dump_value (LLVMValueRef value) { diff --git a/mono/mini/mini-llvm.c b/mono/mini/mini-llvm.c index 5dc34936bb9..563607f8c0f 100644 --- a/mono/mini/mini-llvm.c +++ b/mono/mini/mini-llvm.c @@ -434,6 +434,9 @@ create_llvm_type_for_type (MonoLLVMModule *module, MonoClass *klass) * This is needed on arm64 where HFAs are returned in * registers. */ + /* SIMD types have size 16 in mono_class_value_size () */ + if (klass->simd_type) + nfields = 16/ esize; size = nfields; eltypes = g_new (LLVMTypeRef, size); for (i = 0; i < size; ++i) @@ -5611,6 +5614,31 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) break; #endif } + case OP_TLS_GET: { +#if (defined(TARGET_AMD64) || defined(TARGET_X86)) && defined(__linux__) +#ifdef TARGET_AMD64 + // 257 == FS segment register + LLVMTypeRef ptrtype = LLVMPointerType (IntPtrType (), 257); +#else + // 256 == GS segment register + LLVMTypeRef ptrtype = LLVMPointerType (IntPtrType (), 256); +#endif + // FIXME: XEN + values [ins->dreg] = LLVMBuildLoad (builder, LLVMBuildIntToPtr (builder, LLVMConstInt (IntPtrType (), ins->inst_offset, TRUE), ptrtype, ""), ""); +#elif defined(TARGET_AMD64) && defined(TARGET_OSX) + /* See mono_amd64_emit_tls_get () */ + int offset = mono_amd64_get_tls_gs_offset () + (ins->inst_offset * 8); + + // 256 == GS segment register + LLVMTypeRef ptrtype = LLVMPointerType (IntPtrType (), 256); + values [ins->dreg] = LLVMBuildLoad (builder, LLVMBuildIntToPtr (builder, LLVMConstInt (IntPtrType (), offset, TRUE), ptrtype, ""), ""); +#else + set_failure (ctx, "opcode tls-get"); + break; +#endif + + break; + } case OP_GC_SAFE_POINT: { LLVMValueRef val, cmp, callee; LLVMBasicBlockRef poll_bb, cont_bb; @@ -6119,8 +6147,7 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) values [ins->dreg] = LLVMBuildInsertElement (builder, values [ins->sreg1], convert (ctx, values [ins->sreg2], LLVMDoubleType ()), LLVMConstInt (LLVMInt32Type (), ins->inst_c0, FALSE), dname); break; -#if 0 - // Requires a later llvm version +#if LLVM_API_VERSION > 100 case OP_CVTDQ2PD: { LLVMValueRef indexes [16]; @@ -6146,14 +6173,16 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb) break; #endif +#if LLVM_API_VERSION <= 100 case OP_CVTDQ2PD: + case OP_CVTPS2PD: + case OP_CVTTPS2DQ: +#endif case OP_CVTDQ2PS: case OP_CVTPD2DQ: case OP_CVTPS2DQ: case OP_CVTPD2PS: - case OP_CVTPS2PD: case OP_CVTTPD2DQ: - case OP_CVTTPS2DQ: case OP_EXTRACT_MASK: case OP_SQRTPS: case OP_SQRTPD: diff --git a/mono/mini/mini-posix.c b/mono/mini/mini-posix.c index b423150d4d9..56225b1d33c 100644 --- a/mono/mini/mini-posix.c +++ b/mono/mini/mini-posix.c @@ -120,20 +120,6 @@ mono_runtime_cleanup_handlers (void) { } -#if !defined(PLATFORM_MACOSX) -pid_t -mono_runtime_syscall_fork (void) -{ - g_assert_not_reached(); - return 0; -} - -void -mono_gdb_render_native_backtraces (pid_t crashed_pid) -{ -} -#endif - #else static GHashTable *mono_saved_signal_handlers = NULL; @@ -842,78 +828,112 @@ mono_runtime_setup_stat_profiler (void) #endif -#if !defined(PLATFORM_MACOSX) -pid_t -mono_runtime_syscall_fork () -{ -#if defined(PLATFORM_ANDROID) - /* SYS_fork is defined to be __NR_fork which is not defined in some ndk versions */ - g_assert_not_reached (); - return 0; -#elif defined(SYS_fork) - return (pid_t) syscall (SYS_fork); +#endif /* defined(__native_client__) || defined(HOST_WATCHOS) */ + +#if defined(__native_client__) + +void +mono_gdb_render_native_backtraces (pid_t crashed_pid) +{ +} + #else - g_assert_not_reached (); - return 0; -#endif + +static gboolean +native_stack_with_gdb (pid_t crashed_pid, const char **argv, FILE *commands, char* commands_filename) +{ + gchar *gdb; + + gdb = g_find_program_in_path ("gdb"); + if (!gdb) + return FALSE; + + argv [0] = gdb; + argv [1] = "-batch"; + argv [2] = "-x"; + argv [3] = commands_filename; + argv [4] = "-nx"; + + fprintf (commands, "attach %ld\n", (long) crashed_pid); + fprintf (commands, "info threads\n"); + fprintf (commands, "thread apply all bt\n"); + + return TRUE; +} + + +static gboolean +native_stack_with_lldb (pid_t crashed_pid, const char **argv, FILE *commands, char* commands_filename) +{ + gchar *lldb; + + lldb = g_find_program_in_path ("lldb"); + if (!lldb) + return FALSE; + + argv [0] = lldb; + argv [1] = "--batch"; + argv [2] = "--source"; + argv [3] = commands_filename; + argv [4] = "--no-lldbinit"; + + fprintf (commands, "process attach --pid %ld\n", (long) crashed_pid); + fprintf (commands, "thread list\n"); + fprintf (commands, "thread backtrace all\n"); + fprintf (commands, "detach\n"); + fprintf (commands, "quit\n"); + + return TRUE; } void mono_gdb_render_native_backtraces (pid_t crashed_pid) { +#ifdef HAVE_EXECV const char *argv [10]; - char template_ [] = "/tmp/mono-lldb-commands.XXXXXX"; - char buf1 [128]; FILE *commands; - gboolean using_lldb = FALSE; + char commands_filename [] = "/tmp/mono-gdb-commands.XXXXXX"; - argv [0] = g_find_program_in_path ("gdb"); - if (argv [0] == NULL) { - argv [0] = g_find_program_in_path ("lldb"); - using_lldb = TRUE; - } + if (mkstemp (commands_filename) == -1) + return; - if (argv [0] == NULL) + commands = fopen (commands_filename, "w"); + if (!commands) { + unlink (commands_filename); return; + } - if (using_lldb) { - if (mkstemp (template_) == -1) - return; + memset (argv, 0, sizeof (char*) * 10); - commands = fopen (template_, "w"); +#if defined(PLATFORM_MACOSX) + if (native_stack_with_lldb (crashed_pid, argv, commands, commands_filename)) + goto exec; +#endif - fprintf (commands, "process attach --pid %ld\n", (long) crashed_pid); - fprintf (commands, "thread list\n"); - fprintf (commands, "thread backtrace all\n"); - fprintf (commands, "detach\n"); - fprintf (commands, "quit\n"); + if (native_stack_with_gdb (crashed_pid, argv, commands, commands_filename)) + goto exec; - fflush (commands); - fclose (commands); +#if !defined(PLATFORM_MACOSX) + if (native_stack_with_lldb (crashed_pid, argv, commands, commands_filename)) + goto exec; +#endif - argv [1] = "--source"; - argv [2] = template_; - argv [3] = 0; - } else { - argv [1] = "-ex"; - sprintf (buf1, "attach %ld", (long) crashed_pid); - argv [2] = buf1; - argv [3] = "--ex"; - argv [4] = "info threads"; - argv [5] = "--ex"; - argv [6] = "thread apply all bt"; - argv [7] = "--batch"; - argv [8] = "-nx"; - argv [9] = 0; - } + fprintf (stderr, "mono_gdb_render_native_backtraces not supported on this platform, unable to find gdb or lldb\n"); + + fclose (commands); + unlink (commands_filename); + return; +exec: execv (argv [0], (char**)argv); - if (using_lldb) - unlink (template_); + _exit (-1); +#else + fprintf (stderr, "mono_gdb_render_native_backtraces not supported on this platform\n"); +#endif // HAVE_EXECV } -#endif -#endif /* __native_client__ */ + +#endif /* defined(__native_client__) */ #if !defined (__MACH__) diff --git a/mono/mini/mini-runtime.c b/mono/mini/mini-runtime.c index 0c67814f126..98cd4f6cbea 100644 --- a/mono/mini/mini-runtime.c +++ b/mono/mini/mini-runtime.c @@ -121,6 +121,7 @@ MonoDebugOptions debug_options; #ifdef VALGRIND_JIT_REGISTER_MAP int valgrind_register; #endif +GList* mono_aot_paths; static GSList *tramp_infos; @@ -691,7 +692,7 @@ register_dyn_icall (gpointer func, const char *name, const char *sigstr, gboolea MonoLMF * mono_get_lmf (void) { -#if defined(MONO_ARCH_ENABLE_MONO_LMF_VAR) +#if defined(MONO_ARCH_ENABLE_MONO_LMF_VAR) && defined(HAVE_GET_TLS_ADDR) return (MonoLMF *)mono_tls_get_lmf (); #else MonoJitTlsData *jit_tls; @@ -716,11 +717,11 @@ mono_get_lmf_addr (void) void mono_set_lmf (MonoLMF *lmf) { -#if defined(MONO_ARCH_ENABLE_MONO_LMF_VAR) +#if defined(MONO_ARCH_ENABLE_MONO_LMF_VAR) && defined(HAVE_GET_TLS_ADDR) mono_tls_set_lmf (lmf); -#endif - +#else (*mono_get_lmf_addr ()) = lmf; +#endif } MonoJitTlsData* @@ -852,7 +853,15 @@ setup_jit_tls_data (gpointer stack_start, gpointer abort_func) jit_tls->first_lmf = lmf; -#if defined(MONO_ARCH_ENABLE_MONO_LMF_VAR) + /* + * We can have 2 configurations for accessing lmf. + * We can use only the tls_lmf_addr variable, which will store the address of + * jit_tls->lmf, or, if we have MONO_ARCH_ENABLE_MONO_LMF_VAR enabled, we can + * use both tls_lmf_addr and tls_lmf variables (in this case we need to have + * means of getting the address of a tls variable; this can be done always + * when using __thread or, on osx, even when using pthread) + */ +#if defined(MONO_ARCH_ENABLE_MONO_LMF_VAR) && defined(HAVE_GET_TLS_ADDR) /* jit_tls->lmf is unused */ mono_tls_set_lmf (lmf); mono_set_lmf_addr (mono_tls_get_tls_addr (TLS_KEY_LMF)); @@ -2688,6 +2697,8 @@ MONO_SIG_HANDLER_FUNC (, mono_sigfpe_signal_handler) ji = mono_jit_info_table_find_internal (mono_domain_get (), (char *)mono_arch_ip_from_context (ctx), TRUE, TRUE); + MONO_ENTER_GC_UNSAFE_UNBALANCED; + #if defined(MONO_ARCH_HAVE_IS_INT_OVERFLOW) if (mono_arch_is_int_overflow (ctx, info)) /* @@ -2703,16 +2714,19 @@ MONO_SIG_HANDLER_FUNC (, mono_sigfpe_signal_handler) if (!ji) { if (!mono_do_crash_chaining && mono_chain_signal (MONO_SIG_HANDLER_PARAMS)) - return; + goto exit; mono_handle_native_crash ("SIGFPE", ctx, info); if (mono_do_crash_chaining) { mono_chain_signal (MONO_SIG_HANDLER_PARAMS); - return; + goto exit; } } mono_arch_handle_exception (ctx, exc); + +exit: + MONO_EXIT_GC_UNSAFE_UNBALANCED; } MONO_SIG_HANDLER_FUNC (, mono_sigill_signal_handler) @@ -2836,9 +2850,13 @@ MONO_SIG_HANDLER_FUNC (, mono_sigint_signal_handler) MonoException *exc; MONO_SIG_HANDLER_GET_CONTEXT; + MONO_ENTER_GC_UNSAFE_UNBALANCED; + exc = mono_get_exception_execution_engine ("Interrupted (SIGINT)."); mono_arch_handle_exception (ctx, exc); + + MONO_EXIT_GC_UNSAFE_UNBALANCED; } #ifndef DISABLE_REMOTING diff --git a/mono/mini/mini-s390x.c b/mono/mini/mini-s390x.c index ac0bcaa48fb..8cbcd45accc 100644 --- a/mono/mini/mini-s390x.c +++ b/mono/mini/mini-s390x.c @@ -1368,7 +1368,7 @@ mono_arch_cleanup (void) gboolean mono_arch_have_fast_tls (void) { - return FALSE; + return TRUE; } /*========================= End of Function ========================*/ @@ -3918,6 +3918,34 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb) case OP_S390_SETF4RET: s390_ledbr (code, ins->dreg, ins->sreg1); break; + case OP_TLS_GET: { + if (s390_is_imm16 (ins->inst_offset)) { + s390_lghi (code, s390_r13, ins->inst_offset); + } else if (s390_is_imm32 (ins->inst_offset)) { + s390_lgfi (code, s390_r13, ins->inst_offset); + } else { + S390_SET (code, s390_r13, ins->inst_offset); + } + s390_ear (code, s390_r1, 0); + s390_sllg(code, s390_r1, s390_r1, 0, 32); + s390_ear (code, s390_r1, 1); + s390_lg (code, ins->dreg, s390_r13, s390_r1, 0); + } + break; + case OP_TLS_SET: { + if (s390_is_imm16 (ins->inst_offset)) { + s390_lghi (code, s390_r13, ins->inst_offset); + } else if (s390_is_imm32 (ins->inst_offset)) { + s390_lgfi (code, s390_r13, ins->inst_offset); + } else { + S390_SET (code, s390_r13, ins->inst_offset); + } + s390_ear (code, s390_r1, 0); + s390_sllg(code, s390_r1, s390_r1, 0, 32); + s390_ear (code, s390_r1, 1); + s390_stg (code, ins->sreg1, s390_r13, s390_r1, 0); + } + break; case OP_JMP: { if (cfg->method->save_lmf) restoreLMF(code, cfg->frame_reg, cfg->stack_usage); @@ -6268,6 +6296,18 @@ mono_arch_print_tree (MonoInst *tree, int arity) mono_arch_regname (tree->sreg1)); done = 1; break; + case OP_TLS_GET: + printf ("[0x%lx(0x%lx,%s)]", tree->inst_offset, + tree->inst_imm, + mono_arch_regname (tree->sreg1)); + done = 1; + break; + case OP_TLS_SET: + printf ("[0x%lx(0x%lx,%s)]", tree->inst_offset, + tree->inst_imm, + mono_arch_regname (tree->sreg1)); + done = 1; + break; case OP_S390_BKCHAIN: printf ("[previous_frame(%s)]", mono_arch_regname (tree->sreg1)); diff --git a/mono/mini/mini-x86.h b/mono/mini/mini-x86.h index b423c193b7e..6e04f7d3758 100644 --- a/mono/mini/mini-x86.h +++ b/mono/mini/mini-x86.h @@ -202,7 +202,6 @@ typedef struct { /* X86 uses jit_tls->lmf (See emit_push_lmf ()) */ #define MONO_ARCH_ENABLE_MONO_LMF_VAR 1 #endif -#define MONO_ARCH_HAVE_FAST_TLS (mono_x86_have_fast_tls ()) #define MONO_ARCH_IMT_REG X86_EDX #define MONO_ARCH_VTABLE_REG X86_EDX #define MONO_ARCH_RGCTX_REG MONO_ARCH_IMT_REG @@ -338,9 +337,6 @@ typedef struct { guint32 mono_x86_get_this_arg_offset (MonoMethodSignature *sig); -gboolean -mono_x86_have_fast_tls (void); - void mono_x86_throw_exception (mgreg_t *regs, MonoObject *exc, mgreg_t eip, gboolean rethrow); diff --git a/mono/mini/mini.h b/mono/mini/mini.h index 31791d9adf7..643d6c748d2 100644 --- a/mono/mini/mini.h +++ b/mono/mini/mini.h @@ -125,7 +125,7 @@ #endif /* Version number of the AOT file format */ -#define MONO_AOT_FILE_VERSION 138 +#define MONO_AOT_FILE_VERSION 139 //TODO: This is x86/amd64 specific. #define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6)) @@ -570,6 +570,7 @@ extern GHashTable *mono_single_method_hash; extern gboolean mono_using_xdebug; extern int mini_verbose; extern int valgrind_register; +extern GList* mono_aot_paths; #define INS_INFO(opcode) (&ins_info [((opcode) - OP_START - 1) * 4]) @@ -3176,7 +3177,6 @@ void mono_runtime_cleanup_handlers (void); void mono_runtime_setup_stat_profiler (void); void mono_runtime_shutdown_stat_profiler (void); void mono_runtime_posix_install_handlers (void); -pid_t mono_runtime_syscall_fork (void); void mono_gdb_render_native_backtraces (pid_t crashed_pid); void mono_cross_helpers_run (void); @@ -3202,11 +3202,6 @@ gboolean MONO_SIG_HANDLER_SIGNATURE (mono_chain_signal); #define ARCH_VARARG_ICALLS 0 #endif -/* - * Native unwinder integration - */ -void mono_exception_native_unwind (void *ctx, MONO_SIG_HANDLER_INFO_TYPE *info); - /* * Coop support for trampolines */ diff --git a/mono/mini/simd-intrinsics.c b/mono/mini/simd-intrinsics.c index b237968189c..091f6b4073c 100644 --- a/mono/mini/simd-intrinsics.c +++ b/mono/mini/simd-intrinsics.c @@ -2224,7 +2224,11 @@ emit_vector_t_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSigna /* Emit index check for the end (index + len - 1 < array length) */ end_index_reg = alloc_ireg (cfg); EMIT_NEW_BIALU_IMM (cfg, ins, OP_IADD_IMM, end_index_reg, index_ins->dreg, len - 1); - MONO_EMIT_BOUNDS_CHECK (cfg, array_ins->dreg, MonoArray, max_length, end_index_reg); + + int length_reg = alloc_ireg (cfg); + MONO_EMIT_NEW_LOAD_MEMBASE_OP_FAULT (cfg, OP_LOADI4_MEMBASE, length_reg, array_ins->dreg, MONO_STRUCT_OFFSET (MonoArray, max_length)); + MONO_EMIT_NEW_BIALU (cfg, OP_COMPARE, -1, length_reg, end_index_reg); + MONO_EMIT_NEW_COND_EXC (cfg, LE_UN, "ArgumentException"); /* Load the simd reg into the array slice */ ldelema_ins = mini_emit_ldelema_1_ins (cfg, mono_class_from_mono_type (etype), array_ins, index_ins, TRUE); @@ -2253,10 +2257,6 @@ emit_sys_numerics_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodS const char *nspace = cmethod->klass->name_space; const char *class_name = cmethod->klass->name; - if (cfg->r4fp) - // FIXME: - return NULL; - if (!strcmp ("Vector2", class_name) || !strcmp ("Vector4", class_name) || !strcmp ("Vector3", class_name)) return emit_vector_intrinsics (cfg, cmethod, fsig, args); @@ -2284,10 +2284,6 @@ emit_sys_numerics_vectors_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, Mon { const char *class_name = cmethod->klass->name; - if (cfg->r4fp) - // FIXME: - return NULL; - if (!strcmp (class_name, "Vector`1")) return emit_vector_t_intrinsics (cfg, cmethod, fsig, args); return NULL; @@ -2296,10 +2292,6 @@ emit_sys_numerics_vectors_intrinsics (MonoCompile *cfg, MonoMethod *cmethod, Mon MonoInst* mono_emit_simd_field_load (MonoCompile *cfg, MonoClassField *field, MonoInst *addr) { - if (cfg->r4fp) - // FIXME: - return NULL; - if (is_sys_numerics_assembly (field->parent->image->assembly)) { int index = -1; diff --git a/mono/mini/tramp-arm64-gsharedvt.c b/mono/mini/tramp-arm64-gsharedvt.c index 175f75ddaab..abeb5cd367c 100644 --- a/mono/mini/tramp-arm64-gsharedvt.c +++ b/mono/mini/tramp-arm64-gsharedvt.c @@ -93,7 +93,7 @@ mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpoint break; case GSHAREDVT_ARG_BYVAL_TO_BYREF: src_slot = src & 0x3f; - src_ptr = caller + src_slot + src_offset; + src_ptr = (guint8*)(caller + src_slot + src_offset); callee [dst] = src_ptr; break; default: diff --git a/mono/tests/Makefile.am b/mono/tests/Makefile.am index db85fcb1a3f..5b5fec5acd3 100644 --- a/mono/tests/Makefile.am +++ b/mono/tests/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = assemblyresolve gc-descriptors -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL FEATUREFUL_RUNTIME_TEST = else FEATUREFUL_RUNTIME_TEST = test-appdomain-unload @@ -41,20 +41,21 @@ CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE) with_mono_path = MONO_PATH=$(CLASS) RUNTIME = $(with_mono_path) $(top_builddir)/runtime/mono-wrapper +TOOLS_RUNTIME = MONO_PATH=$(mcs_topdir)/class/lib/build $(top_builddir)/runtime/mono-wrapper --aot-path=$(mcs_topdir)/class/lib/build MKBUNDLE = \ PKG_CONFIG_PATH=$(top_builddir):$(PKG_CONFIG_PATH) \ $(RUNTIME) $(CLASS)/mkbundle.exe -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL PROFILE_MCS_FLAGS = -d:MOBILE,MOBILE_LEGACY,FULL_AOT_DESKTOP endif -if INSTALL_AOT_HYBRID +if INSTALL_TESTING_AOT_HYBRID PROFILE_MCS_FLAGS = -d:MOBILE,MOBILE_LEGACY endif -MCS_NO_LIB = $(RUNTIME) $(CSC) -unsafe -debug:portable \ +MCS_NO_LIB = $(TOOLS_RUNTIME) $(CSC) -unsafe -debug:portable \ -noconfig -nologo \ -nowarn:0162 -nowarn:0168 -nowarn:0219 -nowarn:0414 -nowarn:0618 \ -nowarn:0169 -nowarn:1690 -nowarn:0649 -nowarn:0612 -nowarn:3021 \ @@ -62,9 +63,9 @@ MCS_NO_LIB = $(RUNTIME) $(CSC) -unsafe -debug:portable \ MCS = $(MCS_NO_LIB) -lib:$(CLASS) -ILASM = $(RUNTIME) $(CLASS)/ilasm.exe +ILASM = $(TOOLS_RUNTIME) $(mcs_topdir)/class/lib/build/ilasm.exe -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)" --aot-run-flags "$(AOT_RUN_FLAGS)" --aot-build-flags "$(AOT_BUILD_FLAGS)" else TEST_RUNNER = ./test-runner.exe --runtime $(top_builddir)/runtime/mono-wrapper --mono-path "$(CLASS)" @@ -713,7 +714,7 @@ endif PROFILE_DISABLED_TESTS= -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL # Tests which rely on TypeLoadExceptions # In full-aot mode, these cause the relevant methods to be not AOTed. PROFILE_DISABLED_TESTS += \ @@ -752,7 +753,7 @@ PROFILE_DISABLED_TESTS += \ thunks.exe # Tests which load assemblies which are not -# in the aot_only profile +# in the testing_aot_full profile PROFILE_DISABLED_TESTS += \ assembly-load-remap.exe @@ -840,7 +841,7 @@ PROFILE_DISABLED_TESTS += \ bug-515884.exe endif -if INSTALL_AOT_HYBRID +if INSTALL_TESTING_AOT_HYBRID PROFILE_DISABLED_TESTS += \ bug-80307.exe \ namedmutex-destroy-race.exe @@ -921,13 +922,13 @@ EXTRA_DIST=test-driver test-runner.cs $(TEST_CS_SRC_DIST) $(TEST_IL_SRC) \ %.exe: %.il $(ILASM) -out:$@ $< -if !INSTALL_AOT_ONLY -if !INSTALL_AOT_HYBRID +if !INSTALL_TESTING_AOT_FULL +if !INSTALL_TESTING_AOT_HYBRID TEST_DRIVER_HARD_KILL_FEATURE=-r:Mono.Posix.dll endif endif -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL TEST_DRIVER_DEPEND=TestDriver.dll$(PLATFORM_AOT_SUFFIX) else TEST_DRIVER_DEPEND=TestDriver.dll @@ -980,7 +981,7 @@ bug-81466-lib.dll$(PLATFORM_AOT_SUFFIX) \ TestingReferenceAssembly.dll$(PLATFORM_AOT_SUFFIX) \ TestingReferenceReferenceAssembly.dll$(PLATFORM_AOT_SUFFIX) -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL prereqs: $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS) else prereqs: $(PREREQSI_IL) $(PREREQSI_CS) @@ -1025,7 +1026,7 @@ test-sgen : sgen-tests # Precompile the test assemblies in parallel compile-tests: $(MAKE) -j4 $(TESTSI_CS) $(TESTSI_IL) $(TESTBS) libtest.la $(PREREQSI_IL) $(PREREQSI_CS) -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(MAKE) $(PREREQSI_IL_AOT) $(PREREQSI_CS_AOT) $(AOT_EXTRA_LIBS) endif @@ -1234,7 +1235,7 @@ SGEN_REGULAR_TESTS_SRC = \ SGEN_REGULAR_DISABLED_TESTS= -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL SGEN_REGULAR_DISABLED_TESTS += \ sgen-domain-unload.exe \ sgen-domain-unload-2.exe @@ -1444,7 +1445,7 @@ imt_big_iface_test.exe: $(TEST_DRIVER_DEPEND) make-imt-test.exe EXTRA_DIST += test-inline-call-stack-library.cs test-inline-call-stack.cs test-inline-call-stack-library.dll: $(TEST_DRIVER_DEPEND) $(srcdir)/test-inline-call-stack-library.cs $(MCS) -t:library -out:test-inline-call-stack-library.dll $(srcdir)/test-inline-call-stack-library.cs -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif @@ -1491,7 +1492,7 @@ bug-81673.exe bug-81673-interface.dll: $(srcdir)/bug-81673.cs $(srcdir)/bug-8167 $(MCS) -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs $(MCS) -out:bug-81673.exe -r:bug-81673-interface.dll $(srcdir)/bug-81673.cs $(MCS) -define:WITH_STOP -target:library -out:bug-81673-interface.dll $(srcdir)/bug-81673-interface.cs -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif @@ -1500,7 +1501,7 @@ bug-36848.exe bug-36848-a.dll: $(srcdir)/bug-36848.cs $(srcdir)/bug-36848-a.cs $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs $(MCS) -r:bug-36848-a.dll -out:bug-36848.exe $(srcdir)/bug-36848.cs $(MCS) -target:library -out:bug-36848-a.dll $(srcdir)/bug-36848-a.cs /define:WITH_STOP -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif @@ -1515,7 +1516,7 @@ bug-81691.exe: bug-81691-b.dll EXTRA_DIST += bug-81466-lib.il bug-81466-lib.dll: bug-81466-lib.il $(ILASM) /dll /output:bug-81466-lib.dll $(srcdir)/bug-81466-lib.il -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif bug-81466.exe: bug-81466.il bug-81466-lib.dll @@ -1524,7 +1525,7 @@ bug-81466.exe: bug-81466.il bug-81466-lib.dll EXTRA_DIST += bug-324535-il.il bug-324535-il.dll : bug-324535-il.il $(ILASM) /dll /output:bug-324535-il.dll $(srcdir)/bug-324535-il.il -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif bug-324535.exe : bug-324535.cs bug-324535-il.dll @@ -1533,7 +1534,7 @@ bug-324535.exe : bug-324535.cs bug-324535-il.dll EXTRA_DIST += custom-modifiers.2.cs custom-modifiers-lib.il custom-modifiers-lib.dll: custom-modifiers-lib.il $(ILASM) /dll /output:custom-modifiers-lib.dll $(srcdir)/custom-modifiers-lib.il -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif custom-modifiers.2.exe: custom-modifiers.2.cs custom-modifiers-lib.dll @@ -1542,7 +1543,7 @@ custom-modifiers.2.exe: custom-modifiers.2.cs custom-modifiers-lib.dll EXTRA_DIST += bug-382986-lib.cs bug-382986-lib.dll: bug-382986-lib.cs $(MCS) -target:library -out:$@ $(srcdir)/bug-382986-lib.cs -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif @@ -1569,14 +1570,14 @@ test-coreclr-security : coreclr-security.exe EXTRA_DIST += generic-unboxing.2.il generic-unboxing.2.dll : generic-unboxing.2.il $(ILASM) /dll /output:generic-unboxing.2.dll $(srcdir)/generic-unboxing.2.il -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif EXTRA_DIST += generic-boxing.2.il generic-boxing.2.dll : generic-boxing.2.il generic-unboxing.2.dll $(ILASM) /dll /output:generic-boxing.2.dll $(srcdir)/generic-boxing.2.il -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif @@ -1591,7 +1592,7 @@ generic-box.2.exe : generic-box.2.cs generic-unboxing.2.dll generic-boxing.2.dll EXTRA_DIST += generic-delegate2.2.cs generic-delegate2-lib.2.il generic-delegate2-lib.2.dll : generic-delegate2-lib.2.il $(ILASM) /dll /output:$@ $(srcdir)/generic-delegate2-lib.2.il -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL $(RUNTIME) $(AOT_BUILD_FLAGS) $@ endif generic-delegate2.2.exe : generic-delegate2.2.cs generic-delegate2-lib.2.dll @@ -1662,7 +1663,7 @@ GSHARED_TESTS_SRC = \ GSHARED_DISABLED_TESTS= -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL GSHARED_DISABLED_TESTS += \ generic-type-builder.2.exe endif diff --git a/mono/tests/assemblyresolve/Makefile.am b/mono/tests/assemblyresolve/Makefile.am index 1d3942ffa4f..12379c115f2 100644 --- a/mono/tests/assemblyresolve/Makefile.am +++ b/mono/tests/assemblyresolve/Makefile.am @@ -1,11 +1,8 @@ -CLASS=$(mcs_topdir)/class/lib/$(DEFAULT_PROFILE) - -with_mono_path = MONO_PATH=$(CLASS) RUNTIME = $(top_builddir)/runtime/mono-wrapper --debug -MCS = $(with_mono_path) $(RUNTIME) $(CSC) -noconfig -nologo -debug:portable -target:library +MCS = MONO_PATH=$(mcs_topdir)/class/lib/build $(RUNTIME) $(CSC) -noconfig -nologo -debug:portable -target:library -if INSTALL_AOT_ONLY +if INSTALL_TESTING_AOT_FULL prereq: aot else prereq: test/asm.dll diff --git a/mono/tests/test-runner.cs b/mono/tests/test-runner.cs index 6195d5f4008..025e01cd46f 100644 --- a/mono/tests/test-runner.cs +++ b/mono/tests/test-runner.cs @@ -35,6 +35,7 @@ public class TestRunner class ProcessData { public string test; public StringBuilder stdout, stderr; + public object stdoutLock = new object (), stderrLock = new object (); public string stdoutName, stderrName; } @@ -346,14 +347,16 @@ public class TestRunner data.stderr = new StringBuilder (); p.OutputDataReceived += delegate (object sender, DataReceivedEventArgs e) { - if (e.Data != null) { - data.stdout.AppendLine (e.Data); + lock (data.stdoutLock) { + if (e.Data != null) + data.stdout.AppendLine (e.Data); } }; p.ErrorDataReceived += delegate (object sender, DataReceivedEventArgs e) { - if (e.Data != null) { - data.stderr.AppendLine (e.Data); + lock (data.stderrLock) { + if (e.Data != null) + data.stderr.AppendLine (e.Data); } }; @@ -369,14 +372,8 @@ public class TestRunner timedout.Add (data); } -#if !FULL_AOT_DESKTOP && !MOBILE // Force the process to print a thread dump - try { - Syscall.kill (p.Id, Signum.SIGQUIT); - Thread.Sleep (1000); - } catch { - } -#endif + TryThreadDump (p.Id, data); if (verbose) { output.Write ($"timed out ({timeout}s)"); @@ -611,4 +608,119 @@ public class TestRunner // Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */ return Regex.Replace (text, @"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", ""); } + + static void TryThreadDump (int pid, ProcessData data) + { + try { + TryGDB (pid, data); + return; + } catch { + } + +#if !FULL_AOT_DESKTOP && !MOBILE + /* LLDB cannot produce managed stacktraces for all the threads */ + try { + Syscall.kill (pid, Signum.SIGQUIT); + Thread.Sleep (1000); + } catch { + } +#endif + + try { + TryLLDB (pid, data); + return; + } catch { + } + } + + static void TryLLDB (int pid, ProcessData data) + { + string filename = Path.GetTempFileName (); + + using (StreamWriter sw = new StreamWriter (new FileStream (filename, FileMode.Open, FileAccess.Write))) + { + sw.WriteLine ("process attach --pid " + pid); + sw.WriteLine ("thread list"); + sw.WriteLine ("thread backtrace all"); + sw.WriteLine ("detach"); + sw.WriteLine ("quit"); + sw.Flush (); + + ProcessStartInfo psi = new ProcessStartInfo { + FileName = "lldb", + Arguments = "--batch --source \"" + filename + "\" --no-lldbinit", + UseShellExecute = false, + RedirectStandardError = true, + RedirectStandardOutput = true, + }; + + using (Process process = new Process { StartInfo = psi }) + { + process.OutputDataReceived += delegate (object sender, DataReceivedEventArgs e) { + lock (data.stdoutLock) { + if (e.Data != null) + data.stdout.AppendLine (e.Data); + } + }; + + process.ErrorDataReceived += delegate (object sender, DataReceivedEventArgs e) { + lock (data.stderrLock) { + if (e.Data != null) + data.stderr.AppendLine (e.Data); + } + }; + + process.Start (); + process.BeginOutputReadLine (); + process.BeginErrorReadLine (); + if (!process.WaitForExit (60 * 1000)) + process.Kill (); + } + } + } + + static void TryGDB (int pid, ProcessData data) + { + string filename = Path.GetTempFileName (); + + using (StreamWriter sw = new StreamWriter (new FileStream (filename, FileMode.Open, FileAccess.Write))) + { + sw.WriteLine ("attach " + pid); + sw.WriteLine ("info threads"); + sw.WriteLine ("thread apply all p mono_print_thread_dump(0)"); + sw.WriteLine ("thread apply all backtrace"); + sw.Flush (); + + ProcessStartInfo psi = new ProcessStartInfo { + FileName = "gdb", + Arguments = "-batch -x \"" + filename + "\" -nx", + UseShellExecute = false, + RedirectStandardError = true, + RedirectStandardOutput = true, + }; + + using (Process process = new Process { StartInfo = psi }) + { + process.OutputDataReceived += delegate (object sender, DataReceivedEventArgs e) { + lock (data.stdoutLock) { + if (e.Data != null) + data.stdout.AppendLine (e.Data); + } + }; + + process.ErrorDataReceived += delegate (object sender, DataReceivedEventArgs e) { + lock (data.stderrLock) { + if (e.Data != null) + data.stderr.AppendLine (e.Data); + } + }; + + process.Start (); + process.BeginOutputReadLine (); + process.BeginErrorReadLine (); + if (!process.WaitForExit (60 * 1000)) + process.Kill (); + } + } + } } diff --git a/mono/utils/mach-support-arm.c b/mono/utils/mach-support-arm.c index a7fd9836d18..f84cc85b63c 100644 --- a/mono/utils/mach-support-arm.c +++ b/mono/utils/mach-support-arm.c @@ -106,7 +106,7 @@ mono_mach_arch_get_thread_state_size () int mono_mach_arch_get_thread_fpstate_size () { - g_assert_not_reached (); + return sizeof (arm_neon_state_t); } kern_return_t diff --git a/mono/utils/mach-support-arm64.c b/mono/utils/mach-support-arm64.c index 2035f485b14..4a58dc4a218 100644 --- a/mono/utils/mach-support-arm64.c +++ b/mono/utils/mach-support-arm64.c @@ -106,7 +106,7 @@ mono_mach_arch_get_thread_state_size () int mono_mach_arch_get_thread_fpstate_size () { - g_assert_not_reached (); + return sizeof (arm_neon_state64_t); } kern_return_t diff --git a/mono/utils/mono-threads.c b/mono/utils/mono-threads.c index 9605ad826f2..e8893039fbf 100644 --- a/mono/utils/mono-threads.c +++ b/mono/utils/mono-threads.c @@ -426,6 +426,9 @@ unregister_thread (void *arg) g_assert (mono_thread_info_is_current (info)); g_assert (mono_thread_info_is_live (info)); + /* Pump the HP queue while the thread is alive.*/ + mono_thread_hazardous_try_free_some (); + small_id = info->small_id; /* We only enter the GC unsafe region, as when exiting this function, the thread @@ -481,8 +484,6 @@ unregister_thread (void *arg) /*now it's safe to free the thread info.*/ mono_thread_hazardous_try_free (info, free_thread_info); - /* Pump the HP queue */ - mono_thread_hazardous_try_free_some (); mono_thread_small_id_free (small_id); diff --git a/mono/utils/mono-tls.c b/mono/utils/mono-tls.c index 765011dbfe8..da4498936a2 100644 --- a/mono/utils/mono-tls.c +++ b/mono/utils/mono-tls.c @@ -7,7 +7,6 @@ * Copyright 2013 Xamarin, Inc (http://www.xamarin.com) */ -#include #include #include "mono-tls.h" @@ -34,9 +33,6 @@ * wrappers and managed allocators, both of which are not aot-ed by default. * So far, we never supported inlined fast tls on full-aot systems. */ -#ifdef HAVE_KW_THREAD -#define USE_KW_THREAD -#endif #ifdef USE_KW_THREAD @@ -116,6 +112,44 @@ #define MONO_THREAD_VAR_OFFSET(var,offset) __asm (" ldr %0, 1f; b 2f; 1: .word " #var "(tpoff); 2:" : "=r" (offset)) +#elif defined(TARGET_S390X) +# if defined(__PIC__) +# if !defined(__PIE__) +// This only works if libmono is linked into the application +# define MONO_THREAD_VAR_OFFSET(var,offset) do { guint64 foo; \ + __asm__ ("basr %%r1,0\n\t" \ + "j 0f\n\t" \ + ".quad " #var "@TLSGD\n" \ + "0:\n\t" \ + "lg %%r2,4(%%r1)\n\t" \ + "brasl %%r14,__tls_get_offset@PLT:tls_gdcall:"#var"\n\t" \ + "lgr %0,%%r2\n\t" \ + : "=r" (foo) : \ + : "1", "2", "14", "cc"); \ + offset = foo; } while (0) +# elif __PIE__ == 1 +# define MONO_THREAD_VAR_OFFSET(var,offset) do { guint64 foo; \ + __asm__ ("lg %0," #var "@GOTNTPOFF(%%r12)\n\t" \ + : "=r" (foo)); \ + offset = foo; } while (0) +# elif __PIE__ == 2 +# define MONO_THREAD_VAR_OFFSET(var,offset) do { guint64 foo; \ + __asm__ ("larl %%r1," #var "@INDNTPOFF\n\t" \ + "lg %0,0(%%r1)\n\t" \ + : "=r" (foo) : \ + : "1", "cc"); \ + offset = foo; } while (0) +# endif +# else +# define MONO_THREAD_VAR_OFFSET(var,offset) do { guint64 foo; \ + __asm__ ("basr %%r1,0\n\t" \ + "j 0f\n\t" \ + ".quad " #var "@NTPOFF\n" \ + "0:\n\t" \ + "lg %0,4(%%r1)\n\t" \ + : "=r" (foo) : : "1"); \ + offset = foo; } while (0) +# endif #else #define MONO_THREAD_VAR_OFFSET(var,offset) (offset) = -1 @@ -270,6 +304,7 @@ mono_tls_get_tls_setter (MonoTlsKey key, gboolean name) gpointer mono_tls_get_tls_addr (MonoTlsKey key) { +#ifdef HAVE_GET_TLS_ADDR if (key == TLS_KEY_LMF) { #if defined(USE_KW_THREAD) return &mono_tls_lmf; @@ -277,6 +312,7 @@ mono_tls_get_tls_addr (MonoTlsKey key) return mono_mach_get_tls_address_from_thread (pthread_self (), mono_tls_key_lmf); #endif } +#endif /* Implement if we ever need for other targets/keys */ g_assert_not_reached (); return NULL; diff --git a/mono/utils/mono-tls.h b/mono/utils/mono-tls.h index 8cccc287559..a3751ea6e38 100644 --- a/mono/utils/mono-tls.h +++ b/mono/utils/mono-tls.h @@ -12,6 +12,7 @@ #ifndef __MONO_TLS_H__ #define __MONO_TLS_H__ +#include #include /* TLS entries used by the runtime */ @@ -27,6 +28,17 @@ typedef enum { TLS_KEY_NUM = 6 } MonoTlsKey; +#ifdef HAVE_KW_THREAD +#define USE_KW_THREAD +#endif + +#if defined(USE_KW_THREAD) +#define HAVE_GET_TLS_ADDR +#elif defined(TARGET_MACH) && (defined(TARGET_X86) || defined(TARGET_AMD64)) +/* mono_mach_get_tls_address_from_thread is untested for arm/arm64 */ +#define HAVE_GET_TLS_ADDR +#endif + #ifdef HOST_WIN32 #include diff --git a/msvc/libmono-static.vcxproj b/msvc/libmono-static.vcxproj index 815da6df080..43104889b02 100644 --- a/msvc/libmono-static.vcxproj +++ b/msvc/libmono-static.vcxproj @@ -97,7 +97,6 @@ - true diff --git a/msvc/scripts/order.xml b/msvc/scripts/order.xml index b325a3e54af..48292646522 100644 --- a/msvc/scripts/order.xml +++ b/msvc/scripts/order.xml @@ -1439,7 +1439,7 @@ 4.5 net_4_x - ./../../build/deps/net_4_x_System.Numerics.Vectors.dll.sources + System.Numerics.Vectors.dll.sources false @@ -3610,7 +3610,7 @@ false - /codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll -optimize /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Core.dll + /codepage:65001 /nologo /noconfig /deterministic -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -nowarn:1699 -nostdlib -r:./../../../class/lib/net_4_x/mscorlib.dll /debug:portable -optimize /delaysign /keyfile:../../msfinal.pub /nowarn:1616,1699 -r:./../../../class/lib/net_4_x/System.dll -r:./../../../class/lib/net_4_x/System.Core.dll System.Security.Cryptography.Algorithms.dll ./../../../class/lib/net_4_x/Facades/System.Security.Cryptography.Algorithms.dll diff --git a/packaging/MacSDK/mono.py b/packaging/MacSDK/mono.py index 8b9f6b3a6fc..63bf814d923 100644 --- a/packaging/MacSDK/mono.py +++ b/packaging/MacSDK/mono.py @@ -60,7 +60,7 @@ class MonoMasterPackage(Package): def arch_build(self, arch): if arch == 'darwin-64': # 64-bit build pass self.local_gcc_flags = ['-m64'] - self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0'] + self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0', '--disable-boehm'] if arch == 'darwin-32': # 32-bit build pass self.local_gcc_flags = ['-m32'] diff --git a/runtime/Makefile.am b/runtime/Makefile.am index 5224c91837f..fa969c3c958 100644 --- a/runtime/Makefile.am +++ b/runtime/Makefile.am @@ -48,12 +48,12 @@ if INSTALL_MONOTOUCH_TV build_profiles += monotouch_tv monotouch_tv_runtime endif -if INSTALL_AOT_HYBRID -build_profiles += aot_hybrid +if INSTALL_TESTING_AOT_HYBRID +build_profiles += testing_aot_hybrid endif -if INSTALL_AOT_ONLY -build_profiles += aot_only +if INSTALL_TESTING_AOT_FULL +build_profiles += testing_aot_full endif if INSTALL_XAMMAC @@ -113,20 +113,20 @@ cur_dir_cmd = pwd PLATFORM_PATH_SEPARATOR = : endif -if INSTALL_AOT_ONLY -# ILASM.exe has features which a aot_only runtime will not support. +if INSTALL_TESTING_AOT_FULL +# ILASM.exe has features which a testing_aot_full runtime will not support. # It is invoked with an external mono when used in the runtime. # We skip it here because otherwise it will fail to verify. -AOT_ONLY_FILTER=grep -v ilasm +TESTING_AOT_FULL_FILTER=grep -v ilasm else -AOT_ONLY_FILTER=echo +TESTING_AOT_FULL_FILTER=echo endif # Compile all assemblies with the verifier turned on. Code must be valid but not verifiable. # TODO it would be nice to split assemblies without unsafe code to use the verifier with verifiable mode. # Skip binary_reference_assemblies because they contain metadata only mcs-compileall: mono-wrapper etc/mono/config - export verifiable_files=`ls "$(mcs_topdir)/class/lib/$$profile/" | grep -E '\.(dll|exe)$$' | $(AOT_ONLY_FILTER)` ; \ + export verifiable_files=`ls "$(mcs_topdir)/class/lib/$$profile/" | grep -E '\.(dll|exe)$$' | $(TESTING_AOT_FULL_FILTER)` ; \ save_MONO_PATH=$$MONO_PATH; mcs_topdir=`cd $(mcs_topdir) && $(cur_dir_cmd)`; ok=:; \ for profile in $(test_profiles); do \ if [ "binary_reference_assemblies" = "$$profile" ]; then \ diff --git a/scripts/ci/run-test-aot_hybrid.sh b/scripts/ci/run-test-aot_hybrid.sh deleted file mode 100755 index 272ff9e454c..00000000000 --- a/scripts/ci/run-test-aot_hybrid.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -e - -${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k aotcheck -${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1 -${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test -${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall -${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check -${TESTCMD} --label=System --timeout=10m make -w -C mcs/class/System run-test -${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test -${TESTCMD} --label=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test -${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test -${TESTCMD} --label=System.Web.Services --timeout=5m make -w -C mcs/class/System.Web.Services run-test -${TESTCMD} --label=I18N.CJK --timeout=5m make -w -C mcs/class/I18N/CJK run-test -${TESTCMD} --label=I18N.West --timeout=5m make -w -C mcs/class/I18N/West run-test -${TESTCMD} --label=I18N.MidEast --timeout=5m make -w -C mcs/class/I18N/MidEast run-test -${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test -${TESTCMD} --label=System.Core --timeout=15m make -w -C mcs/class/System.Core run-test -${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml.Linq run-test -${TESTCMD} --label=System.Runtime.Serialization --timeout=5m make -w -C mcs/class/System.Runtime.Serialization run-test -${TESTCMD} --label=System.ServiceModel --timeout=15m make -w -C mcs/class/System.ServiceModel run-test -${TESTCMD} --label=System.ServiceModel.Web --timeout=5m make -w -C mcs/class/System.ServiceModel.Web run-test -${TESTCMD} --label=System.ComponentModel.DataAnnotations --timeout=5m make -w -C mcs/class/System.ComponentModel.DataAnnotations run-test -${TESTCMD} --label=Mono.CSharp --timeout=5m make -w -C mcs/class/Mono.CSharp run-test -${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test -${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test -${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test - -rm -fr /tmp/jenkins-temp-aspnet* diff --git a/scripts/ci/run-test-aot_only.sh b/scripts/ci/run-test-aot_only.sh deleted file mode 100755 index c8b5d79d32b..00000000000 --- a/scripts/ci/run-test-aot_only.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash -e - -if test -n "${MONO_LLVMONLY}"; -then -${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k llvmonlycheck -else -${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k fullaotcheck -fi - -${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1 -${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test -${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall -${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check -${TESTCMD} --label=System --timeout=10m make -w -C mcs/class/System run-test -${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test -${TESTCMD} --label=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test -${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test -${TESTCMD} --label=System.Web.Services --timeout=5m make -w -C mcs/class/System.Web.Services run-test -${TESTCMD} --label=I18N.CJK --timeout=5m make -w -C mcs/class/I18N/CJK run-test -${TESTCMD} --label=I18N.West --timeout=5m make -w -C mcs/class/I18N/West run-test -${TESTCMD} --label=I18N.MidEast --timeout=5m make -w -C mcs/class/I18N/MidEast run-test -${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test -${TESTCMD} --label=System.Core --timeout=15m make -w -C mcs/class/System.Core run-test -${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml.Linq run-test -${TESTCMD} --label=System.Runtime.Serialization --timeout=5m make -w -C mcs/class/System.Runtime.Serialization run-test -${TESTCMD} --label=System.ServiceModel --timeout=15m make -w -C mcs/class/System.ServiceModel run-test -${TESTCMD} --label=System.ServiceModel.Web --timeout=5m make -w -C mcs/class/System.ServiceModel.Web run-test -${TESTCMD} --label=System.ComponentModel.DataAnnotations --timeout=5m make -w -C mcs/class/System.ComponentModel.DataAnnotations run-test -${TESTCMD} --label=Mono.CSharp --timeout=5m make -w -C mcs/class/Mono.CSharp run-test -${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test -${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test -${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test - -rm -fr /tmp/jenkins-temp-aspnet* diff --git a/scripts/ci/run-test-testing_aot_full.sh b/scripts/ci/run-test-testing_aot_full.sh new file mode 100755 index 00000000000..c8b5d79d32b --- /dev/null +++ b/scripts/ci/run-test-testing_aot_full.sh @@ -0,0 +1,34 @@ +#!/bin/bash -e + +if test -n "${MONO_LLVMONLY}"; +then +${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k llvmonlycheck +else +${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k fullaotcheck +fi + +${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1 +${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test +${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall +${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check +${TESTCMD} --label=System --timeout=10m make -w -C mcs/class/System run-test +${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test +${TESTCMD} --label=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test +${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test +${TESTCMD} --label=System.Web.Services --timeout=5m make -w -C mcs/class/System.Web.Services run-test +${TESTCMD} --label=I18N.CJK --timeout=5m make -w -C mcs/class/I18N/CJK run-test +${TESTCMD} --label=I18N.West --timeout=5m make -w -C mcs/class/I18N/West run-test +${TESTCMD} --label=I18N.MidEast --timeout=5m make -w -C mcs/class/I18N/MidEast run-test +${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test +${TESTCMD} --label=System.Core --timeout=15m make -w -C mcs/class/System.Core run-test +${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml.Linq run-test +${TESTCMD} --label=System.Runtime.Serialization --timeout=5m make -w -C mcs/class/System.Runtime.Serialization run-test +${TESTCMD} --label=System.ServiceModel --timeout=15m make -w -C mcs/class/System.ServiceModel run-test +${TESTCMD} --label=System.ServiceModel.Web --timeout=5m make -w -C mcs/class/System.ServiceModel.Web run-test +${TESTCMD} --label=System.ComponentModel.DataAnnotations --timeout=5m make -w -C mcs/class/System.ComponentModel.DataAnnotations run-test +${TESTCMD} --label=Mono.CSharp --timeout=5m make -w -C mcs/class/Mono.CSharp run-test +${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test +${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test +${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test + +rm -fr /tmp/jenkins-temp-aspnet* diff --git a/scripts/ci/run-test-testing_aot_hybrid.sh b/scripts/ci/run-test-testing_aot_hybrid.sh new file mode 100755 index 00000000000..272ff9e454c --- /dev/null +++ b/scripts/ci/run-test-testing_aot_hybrid.sh @@ -0,0 +1,28 @@ +#!/bin/bash -e + +${TESTCMD} --label=mini --timeout=25m make -j 4 -w -C mono/mini -k aotcheck +${TESTCMD} --label=runtime --timeout=160m make -w -C mono/tests -k test-wrench V=1 CI=1 +${TESTCMD} --label=corlib --timeout=30m make -w -C mcs/class/corlib run-test +${TESTCMD} --label=verify --timeout=15m make -w -C runtime mcs-compileall +${TESTCMD} --label=profiler --timeout=30m make -w -C mono/profiler -k check +${TESTCMD} --label=System --timeout=10m make -w -C mcs/class/System run-test +${TESTCMD} --label=System.XML --timeout=5m make -w -C mcs/class/System.XML run-test +${TESTCMD} --label=Mono.Security --timeout=5m make -w -C mcs/class/Mono.Security run-test +${TESTCMD} --label=System.Data --timeout=5m make -w -C mcs/class/System.Data run-test +${TESTCMD} --label=System.Web.Services --timeout=5m make -w -C mcs/class/System.Web.Services run-test +${TESTCMD} --label=I18N.CJK --timeout=5m make -w -C mcs/class/I18N/CJK run-test +${TESTCMD} --label=I18N.West --timeout=5m make -w -C mcs/class/I18N/West run-test +${TESTCMD} --label=I18N.MidEast --timeout=5m make -w -C mcs/class/I18N/MidEast run-test +${TESTCMD} --label=System.Transactions --timeout=5m make -w -C mcs/class/System.Transactions run-test +${TESTCMD} --label=System.Core --timeout=15m make -w -C mcs/class/System.Core run-test +${TESTCMD} --label=System.Xml.Linq --timeout=5m make -w -C mcs/class/System.Xml.Linq run-test +${TESTCMD} --label=System.Runtime.Serialization --timeout=5m make -w -C mcs/class/System.Runtime.Serialization run-test +${TESTCMD} --label=System.ServiceModel --timeout=15m make -w -C mcs/class/System.ServiceModel run-test +${TESTCMD} --label=System.ServiceModel.Web --timeout=5m make -w -C mcs/class/System.ServiceModel.Web run-test +${TESTCMD} --label=System.ComponentModel.DataAnnotations --timeout=5m make -w -C mcs/class/System.ComponentModel.DataAnnotations run-test +${TESTCMD} --label=Mono.CSharp --timeout=5m make -w -C mcs/class/Mono.CSharp run-test +${TESTCMD} --label=System.Numerics --timeout=5m make -w -C mcs/class/System.Numerics run-test +${TESTCMD} --label=System.Net.Http --timeout=5m make -w -C mcs/class/System.Net.Http run-test +${TESTCMD} --label=System.Json --timeout=5m make -w -C mcs/class/System.Json run-test + +rm -fr /tmp/jenkins-temp-aspnet*