# https://help.github.com/articles/about-codeowners
acceptance-tests/* @akoeplinger
-acceptance-tests/profiler-stress @alexrp
+acceptance-tests/profiler-stress* @alexrp
docs/sources/mono-api-profiler.html @alexrp
man/mprof-report.1 @alexrp
mcs/build @marek-safar
mcs/errors @marek-safar
mcs/mcs @marek-safar
mcs/tests @marek-safar
+mcs/class/corlib/System.Reflection*/ @vargaz @lambdageek
+mcs/class/Mono.Debugger.Soft @vargaz
mcs/class/Mono.Options @jonpryor
mcs/class/Mono.Profiler.Log @alexrp
mono/metadata/profiler* @alexrp
check-profiler-stress:
@$(MAKE) validate-benchmarker RESET_VERSIONS=1
- cd profiler-stress && $(MCS) -target:exe $(addprefix -r:, $(SYS_REFS)) -out:runner.exe @runner.exe.sources
+ cd profiler-stress && $(MCS) -debug -define:ARCH_$(arch_target) -target:exe $(addprefix -r:, $(SYS_REFS)) -out:runner.exe @runner.exe.sources
cd profiler-stress && $(RUNTIME) runner.exe
"jit",
};
- static readonly TimeSpan _timeout = TimeSpan.FromHours (10);
+ static readonly TimeSpan _timeout = TimeSpan.FromHours (8);
- static readonly Dictionary<string, Action<TestResult>> _processors = new Dictionary<string, Action<TestResult>> () {
+ static readonly Dictionary<string, Predicate<Benchmark>> _filters = new Dictionary<string, Predicate<Benchmark>> {
+ { "ironjs-v8", FilterArmArchitecture },
+ };
+
+ static readonly Dictionary<string, Action<TestResult>> _processors = new Dictionary<string, Action<TestResult>> {
{ "msbiology", Process32BitOutOfMemory },
};
return Regex.Replace (text, @"[^\x09\x0A\x0D\x20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", string.Empty);
}
+ static bool FilterArmArchitecture (Benchmark benchmark)
+ {
+#if ARCH_arm || ARCH_arm64
+ return false;
+#else
+ return true;
+#endif
+ }
+
static void Process32BitOutOfMemory (TestResult result)
{
if (Environment.Is64BitProcess)
result.ExitCode = 0;
}
+ static bool IsSupported (Benchmark benchmark)
+ {
+ return _filters.TryGetValue (benchmark.Name, out var filter) ? filter (benchmark) : true;
+ }
+
static int Main ()
{
var depDir = Path.Combine ("..", "external", "benchmarker");
var benchmarks = Directory.EnumerateFiles (benchDir, "*.benchmark")
.Select (Benchmark.Load)
- .Where (b => !b.OnlyExplicit && b.ClientCommandLine == null)
+ .Where (b => !b.OnlyExplicit && b.ClientCommandLine == null && IsSupported (b))
.OrderBy (b => b.Name)
.ToArray ();
proc.OutputDataReceived += (sender, args) => {
if (args.Data != null)
- stdout.AppendLine (args.Data);
+ lock (result)
+ stdout.AppendLine (args.Data);
};
proc.ErrorDataReceived += (sender, args) => {
if (args.Data != null)
- stderr.AppendLine (args.Data);
+ lock (result)
+ stderr.AppendLine (args.Data);
};
result.Stopwatch.Start ();
result.Stopwatch.Stop ();
- result.StandardOutput = stdout.ToString ();
- result.StandardError = stderr.ToString ();
+ lock (result) {
+ result.StandardOutput = stdout.ToString ();
+ result.StandardError = stderr.ToString ();
+ }
}
var resultStr = result.ExitCode == null ? "timed out" : $"exited with code: {result.ExitCode}";
echo Done running libgc/autogen.sh ...
fi
-if test -d $srcdir/eglib; then
- echo Running eglib/autogen.sh ...
- (cd $srcdir/eglib ; NOCONFIGURE=1 ./autogen.sh "$@")
- echo Done running eglib/autogen.sh ...
-fi
-
if test x$MONO_EXTRA_CONFIGURE_FLAGS != x; then
echo "MONO_EXTRA_CONFIGURE_FLAGS is $MONO_EXTRA_CONFIGURE_FLAGS"
fi
# This can be reset to 0 when Mono's version number is bumped
# since it's part of the corlib version (the prefix '1' in the full
# version number is to ensure the number isn't treated as octal in C)
-MONO_CORLIB_COUNTER=2
+MONO_CORLIB_COUNTER=3
MONO_CORLIB_VERSION=`printf "1%02d%02d%02d%03d" $MONO_VERSION_MAJOR $MONO_VERSION_MINOR $MONO_VERSION_BUILD $MONO_CORLIB_COUNTER`
AC_DEFINE_UNQUOTED(MONO_CORLIB_VERSION,$MONO_CORLIB_VERSION,[Version of the corlib-runtime interface])
# libgc should inherit the original CFLAGS/CPPFLAGS passed to configure, i.e. -O0
CPPFLAGS_FOR_LIBGC=$CPPFLAGS
CFLAGS_FOR_LIBGC=$CFLAGS
-CPPFLAGS_FOR_EGLIB=$CPPFLAGS
-CFLAGS_FOR_EGLIB=$CFLAGS
CPPFLAGS_FOR_BTLS=$CPPFLAGS
CFLAGS_FOR_BTLS=$CFLAGS
CCASFLAGS="$CCASFLAGS $BROKEN_DARWIN_FLAGS"
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC $BROKEN_DARWIN_CPPFLAGS"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC $BROKEN_DARWIN_FLAGS"
- CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_CPPFLAGS"
- CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
with_sgen_default_concurrent=yes
;;
x*64-*-darwin*)
if test x"$disable_visibility_hidden" = xno; then
# Don't export any symbols by default
SHARED_CFLAGS="-fvisibility=hidden"
- CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB -fvisibility=hidden"
CXXFLAGS="$CXXFLAGS -fvisibility=hidden"
fi
AC_SUBST([WERROR_CFLAGS])
AC_SUBST([SHARED_CFLAGS])
-ac_configure_args="$ac_configure_args \"CPPFLAGS_FOR_EGLIB=$EGLIB_CPPFLAGS\" \"CFLAGS_FOR_EGLIB=$CFLAGS_FOR_EGLIB\""
-AC_CONFIG_SUBDIRS(eglib)
-
GLIB_CFLAGS='-I$(top_srcdir)/eglib/src -I$(top_builddir)/eglib/src'
GLIB_LIBS='-L$(top_builddir)/eglib/src -leglib -lm'
CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DTARGET_IOS"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -DTARGET_IOS"
BTLS_SUPPORTED=no
+ target_ios=yes
])
fi
AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
;;
esac
-
AC_SUBST(libsuffix)
+######################################
+# EGLIB CHECKS
+######################################
+
+GNUC_PRETTY=
+GNUC_UNUSED=
+BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
+if test x$GCC = xyes; then
+ GNUC_UNUSED='__attribute__((__unused__))'
+ GNUC_NORETURN='__attribute__((__noreturn__))'
+ case $host_cpu in
+ i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
+ esac
+fi
+AC_SUBST(GNUC_PRETTY)
+AC_SUBST(GNUC_UNUSED)
+AC_SUBST(GNUC_NORETURN)
+AC_SUBST(BREAKPOINT)
+
+AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
+
+case $host in
+*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
+ PATHSEP='\\'
+ SEARCHSEP=';'
+ OS="WIN32"
+ PIDTYPE='void *'
+ ;;
+*)
+ PATHSEP='/'
+ SEARCHSEP=':'
+ OS="UNIX"
+ PIDTYPE='int'
+ ;;
+esac
+
+case $host in
+ *-*-solaris*)
+ CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
+ ;;
+esac
+
+case $target in
+arm*-darwin*|aarch64*-*)
+ CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
+ ;;
+i*86-*-darwin*)
+ ORDER=G_LITTLE_ENDIAN
+ ;;
+*-*-haiku*)
+ LDFLAGS="$LDFLAGS -ltextencoding"
+ ;;
+*-*-openbsd*)
+ CFLAGS="$CFLAGS -pthread"
+ LDFLAGS="$LDFLAGS -pthread"
+ ;;
+esac
+
+AC_SUBST(ORDER)
+AC_SUBST(CFLAGS)
+AC_SUBST(PATHSEP)
+AC_SUBST(SEARCHSEP)
+AC_SUBST(OS)
+AC_SUBST(PIDTYPE)
+
+# Defined for all targets/platforms using classic Windows API support.
+AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
+AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
+
+AC_CHECK_SIZEOF(int)
+AC_CHECK_SIZEOF(void *)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
+AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf strerror_r)
+AC_CHECK_FUNCS(getrlimit)
+AC_CHECK_FUNCS(fork execv execve)
+
+AC_ARG_WITH([overridable-allocators], [ --with-overridable-allocators allow g_*alloc/g_free to call custom allocators set via g_mem_set_vtable])
+
+if test x$with_overridable_allocators = xyes; then
+ AC_DEFINE(ENABLE_OVERRIDABLE_ALLOCATORS,1,[Overridable allocator support enabled])
+ AC_MSG_NOTICE([Overridable allocator support enabled])
+else
+ AC_MSG_NOTICE([Overridable allocator support disabled])
+fi
+
+#
+# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
+# the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
+# removed once support for 10.6 is dropped.
+#
+# iOS detection of strndup and getpwuid_r is faulty for some reason so let's simply avoid it
+#
+if test x$target_osx = xyes; then
+AC_CHECK_FUNCS(getpwuid_r)
+elif test x$target_ios = xno; then
+AC_CHECK_FUNCS(strndup getpwuid_r)
+fi
+
+AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno || test x$with_overridable_allocators = xyes)
+AM_ICONV()
+AC_SEARCH_LIBS(sqrtf, m)
+
+# nanosleep may not be part of libc, also search it in other libraries
+AC_SEARCH_LIBS(nanosleep, rt)
+
+AC_SEARCH_LIBS(dlopen, dl)
+old_ldflags="${LDFLAGS}"
+LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
+AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
+if test $found_export_dynamic = no; then
+ LDFLAGS="${old_ldflags}"
+fi
+
+AC_MSG_CHECKING(for varargs macros)
+AC_TRY_COMPILE([],[
+int foo (int i, int j);
+#define bar(...) foo (1, __VA_ARGS__)
+void main () {
+ bar (2);
+}
+],have_iso_varargs=yes,have_iso_varargs=no)
+AC_MSG_RESULT($have_iso_varargs)
+G_HAVE_ISO_VARARGS=0
+if test "x$have_iso_varargs" = "xyes"; then
+ G_HAVE_ISO_VARARGS=1
+fi
+AC_SUBST(G_HAVE_ISO_VARARGS)
+
+AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h localcharset.h sys/types.h sys/resource.h)
+AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
+AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
+AC_SUBST(HAVE_ALLOCA_H)
+
+if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
+ GPOINTER_TO_INT="((gint) (ptr))"
+ GPOINTER_TO_UINT="((guint) (ptr))"
+ GINT_TO_POINTER="((gpointer) (v))"
+ GUINT_TO_POINTER="((gpointer) (v))"
+ GSIZE="int"
+ GSIZE_FORMAT='"u"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
+ GPOINTER_TO_INT="((gint)(long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(glong) (v))"
+ GUINT_TO_POINTER="((gpointer)(gulong) (v))"
+ GSIZE="long"
+ GSIZE_FORMAT='"lu"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
+ GPOINTER_TO_INT="((gint)(long long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(long long) (v))"
+ GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
+ GSIZE="long long"
+ GSIZE_FORMAT='"I64u"'
+else
+ AC_MSG_ERROR([unsupported pointer size])
+fi
+
+AC_SUBST(GPOINTER_TO_INT)
+AC_SUBST(GPOINTER_TO_UINT)
+AC_SUBST(GINT_TO_POINTER)
+AC_SUBST(GUINT_TO_POINTER)
+AC_SUBST(GSIZE)
+AC_SUBST(GSIZE_FORMAT)
+AC_SUBST(G_GUINT64_FORMAT)
+AC_SUBST(G_GINT64_FORMAT)
+AC_SUBST(G_GUINT32_FORMAT)
+AC_SUBST(G_GINT32_FORMAT)
+
+#
+# END OF EGLIB CHECKS
+#
+
AC_ARG_WITH([libgdiplus],
[ --with-libgdiplus=installed|sibling|<path> Override the libgdiplus used for System.Drawing tests (defaults to installed)],
[], [with_libgdiplus=installed])
mono_runtime=mono/mini/mono
AC_SUBST(mono_runtime)
-CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.2.3.0/tools/csc.exe
+CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/Microsoft.Net.Compilers.2.3.1/tools/csc.exe
if test $csc_compiler = mcs; then
CSC=$mcs_topdir/class/lib/build/mcs.exe
mono/benchmark/Makefile
mono/mini/Makefile
mono/profiler/Makefile
+eglib/Makefile
+eglib/src/Makefile
+eglib/src/eglib-config.h
m4/Makefile
ikvm-native/Makefile
scripts/Makefile
-ACLOCAL_AMFLAGS = -I m4
-
AM_CFLAGS = $(WERROR_CFLAGS)
-if HOST_WIN32
-SUBDIRS = m4 src
-else
-if PLATFORM_DARWIN
-SUBDIRS = m4 src
-else
-if CROSS_COMPILING
-SUBDIRS = m4 src
-else
-SUBDIRS = m4 src test
-endif
-endif
-endif
+SUBDIRS = src
-EXTRA_DIST = autogen.sh README NEWS AUTHORS winconfig.h
+EXTRA_DIST = README NEWS AUTHORS winconfig.h
+++ /dev/null
-dnl dolt, a replacement for libtool
-dnl Copyright © 2007-2008 Josh Triplett <josh@freedesktop.org>
-dnl Copying and distribution of this file, with or without modification,
-dnl are permitted in any medium without royalty provided the copyright
-dnl notice and this notice are preserved.
-dnl
-dnl To use dolt, invoke the DOLT macro immediately after the libtool macros.
-dnl Optionally, copy this file into acinclude.m4, to avoid the need to have it
-dnl installed when running autoconf on your project.
-
-AC_DEFUN([DOLT], [
-AC_REQUIRE([AC_CANONICAL_HOST])
-# dolt, a replacement for libtool
-# Josh Triplett <josh@freedesktop.org>
-AC_PATH_PROG(DOLT_BASH, bash)
-AC_MSG_CHECKING([if dolt supports this host])
-dolt_supported=yes
-if test x$DOLT_BASH = x; then
- dolt_supported=no
-fi
-if test x$GCC != xyes; then
- dolt_supported=no
-fi
-case $host in
-i?86-*-linux*|i?86-apple-darwin*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
-|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*|aarch64*)
- pic_options='-fPIC'
- ;;
-?86-pc-cygwin*|i?86-pc-cygwin*|i?86-pc-mingw32*)
- pic_options='-DDLL_EXPORT'
- ;;
-i?86-apple-darwin*|arm-apple-darwin*)
- pic_options='-fno-common'
- ;;
-*)
- dolt_supported=no
- ;;
-esac
-if test x$dolt_supported = xno ; then
- AC_MSG_RESULT([no, falling back to libtool])
- LTCOMPILE='$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(COMPILE)'
- LTCXXCOMPILE='$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXXCOMPILE)'
-else
- AC_MSG_RESULT([yes, replacing libtool])
-
-dnl Start writing out doltcompile.
- cat <<__DOLTCOMPILE__EOF__ >doltcompile
-#!$DOLT_BASH
-__DOLTCOMPILE__EOF__
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-args=("$[]@")
-for ((arg=0; arg<${#args@<:@@@:>@}; arg++)) ; do
- if test x"${args@<:@$arg@:>@}" = x-o ; then
- objarg=$((arg+1))
- break
- fi
-done
-if test x$objarg = x ; then
- echo 'Error: no -o on compiler command line' 1>&2
- exit 1
-fi
-lo="${args@<:@$objarg@:>@}"
-obj="${lo%.lo}"
-if test x"$lo" = x"$obj" ; then
- echo "Error: libtool object file name \"$lo\" does not end in .lo" 1>&2
- exit 1
-fi
-objbase="${obj##*/}"
-__DOLTCOMPILE__EOF__
-
-dnl Write out shared compilation code.
- if test x$enable_shared = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-libobjdir="${obj%$objbase}.libs"
-if test ! -d "$libobjdir" ; then
- mkdir_out="$(mkdir "$libobjdir" 2>&1)"
- mkdir_ret=$?
- if test "$mkdir_ret" -ne 0 && test ! -d "$libobjdir" ; then
- echo "$mkdir_out" 1>&2
- exit $mkdir_ret
- fi
-fi
-pic_object="$libobjdir/$objbase.o"
-args@<:@$objarg@:>@="$pic_object"
-__DOLTCOMPILE__EOF__
- cat <<__DOLTCOMPILE__EOF__ >>doltcompile
-"\${args@<:@@@:>@}" $pic_options -DPIC || exit \$?
-__DOLTCOMPILE__EOF__
- fi
-
-dnl Write out static compilation code.
-dnl Avoid duplicate compiler output if also building shared objects.
- if test x$enable_static = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-non_pic_object="$obj.o"
-args@<:@$objarg@:>@="$non_pic_object"
-__DOLTCOMPILE__EOF__
- if test x$enable_shared = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-"${args@<:@@@:>@}" >/dev/null 2>&1 || exit $?
-__DOLTCOMPILE__EOF__
- else
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-"${args@<:@@@:>@}" || exit $?
-__DOLTCOMPILE__EOF__
- fi
- fi
-
-dnl Write out the code to write the .lo file.
-dnl The second line of the .lo file must match "^# Generated by .*libtool"
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-{
-echo "# $lo - a libtool object file"
-echo "# Generated by doltcompile, not libtool"
-__DOLTCOMPILE__EOF__
-
- if test x$enable_shared = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-echo "pic_object='.libs/${objbase}.o'"
-__DOLTCOMPILE__EOF__
- else
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-echo pic_object=none
-__DOLTCOMPILE__EOF__
- fi
-
- if test x$enable_static = xyes; then
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-echo "non_pic_object='${objbase}.o'"
-__DOLTCOMPILE__EOF__
- else
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-echo non_pic_object=none
-__DOLTCOMPILE__EOF__
- fi
-
- cat <<'__DOLTCOMPILE__EOF__' >>doltcompile
-} > "$lo"
-__DOLTCOMPILE__EOF__
-
-dnl Done writing out doltcompile; substitute it for libtool compilation.
- chmod +x doltcompile
- LTCOMPILE='$(top_builddir)/doltcompile $(COMPILE)'
- LTCXXCOMPILE='$(top_builddir)/doltcompile $(CXXCOMPILE)'
-
-dnl automake ignores LTCOMPILE and LTCXXCOMPILE when it has separate CFLAGS for
-dnl a target, so write out a libtool wrapper to handle that case.
-dnl Note that doltlibtool does not handle inferred tags or option arguments
-dnl without '=', because automake does not use them.
- cat <<__DOLTLIBTOOL__EOF__ > doltlibtool
-#!$DOLT_BASH
-__DOLTLIBTOOL__EOF__
- cat <<'__DOLTLIBTOOL__EOF__' >>doltlibtool
-top_builddir_slash="${0%%doltlibtool}"
-: ${top_builddir_slash:=./}
-args=()
-modeok=false
-tagok=false
-for arg in "$[]@"; do
- case "$arg" in
- --silent) ;;
- --mode=compile) modeok=true ;;
- --tag=CC|--tag=CXX) tagok=true ;;
- --quiet) ;;
- *) args@<:@${#args[@]}@:>@="$arg" ;;
- esac
-done
-if $modeok && $tagok ; then
- . ${top_builddir_slash}doltcompile "${args@<:@@@:>@}"
-else
- exec ${top_builddir_slash}libtool "$[]@"
-fi
-__DOLTLIBTOOL__EOF__
-
-dnl Done writing out doltlibtool; substitute it for libtool.
- chmod +x doltlibtool
- LIBTOOL='$(top_builddir)/doltlibtool'
-fi
-AC_SUBST(LTCOMPILE)
-AC_SUBST(LTCXXCOMPILE)
-# end dolt
-])
+++ /dev/null
-#!/bin/sh
-# Run this to generate all the initial makefiles, etc.
-# Ripped off from GNOME macros version
-
-DIE=0
-
-srcdir=`dirname $0`
-test -z "$srcdir" && srcdir=.
-
-if [ -n "$MONO_PATH" ]; then
- # from -> /mono/lib:/another/mono/lib
- # to -> /mono /another/mono
- for i in `echo ${MONO_PATH} | tr ":" " "`; do
- i=`dirname ${i}`
- if [ -n "{i}" -a -d "${i}/share/aclocal" ]; then
- ACLOCAL_FLAGS="-I ${i}/share/aclocal $ACLOCAL_FLAGS"
- fi
- if [ -n "{i}" -a -d "${i}/bin" ]; then
- PATH="${i}/bin:$PATH"
- fi
- done
- export PATH
-fi
-
-(autoconf --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`autoconf' installed to compile Mono."
- echo "Download the appropriate package for your distribution,"
- echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
- DIE=1
-}
-
-if [ -z "$LIBTOOLIZE" ]; then
- LIBTOOLIZE=`which glibtoolize 2>/dev/null`
- if [ ! -x "$LIBTOOLIZE" ]; then
- LIBTOOLIZE=`which libtoolize`
- fi
-fi
-
-(grep "^AM_PROG_LIBTOOL" $srcdir/configure.ac >/dev/null) && {
- ($LIBTOOLIZE --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`libtoolize' installed to compile Mono."
- echo "Get ftp://ftp.gnu.org/gnu/libtool/libtool-1.2.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- }
-}
-
-grep "^AM_GNU_GETTEXT" $srcdir/configure.ac >/dev/null && {
- grep "sed.*POTFILES" $srcdir/configure.ac >/dev/null || \
- (gettext --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`gettext' installed to compile Mono."
- echo "Get ftp://alpha.gnu.org/gnu/gettext-0.10.35.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- }
-}
-
-(automake --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: You must have \`automake' installed to compile Mono."
- echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
- NO_AUTOMAKE=yes
-}
-
-
-# if no automake, don't bother testing for aclocal
-test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || {
- echo
- echo "**Error**: Missing \`aclocal'. The version of \`automake'"
- echo "installed doesn't appear recent enough."
- echo "Get ftp://ftp.gnu.org/pub/gnu/automake-1.3.tar.gz"
- echo "(or a newer version if it is available)"
- DIE=1
-}
-
-if test "$DIE" -eq 1; then
- exit 1
-fi
-
-if test x$NOCONFIGURE = x && test -z "$*"; then
- echo "**Warning**: I am going to run \`configure' with no arguments."
- echo "If you wish to pass any to it, please specify them on the"
- echo \`$0\'" command line."
- echo
-fi
-
-case $CC in
-xlc )
- am_opt=--include-deps;;
-esac
-
-
-if grep "^AM_PROG_LIBTOOL" configure.ac >/dev/null; then
- if test -z "$NO_LIBTOOLIZE" ; then
- echo "Running libtoolize..."
- $LIBTOOLIZE --force --copy
- fi
-fi
-
-echo "Running aclocal -I m4 $ACLOCAL_FLAGS ..."
-aclocal -I m4 $ACLOCAL_FLAGS || {
- echo
- echo "**Error**: aclocal failed. This may mean that you have not"
- echo "installed all of the packages you need, or you may need to"
- echo "set ACLOCAL_FLAGS to include \"-I \$prefix/share/aclocal\""
- echo "for the prefix where you installed the packages whose"
- echo "macros were not found"
- exit 1
-}
-
-if grep "^AC_CONFIG_HEADERS" configure.ac >/dev/null; then
- echo "Running autoheader..."
- autoheader || { echo "**Error**: autoheader failed."; exit 1; }
-fi
-
-echo "Running automake --gnu $am_opt ..."
-automake --add-missing --gnu $am_opt ||
- { echo "**Error**: automake failed."; exit 1; }
-echo "Running autoconf ..."
-autoconf || { echo "**Error**: autoconf failed."; exit 1; }
-
-
-conf_flags="--enable-maintainer-mode" #--enable-compile-warnings --enable-iso-c
-
-if test x$NOCONFIGURE = x; then
- echo Running $srcdir/configure $conf_flags "$@" ...
- $srcdir/configure $conf_flags "$@" \
- && echo Now type \`make\' to compile $PKG_NAME || exit 1
-else
- echo Skipping configure process.
-fi
+++ /dev/null
-#! /bin/sh
-# Output a system dependent set of variables, describing how to set the
-# run time search path of shared libraries in an executable.
-#
-# Copyright 1996-2010 Free Software Foundation, Inc.
-# Taken from GNU libtool, 2001
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-#
-# The first argument passed to this file is the canonical host specification,
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
-# should be set by the caller.
-#
-# The set of defined variables is at the end of this script.
-
-# Known limitations:
-# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
-# than 256 bytes, otherwise the compiler driver will dump core. The only
-# known workaround is to choose shorter directory names for the build
-# directory and/or the installation directory.
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-shrext=.so
-
-host="$1"
-host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
-host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
-host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
-
-# Code taken from libtool.m4's _LT_CC_BASENAME.
-
-for cc_temp in $CC""; do
- case $cc_temp in
- compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
- distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
- \-*) ;;
- *) break;;
- esac
-done
-cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
-
-# Code taken from libtool.m4's _LT_COMPILER_PIC.
-
-wl=
-if test "$GCC" = yes; then
- wl='-Wl,'
-else
- case "$host_os" in
- aix*)
- wl='-Wl,'
- ;;
- darwin*)
- case $cc_basename in
- xlc*)
- wl='-Wl,'
- ;;
- esac
- ;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
- ;;
- hpux9* | hpux10* | hpux11*)
- wl='-Wl,'
- ;;
- irix5* | irix6* | nonstopux*)
- wl='-Wl,'
- ;;
- newsos6)
- ;;
- linux* | k*bsd*-gnu)
- case $cc_basename in
- ecc*)
- wl='-Wl,'
- ;;
- icc* | ifort*)
- wl='-Wl,'
- ;;
- lf95*)
- wl='-Wl,'
- ;;
- pgcc | pgf77 | pgf90)
- wl='-Wl,'
- ;;
- ccc*)
- wl='-Wl,'
- ;;
- como)
- wl='-lopt='
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- wl='-Wl,'
- ;;
- esac
- ;;
- esac
- ;;
- osf3* | osf4* | osf5*)
- wl='-Wl,'
- ;;
- rdos*)
- ;;
- solaris*)
- wl='-Wl,'
- ;;
- sunos4*)
- wl='-Qoption ld '
- ;;
- sysv4 | sysv4.2uw2* | sysv4.3*)
- wl='-Wl,'
- ;;
- sysv4*MP*)
- ;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- wl='-Wl,'
- ;;
- unicos*)
- wl='-Wl,'
- ;;
- uts4*)
- ;;
- esac
-fi
-
-# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
-
-hardcode_libdir_flag_spec=
-hardcode_libdir_separator=
-hardcode_direct=no
-hardcode_minus_L=no
-
-case "$host_os" in
- cygwin* | mingw* | pw32* | cegcc*)
- # FIXME: the MSVC++ port hasn't been tested in a loooong time
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- if test "$GCC" != yes; then
- with_gnu_ld=no
- fi
- ;;
- interix*)
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
- openbsd*)
- with_gnu_ld=no
- ;;
-esac
-
-ld_shlibs=yes
-if test "$with_gnu_ld" = yes; then
- # Set some defaults for GNU ld with shared library support. These
- # are reset later if shared libraries are not supported. Putting them
- # here allows them to be overridden if necessary.
- # Unlike libtool, we use -rpath here, not --rpath, since the documented
- # option of GNU ld is called -rpath, not --rpath.
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- case "$host_os" in
- aix[3-9]*)
- # On AIX/PPC, the GNU linker is very broken
- if test "$host_cpu" != ia64; then
- ld_shlibs=no
- fi
- ;;
- amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
- # that the semantics of dynamic libraries on AmigaOS, at least up
- # to version 4, is to share data among multiple programs linked
- # with the same dynamic library. Since this doesn't match the
- # behavior of shared libraries on other platforms, we cannot use
- # them.
- ld_shlibs=no
- ;;
- beos*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- cygwin* | mingw* | pw32* | cegcc*)
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- hardcode_libdir_flag_spec='-L$libdir'
- if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- interix[3-9]*)
- hardcode_direct=no
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- ;;
- gnu* | linux* | k*bsd*-gnu)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- netbsd*)
- ;;
- solaris*)
- if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
- ld_shlibs=no
- elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
- case `$LD -v 2>&1` in
- *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
- ld_shlibs=no
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
- else
- ld_shlibs=no
- fi
- ;;
- esac
- ;;
- sunos4*)
- hardcode_direct=yes
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- :
- else
- ld_shlibs=no
- fi
- ;;
- esac
- if test "$ld_shlibs" = no; then
- hardcode_libdir_flag_spec=
- fi
-else
- case "$host_os" in
- aix3*)
- # Note: this linker hardcodes the directories in LIBPATH if there
- # are no directories specified by -L.
- hardcode_minus_L=yes
- if test "$GCC" = yes; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- hardcode_direct=unsupported
- fi
- ;;
- aix[4-9]*)
- if test "$host_cpu" = ia64; then
- # On IA64, the linker does run time linking by default, so we don't
- # have to do anything special.
- aix_use_runtimelinking=no
- else
- aix_use_runtimelinking=no
- # Test if we are trying to use run time linking or normal
- # AIX style linking. If -brtl is somewhere in LDFLAGS, we
- # need to do runtime linking.
- case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
- for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
- done
- ;;
- esac
- fi
- hardcode_direct=yes
- hardcode_libdir_separator=':'
- if test "$GCC" = yes; then
- case $host_os in aix4.[012]|aix4.[012].*)
- collect2name=`${CC} -print-prog-name=collect2`
- if test -f "$collect2name" && \
- strings "$collect2name" | grep resolve_lib_name >/dev/null
- then
- # We have reworked collect2
- :
- else
- # We have old collect2
- hardcode_direct=unsupported
- hardcode_minus_L=yes
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_libdir_separator=
- fi
- ;;
- esac
- fi
- # Begin _LT_AC_SYS_LIBPATH_AIX.
- echo 'int main () { return 0; }' > conftest.c
- ${CC} ${LDFLAGS} conftest.c -o conftest
- aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
-}'`
- if test -z "$aix_libpath"; then
- aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
-}'`
- fi
- if test -z "$aix_libpath"; then
- aix_libpath="/usr/lib:/lib"
- fi
- rm -f conftest.c conftest
- # End _LT_AC_SYS_LIBPATH_AIX.
- if test "$aix_use_runtimelinking" = yes; then
- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- else
- if test "$host_cpu" = ia64; then
- hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
- else
- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- fi
- fi
- ;;
- amigaos*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- # see comment about different semantics on the GNU ld section
- ld_shlibs=no
- ;;
- bsdi[45]*)
- ;;
- cygwin* | mingw* | pw32* | cegcc*)
- # When not using gcc, we currently assume that we are using
- # Microsoft Visual C++.
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- hardcode_libdir_flag_spec=' '
- libext=lib
- ;;
- darwin* | rhapsody*)
- hardcode_direct=no
- if test "$GCC" = yes ; then
- :
- else
- case $cc_basename in
- xlc*)
- ;;
- *)
- ld_shlibs=no
- ;;
- esac
- fi
- ;;
- dgux*)
- hardcode_libdir_flag_spec='-L$libdir'
- ;;
- freebsd1*)
- ld_shlibs=no
- ;;
- freebsd2.2*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- freebsd2*)
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
- freebsd* | dragonfly*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- hpux9*)
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator=:
- hardcode_direct=yes
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- hardcode_minus_L=yes
- ;;
- hpux10*)
- if test "$with_gnu_ld" = no; then
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator=:
- hardcode_direct=yes
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- hardcode_minus_L=yes
- fi
- ;;
- hpux11*)
- if test "$with_gnu_ld" = no; then
- hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator=:
- case $host_cpu in
- hppa*64*|ia64*)
- hardcode_direct=no
- ;;
- *)
- hardcode_direct=yes
- # hardcode_minus_L: Not really in the search PATH,
- # but as the default location of the library.
- hardcode_minus_L=yes
- ;;
- esac
- fi
- ;;
- irix5* | irix6* | nonstopux*)
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
- netbsd*)
- hardcode_libdir_flag_spec='-R$libdir'
- hardcode_direct=yes
- ;;
- newsos6)
- hardcode_direct=yes
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
- openbsd*)
- if test -f /usr/libexec/ld.so; then
- hardcode_direct=yes
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- else
- case "$host_os" in
- openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
- hardcode_libdir_flag_spec='-R$libdir'
- ;;
- *)
- hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
- ;;
- esac
- fi
- else
- ld_shlibs=no
- fi
- ;;
- os2*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_minus_L=yes
- ;;
- osf3*)
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator=:
- ;;
- osf4* | osf5*)
- if test "$GCC" = yes; then
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- else
- # Both cc and cxx compiler support -rpath directly
- hardcode_libdir_flag_spec='-rpath $libdir'
- fi
- hardcode_libdir_separator=:
- ;;
- solaris*)
- hardcode_libdir_flag_spec='-R$libdir'
- ;;
- sunos4*)
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_direct=yes
- hardcode_minus_L=yes
- ;;
- sysv4)
- case $host_vendor in
- sni)
- hardcode_direct=yes # is this really true???
- ;;
- siemens)
- hardcode_direct=no
- ;;
- motorola)
- hardcode_direct=no #Motorola manual says yes, but my tests say they lie
- ;;
- esac
- ;;
- sysv4.3*)
- ;;
- sysv4*MP*)
- if test -d /usr/nec; then
- ld_shlibs=yes
- fi
- ;;
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
- ;;
- sysv5* | sco3.2v5* | sco5v6*)
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- hardcode_libdir_separator=':'
- ;;
- uts4*)
- hardcode_libdir_flag_spec='-L$libdir'
- ;;
- *)
- ld_shlibs=no
- ;;
- esac
-fi
-
-# Check dynamic linker characteristics
-# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
-# Unlike libtool.m4, here we don't care about _all_ names of the library, but
-# only about the one the linker finds when passed -lNAME. This is the last
-# element of library_names_spec in libtool.m4, or possibly two of them if the
-# linker has special search rules.
-library_names_spec= # the last element of library_names_spec in libtool.m4
-libname_spec='lib$name'
-case "$host_os" in
- aix3*)
- library_names_spec='$libname.a'
- ;;
- aix[4-9]*)
- library_names_spec='$libname$shrext'
- ;;
- amigaos*)
- library_names_spec='$libname.a'
- ;;
- beos*)
- library_names_spec='$libname$shrext'
- ;;
- bsdi[45]*)
- library_names_spec='$libname$shrext'
- ;;
- cygwin* | mingw* | pw32* | cegcc*)
- shrext=.dll
- library_names_spec='$libname.dll.a $libname.lib'
- ;;
- darwin* | rhapsody*)
- shrext=.dylib
- library_names_spec='$libname$shrext'
- ;;
- dgux*)
- library_names_spec='$libname$shrext'
- ;;
- freebsd1*)
- ;;
- freebsd* | dragonfly*)
- case "$host_os" in
- freebsd[123]*)
- library_names_spec='$libname$shrext$versuffix' ;;
- *)
- library_names_spec='$libname$shrext' ;;
- esac
- ;;
- gnu*)
- library_names_spec='$libname$shrext'
- ;;
- hpux9* | hpux10* | hpux11*)
- case $host_cpu in
- ia64*)
- shrext=.so
- ;;
- hppa*64*)
- shrext=.sl
- ;;
- *)
- shrext=.sl
- ;;
- esac
- library_names_spec='$libname$shrext'
- ;;
- interix[3-9]*)
- library_names_spec='$libname$shrext'
- ;;
- irix5* | irix6* | nonstopux*)
- library_names_spec='$libname$shrext'
- case "$host_os" in
- irix5* | nonstopux*)
- libsuff= shlibsuff=
- ;;
- *)
- case $LD in
- *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
- *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
- *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
- *) libsuff= shlibsuff= ;;
- esac
- ;;
- esac
- ;;
- linux*oldld* | linux*aout* | linux*coff*)
- ;;
- linux* | k*bsd*-gnu)
- library_names_spec='$libname$shrext'
- ;;
- knetbsd*-gnu)
- library_names_spec='$libname$shrext'
- ;;
- netbsd*)
- library_names_spec='$libname$shrext'
- ;;
- newsos6)
- library_names_spec='$libname$shrext'
- ;;
- nto-qnx*)
- library_names_spec='$libname$shrext'
- ;;
- openbsd*)
- library_names_spec='$libname$shrext$versuffix'
- ;;
- os2*)
- libname_spec='$name'
- shrext=.dll
- library_names_spec='$libname.a'
- ;;
- osf3* | osf4* | osf5*)
- library_names_spec='$libname$shrext'
- ;;
- rdos*)
- ;;
- solaris*)
- library_names_spec='$libname$shrext'
- ;;
- sunos4*)
- library_names_spec='$libname$shrext$versuffix'
- ;;
- sysv4 | sysv4.3*)
- library_names_spec='$libname$shrext'
- ;;
- sysv4*MP*)
- library_names_spec='$libname$shrext'
- ;;
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- library_names_spec='$libname$shrext'
- ;;
- uts4*)
- library_names_spec='$libname$shrext'
- ;;
-esac
-
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
-shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
-escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
-
-LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
-
-# How to pass a linker flag through the compiler.
-wl="$escaped_wl"
-
-# Static library suffix (normally "a").
-libext="$libext"
-
-# Shared library suffix (normally "so").
-shlibext="$shlibext"
-
-# Format of library name prefix.
-libname_spec="$escaped_libname_spec"
-
-# Library names that the linker finds when passed -lNAME.
-library_names_spec="$escaped_library_names_spec"
-
-# Flag to hardcode \$libdir into a binary during linking.
-# This must work even if \$libdir does not exist.
-hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator="$hardcode_libdir_separator"
-
-# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct="$hardcode_direct"
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L="$hardcode_minus_L"
-
-EOF
+++ /dev/null
-#
-# Copyright 2012 Xamarin Inc
-#
-AC_INIT(eglib, [0.3],
- [http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
-
-AC_CONFIG_SRCDIR([README])
-AC_CONFIG_MACRO_DIR([m4])
-AC_CANONICAL_SYSTEM
-AC_CANONICAL_HOST
-
-AM_INIT_AUTOMAKE([1.9 dist-bzip2 tar-ustar no-dist-gzip foreign])
-AC_CONFIG_HEADERS([config.h])
-AM_MAINTAINER_MODE
-
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
-AC_PROG_CC
-AM_PROG_LIBTOOL
-# Use dolt (http://dolt.freedesktop.org/) instead of libtool for building.
-DOLT
-GNUC_PRETTY=
-GNUC_UNUSED=
-BREAKPOINT="G_STMT_START { raise (SIGTRAP); } G_STMT_END"
-if test x$GCC = xyes; then
- GNUC_UNUSED='__attribute__((__unused__))'
- GNUC_NORETURN='__attribute__((__noreturn__))'
- case $host_cpu in
- i*86|x86_64) BREAKPOINT="G_STMT_START { __asm__ (\"int \$03\"); } G_STMT_END" ;;
- esac
-fi
-AC_SUBST(GNUC_PRETTY)
-AC_SUBST(GNUC_UNUSED)
-AC_SUBST(GNUC_NORETURN)
-AC_SUBST(BREAKPOINT)
-
-# We use a separate variable to pass down CPPFLAGS and CFLAGS from the main mono
-# configure, because of autoconf brokeness
-if test "x$CPPFLAGS_FOR_EGLIB" != "x"; then
- CPPFLAGS=$CPPFLAGS_FOR_EGLIB
-fi
-if test "x$CFLAGS_FOR_EGLIB" != "x"; then
- CFLAGS=$CFLAGS_FOR_EGLIB
-fi
-
-CFLAGS="$CFLAGS -g -D_GNU_SOURCE"
-
-AM_CONDITIONAL(CROSS_COMPILING, [test x$cross_compiling = xyes])
-AC_C_BIGENDIAN([ORDER=G_BIG_ENDIAN],[ORDER=G_LITTLE_ENDIAN])
-
-platform_darwin=no
-platform_android=no
-
-case $host in
-*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
- PATHSEP='\\'
- SEARCHSEP=';'
- OS="WIN32"
- PIDTYPE='void *'
- ;;
-*-*darwin*)
- platform_darwin=yes
- PATHSEP='/'
- SEARCHSEP=':'
- OS="UNIX"
- PIDTYPE='int'
- ;;
-*-*-linux-android*)
- platform_android=yes
- AC_DEFINE(PLATFORM_ANDROID,1,[Targeting the Android platform])
- PATHSEP='/'
- SEARCHSEP=':'
- OS="UNIX"
- PIDTYPE='int'
- ;;
-*)
- PATHSEP='/'
- SEARCHSEP=':'
- OS="UNIX"
- PIDTYPE='int'
- ;;
-esac
-
-case $host in
- *-*-solaris*)
- CFLAGS="$CFLAGS -D_POSIX_PTHREAD_SEMANTICS"
- ;;
-esac
-
-case $target in
-arm*-darwin*|aarch64*-*)
- CFLAGS="$CFLAGS -U_FORTIFY_SOURCE"
- ;;
-i*86-*-darwin*)
- ORDER=G_LITTLE_ENDIAN
- ;;
-*-*-haiku*)
- LDFLAGS="$LDFLAGS -ltextencoding"
- ;;
-*-*-openbsd*)
- CFLAGS="$CFLAGS -pthread"
- LDFLAGS="$LDFLAGS -pthread"
- ;;
-esac
-
-target_osx=no
-target_ios=no
-
-if test "x$platform_darwin" = "xyes"; then
- AC_TRY_COMPILE([#include "TargetConditionals.h"],[
- #if TARGET_IPHONE_SIMULATOR == 1 || TARGET_OS_IPHONE == 1
- #error fail this for ios
- #endif
- return 0;
- ], [
- AC_DEFINE(TARGET_OSX,1,[The JIT/AOT targets OSX])
- target_osx=yes
- ], [
- AC_DEFINE(TARGET_IOS,1,[The JIT/AOT targets iOS])
- target_ios=yes
- ])
- AC_DEFINE(TARGET_MACH,1,[The JIT/AOT targets Apple platforms])
-fi
-
-AC_SUBST(ORDER)
-AC_SUBST(CFLAGS)
-AC_SUBST(PATHSEP)
-AC_SUBST(SEARCHSEP)
-AC_SUBST(OS)
-AC_SUBST(PIDTYPE)
-AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
-AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
-AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
-AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
-
-# Defined for all targets/platforms using classic Windows API support.
-AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
-AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
-
-AC_CHECK_SIZEOF(int)
-AC_CHECK_SIZEOF(void *)
-AC_CHECK_SIZEOF(long)
-AC_CHECK_SIZEOF(long long)
-AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf strerror_r)
-AC_CHECK_FUNCS(getrlimit)
-AC_CHECK_FUNCS(fork execv execve)
-
-AC_ARG_WITH([overridable-allocators], [ --with-overridable-allocators allow g_*alloc/g_free to call custom allocators set via g_mem_set_vtable])
-
-if test x$with_overridable_allocators = xyes; then
- AC_DEFINE(ENABLE_OVERRIDABLE_ALLOCATORS,1,[Overridable allocator support enabled])
- AC_MSG_NOTICE([Overridable allocator support enabled])
-else
- AC_MSG_NOTICE([Overridable allocator support disabled])
-fi
-
-#
-# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
-# the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
-# removed once support for 10.6 is dropped.
-#
-# iOS detection of strndup and getpwuid_r is faulty for some reason so let's simply avoid it
-#
-if test x$target_osx = xyes; then
-AC_CHECK_FUNCS(getpwuid_r)
-elif test x$target_ios = xno; then
-AC_CHECK_FUNCS(strndup getpwuid_r)
-fi
-
-AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno || test x$with_overridable_allocators = xyes)
-AM_ICONV()
-AC_SEARCH_LIBS(sqrtf, m)
-
-# nanosleep may not be part of libc, also search it in other libraries
-AC_SEARCH_LIBS(nanosleep, rt)
-
-AC_SEARCH_LIBS(dlopen, dl)
-old_ldflags="${LDFLAGS}"
-LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
-AC_TRY_LINK(, [int i;], found_export_dynamic=yes, found_export_dynamic=no)
-if test $found_export_dynamic = no; then
- LDFLAGS="${old_ldflags}"
-fi
-
-AC_MSG_CHECKING(for varargs macros)
-AC_TRY_COMPILE([],[
-int foo (int i, int j);
-#define bar(...) foo (1, __VA_ARGS__)
-void main () {
- bar (2);
-}
-],have_iso_varargs=yes,have_iso_varargs=no)
-AC_MSG_RESULT($have_iso_varargs)
-G_HAVE_ISO_VARARGS=0
-if test "x$have_iso_varargs" = "xyes"; then
- G_HAVE_ISO_VARARGS=1
-fi
-AC_SUBST(G_HAVE_ISO_VARARGS)
-
-AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h localcharset.h sys/types.h sys/resource.h)
-AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
-AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
-AC_SUBST(HAVE_ALLOCA_H)
-
-if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
- GPOINTER_TO_INT="((gint) (ptr))"
- GPOINTER_TO_UINT="((guint) (ptr))"
- GINT_TO_POINTER="((gpointer) (v))"
- GUINT_TO_POINTER="((gpointer) (v))"
- GSIZE="int"
- GSIZE_FORMAT='"u"'
-elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
- GPOINTER_TO_INT="((gint)(long) (ptr))"
- GPOINTER_TO_UINT="((guint)(long) (ptr))"
- GINT_TO_POINTER="((gpointer)(glong) (v))"
- GUINT_TO_POINTER="((gpointer)(gulong) (v))"
- GSIZE="long"
- GSIZE_FORMAT='"lu"'
-elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
- GPOINTER_TO_INT="((gint)(long long) (ptr))"
- GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
- GINT_TO_POINTER="((gpointer)(long long) (v))"
- GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
- GSIZE="long long"
- GSIZE_FORMAT='"I64u"'
-else
- AC_MSG_ERROR([unsupported pointer size])
-fi
-
-AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
-
-pkg_config_path=
-AC_ARG_WITH(crosspkgdir, [ --with-crosspkgdir=/path/to/pkg-config/dir Change pkg-config dir to custom dir],
- if test x$with_crosspkgdir = "x"; then
- if test -s $PKG_CONFIG_PATH; then
- pkg_config_path=$PKG_CONFIG_PATH
- fi
- else
- pkg_config_path=$with_crosspkgdir
- PKG_CONFIG_PATH=$pkg_config_path
- export PKG_CONFIG_PATH
- fi
-)
-
-AC_ARG_ENABLE(werror, [ --enable-werror Pass -Werror to the C compiler], werror_flag=$enableval, werror_flag=no)
-if test x$werror_flag = xyes; then
- WERROR_CFLAGS="-Werror"
-fi
-AC_SUBST([WERROR_CFLAGS])
-
-AC_SUBST(GPOINTER_TO_INT)
-AC_SUBST(GPOINTER_TO_UINT)
-AC_SUBST(GINT_TO_POINTER)
-AC_SUBST(GUINT_TO_POINTER)
-AC_SUBST(GSIZE)
-AC_SUBST(GSIZE_FORMAT)
-AC_SUBST(G_GUINT64_FORMAT)
-AC_SUBST(G_GINT64_FORMAT)
-AC_SUBST(G_GUINT32_FORMAT)
-AC_SUBST(G_GINT32_FORMAT)
-
-AC_OUTPUT([
-Makefile
-m4/Makefile
-src/Makefile
-src/eglib-config.h
-test/Makefile
-])
+++ /dev/null
-Makefile
-Makefile.in
-libtool.m4
-ltoptions.m4
-ltsugar.m4
-ltversion.m4
-lt~obsolete.m4
+++ /dev/null
-EXTRA_DIST = $(wildcard *.m4)
+++ /dev/null
-# iconv.m4 serial 11 (gettext-0.18.1)
-dnl Copyright (C) 2000-2002, 2007-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-AC_DEFUN([AM_ICONV_LINKFLAGS_BODY],
-[
- dnl Prerequisites of AC_LIB_LINKFLAGS_BODY.
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
-
- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
- dnl accordingly.
- AC_LIB_LINKFLAGS_BODY([iconv])
-])
-
-AC_DEFUN([AM_ICONV_LINK],
-[
- dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
- dnl those with the standalone portable GNU libiconv installed).
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
-
- dnl Search for libiconv and define LIBICONV, LTLIBICONV and INCICONV
- dnl accordingly.
- AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY])
-
- dnl Add $INCICONV to CPPFLAGS before performing the following checks,
- dnl because if the user has installed libiconv and not disabled its use
- dnl via --without-libiconv-prefix, he wants to use it. The first
- dnl AC_TRY_LINK will then fail, the second AC_TRY_LINK will succeed.
- am_save_CPPFLAGS="$CPPFLAGS"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INCICONV])
-
- AC_CACHE_CHECK([for iconv], [am_cv_func_iconv], [
- am_cv_func_iconv="no, consider installing GNU libiconv"
- am_cv_lib_iconv=no
- AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
- [am_cv_func_iconv=yes])
- if test "$am_cv_func_iconv" != yes; then
- am_save_LIBS="$LIBS"
- LIBS="$LIBS $LIBICONV"
- AC_TRY_LINK([#include <stdlib.h>
-#include <iconv.h>],
- [iconv_t cd = iconv_open("","");
- iconv(cd,NULL,NULL,NULL,NULL);
- iconv_close(cd);],
- [am_cv_lib_iconv=yes]
- [am_cv_func_iconv=yes])
- LIBS="$am_save_LIBS"
- fi
- ])
- if test "$am_cv_func_iconv" = yes; then
- AC_CACHE_CHECK([for working iconv], [am_cv_func_iconv_works], [
- dnl This tests against bugs in AIX 5.1, HP-UX 11.11, Solaris 10.
- am_save_LIBS="$LIBS"
- if test $am_cv_lib_iconv = yes; then
- LIBS="$LIBS $LIBICONV"
- fi
- AC_TRY_RUN([
-#include <iconv.h>
-#include <string.h>
-int main ()
-{
- /* Test against AIX 5.1 bug: Failures are not distinguishable from successful
- returns. */
- {
- iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8");
- if (cd_utf8_to_88591 != (iconv_t)(-1))
- {
- static const char input[] = "\342\202\254"; /* EURO SIGN */
- char buf[10];
- const char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_utf8_to_88591,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if (res == 0)
- return 1;
- }
- }
- /* Test against Solaris 10 bug: Failures are not distinguishable from
- successful returns. */
- {
- iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646");
- if (cd_ascii_to_88591 != (iconv_t)(-1))
- {
- static const char input[] = "\263";
- char buf[10];
- const char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_ascii_to_88591,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if (res == 0)
- return 1;
- }
- }
-#if 0 /* This bug could be worked around by the caller. */
- /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */
- {
- iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591");
- if (cd_88591_to_utf8 != (iconv_t)(-1))
- {
- static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337";
- char buf[50];
- const char *inptr = input;
- size_t inbytesleft = strlen (input);
- char *outptr = buf;
- size_t outbytesleft = sizeof (buf);
- size_t res = iconv (cd_88591_to_utf8,
- (char **) &inptr, &inbytesleft,
- &outptr, &outbytesleft);
- if ((int)res > 0)
- return 1;
- }
- }
-#endif
- /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is
- provided. */
- if (/* Try standardized names. */
- iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1)
- /* Try IRIX, OSF/1 names. */
- && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1)
- /* Try AIX names. */
- && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1)
- /* Try HP-UX names. */
- && iconv_open ("utf8", "eucJP") == (iconv_t)(-1))
- return 1;
- return 0;
-}], [am_cv_func_iconv_works=yes], [am_cv_func_iconv_works=no],
- [case "$host_os" in
- aix* | hpux*) am_cv_func_iconv_works="guessing no" ;;
- *) am_cv_func_iconv_works="guessing yes" ;;
- esac])
- LIBS="$am_save_LIBS"
- ])
- case "$am_cv_func_iconv_works" in
- *no) am_func_iconv=no am_cv_lib_iconv=no ;;
- *) am_func_iconv=yes ;;
- esac
- else
- am_func_iconv=no am_cv_lib_iconv=no
- fi
- if test "$am_func_iconv" = yes; then
- AC_DEFINE([HAVE_ICONV], [1],
- [Define if you have the iconv() function and it works.])
- fi
- if test "$am_cv_lib_iconv" = yes; then
- AC_MSG_CHECKING([how to link with libiconv])
- AC_MSG_RESULT([$LIBICONV])
- else
- dnl If $LIBICONV didn't lead to a usable library, we don't need $INCICONV
- dnl either.
- CPPFLAGS="$am_save_CPPFLAGS"
- LIBICONV=
- LTLIBICONV=
- fi
- AC_SUBST([LIBICONV])
- AC_SUBST([LTLIBICONV])
-])
-
-dnl Define AM_ICONV using AC_DEFUN_ONCE for Autoconf >= 2.64, in order to
-dnl avoid warnings like
-dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required".
-dnl This is tricky because of the way 'aclocal' is implemented:
-dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN.
-dnl Otherwise aclocal's initial scan pass would miss the macro definition.
-dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions.
-dnl Otherwise aclocal would emit many "Use of uninitialized value $1"
-dnl warnings.
-m4_define([gl_iconv_AC_DEFUN],
- m4_version_prereq([2.64],
- [[AC_DEFUN_ONCE(
- [$1], [$2])]],
- [[AC_DEFUN(
- [$1], [$2])]]))
-gl_iconv_AC_DEFUN([AM_ICONV],
-[
- AM_ICONV_LINK
- if test "$am_cv_func_iconv" = yes; then
- AC_MSG_CHECKING([for iconv declaration])
- AC_CACHE_VAL([am_cv_proto_iconv], [
- AC_TRY_COMPILE([
-#include <stdlib.h>
-#include <iconv.h>
-extern
-#ifdef __cplusplus
-"C"
-#endif
-#if defined(__STDC__) || defined(__cplusplus)
-size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
-#else
-size_t iconv();
-#endif
-], [], [am_cv_proto_iconv_arg1=""], [am_cv_proto_iconv_arg1="const"])
- am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
- am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
- AC_MSG_RESULT([
- $am_cv_proto_iconv])
- AC_DEFINE_UNQUOTED([ICONV_CONST], [$am_cv_proto_iconv_arg1],
- [Define as const if the declaration of iconv() needs const.])
- fi
-])
+++ /dev/null
-# lib-ld.m4 serial 4 (gettext-0.18)
-dnl Copyright (C) 1996-2003, 2009-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl Subroutines of libtool.m4,
-dnl with replacements s/AC_/AC_LIB/ and s/lt_cv/acl_cv/ to avoid collision
-dnl with libtool.m4.
-
-dnl From libtool-1.4. Sets the variable with_gnu_ld to yes or no.
-AC_DEFUN([AC_LIB_PROG_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], [acl_cv_prog_gnu_ld],
-[# I'd rather use --version here, but apparently some GNU ld's only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
- acl_cv_prog_gnu_ld=yes ;;
-*)
- acl_cv_prog_gnu_ld=no ;;
-esac])
-with_gnu_ld=$acl_cv_prog_gnu_ld
-])
-
-dnl From libtool-1.4. Sets the variable LD.
-AC_DEFUN([AC_LIB_PROG_LD],
-[AC_ARG_WITH([gnu-ld],
-[ --with-gnu-ld assume the C compiler uses GNU ld [default=no]],
-test "$withval" = no || with_gnu_ld=yes, with_gnu_ld=no)
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# Prepare PATH_SEPARATOR.
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- echo "#! /bin/sh" >conf$$.sh
- echo "exit 0" >>conf$$.sh
- chmod +x conf$$.sh
- if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
- PATH_SEPARATOR=';'
- else
- PATH_SEPARATOR=:
- fi
- rm -f conf$$.sh
-fi
-ac_prog=ld
-if test "$GCC" = yes; then
- # Check if gcc -print-prog-name=ld gives a path.
- AC_MSG_CHECKING([for ld used by GCC])
- case $host in
- *-*-mingw*)
- # gcc leaves a trailing carriage return which upsets mingw
- ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;;
- *)
- ac_prog=`($CC -print-prog-name=ld) 2>&5` ;;
- esac
- case $ac_prog in
- # Accept absolute paths.
- [[\\/]* | [A-Za-z]:[\\/]*)]
- [re_direlt='/[^/][^/]*/\.\./']
- # Canonicalize the path of ld
- ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'`
- while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"`
- done
- test -z "$LD" && LD="$ac_prog"
- ;;
- "")
- # If it fails, then pretend we aren't using GCC.
- ac_prog=ld
- ;;
- *)
- # If it is relative, then search for the first ld in PATH.
- with_gnu_ld=unknown
- ;;
- esac
-elif test "$with_gnu_ld" = yes; then
- AC_MSG_CHECKING([for GNU ld])
-else
- AC_MSG_CHECKING([for non-GNU ld])
-fi
-AC_CACHE_VAL([acl_cv_path_LD],
-[if test -z "$LD"; then
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}"
- for ac_dir in $PATH; do
- test -z "$ac_dir" && ac_dir=.
- if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then
- acl_cv_path_LD="$ac_dir/$ac_prog"
- # Check to see if the program is GNU ld. I'd rather use --version,
- # but apparently some GNU ld's only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in
- *GNU* | *'with BFD'*)
- test "$with_gnu_ld" != no && break ;;
- *)
- test "$with_gnu_ld" != yes && break ;;
- esac
- fi
- done
- IFS="$ac_save_ifs"
-else
- acl_cv_path_LD="$LD" # Let the user override the test with a path.
-fi])
-LD="$acl_cv_path_LD"
-if test -n "$LD"; then
- AC_MSG_RESULT([$LD])
-else
- AC_MSG_RESULT([no])
-fi
-test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-AC_LIB_PROG_LD_GNU
-])
+++ /dev/null
-# lib-link.m4 serial 21 (gettext-0.18)
-dnl Copyright (C) 2001-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-AC_PREREQ([2.54])
-
-dnl AC_LIB_LINKFLAGS(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets and AC_SUBSTs the LIB${NAME} and LTLIB${NAME} variables and
-dnl augments the CPPFLAGS variable.
-dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
-dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
-AC_DEFUN([AC_LIB_LINKFLAGS],
-[
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
- pushdef([Name],[translit([$1],[./-], [___])])
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- AC_CACHE_CHECK([how to link with lib[]$1], [ac_cv_lib[]Name[]_libs], [
- AC_LIB_LINKFLAGS_BODY([$1], [$2])
- ac_cv_lib[]Name[]_libs="$LIB[]NAME"
- ac_cv_lib[]Name[]_ltlibs="$LTLIB[]NAME"
- ac_cv_lib[]Name[]_cppflags="$INC[]NAME"
- ac_cv_lib[]Name[]_prefix="$LIB[]NAME[]_PREFIX"
- ])
- LIB[]NAME="$ac_cv_lib[]Name[]_libs"
- LTLIB[]NAME="$ac_cv_lib[]Name[]_ltlibs"
- INC[]NAME="$ac_cv_lib[]Name[]_cppflags"
- LIB[]NAME[]_PREFIX="$ac_cv_lib[]Name[]_prefix"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
- AC_SUBST([LIB]NAME[_PREFIX])
- dnl Also set HAVE_LIB[]NAME so that AC_LIB_HAVE_LINKFLAGS can reuse the
- dnl results of this search when this library appears as a dependency.
- HAVE_LIB[]NAME=yes
- popdef([NAME])
- popdef([Name])
-])
-
-dnl AC_LIB_HAVE_LINKFLAGS(name, dependencies, includes, testcode, [missing-message])
-dnl searches for libname and the libraries corresponding to explicit and
-dnl implicit dependencies, together with the specified include files and
-dnl the ability to compile and link the specified testcode. The missing-message
-dnl defaults to 'no' and may contain additional hints for the user.
-dnl If found, it sets and AC_SUBSTs HAVE_LIB${NAME}=yes and the LIB${NAME}
-dnl and LTLIB${NAME} variables and augments the CPPFLAGS variable, and
-dnl #defines HAVE_LIB${NAME} to 1. Otherwise, it sets and AC_SUBSTs
-dnl HAVE_LIB${NAME}=no and LIB${NAME} and LTLIB${NAME} to empty.
-dnl Sets and AC_SUBSTs the LIB${NAME}_PREFIX variable to nonempty if libname
-dnl was found in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
-AC_DEFUN([AC_LIB_HAVE_LINKFLAGS],
-[
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- AC_REQUIRE([AC_LIB_RPATH])
- pushdef([Name],[translit([$1],[./-], [___])])
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
-
- dnl Search for lib[]Name and define LIB[]NAME, LTLIB[]NAME and INC[]NAME
- dnl accordingly.
- AC_LIB_LINKFLAGS_BODY([$1], [$2])
-
- dnl Add $INC[]NAME to CPPFLAGS before performing the following checks,
- dnl because if the user has installed lib[]Name and not disabled its use
- dnl via --without-lib[]Name-prefix, he wants to use it.
- ac_save_CPPFLAGS="$CPPFLAGS"
- AC_LIB_APPENDTOVAR([CPPFLAGS], [$INC]NAME)
-
- AC_CACHE_CHECK([for lib[]$1], [ac_cv_lib[]Name], [
- ac_save_LIBS="$LIBS"
- dnl If $LIB[]NAME contains some -l options, add it to the end of LIBS,
- dnl because these -l options might require -L options that are present in
- dnl LIBS. -l options benefit only from the -L options listed before it.
- dnl Otherwise, add it to the front of LIBS, because it may be a static
- dnl library that depends on another static library that is present in LIBS.
- dnl Static libraries benefit only from the static libraries listed after
- dnl it.
- case " $LIB[]NAME" in
- *" -l"*) LIBS="$LIBS $LIB[]NAME" ;;
- *) LIBS="$LIB[]NAME $LIBS" ;;
- esac
- AC_TRY_LINK([$3], [$4],
- [ac_cv_lib[]Name=yes],
- [ac_cv_lib[]Name='m4_if([$5], [], [no], [[$5]])'])
- LIBS="$ac_save_LIBS"
- ])
- if test "$ac_cv_lib[]Name" = yes; then
- HAVE_LIB[]NAME=yes
- AC_DEFINE([HAVE_LIB]NAME, 1, [Define if you have the lib][$1 library.])
- AC_MSG_CHECKING([how to link with lib[]$1])
- AC_MSG_RESULT([$LIB[]NAME])
- else
- HAVE_LIB[]NAME=no
- dnl If $LIB[]NAME didn't lead to a usable library, we don't need
- dnl $INC[]NAME either.
- CPPFLAGS="$ac_save_CPPFLAGS"
- LIB[]NAME=
- LTLIB[]NAME=
- LIB[]NAME[]_PREFIX=
- fi
- AC_SUBST([HAVE_LIB]NAME)
- AC_SUBST([LIB]NAME)
- AC_SUBST([LTLIB]NAME)
- AC_SUBST([LIB]NAME[_PREFIX])
- popdef([NAME])
- popdef([Name])
-])
-
-dnl Determine the platform dependent parameters needed to use rpath:
-dnl acl_libext,
-dnl acl_shlibext,
-dnl acl_hardcode_libdir_flag_spec,
-dnl acl_hardcode_libdir_separator,
-dnl acl_hardcode_direct,
-dnl acl_hardcode_minus_L.
-AC_DEFUN([AC_LIB_RPATH],
-[
- dnl Tell automake >= 1.10 to complain if config.rpath is missing.
- m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([config.rpath])])
- AC_REQUIRE([AC_PROG_CC]) dnl we use $CC, $GCC, $LDFLAGS
- AC_REQUIRE([AC_LIB_PROG_LD]) dnl we use $LD, $with_gnu_ld
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl we use $host
- AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT]) dnl we use $ac_aux_dir
- AC_CACHE_CHECK([for shared library run path origin], [acl_cv_rpath], [
- CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \
- ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh
- . ./conftest.sh
- rm -f ./conftest.sh
- acl_cv_rpath=done
- ])
- wl="$acl_cv_wl"
- acl_libext="$acl_cv_libext"
- acl_shlibext="$acl_cv_shlibext"
- acl_libname_spec="$acl_cv_libname_spec"
- acl_library_names_spec="$acl_cv_library_names_spec"
- acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec"
- acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator"
- acl_hardcode_direct="$acl_cv_hardcode_direct"
- acl_hardcode_minus_L="$acl_cv_hardcode_minus_L"
- dnl Determine whether the user wants rpath handling at all.
- AC_ARG_ENABLE([rpath],
- [ --disable-rpath do not hardcode runtime library paths],
- :, enable_rpath=yes)
-])
-
-dnl AC_LIB_FROMPACKAGE(name, package)
-dnl declares that libname comes from the given package. The configure file
-dnl will then not have a --with-libname-prefix option but a
-dnl --with-package-prefix option. Several libraries can come from the same
-dnl package. This declaration must occur before an AC_LIB_LINKFLAGS or similar
-dnl macro call that searches for libname.
-AC_DEFUN([AC_LIB_FROMPACKAGE],
-[
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- define([acl_frompackage_]NAME, [$2])
- popdef([NAME])
- pushdef([PACK],[$2])
- pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- define([acl_libsinpackage_]PACKUP,
- m4_ifdef([acl_libsinpackage_]PACKUP, [acl_libsinpackage_]PACKUP[[, ]],)[lib$1])
- popdef([PACKUP])
- popdef([PACK])
-])
-
-dnl AC_LIB_LINKFLAGS_BODY(name [, dependencies]) searches for libname and
-dnl the libraries corresponding to explicit and implicit dependencies.
-dnl Sets the LIB${NAME}, LTLIB${NAME} and INC${NAME} variables.
-dnl Also, sets the LIB${NAME}_PREFIX variable to nonempty if libname was found
-dnl in ${LIB${NAME}_PREFIX}/$acl_libdirstem.
-AC_DEFUN([AC_LIB_LINKFLAGS_BODY],
-[
- AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
- pushdef([NAME],[translit([$1],[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- pushdef([PACK],[m4_ifdef([acl_frompackage_]NAME, [acl_frompackage_]NAME, lib[$1])])
- pushdef([PACKUP],[translit(PACK,[abcdefghijklmnopqrstuvwxyz./-],
- [ABCDEFGHIJKLMNOPQRSTUVWXYZ___])])
- pushdef([PACKLIBS],[m4_ifdef([acl_frompackage_]NAME, [acl_libsinpackage_]PACKUP, lib[$1])])
- dnl Autoconf >= 2.61 supports dots in --with options.
- pushdef([P_A_C_K],[m4_if(m4_version_compare(m4_defn([m4_PACKAGE_VERSION]),[2.61]),[-1],[translit(PACK,[.],[_])],PACK)])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- AC_ARG_WITH(P_A_C_K[-prefix],
-[[ --with-]]P_A_C_K[[-prefix[=DIR] search for ]PACKLIBS[ in DIR/include and DIR/lib
- --without-]]P_A_C_K[[-prefix don't search for ]PACKLIBS[ in includedir and libdir]],
-[
- if test "X$withval" = "Xno"; then
- use_additional=no
- else
- if test "X$withval" = "X"; then
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- else
- additional_includedir="$withval/include"
- additional_libdir="$withval/$acl_libdirstem"
- if test "$acl_libdirstem2" != "$acl_libdirstem" \
- && ! test -d "$withval/$acl_libdirstem"; then
- additional_libdir="$withval/$acl_libdirstem2"
- fi
- fi
- fi
-])
- dnl Search the library and its dependencies in $additional_libdir and
- dnl $LDFLAGS. Using breadth-first-seach.
- LIB[]NAME=
- LTLIB[]NAME=
- INC[]NAME=
- LIB[]NAME[]_PREFIX=
- dnl HAVE_LIB${NAME} is an indicator that LIB${NAME}, LTLIB${NAME} have been
- dnl computed. So it has to be reset here.
- HAVE_LIB[]NAME=
- rpathdirs=
- ltrpathdirs=
- names_already_handled=
- names_next_round='$1 $2'
- while test -n "$names_next_round"; do
- names_this_round="$names_next_round"
- names_next_round=
- for name in $names_this_round; do
- already_handled=
- for n in $names_already_handled; do
- if test "$n" = "$name"; then
- already_handled=yes
- break
- fi
- done
- if test -z "$already_handled"; then
- names_already_handled="$names_already_handled $name"
- dnl See if it was already located by an earlier AC_LIB_LINKFLAGS
- dnl or AC_LIB_HAVE_LINKFLAGS call.
- uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'`
- eval value=\"\$HAVE_LIB$uppername\"
- if test -n "$value"; then
- if test "$value" = yes; then
- eval value=\"\$LIB$uppername\"
- test -z "$value" || LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$value"
- eval value=\"\$LTLIB$uppername\"
- test -z "$value" || LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$value"
- else
- dnl An earlier call to AC_LIB_HAVE_LINKFLAGS has determined
- dnl that this library doesn't exist. So just drop it.
- :
- fi
- else
- dnl Search the library lib$name in $additional_libdir and $LDFLAGS
- dnl and the already constructed $LIBNAME/$LTLIBNAME.
- found_dir=
- found_la=
- found_so=
- found_a=
- eval libname=\"$acl_libname_spec\" # typically: libname=lib$name
- if test -n "$acl_shlibext"; then
- shrext=".$acl_shlibext" # typically: shrext=.so
- else
- shrext=
- fi
- if test $use_additional = yes; then
- dir="$additional_libdir"
- dnl The same code as in the loop below:
- dnl First look for a shared library.
- if test -n "$acl_shlibext"; then
- if test -f "$dir/$libname$shrext"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext"
- else
- if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
- ver=`(cd "$dir" && \
- for f in "$libname$shrext".*; do echo "$f"; done \
- | sed -e "s,^$libname$shrext\\\\.,," \
- | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
- | sed 1q ) 2>/dev/null`
- if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext.$ver"
- fi
- else
- eval library_names=\"$acl_library_names_spec\"
- for f in $library_names; do
- if test -f "$dir/$f"; then
- found_dir="$dir"
- found_so="$dir/$f"
- break
- fi
- done
- fi
- fi
- fi
- dnl Then look for a static library.
- if test "X$found_dir" = "X"; then
- if test -f "$dir/$libname.$acl_libext"; then
- found_dir="$dir"
- found_a="$dir/$libname.$acl_libext"
- fi
- fi
- if test "X$found_dir" != "X"; then
- if test -f "$dir/$libname.la"; then
- found_la="$dir/$libname.la"
- fi
- fi
- fi
- if test "X$found_dir" = "X"; then
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- case "$x" in
- -L*)
- dir=`echo "X$x" | sed -e 's/^X-L//'`
- dnl First look for a shared library.
- if test -n "$acl_shlibext"; then
- if test -f "$dir/$libname$shrext"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext"
- else
- if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then
- ver=`(cd "$dir" && \
- for f in "$libname$shrext".*; do echo "$f"; done \
- | sed -e "s,^$libname$shrext\\\\.,," \
- | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \
- | sed 1q ) 2>/dev/null`
- if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then
- found_dir="$dir"
- found_so="$dir/$libname$shrext.$ver"
- fi
- else
- eval library_names=\"$acl_library_names_spec\"
- for f in $library_names; do
- if test -f "$dir/$f"; then
- found_dir="$dir"
- found_so="$dir/$f"
- break
- fi
- done
- fi
- fi
- fi
- dnl Then look for a static library.
- if test "X$found_dir" = "X"; then
- if test -f "$dir/$libname.$acl_libext"; then
- found_dir="$dir"
- found_a="$dir/$libname.$acl_libext"
- fi
- fi
- if test "X$found_dir" != "X"; then
- if test -f "$dir/$libname.la"; then
- found_la="$dir/$libname.la"
- fi
- fi
- ;;
- esac
- if test "X$found_dir" != "X"; then
- break
- fi
- done
- fi
- if test "X$found_dir" != "X"; then
- dnl Found the library.
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$found_dir -l$name"
- if test "X$found_so" != "X"; then
- dnl Linking with a shared library. We attempt to hardcode its
- dnl directory into the executable's runpath, unless it's the
- dnl standard /usr/lib.
- if test "$enable_rpath" = no \
- || test "X$found_dir" = "X/usr/$acl_libdirstem" \
- || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then
- dnl No hardcoding is needed.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- dnl Potentially add DIR to ltrpathdirs.
- dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $found_dir"
- fi
- dnl The hardcoding into $LIBNAME is system dependent.
- if test "$acl_hardcode_direct" = yes; then
- dnl Using DIR/libNAME.so during linking hardcodes DIR into the
- dnl resulting binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
- dnl Use an explicit option to hardcode DIR into the resulting
- dnl binary.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- dnl Potentially add DIR to rpathdirs.
- dnl The rpathdirs will be appended to $LIBNAME at the end.
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $found_dir"
- fi
- else
- dnl Rely on "-L$found_dir".
- dnl But don't add it if it's already contained in the LDFLAGS
- dnl or the already constructed $LIBNAME
- haveit=
- for x in $LDFLAGS $LIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$found_dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir"
- fi
- if test "$acl_hardcode_minus_L" != no; then
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_so"
- else
- dnl We cannot use $acl_hardcode_runpath_var and LD_RUN_PATH
- dnl here, because this doesn't fit in flags passed to the
- dnl compiler. So give up. No hardcoding. This affects only
- dnl very old systems.
- dnl FIXME: Not sure whether we should use
- dnl "-L$found_dir -l$name" or "-L$found_dir $found_so"
- dnl here.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
- fi
- fi
- fi
- fi
- else
- if test "X$found_a" != "X"; then
- dnl Linking with a static library.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$found_a"
- else
- dnl We shouldn't come here, but anyway it's good to have a
- dnl fallback.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$found_dir -l$name"
- fi
- fi
- dnl Assume the include files are nearby.
- additional_includedir=
- case "$found_dir" in
- */$acl_libdirstem | */$acl_libdirstem/)
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'`
- if test "$name" = '$1'; then
- LIB[]NAME[]_PREFIX="$basedir"
- fi
- additional_includedir="$basedir/include"
- ;;
- */$acl_libdirstem2 | */$acl_libdirstem2/)
- basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'`
- if test "$name" = '$1'; then
- LIB[]NAME[]_PREFIX="$basedir"
- fi
- additional_includedir="$basedir/include"
- ;;
- esac
- if test "X$additional_includedir" != "X"; then
- dnl Potentially add $additional_includedir to $INCNAME.
- dnl But don't add it
- dnl 1. if it's the standard /usr/include,
- dnl 2. if it's /usr/local/include and we are using GCC on Linux,
- dnl 3. if it's already present in $CPPFLAGS or the already
- dnl constructed $INCNAME,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_includedir" != "X/usr/include"; then
- haveit=
- if test "X$additional_includedir" = "X/usr/local/include"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- for x in $CPPFLAGS $INC[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-I$additional_includedir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_includedir"; then
- dnl Really add $additional_includedir to $INCNAME.
- INC[]NAME="${INC[]NAME}${INC[]NAME:+ }-I$additional_includedir"
- fi
- fi
- fi
- fi
- fi
- dnl Look for dependencies.
- if test -n "$found_la"; then
- dnl Read the .la file. It defines the variables
- dnl dlname, library_names, old_library, dependency_libs, current,
- dnl age, revision, installed, dlopen, dlpreopen, libdir.
- save_libdir="$libdir"
- case "$found_la" in
- */* | *\\*) . "$found_la" ;;
- *) . "./$found_la" ;;
- esac
- libdir="$save_libdir"
- dnl We use only dependency_libs.
- for dep in $dependency_libs; do
- case "$dep" in
- -L*)
- additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'`
- dnl Potentially add $additional_libdir to $LIBNAME and $LTLIBNAME.
- dnl But don't add it
- dnl 1. if it's the standard /usr/lib,
- dnl 2. if it's /usr/local/lib and we are using GCC on Linux,
- dnl 3. if it's already present in $LDFLAGS or the already
- dnl constructed $LIBNAME,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \
- && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then
- haveit=
- if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \
- || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- haveit=
- for x in $LDFLAGS $LIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LIBNAME.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-L$additional_libdir"
- fi
- fi
- haveit=
- for x in $LDFLAGS $LTLIB[]NAME; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LTLIBNAME.
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-L$additional_libdir"
- fi
- fi
- fi
- fi
- ;;
- -R*)
- dir=`echo "X$dep" | sed -e 's/^X-R//'`
- if test "$enable_rpath" != no; then
- dnl Potentially add DIR to rpathdirs.
- dnl The rpathdirs will be appended to $LIBNAME at the end.
- haveit=
- for x in $rpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- rpathdirs="$rpathdirs $dir"
- fi
- dnl Potentially add DIR to ltrpathdirs.
- dnl The ltrpathdirs will be appended to $LTLIBNAME at the end.
- haveit=
- for x in $ltrpathdirs; do
- if test "X$x" = "X$dir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- ltrpathdirs="$ltrpathdirs $dir"
- fi
- fi
- ;;
- -l*)
- dnl Handle this in the next round.
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'`
- ;;
- *.la)
- dnl Handle this in the next round. Throw away the .la's
- dnl directory; it is already contained in a preceding -L
- dnl option.
- names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
- ;;
- *)
- dnl Most likely an immediate library name.
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$dep"
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }$dep"
- ;;
- esac
- done
- fi
- else
- dnl Didn't find the library; assume it is in the system directories
- dnl known to the linker and runtime loader. (All the system
- dnl directories known to the linker should also be known to the
- dnl runtime loader, otherwise the system is severely misconfigured.)
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }-l$name"
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-l$name"
- fi
- fi
- fi
- done
- done
- if test "X$rpathdirs" != "X"; then
- if test -n "$acl_hardcode_libdir_separator"; then
- dnl Weird platform: only the last -rpath option counts, the user must
- dnl pass all path elements in one option. We can arrange that for a
- dnl single library, but not when more than one $LIBNAMEs are used.
- alldirs=
- for found_dir in $rpathdirs; do
- alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir"
- done
- dnl Note: acl_hardcode_libdir_flag_spec uses $libdir and $wl.
- acl_save_libdir="$libdir"
- libdir="$alldirs"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- else
- dnl The -rpath options are cumulative.
- for found_dir in $rpathdirs; do
- acl_save_libdir="$libdir"
- libdir="$found_dir"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- LIB[]NAME="${LIB[]NAME}${LIB[]NAME:+ }$flag"
- done
- fi
- fi
- if test "X$ltrpathdirs" != "X"; then
- dnl When using libtool, the option that works for both libraries and
- dnl executables is -R. The -R options are cumulative.
- for found_dir in $ltrpathdirs; do
- LTLIB[]NAME="${LTLIB[]NAME}${LTLIB[]NAME:+ }-R$found_dir"
- done
- fi
- popdef([P_A_C_K])
- popdef([PACKLIBS])
- popdef([PACKUP])
- popdef([PACK])
- popdef([NAME])
-])
-
-dnl AC_LIB_APPENDTOVAR(VAR, CONTENTS) appends the elements of CONTENTS to VAR,
-dnl unless already present in VAR.
-dnl Works only for CPPFLAGS, not for LIB* variables because that sometimes
-dnl contains two or three consecutive elements that belong together.
-AC_DEFUN([AC_LIB_APPENDTOVAR],
-[
- for element in [$2]; do
- haveit=
- for x in $[$1]; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X$element"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- [$1]="${[$1]}${[$1]:+ }$element"
- fi
- done
-])
-
-dnl For those cases where a variable contains several -L and -l options
-dnl referring to unknown libraries and directories, this macro determines the
-dnl necessary additional linker options for the runtime path.
-dnl AC_LIB_LINKFLAGS_FROM_LIBS([LDADDVAR], [LIBSVALUE], [USE-LIBTOOL])
-dnl sets LDADDVAR to linker options needed together with LIBSVALUE.
-dnl If USE-LIBTOOL evaluates to non-empty, linking with libtool is assumed,
-dnl otherwise linking without libtool is assumed.
-AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS],
-[
- AC_REQUIRE([AC_LIB_RPATH])
- AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
- $1=
- if test "$enable_rpath" != no; then
- if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then
- dnl Use an explicit option to hardcode directories into the resulting
- dnl binary.
- rpathdirs=
- next=
- for opt in $2; do
- if test -n "$next"; then
- dir="$next"
- dnl No need to hardcode the standard /usr/lib.
- if test "X$dir" != "X/usr/$acl_libdirstem" \
- && test "X$dir" != "X/usr/$acl_libdirstem2"; then
- rpathdirs="$rpathdirs $dir"
- fi
- next=
- else
- case $opt in
- -L) next=yes ;;
- -L*) dir=`echo "X$opt" | sed -e 's,^X-L,,'`
- dnl No need to hardcode the standard /usr/lib.
- if test "X$dir" != "X/usr/$acl_libdirstem" \
- && test "X$dir" != "X/usr/$acl_libdirstem2"; then
- rpathdirs="$rpathdirs $dir"
- fi
- next= ;;
- *) next= ;;
- esac
- fi
- done
- if test "X$rpathdirs" != "X"; then
- if test -n ""$3""; then
- dnl libtool is used for linking. Use -R options.
- for dir in $rpathdirs; do
- $1="${$1}${$1:+ }-R$dir"
- done
- else
- dnl The linker is used for linking directly.
- if test -n "$acl_hardcode_libdir_separator"; then
- dnl Weird platform: only the last -rpath option counts, the user
- dnl must pass all path elements in one option.
- alldirs=
- for dir in $rpathdirs; do
- alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$dir"
- done
- acl_save_libdir="$libdir"
- libdir="$alldirs"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- $1="$flag"
- else
- dnl The -rpath options are cumulative.
- for dir in $rpathdirs; do
- acl_save_libdir="$libdir"
- libdir="$dir"
- eval flag=\"$acl_hardcode_libdir_flag_spec\"
- libdir="$acl_save_libdir"
- $1="${$1}${$1:+ }$flag"
- done
- fi
- fi
- fi
- fi
- fi
- AC_SUBST([$1])
-])
+++ /dev/null
-# lib-prefix.m4 serial 7 (gettext-0.18)
-dnl Copyright (C) 2001-2005, 2008-2010 Free Software Foundation, Inc.
-dnl This file is free software; the Free Software Foundation
-dnl gives unlimited permission to copy and/or distribute it,
-dnl with or without modifications, as long as this notice is preserved.
-
-dnl From Bruno Haible.
-
-dnl AC_LIB_ARG_WITH is synonymous to AC_ARG_WITH in autoconf-2.13, and
-dnl similar to AC_ARG_WITH in autoconf 2.52...2.57 except that is doesn't
-dnl require excessive bracketing.
-ifdef([AC_HELP_STRING],
-[AC_DEFUN([AC_LIB_ARG_WITH], [AC_ARG_WITH([$1],[[$2]],[$3],[$4])])],
-[AC_DEFUN([AC_][LIB_ARG_WITH], [AC_ARG_WITH([$1],[$2],[$3],[$4])])])
-
-dnl AC_LIB_PREFIX adds to the CPPFLAGS and LDFLAGS the flags that are needed
-dnl to access previously installed libraries. The basic assumption is that
-dnl a user will want packages to use other packages he previously installed
-dnl with the same --prefix option.
-dnl This macro is not needed if only AC_LIB_LINKFLAGS is used to locate
-dnl libraries, but is otherwise very convenient.
-AC_DEFUN([AC_LIB_PREFIX],
-[
- AC_BEFORE([$0], [AC_LIB_LINKFLAGS])
- AC_REQUIRE([AC_PROG_CC])
- AC_REQUIRE([AC_CANONICAL_HOST])
- AC_REQUIRE([AC_LIB_PREPARE_MULTILIB])
- AC_REQUIRE([AC_LIB_PREPARE_PREFIX])
- dnl By default, look in $includedir and $libdir.
- use_additional=yes
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- AC_LIB_ARG_WITH([lib-prefix],
-[ --with-lib-prefix[=DIR] search for libraries in DIR/include and DIR/lib
- --without-lib-prefix don't search for libraries in includedir and libdir],
-[
- if test "X$withval" = "Xno"; then
- use_additional=no
- else
- if test "X$withval" = "X"; then
- AC_LIB_WITH_FINAL_PREFIX([
- eval additional_includedir=\"$includedir\"
- eval additional_libdir=\"$libdir\"
- ])
- else
- additional_includedir="$withval/include"
- additional_libdir="$withval/$acl_libdirstem"
- fi
- fi
-])
- if test $use_additional = yes; then
- dnl Potentially add $additional_includedir to $CPPFLAGS.
- dnl But don't add it
- dnl 1. if it's the standard /usr/include,
- dnl 2. if it's already present in $CPPFLAGS,
- dnl 3. if it's /usr/local/include and we are using GCC on Linux,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_includedir" != "X/usr/include"; then
- haveit=
- for x in $CPPFLAGS; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-I$additional_includedir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test "X$additional_includedir" = "X/usr/local/include"; then
- if test -n "$GCC"; then
- case $host_os in
- linux* | gnu* | k*bsd*-gnu) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- if test -d "$additional_includedir"; then
- dnl Really add $additional_includedir to $CPPFLAGS.
- CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }-I$additional_includedir"
- fi
- fi
- fi
- fi
- dnl Potentially add $additional_libdir to $LDFLAGS.
- dnl But don't add it
- dnl 1. if it's the standard /usr/lib,
- dnl 2. if it's already present in $LDFLAGS,
- dnl 3. if it's /usr/local/lib and we are using GCC on Linux,
- dnl 4. if it doesn't exist as a directory.
- if test "X$additional_libdir" != "X/usr/$acl_libdirstem"; then
- haveit=
- for x in $LDFLAGS; do
- AC_LIB_WITH_FINAL_PREFIX([eval x=\"$x\"])
- if test "X$x" = "X-L$additional_libdir"; then
- haveit=yes
- break
- fi
- done
- if test -z "$haveit"; then
- if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem"; then
- if test -n "$GCC"; then
- case $host_os in
- linux*) haveit=yes;;
- esac
- fi
- fi
- if test -z "$haveit"; then
- if test -d "$additional_libdir"; then
- dnl Really add $additional_libdir to $LDFLAGS.
- LDFLAGS="${LDFLAGS}${LDFLAGS:+ }-L$additional_libdir"
- fi
- fi
- fi
- fi
- fi
-])
-
-dnl AC_LIB_PREPARE_PREFIX creates variables acl_final_prefix,
-dnl acl_final_exec_prefix, containing the values to which $prefix and
-dnl $exec_prefix will expand at the end of the configure script.
-AC_DEFUN([AC_LIB_PREPARE_PREFIX],
-[
- dnl Unfortunately, prefix and exec_prefix get only finally determined
- dnl at the end of configure.
- if test "X$prefix" = "XNONE"; then
- acl_final_prefix="$ac_default_prefix"
- else
- acl_final_prefix="$prefix"
- fi
- if test "X$exec_prefix" = "XNONE"; then
- acl_final_exec_prefix='${prefix}'
- else
- acl_final_exec_prefix="$exec_prefix"
- fi
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- eval acl_final_exec_prefix=\"$acl_final_exec_prefix\"
- prefix="$acl_save_prefix"
-])
-
-dnl AC_LIB_WITH_FINAL_PREFIX([statement]) evaluates statement, with the
-dnl variables prefix and exec_prefix bound to the values they will have
-dnl at the end of the configure script.
-AC_DEFUN([AC_LIB_WITH_FINAL_PREFIX],
-[
- acl_save_prefix="$prefix"
- prefix="$acl_final_prefix"
- acl_save_exec_prefix="$exec_prefix"
- exec_prefix="$acl_final_exec_prefix"
- $1
- exec_prefix="$acl_save_exec_prefix"
- prefix="$acl_save_prefix"
-])
-
-dnl AC_LIB_PREPARE_MULTILIB creates
-dnl - a variable acl_libdirstem, containing the basename of the libdir, either
-dnl "lib" or "lib64" or "lib/64",
-dnl - a variable acl_libdirstem2, as a secondary possible value for
-dnl acl_libdirstem, either the same as acl_libdirstem or "lib/sparcv9" or
-dnl "lib/amd64".
-AC_DEFUN([AC_LIB_PREPARE_MULTILIB],
-[
- dnl There is no formal standard regarding lib and lib64.
- dnl On glibc systems, the current practice is that on a system supporting
- dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
- dnl $prefix/lib64 and 32-bit libraries go under $prefix/lib. We determine
- dnl the compiler's default mode by looking at the compiler's library search
- dnl path. If at least one of its elements ends in /lib64 or points to a
- dnl directory whose absolute pathname ends in /lib64, we assume a 64-bit ABI.
- dnl Otherwise we use the default, namely "lib".
- dnl On Solaris systems, the current practice is that on a system supporting
- dnl 32-bit and 64-bit instruction sets or ABIs, 64-bit libraries go under
- dnl $prefix/lib/64 (which is a symlink to either $prefix/lib/sparcv9 or
- dnl $prefix/lib/amd64) and 32-bit libraries go under $prefix/lib.
- AC_REQUIRE([AC_CANONICAL_HOST])
- acl_libdirstem=lib
- acl_libdirstem2=
- case "$host_os" in
- solaris*)
- dnl See Solaris 10 Software Developer Collection > Solaris 64-bit Developer's Guide > The Development Environment
- dnl <http://docs.sun.com/app/docs/doc/816-5138/dev-env?l=en&a=view>.
- dnl "Portable Makefiles should refer to any library directories using the 64 symbolic link."
- dnl But we want to recognize the sparcv9 or amd64 subdirectory also if the
- dnl symlink is missing, so we set acl_libdirstem2 too.
- AC_CACHE_CHECK([for 64-bit host], [gl_cv_solaris_64bit],
- [AC_EGREP_CPP([sixtyfour bits], [
-#ifdef _LP64
-sixtyfour bits
-#endif
- ], [gl_cv_solaris_64bit=yes], [gl_cv_solaris_64bit=no])
- ])
- if test $gl_cv_solaris_64bit = yes; then
- acl_libdirstem=lib/64
- case "$host_cpu" in
- sparc*) acl_libdirstem2=lib/sparcv9 ;;
- i*86 | x86_64) acl_libdirstem2=lib/amd64 ;;
- esac
- fi
- ;;
- *)
- searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'`
- if test -n "$searchpath"; then
- acl_save_IFS="${IFS= }"; IFS=":"
- for searchdir in $searchpath; do
- if test -d "$searchdir"; then
- case "$searchdir" in
- */lib64/ | */lib64 ) acl_libdirstem=lib64 ;;
- */../ | */.. )
- # Better ignore directories of this form. They are misleading.
- ;;
- *) searchdir=`cd "$searchdir" && pwd`
- case "$searchdir" in
- */lib64 ) acl_libdirstem=lib64 ;;
- esac ;;
- esac
- fi
- done
- IFS="$acl_save_IFS"
- fi
- ;;
- esac
- test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem"
-])
unicode-data.h \
$(os_files)
-libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2
+libeglib_la_CFLAGS = -g -Wall -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
AM_CPPFLAGS = -I$(srcdir)
exit (0);
}
-
-#if PLATFORM_ANDROID
+#if TARGET_ANDROID
#include <android/log.h>
static android_LogPriority
-Subproject commit 1cd7cc5a141a737ee717505923c08d28f5f63c3d
+Subproject commit e790a9b77031ef1d8ebf093ef88840edea11ed73
-Subproject commit 4ae08e8dd6425fa0936aa43d95966539359b5081
+Subproject commit b445017309aac741a26d8c51bb0636234084bf23
-Subproject commit 797f074e49933b5fffb42d1a945270f3a88de042
+Subproject commit 74ccd8aa00d7d271191ca3b9c4f818268dc36c28
-Subproject commit dcb0a0534d5104eaf945d3d1f319dc33044b7bbe
+Subproject commit 80b86f340b7f6fb7afe84443214e1cbd7ff70620
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\EXPRExtensions.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ExprFactory.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\EXPRFLAG.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\FileRecord.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\FundamentalTypes.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\GlobalSymbolContext.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\GroupToArgsBinder.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\GroupToArgsBinderResult.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\ImplicitConversion.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\InputFile.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\LangCompiler.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MemberLookup.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\MemberLookupResults.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Return.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Statement.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Temporary.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\TypeArguments.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\TypeOf.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UnaryOperator.cs" />\r
- <Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UnboundAnonymousFunction.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UserDefinedConversion.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\UserDefinedLogicalOperator.cs" />\r
<Compile Include="..\..\..\external\corefx\src\Microsoft.CSharp\src\Microsoft\CSharp\RuntimeBinder\Semantics\Tree\Visitors\ExpressionTreeRewriter.cs" />\r
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRExtensions.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ExprFactory.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/EXPRFLAG.cs
-../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/FileRecord.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/FundamentalTypes.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GlobalSymbolContext.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinder.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/GroupToArgsBinderResult.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/ImplicitConversion.cs
-../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/InputFile.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/LangCompiler.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookup.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/MemberLookupResults.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Return.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Statement.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Temporary.cs
-../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeArguments.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/TypeOf.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnaryOperator.cs
-../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UnboundAnonymousFunction.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedConversion.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/UserDefinedLogicalOperator.cs
../../../external/corefx/src/Microsoft.CSharp/src/Microsoft/CSharp/RuntimeBinder/Semantics/Tree/Visitors/ExpressionTreeRewriter.cs
public const string BindPropertyFailedMethodGroup = "The name '{0}' is bound to a method and cannot be used like a property";
public const string BindPropertyFailedEvent = "The event '{0}' can only appear on the left hand side of +";
public const string BindInvokeFailedNonDelegate = "Cannot invoke a non-delegate type";
- public const string BindImplicitConversionRequireOneArgument = "Implicit conversion takes exactly one argument";
- public const string BindExplicitConversionRequireOneArgument = "Explicit conversion takes exactly one argument";
public const string BindBinaryAssignmentRequireTwoArguments = "Binary operators cannot be invoked with one argument";
public const string BindBinaryAssignmentFailedNullReference = "Cannot perform member assignment on a null reference";
public const string NullReferenceOnMemberException = "Cannot perform runtime binding on a null reference";
public const string BindCallToConditionalMethod = "Cannot dynamically invoke method '{0}' because it has a Conditional attribute";
public const string BindToVoidMethodButExpectResult = "Cannot implicitly convert type 'void' to 'object'";
public const string BadBinaryOps = "Operator '{0}' cannot be applied to operands of type '{1}' and '{2}'";
- public const string IntDivByZero = "Division by constant zero";
public const string BadIndexLHS = "Cannot apply indexing with [] to an expression of type '{0}'";
public const string BadIndexCount = "Wrong number of indices inside []; expected '{0}'";
public const string BadUnaryOp = "Operator '{0}' cannot be applied to operand of type '{1}'";
public const string AssgReadonlyProp = "Property or indexer '{0}' cannot be assigned to -- it is read only";
public const string AbstractBaseCall = "Cannot call an abstract base member: '{0}'";
public const string RefProperty = "A property or indexer may not be passed as an out or ref parameter";
- public const string ManagedAddr = "Cannot take the address of, get the size of, or declare a pointer to a managed type ('{0}')";
- public const string FixedNotNeeded = "You cannot use the fixed statement to take the address of an already fixed expression";
public const string UnsafeNeeded = "Dynamic calls cannot be used in conjunction with pointers";
public const string BadBoolOp = "In order to be applicable as a short circuit operator a user-defined logical operator ('{0}') must have the same return type as the type of its 2 parameters";
public const string MustHaveOpTF = "The type ('{0}') must contain declarations of operator true and operator false";
- public const string CheckedOverflow = "The operation overflows at compile time in checked mode";
public const string ConstOutOfRangeChecked = "Constant value '{0}' cannot be converted to a '{1}' (use 'unchecked' syntax to override)";
public const string AmbigMember = "Ambiguity between '{0}' and '{1}'";
public const string SizeofUnsafe = "'{0}' does not have a predefined size, therefore sizeof can only be used in an unsafe context (consider using System.Runtime.InteropServices.Marshal.SizeOf)";
- public const string FieldInitRefNonstatic = "A field initializer cannot reference the non-static field, method, or property '{0}'";
public const string CallingFinalizeDepracated = "Destructors and object.Finalize cannot be called directly. Consider calling IDisposable.Dispose if available.";
public const string CallingBaseFinalizeDeprecated = "Do not directly call your base class Finalize method. It is called automatically from your destructor.";
- public const string BadCastInFixed = "The right hand side of a fixed statement assignment may not be a cast expression";
public const string NoImplicitConvCast = "Cannot implicitly convert type '{0}' to '{1}'. An explicit conversion exists (are you missing a cast?)";
public const string InaccessibleGetter = "The property or indexer '{0}' cannot be used in this context because the get accessor is inaccessible";
public const string InaccessibleSetter = "The property or indexer '{0}' cannot be used in this context because the set accessor is inaccessible";
public const string MethGrpToNonDel = "Cannot convert method group '{0}' to non-delegate type '{1}'. Did you intend to invoke the method?";
public const string RefConstraintNotSatisfied = "The type '{2}' must be a reference type in order to use it as parameter '{1}' in the generic type or method '{0}'";
public const string ValConstraintNotSatisfied = "The type '{2}' must be a non-nullable value type in order to use it as parameter '{1}' in the generic type or method '{0}'";
- public const string CircularConstraint = "Circular constraint dependency involving '{0}' and '{1}'";
- public const string BaseConstraintConflict = "Type parameter '{0}' inherits conflicting constraints '{1}' and '{2}'";
- public const string ConWithValCon = "Type parameter '{1}' has the 'struct' constraint so '{1}' cannot be used as a constraint for '{0}'";
public const string AmbigUDConv = "Ambiguous user defined conversions '{0}' and '{1}' when converting from '{2}' to '{3}'";
public const string PredefinedTypeNotFound = "Predefined type '{0}' is not defined or imported";
- public const string PredefinedTypeBadType = "Predefined type '{0}' is declared incorrectly";
public const string BindToBogus = "'{0}' is not supported by the language";
public const string CantCallSpecialMethod = "'{0}': cannot explicitly call operator or accessor";
public const string BogusType = "'{0}' is a type not supported by the language";
public const string MissingPredefinedMember = "Missing compiler required member '{0}.{1}'";
public const string LiteralDoubleCast = "Literal of type double cannot be implicitly converted to type '{1}'; use an '{0}' suffix to create a literal of this type";
- public const string UnifyingInterfaceInstantiations = "'{0}' cannot implement both '{1}' and '{2}' because they may unify for some type parameter substitutions";
public const string ConvertToStaticClass = "Cannot convert to static type '{0}'";
public const string GenericArgIsStaticClass = "'{0}': static types cannot be used as type arguments";
public const string PartialMethodToDelegate = "Cannot create delegate from method '{0}' because it is a partial method without an implementing declaration";
public const string RefReadonlyStatic2 = "Fields of static readonly field '{0}' cannot be passed ref or out (except in a static constructor)";
public const string AssgReadonlyLocalCause = "Cannot assign to '{0}' because it is a '{1}'";
public const string RefReadonlyLocalCause = "Cannot pass '{0}' as a ref or out argument because it is a '{1}'";
- public const string ThisStructNotInAnonMeth = "Anonymous methods, lambda expressions, and query expressions inside structs cannot access instance members of 'this'. Consider copying 'this' to a local variable outside the anonymous method, lambda expression or query expression and using the local instead.";
public const string DelegateOnNullable = "Cannot bind delegate to '{0}' because it is a member of 'System.Nullable<T>'";
public const string BadCtorArgCount = "'{0}' does not contain a constructor that takes '{1}' arguments";
public const string BadExtensionArgTypes = "'{0}' does not contain a definition for '{1}' and the best extension method overload '{2}' has some invalid arguments";
public const string BadNamedArgumentForDelegateInvoke = "The delegate '{0}' does not have a parameter named '{1}'";
public const string DuplicateNamedArgument = "Named argument '{0}' cannot be specified multiple times";
public const string NamedArgumentUsedInPositional = "Named argument '{0}' specifies a parameter for which a positional argument has already been given";
+ public const string TypeArgumentRequiredForStaticCall = "The first argument to dynamically-bound static call must be a Type";
}
<AppDesignerFolder>Properties</AppDesignerFolder>\r
<RootNamespace>Mono.CSharp</RootNamespace>\r
<AssemblyName>Mono.CSharp</AssemblyName>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+ <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
<FileUpgradeFlags>\r
</FileUpgradeFlags>\r
<Compile Include="..\Mono.CompilerServices.SymbolWriter\SourceMethodBuilder.cs">\r
<Link>SourceMethodBuilder.cs</Link>\r
</Compile>\r
+ <Compile Include="..\..\mcs\tuples.cs">\r
+ <Link>tuples.cs</Link>\r
+ </Compile>\r
</ItemGroup>\r
<ItemGroup>\r
<Folder Include="Properties\" />\r
<PropertyGroup>\r
<PreBuildEvent>"$(ProjectDir)..\..\jay\jay" -cvt < "$(ProjectDir)..\..\jay\skeleton.cs" "$(ProjectDir)..\..\mcs\cs-parser.jay" > "$(ProjectDir)cs-parser.cs"</PreBuildEvent>\r
</PropertyGroup>\r
-</Project>
+</Project>\r
object res = Evaluator.Evaluate ("attr.GetType().Name;");
Assert.AreEqual ("A", res);
}
+
+ [Test]
+ public void EnumType ()
+ {
+ Evaluator.Run ("public class TestClass { private TestEnum _te; public string Get() { return _te.ToString(); } } public enum TestEnum { First, Second }");
+ }
}
}
\ No newline at end of file
<Compile Include="Mono.Profiler.Log\LogEventVisitor.cs" />\r
<Compile Include="Mono.Profiler.Log\LogException.cs" />\r
<Compile Include="Mono.Profiler.Log\LogProcessor.cs" />\r
+ <Compile Include="Mono.Profiler.Log\LogProfiler.cs" />\r
<Compile Include="Mono.Profiler.Log\LogReader.cs" />\r
- <Compile Include="Mono.Profiler.Log\LogRuntimeProfiler.cs" />\r
<Compile Include="Mono.Profiler.Log\LogStream.cs" />\r
<Compile Include="Mono.Profiler.Log\LogStreamHeader.cs" />\r </ItemGroup>\r
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+using System.Security;
namespace Mono.Profiler.Log {
try {
GetMaxStackTraceFrames ();
return (bool) (_attached = true);
- } catch (MissingMethodException) {
+ } catch (Exception e) when (e is MissingMethodException || e is SecurityException) {
return (bool) (_attached = false);
}
}
namespace System.Security.Cryptography.X509Certificates
{
- public static class RSACertificateExtensions
+#if SYSTEM_SECURITY_DLL
+ internal
+#else
+ public
+#endif
+ static class RSACertificateExtensions
{
public static RSA GetRSAPrivateKey(this X509Certificate2 certificate)
{
}
[Test]
- [Ignore ("https://bugzilla.xamarin.com/show_bug.cgi?id=36634")]
public void Bug609381 ()
{
string portName = "ipc" + Guid.NewGuid ().ToString ("N");
LIBRARY = System.Security.dll
LIB_REFS = secxml/System bare/System.Xml $(MONO_SECURITY)
-LIB_MCS_FLAGS = -nowarn:618 \
- -d:SECURITY_DEP \
- -nowarn:414
+LIB_MCS_FLAGS = \
+ -nowarn:414,618 \
+ -d:SECURITY_DEP,SYSTEM_SECURITY_DLL
LOCAL_MCS_FLAGS =
+++ /dev/null
-//
-// XmlCanonicalizer.cs - C14N implementation for XML Signature
-// http://www.w3.org/TR/xml-c14n
-//
-// Author:
-// Aleksey Sanin (aleksey@aleksey.com)
-//
-// (C) 2003 Aleksey Sanin (aleksey@aleksey.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.Collections;
-using System.IO;
-using System.Text;
-using System.Xml;
-
-namespace Mono.Xml {
-
- internal class XmlCanonicalizer {
-
- private enum XmlCanonicalizerState
- {
- BeforeDocElement,
- InsideDocElement,
- AfterDocElement
- }
-
- // c14n parameters
- private bool comments;
- private bool exclusive;
- string inclusiveNamespacesPrefixList;
-
- // input/output
- private XmlNodeList xnl;
- private StringBuilder res;
-
- // namespaces rendering stack
- private XmlCanonicalizerState state;
- private ArrayList visibleNamespaces;
- private int prevVisibleNamespacesStart;
- private int prevVisibleNamespacesEnd;
- private Hashtable propagatedNss;
-
- public XmlCanonicalizer (bool withComments, bool excC14N, Hashtable propagatedNamespaces)
- {
- res = new StringBuilder ();
- comments = withComments;
- exclusive = excC14N;
- propagatedNss = propagatedNamespaces;
- }
-
- void Initialize ()
- {
- state = XmlCanonicalizerState.BeforeDocElement;
- visibleNamespaces = new ArrayList ();
- prevVisibleNamespacesStart = 0;
- prevVisibleNamespacesEnd = 0;
- res.Length = 0;
- }
-
- public Stream Canonicalize (XmlDocument doc)
- {
- if (doc == null)
- throw new ArgumentNullException ("doc");
- Initialize ();
-
- FillMissingPrefixes (doc, new XmlNamespaceManager (doc.NameTable), new ArrayList ());
- WriteDocumentNode (doc);
-
- UTF8Encoding utf8 = new UTF8Encoding ();
- byte[] data = utf8.GetBytes (res.ToString ());
- return new MemoryStream (data);
- }
-
- public Stream Canonicalize (XmlNodeList nodes)
- {
- xnl = nodes;
- if (nodes == null || nodes.Count < 1)
- return new MemoryStream ();
- XmlNode n = nodes [0];
- return Canonicalize (n.NodeType == XmlNodeType.Document ? n as XmlDocument : n.OwnerDocument);
- }
-
- // See xml-enc-c14n specification
- public string InclusiveNamespacesPrefixList {
- get { return inclusiveNamespacesPrefixList; }
- set { inclusiveNamespacesPrefixList = value; }
- }
-
- XmlAttribute CreateXmlns (XmlNode n)
- {
- XmlAttribute a = n.Prefix.Length == 0 ?
- n.OwnerDocument.CreateAttribute ("xmlns", "http://www.w3.org/2000/xmlns/") :
- n.OwnerDocument.CreateAttribute ("xmlns", n.Prefix, "http://www.w3.org/2000/xmlns/");
- a.Value = n.NamespaceURI;
- return a;
- }
-
- // Note that this must be done *before* filtering nodes out
- // by context node list.
- private void FillMissingPrefixes (XmlNode n, XmlNamespaceManager nsmgr, ArrayList tmpList)
- {
- if (n.Prefix.Length == 0 && propagatedNss != null) {
- foreach (DictionaryEntry de in propagatedNss)
- if ((string) de.Value == n.NamespaceURI) {
- n.Prefix = (string) de.Key;
- break;
- }
- }
-
- if (n.NodeType == XmlNodeType.Element && ((XmlElement) n).HasAttributes) {
- foreach (XmlAttribute a in n.Attributes)
- if (a.NamespaceURI == "http://www.w3.org/2000/xmlns/")
- nsmgr.AddNamespace (a.Prefix.Length == 0 ? String.Empty : a.LocalName, a.Value);
- nsmgr.PushScope ();
- }
-
- if (n.NamespaceURI.Length > 0 && nsmgr.LookupPrefix (n.NamespaceURI) == null)
- tmpList.Add (CreateXmlns (n));
-
- if (n.NodeType == XmlNodeType.Element && ((XmlElement) n).HasAttributes) {
- foreach (XmlAttribute a in n.Attributes)
- if (a.NamespaceURI.Length > 0 && nsmgr.LookupNamespace (a.Prefix) == null)
- tmpList.Add (CreateXmlns (a));
- }
-
- foreach (XmlAttribute a in tmpList)
- ((XmlElement) n).SetAttributeNode (a);
- tmpList.Clear ();
-
- if (n.HasChildNodes) {
- for (XmlNode c = n.FirstChild; c != null; c = c.NextSibling)
- if (c.NodeType == XmlNodeType.Element)
- FillMissingPrefixes (c, nsmgr, tmpList);
- }
- nsmgr.PopScope ();
- }
-
- private void WriteNode (XmlNode node)
- {
- // Console.WriteLine ("C14N Debug: node=" + node.Name);
-
- bool visible = IsNodeVisible (node);
- switch (node.NodeType) {
- case XmlNodeType.Document:
- case XmlNodeType.DocumentFragment:
- WriteDocumentNode (node);
- break;
- case XmlNodeType.Element:
- WriteElementNode (node, visible);
- break;
- case XmlNodeType.CDATA:
- case XmlNodeType.SignificantWhitespace:
- case XmlNodeType.Text:
- // CDATA sections are processed as text nodes
- WriteTextNode (node, visible);
- break;
- case XmlNodeType.Whitespace:
- if (state == XmlCanonicalizerState.InsideDocElement)
- WriteTextNode (node, visible);
- break;
- case XmlNodeType.Comment:
- WriteCommentNode (node, visible);
- break;
- case XmlNodeType.ProcessingInstruction:
- WriteProcessingInstructionNode (node, visible);
- break;
- case XmlNodeType.EntityReference:
- for (int i = 0; i < node.ChildNodes.Count; i++)
- WriteNode (node.ChildNodes [i]);
- break;
- case XmlNodeType.Attribute:
- throw new XmlException ("Attribute node is impossible here", null);
- case XmlNodeType.EndElement:
- throw new XmlException ("EndElement node is impossible here", null);
- case XmlNodeType.EndEntity:
- throw new XmlException ("EndEntity node is impossible here", null);
- case XmlNodeType.DocumentType:
- case XmlNodeType.Entity:
- case XmlNodeType.Notation:
- case XmlNodeType.XmlDeclaration:
- // just do nothing
- break;
- }
- }
-
- private void WriteDocumentNode (XmlNode node)
- {
- state = XmlCanonicalizerState.BeforeDocElement;
- for (XmlNode child = node.FirstChild; child != null; child = child.NextSibling)
- WriteNode (child);
- }
-
- // Element Nodes
- // If the element is not in the node-set, then the result is obtained
- // by processing the namespace axis, then the attribute axis, then
- // processing the child nodes of the element that are in the node-set
- // (in document order). If the element is inthe node-set, then the result
- // is an open angle bracket (<), the element QName, the result of
- // processing the namespace axis, the result of processing the attribute
- // axis, a close angle bracket (>), the result of processing the child
- // nodes of the element that are in the node-set (in document order), an
- // open angle bracket, a forward slash (/), the element QName, and a close
- // angle bracket.
- private void WriteElementNode (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: element node");
-
- // remember current state
- int savedPrevVisibleNamespacesStart = prevVisibleNamespacesStart;
- int savedPrevVisibleNamespacesEnd = prevVisibleNamespacesEnd;
- int savedVisibleNamespacesSize = visibleNamespaces.Count;
- XmlCanonicalizerState s = state;
- if (visible && state == XmlCanonicalizerState.BeforeDocElement)
- state = XmlCanonicalizerState.InsideDocElement;
-
- // write start tag
- if (visible) {
- res.Append ("<");
- res.Append (node.Name);
- }
-
- // this is odd but you can select namespaces
- // and attributes even if node itself is not visible
- WriteNamespacesAxis (node, visible);
- WriteAttributesAxis (node);
-
- if (visible)
- res.Append (">");
-
- // write children
- for (XmlNode child = node.FirstChild; child != null; child = child.NextSibling)
- WriteNode (child);
-
- // write end tag
- if (visible) {
- res.Append ("</");
- res.Append (node.Name);
- res.Append (">");
- }
-
- // restore state
- if (visible && s == XmlCanonicalizerState.BeforeDocElement)
- state = XmlCanonicalizerState.AfterDocElement;
- prevVisibleNamespacesStart = savedPrevVisibleNamespacesStart;
- prevVisibleNamespacesEnd = savedPrevVisibleNamespacesEnd;
- if (visibleNamespaces.Count > savedVisibleNamespacesSize) {
- visibleNamespaces.RemoveRange (savedVisibleNamespacesSize,
- visibleNamespaces.Count - savedVisibleNamespacesSize);
- }
- }
-
- // Namespace Axis
- // Consider a list L containing only namespace nodes in the
- // axis and in the node-set in lexicographic order (ascending). To begin
- // processing L, if the first node is not the default namespace node (a node
- // with no namespace URI and no local name), then generate a space followed
- // by xmlns="" if and only if the following conditions are met:
- // - the element E that owns the axis is in the node-set
- // - The nearest ancestor element of E in the node-set has a default
- // namespace node in the node-set (default namespace nodes always
- // have non-empty values in XPath)
- // The latter condition eliminates unnecessary occurrences of xmlns="" in
- // the canonical form since an element only receives an xmlns="" if its
- // default namespace is empty and if it has an immediate parent in the
- // canonical form that has a non-empty default namespace. To finish
- // processing L, simply process every namespace node in L, except omit
- // namespace node with local name xml, which defines the xml prefix,
- // if its string value is http://www.w3.org/XML/1998/namespace.
- private void WriteNamespacesAxis (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: namespaces");
-
- XmlDocument doc = node.OwnerDocument;
- bool has_empty_namespace = false;
- ArrayList list = new ArrayList ();
- for (XmlNode cur = node; cur != null && cur != doc; cur = cur.ParentNode) {
- foreach (XmlAttribute attribute in cur.Attributes) {
- if (!IsNamespaceNode (attribute))
- continue;
-
- // get namespace prefix
- string prefix = string.Empty;
- if (attribute.Prefix == "xmlns")
- prefix = attribute.LocalName;
-
- // check if it is "xml" namespace
- if (prefix == "xml" && attribute.Value == "http://www.w3.org/XML/1998/namespace")
- continue;
-
- // make sure that this is an active namespace
- // for our node
- string ns = node.GetNamespaceOfPrefix (prefix);
- if (ns != attribute.Value)
- continue;
-
- // check that it is selected with XPath
- if (!IsNodeVisible (attribute))
- continue;
-
- // check that we have not rendered it yet
- bool rendered = IsNamespaceRendered (prefix, attribute.Value);
-
- // For exc-c14n, only visibly utilized
- // namespaces are written.
- if (exclusive && !IsVisiblyUtilized (node as XmlElement, attribute))
- continue;
-
- // add to the visible namespaces stack
- if (visible)
- visibleNamespaces.Add (attribute);
-
- if (!rendered)
- list.Add (attribute);
-
- if (prefix == string.Empty)
- has_empty_namespace = true;
- }
- }
-
- // add empty namespace if needed
- if (visible && !has_empty_namespace && !IsNamespaceRendered (string.Empty, string.Empty) && node.NamespaceURI == String.Empty)
- res.Append (" xmlns=\"\"");
-
- list.Sort (new XmlDsigC14NTransformNamespacesComparer ());
- foreach (object obj in list) {
- XmlNode attribute = (obj as XmlNode);
- if (attribute != null) {
- res.Append (" ");
- res.Append (attribute.Name);
- res.Append ("=\"");
- res.Append (attribute.Value);
- res.Append ("\"");
- }
- }
-
- // move the rendered namespaces stack
- if (visible) {
- prevVisibleNamespacesStart = prevVisibleNamespacesEnd;
- prevVisibleNamespacesEnd = visibleNamespaces.Count;
- }
- }
-
- // Attribute Axis
- // In lexicographic order (ascending), process each node that
- // is in the element's attribute axis and in the node-set.
- //
- // The processing of an element node E MUST be modified slightly
- // when an XPath node-set is given as input and the element's
- // parent is omitted from the node-set.
- private void WriteAttributesAxis (XmlNode node)
- {
- // Console.WriteLine ("Debug: attributes");
-
- ArrayList list = new ArrayList ();
- foreach (XmlNode attribute in node.Attributes) {
- if (!IsNamespaceNode (attribute) && IsNodeVisible (attribute))
- list.Add (attribute);
- }
-
- // Add attributes from "xml" namespace for "inclusive" c14n only:
- //
- // The method for processing the attribute axis of an element E
- // in the node-set is enhanced. All element nodes along E's
- // ancestor axis are examined for nearest occurrences of
- // attributes in the xml namespace, such as xml:lang and
- // xml:space (whether or not they are in the node-set).
- // From this list of attributes, remove any that are in E's
- // attribute axis (whether or not they are in the node-set).
- // Then, lexicographically merge this attribute list with the
- // nodes of E's attribute axis that are in the node-set. The
- // result of visiting the attribute axis is computed by
- // processing the attribute nodes in this merged attribute list.
- if (!exclusive && node.ParentNode != null && node.ParentNode.ParentNode != null && !IsNodeVisible (node.ParentNode.ParentNode)) {
- // if we have whole document then the node.ParentNode.ParentNode
- // is always visible
- for (XmlNode cur = node.ParentNode; cur != null; cur = cur.ParentNode) {
- if (cur.Attributes == null)
- continue;
- foreach (XmlNode attribute in cur.Attributes) {
- // we are looking for "xml:*" attributes
- if (attribute.Prefix != "xml")
- continue;
-
- // exclude ones that are in the node's attributes axis
- if (node.Attributes.GetNamedItem (attribute.LocalName, attribute.NamespaceURI) != null)
- continue;
-
- // finally check that we don't have the same attribute in our list
- bool found = false;
- foreach (object obj in list) {
- XmlNode n = (obj as XmlNode);
- if (n.Prefix == "xml" && n.LocalName == attribute.LocalName) {
- found = true;
- break;
- }
- }
-
- if (found)
- continue;
-
- // now we can add this attribute to our list
- list.Add (attribute);
- }
- }
- }
-
- // sort namespaces and write results
- list.Sort (new XmlDsigC14NTransformAttributesComparer ());
- foreach (object obj in list) {
- XmlNode attribute = (obj as XmlNode);
- if (attribute != null) {
- res.Append (" ");
- res.Append (attribute.Name);
- res.Append ("=\"");
- res.Append (NormalizeString (attribute.Value, XmlNodeType.Attribute));
- res.Append ("\"");
- }
- }
- }
-
- // Text Nodes
- // the string value, except all ampersands are replaced
- // by &, all open angle brackets (<) are replaced by <, all closing
- // angle brackets (>) are replaced by >, and all #xD characters are
- // replaced by 
.
- private void WriteTextNode (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: text node");
- if (visible)
- res.Append (NormalizeString (node.Value, node.NodeType));
-// res.Append (NormalizeString (node.Value, XmlNodeType.Text));
- }
-
- // Comment Nodes
- // Nothing if generating canonical XML without comments. For
- // canonical XML with comments, generate the opening comment
- // symbol (<!--), the string value of the node, and the
- // closing comment symbol (-->). Also, a trailing #xA is rendered
- // after the closing comment symbol for comment children of the
- // root node with a lesser document order than the document
- // element, and a leading #xA is rendered before the opening
- // comment symbol of comment children of the root node with a
- // greater document order than the document element. (Comment
- // children of the root node represent comments outside of the
- // top-level document element and outside of the document type
- // declaration).
- private void WriteCommentNode (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: comment node");
- if (visible && comments) {
- if (state == XmlCanonicalizerState.AfterDocElement)
- res.Append ("\x0A<!--");
- else
- res.Append ("<!--");
-
- res.Append (NormalizeString (node.Value, XmlNodeType.Comment));
-
- if (state == XmlCanonicalizerState.BeforeDocElement)
- res.Append ("-->\x0A");
- else
- res.Append ("-->");
- }
- }
-
- // Processing Instruction (PI) Nodes-
- // The opening PI symbol (<?), the PI target name of the node,
- // a leading space and the string value if it is not empty, and
- // the closing PI symbol (?>). If the string value is empty,
- // then the leading space is not added. Also, a trailing #xA is
- // rendered after the closing PI symbol for PI children of the
- // root node with a lesser document order than the document
- // element, and a leading #xA is rendered before the opening PI
- // symbol of PI children of the root node with a greater document
- // order than the document element.
- private void WriteProcessingInstructionNode (XmlNode node, bool visible)
- {
- // Console.WriteLine ("Debug: PI node");
-
- if (visible) {
- if (state == XmlCanonicalizerState.AfterDocElement)
- res.Append ("\x0A<?");
- else
- res.Append ("<?");
-
- res.Append (node.Name);
- if (node.Value.Length > 0) {
- res.Append (" ");
- res.Append (NormalizeString (node.Value, XmlNodeType.ProcessingInstruction));
- }
-
- if (state == XmlCanonicalizerState.BeforeDocElement)
- res.Append ("?>\x0A");
- else
- res.Append ("?>");
- }
- }
-
- // determines whether the node is in the node-set or not.
- private bool IsNodeVisible (XmlNode node)
- {
- // if node list is empty then we process whole document
- if (xnl == null)
- return true;
-
- // walk thru the list
- foreach (XmlNode xn in xnl) {
- if (node.Equals (xn))
- return true;
- }
-
- return false;
- }
-
- // This method assumes that the namespace node is *not*
- // rendered yet.
- private bool IsVisiblyUtilized (XmlElement owner, XmlAttribute ns)
- {
- if (owner == null)
- return false;
-
- string prefix = ns.LocalName == "xmlns" ? String.Empty : ns.LocalName;
- if (owner.Prefix == prefix && owner.NamespaceURI == ns.Value)
- return true;
- if (!owner.HasAttributes)
- return false;
- foreach (XmlAttribute a in owner.Attributes) {
- if (a.Prefix == String.Empty)
- continue;
- if (a.Prefix != prefix || a.NamespaceURI != ns.Value)
- continue;
- if (IsNodeVisible (a))
- return true;
- }
- return false;
- }
-
- private bool IsNamespaceRendered (string prefix, string uri)
- {
- // if the default namespace xmlns="" is not re-defined yet
- // then we do not want to print it out
- bool IsEmptyNs = prefix == string.Empty && uri == string.Empty;
- int start = (IsEmptyNs) ? 0 : prevVisibleNamespacesStart;
- for (int i = visibleNamespaces.Count - 1; i >= start; i--) {
- XmlNode node = (visibleNamespaces[i] as XmlNode);
- if (node != null) {
- // get namespace prefix
- string p = string.Empty;
- if (node.Prefix == "xmlns")
- p = node.LocalName;
- if (p == prefix)
- return node.Value == uri;
- }
- }
-
- return IsEmptyNs;
- }
-
- private bool IsNamespaceNode (XmlNode node)
- {
- if (node == null || node.NodeType != XmlNodeType.Attribute)
- return false;
- return node.NamespaceURI == "http://www.w3.org/2000/xmlns/";
- }
-
- private bool IsTextNode (XmlNodeType type)
- {
- switch (type) {
- case XmlNodeType.Text:
- case XmlNodeType.CDATA:
- case XmlNodeType.SignificantWhitespace:
- case XmlNodeType.Whitespace:
- return true;
- }
- return false;
- }
-
- private string NormalizeString (string input, XmlNodeType type)
- {
- StringBuilder sb = new StringBuilder ();
- for (int i = 0; i < input.Length; i++) {
- char ch = input[i];
- if (ch == '<' && (type == XmlNodeType.Attribute || IsTextNode (type)))
- sb.Append ("<");
- else if (ch == '>' && IsTextNode (type))
- sb.Append (">");
- else if (ch == '&' && (type == XmlNodeType.Attribute || IsTextNode (type)))
- sb.Append ("&");
- else if (ch == '\"' && type == XmlNodeType.Attribute)
- sb.Append (""");
- else if (ch == '\x09' && type == XmlNodeType.Attribute)
- sb.Append ("	");
- else if (ch == '\x0A' && type == XmlNodeType.Attribute)
- sb.Append ("
");
- else if (ch == '\x0D')
- sb.Append ("
");
- else
- sb.Append (ch);
- }
-
- return sb.ToString ();
- }
- }
-
- internal class XmlDsigC14NTransformAttributesComparer : IComparer
- {
- public int Compare (object x, object y)
- {
- XmlNode n1 = (x as XmlNode);
- XmlNode n2 = (y as XmlNode);
-
- // simple cases
- if (n1 == n2)
- return 0;
- else if (n1 == null)
- return -1;
- else if (n2 == null)
- return 1;
- else if (n1.Prefix == n2.Prefix)
- return string.CompareOrdinal (n1.LocalName, n2.LocalName);
-
- // Attributes in the default namespace are first
- // because the default namespace is not applied to
- // unqualified attributes
- if (n1.Prefix == string.Empty)
- return -1;
- else if (n2.Prefix == string.Empty)
- return 1;
-
- int ret = string.Compare (n1.NamespaceURI, n2.NamespaceURI);
- if (ret == 0)
- ret = string.Compare (n1.LocalName, n2.LocalName);
- return ret;
- }
- }
-
- internal class XmlDsigC14NTransformNamespacesComparer : IComparer
- {
- public int Compare (object x, object y)
- {
- XmlNode n1 = (x as XmlNode);
- XmlNode n2 = (y as XmlNode);
-
- // simple cases
- if (n1 == n2)
- return 0;
- else if (n1 == null)
- return -1;
- else if (n2 == null)
- return 1;
- else if (n1.Prefix == string.Empty)
- return -1;
- else if (n2.Prefix == string.Empty)
- return 1;
-
- return string.Compare (n1.LocalName, n2.LocalName);
- }
- }
-}
-
<SchemaVersion>2.0</SchemaVersion>\r
<ProjectGuid>{3ED36717-A9D1-4289-8949-9B7F39766DEB}</ProjectGuid>\r
<OutputType>Library</OutputType>\r
- <NoWarn>1699,618,414</NoWarn>\r
+ <NoWarn>1699,414,618</NoWarn>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
- <NoWarn>1699,618,414</NoWarn>\r
+ <NoWarn>1699,414,618</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SECURITY_DEP</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SECURITY_DEP;SYSTEM_SECURITY_DLL</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,618,414</NoWarn>\r
+ <NoWarn>1699,414,618</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SECURITY_DEP</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;SECURITY_DEP;SYSTEM_SECURITY_DLL</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
</PropertyGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<ItemGroup>\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\AncestralNamespaceContextManager.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\AttributeSortOrder.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\C14NAncestralNamespaceContextManager.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalizationDispatcher.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXml.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlAttribute.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlCDataSection.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlComment.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlDocument.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlElement.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlEntityReference.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlNodeList.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlProcessingInstruction.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlSignificantWhitespace.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlText.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CanonicalXmlWhitespace.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CertUsageType.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\CryptoHelpers.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\DocPosition.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\DSASignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\ExcAncestralNamespaceContextManager.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\ExcCanonicalXml.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\ICanonicalizableNode.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\MyXmlDocument.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\NamespaceFrame.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\NamespaceSortOrder.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\Reference.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\ReferenceTargetType.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SHA1SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SHA256SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SHA384SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SHA512SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\RSAPKCS1SignatureDescription.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\SignedXmlDebugLog.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\Transform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\TransformChain.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\Utils.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDecryptionTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigBase64Transform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigC14NTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigC14NWithCommentsTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigEnvelopedSignatureTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigExcC14NTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigExcC14NWithCommentsTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigXPathTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlDsigXsltTransform.cs" />\r
+ <Compile Include="..\..\..\external\corefx\src\System.Security.Cryptography.Xml\src\System\Security\Cryptography\Xml\XmlLicenseTransform.cs" />\r
<Compile Include="..\..\build\common\Consts.cs" />\r
<Compile Include="..\..\build\common\Locale.cs" />\r
<Compile Include="..\..\build\common\MonoTODOAttribute.cs" />\r
+ <Compile Include="..\System.Core\System.Security.Cryptography.X509Certificates\RSACertificateExtensions.cs" />\r
<Compile Include="Assembly\AssemblyInfo.cs" />\r
<Compile Include="corefx\SR.cs" />\r
<Compile Include="Mono.Security.Cryptography\ManagedProtection.cs" />\r
<Compile Include="Mono.Security.Cryptography\NativeDapiProtection.cs" />\r
- <Compile Include="Mono.Xml\XmlCanonicalizer.cs" />\r
<Compile Include="System.Security.Cryptography.Pkcs\AlgorithmIdentifier.cs" />\r
<Compile Include="System.Security.Cryptography.Pkcs\CmsRecipient.cs" />\r
<Compile Include="System.Security.Cryptography.Pkcs\CmsRecipientCollection.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\KeyInfoX509Data.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\KeyReference.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\Manifest.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\Reference.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\ReferenceList.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\RSAKeyValue.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\Signature.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\SignedInfo.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\SignedXml.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\SymmetricKeyWrap.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\Transform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\TransformChain.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\X509IssuerSerial.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDecryptionTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigBase64Transform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigC14NTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigC14NWithCommentsTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigEnvelopedSignatureTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigExcC14NTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigExcC14NWithCommentsTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigNodeList.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigXPathTransform.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlDsigXsltTransform.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\XmlEncryption.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlLicenseTransform.cs" />\r
<Compile Include="System.Security.Cryptography.Xml\XmlSignature.cs" />\r
- <Compile Include="System.Security.Cryptography.Xml\XmlSignatureStreamReader.cs" />\r
<Compile Include="System.Security.Cryptography\CryptographicAttribute.cs" />\r
<Compile Include="System.Security.Cryptography\CryptographicAttributeCollection.cs" />\r
<Compile Include="System.Security.Cryptography\CryptographicAttributeEnumerator.cs" />\r
foreach (XmlNode xn in ((XmlElement) n).GetElementsByTagName (XmlSignature.ElementNames.Transform, XmlSignature.NamespaceURI)) {
Transform t = null;
switch (((XmlElement) xn).Attributes [XmlSignature.AttributeNames.Algorithm].Value) {
- case XmlSignature.AlgorithmNamespaces.XmlDsigBase64Transform:
+ case SignedXml.XmlDsigBase64TransformUrl:
t = new XmlDsigBase64Transform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigC14NTransform:
+ case SignedXml.XmlDsigC14NTransformUrl:
t = new XmlDsigC14NTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform:
+ case SignedXml.XmlDsigC14NWithCommentsTransformUrl:
t = new XmlDsigC14NWithCommentsTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform:
+ case SignedXml.XmlDsigEnvelopedSignatureTransformUrl:
t = new XmlDsigEnvelopedSignatureTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigXPathTransform:
+ case SignedXml.XmlDsigXPathTransformUrl:
t = new XmlDsigXPathTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigXsltTransform:
+ case SignedXml.XmlDsigXsltTransformUrl:
t = new XmlDsigXsltTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NTransform:
+ case SignedXml.XmlDsigExcC14NTransformUrl:
t = new XmlDsigExcC14NTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform:
+ case SignedXml.XmlDsigExcC14NWithCommentsTransformUrl:
t = new XmlDsigExcC14NWithCommentsTransform ();
break;
- case XmlSignature.AlgorithmNamespaces.XmlDecryptionTransform:
+ case SignedXml.XmlDecryptionTransformUrl:
t = new XmlDecryptionTransform ();
break;
default:
+++ /dev/null
-//
-// Reference.cs - Reference implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.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.IO;
-using System.Runtime.InteropServices;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- // http://www.w3.org/TR/2002/REC-xmldsig-core-20020212/Overview.html#sec-Reference
- public class Reference {
-
- private TransformChain chain;
- private string digestMethod;
- private byte[] digestValue;
- private string id;
- private string uri;
- private string type;
- private Stream stream;
- private XmlElement element;
-
- public Reference ()
- {
- chain = new TransformChain ();
- digestMethod = XmlSignature.NamespaceURI + "sha1";
- }
-
- [MonoTODO ("There is no description about how it is used.")]
- public Reference (Stream stream) : this ()
- {
- this.stream = stream;
- }
-
- public Reference (string uri) : this ()
- {
- this.uri = uri;
- }
-
- // default to SHA1
- public string DigestMethod {
- get { return digestMethod; }
- set {
- element = null;
- digestMethod = value;
- }
- }
-
- public byte[] DigestValue {
- get { return digestValue; }
- set {
- element = null;
- digestValue = value;
- }
- }
-
- public string Id {
- get { return id; }
- set {
- element = null;
- id = value;
- }
- }
-
- public TransformChain TransformChain {
- get { return chain; }
- [ComVisible (false)]
- set { chain = value; }
- }
-
- public string Type {
- get { return type; }
- set {
- element = null;
- type = value;
- }
- }
-
- public string Uri {
- get { return uri; }
- set {
- element = null;
- uri = value;
- }
- }
-
- public void AddTransform (Transform transform)
- {
- chain.Add (transform);
- }
-
- public XmlElement GetXml ()
- {
- if (element != null)
- return element;
-
- if (digestMethod == null)
- throw new CryptographicException ("DigestMethod");
- if (digestValue == null)
- throw new NullReferenceException ("DigestValue");
-
- XmlDocument document = new XmlDocument ();
- XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Reference, XmlSignature.NamespaceURI);
- if (id != null)
- xel.SetAttribute (XmlSignature.AttributeNames.Id, id);
- if (uri != null)
- xel.SetAttribute (XmlSignature.AttributeNames.URI, uri);
- if (type != null)
- xel.SetAttribute (XmlSignature.AttributeNames.Type, type);
-
- if (chain.Count > 0) {
- XmlElement ts = document.CreateElement (XmlSignature.ElementNames.Transforms, XmlSignature.NamespaceURI);
- foreach (Transform t in chain) {
- XmlNode xn = t.GetXml ();
- XmlNode newNode = document.ImportNode (xn, true);
- ts.AppendChild (newNode);
- }
- xel.AppendChild (ts);
- }
-
- XmlElement dm = document.CreateElement (XmlSignature.ElementNames.DigestMethod, XmlSignature.NamespaceURI);
- dm.SetAttribute (XmlSignature.AttributeNames.Algorithm, digestMethod);
- xel.AppendChild (dm);
-
- XmlElement dv = document.CreateElement (XmlSignature.ElementNames.DigestValue, XmlSignature.NamespaceURI);
- dv.InnerText = Convert.ToBase64String (digestValue);
- xel.AppendChild (dv);
-
- return xel;
- }
-
- // note: we do NOT return null -on purpose- if attribute isn't found
- private string GetAttribute (XmlElement xel, string attribute)
- {
- XmlAttribute xa = xel.Attributes [attribute];
- return ((xa != null) ? xa.InnerText : null);
- }
-
- public void LoadXml (XmlElement value)
- {
- if (value == null)
- throw new ArgumentNullException ("value");
-
- if ((value.LocalName != XmlSignature.ElementNames.Reference) || (value.NamespaceURI != XmlSignature.NamespaceURI))
- throw new CryptographicException ();
-
- id = GetAttribute (value, XmlSignature.AttributeNames.Id);
- uri = GetAttribute (value, XmlSignature.AttributeNames.URI);
- type = GetAttribute (value, XmlSignature.AttributeNames.Type);
- // Note: order is important for validations
- XmlNodeList xnl = value.GetElementsByTagName (XmlSignature.ElementNames.Transform, XmlSignature.NamespaceURI);
- if ((xnl != null) && (xnl.Count > 0)) {
- Transform t = null;
- foreach (XmlNode xn in xnl) {
- string a = GetAttribute ((XmlElement)xn, XmlSignature.AttributeNames.Algorithm);
-/* This code is useful for debugging in VS.NET because using CryptoConfig
- (from MS mscorlib) would throw InvalidCastException because it's
- Transform would come from MS System.Security.dll not Mono's.
- switch (a) {
- case "http://www.w3.org/2000/09/xmldsig#base64":
- t = new XmlDsigBase64Transform ();
- break;
- case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315":
- t = new XmlDsigC14NTransform ();
- break;
- case "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments":
- t = new XmlDsigC14NWithCommentsTransform ();
- break;
- case "http://www.w3.org/2000/09/xmldsig#enveloped-signature":
- t = new XmlDsigEnvelopedSignatureTransform ();
- break;
- case "http://www.w3.org/TR/1999/REC-xpath-19991116":
- t = new XmlDsigXPathTransform ();
- break;
- case "http://www.w3.org/TR/1999/REC-xslt-19991116":
- t = new XmlDsigXsltTransform ();
- break;
- case "http://www.w3.org/2002/07/decrypt#XML":
- t = new XmlDecryptionTransform ();
- break;
- default:
- throw new NotSupportedException ();
- }
-*/
- t = (Transform) CryptoConfig.CreateFromName (a);
- if (t == null)
- throw new CryptographicException ("Unknown transform {0}.", a);
-
- if (xn.ChildNodes.Count > 0) {
- t.LoadInnerXml (xn.ChildNodes);
- }
- AddTransform (t);
- }
- }
- // get DigestMethod
- DigestMethod = XmlSignature.GetAttributeFromElement (value, XmlSignature.AttributeNames.Algorithm, XmlSignature.ElementNames.DigestMethod);
- // get DigestValue
- XmlElement dig = XmlSignature.GetChildElement (value, XmlSignature.ElementNames.DigestValue, XmlSignature.NamespaceURI);
- if (dig != null)
- DigestValue = Convert.FromBase64String (dig.InnerText);
- element = value;
- }
- }
-}
namespace System.Security.Cryptography.Xml {
public class SignedXml {
-
- public const string XmlDsigCanonicalizationUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
- public const string XmlDsigCanonicalizationWithCommentsUrl = XmlDsigCanonicalizationUrl + "#WithComments";
- public const string XmlDsigDSAUrl = XmlDsigNamespaceUrl + "dsa-sha1";
- public const string XmlDsigHMACSHA1Url = XmlDsigNamespaceUrl + "hmac-sha1";
- public const string XmlDsigMinimalCanonicalizationUrl = XmlDsigNamespaceUrl + "minimal";
- public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#";
- public const string XmlDsigRSASHA1Url = XmlDsigNamespaceUrl + "rsa-sha1";
- public const string XmlDsigSHA1Url = XmlDsigNamespaceUrl + "sha1";
-
- public const string XmlDecryptionTransformUrl = "http://www.w3.org/2002/07/decrypt#XML";
- public const string XmlDsigBase64TransformUrl = XmlDsigNamespaceUrl + "base64";
- public const string XmlDsigC14NTransformUrl = XmlDsigCanonicalizationUrl;
- public const string XmlDsigC14NWithCommentsTransformUrl = XmlDsigCanonicalizationWithCommentsUrl;
- public const string XmlDsigEnvelopedSignatureTransformUrl = XmlDsigNamespaceUrl + "enveloped-signature";
- public const string XmlDsigExcC14NTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#";
- public const string XmlDsigExcC14NWithCommentsTransformUrl = XmlDsigExcC14NTransformUrl + "WithComments";
- public const string XmlDsigXPathTransformUrl = "http://www.w3.org/TR/1999/REC-xpath-19991116";
- public const string XmlDsigXsltTransformUrl = "http://www.w3.org/TR/1999/REC-xslt-19991116";
- public const string XmlLicenseTransformUrl = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform";
+ public const string XmlDsigNamespaceUrl = "http://www.w3.org/2000/09/xmldsig#";
+ public const string XmlDsigMinimalCanonicalizationUrl = "http://www.w3.org/2000/09/xmldsig#minimal";
+ public const string XmlDsigCanonicalizationUrl = XmlDsigC14NTransformUrl;
+ public const string XmlDsigCanonicalizationWithCommentsUrl = XmlDsigC14NWithCommentsTransformUrl;
+
+ public const string XmlDsigSHA1Url = "http://www.w3.org/2000/09/xmldsig#sha1";
+ public const string XmlDsigDSAUrl = "http://www.w3.org/2000/09/xmldsig#dsa-sha1";
+ public const string XmlDsigRSASHA1Url = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
+ public const string XmlDsigHMACSHA1Url = "http://www.w3.org/2000/09/xmldsig#hmac-sha1";
+
+ public const string XmlDsigSHA256Url = "http://www.w3.org/2001/04/xmlenc#sha256";
+ public const string XmlDsigRSASHA256Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256";
+
+ // Yes, SHA384 is in the xmldsig-more namespace even though all the other SHA variants are in xmlenc. That's the standard.
+ public const string XmlDsigSHA384Url = "http://www.w3.org/2001/04/xmldsig-more#sha384";
+ public const string XmlDsigRSASHA384Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384";
+
+ public const string XmlDsigSHA512Url = "http://www.w3.org/2001/04/xmlenc#sha512";
+ public const string XmlDsigRSASHA512Url = "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512";
+
+ public const string XmlDsigC14NTransformUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
+ public const string XmlDsigC14NWithCommentsTransformUrl = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
+ public const string XmlDsigExcC14NTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#";
+ public const string XmlDsigExcC14NWithCommentsTransformUrl = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
+ public const string XmlDsigBase64TransformUrl = "http://www.w3.org/2000/09/xmldsig#base64";
+ public const string XmlDsigXPathTransformUrl = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+ public const string XmlDsigXsltTransformUrl = "http://www.w3.org/TR/1999/REC-xslt-19991116";
+ public const string XmlDsigEnvelopedSignatureTransformUrl = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
+ public const string XmlDecryptionTransformUrl = "http://www.w3.org/2002/07/decrypt#XML";
+ public const string XmlLicenseTransformUrl = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform";
private EncryptedXml encryptedXml;
private XmlElement signatureElement;
private Hashtable hashes;
// FIXME: enable it after CAS implementation
- private XmlResolver xmlResolver = new XmlUrlResolver ();
+ internal XmlResolver _xmlResolver = new XmlUrlResolver ();
+ private bool _bResolverSet = true;
+ internal XmlElement _context;
private ArrayList manifests;
private IEnumerator _x509Enumerator;
m_signature = new Signature ();
m_signature.SignedInfo = new SignedInfo ();
hashes = new Hashtable (2); // 98% SHA1 for now
+ _context = null;
}
public SignedXml (XmlDocument document) : this ()
if (document == null)
throw new ArgumentNullException ("document");
envdoc = document;
+ _context = document.DocumentElement;
}
public SignedXml (XmlElement elem) : this ()
if (elem == null)
throw new ArgumentNullException ("elem");
envdoc = new XmlDocument ();
+ _context = elem;
envdoc.LoadXml (elem.OuterXml);
}
set { m_strSigningKeyName = value; }
}
+ public XmlResolver Resolver
+ {
+ // This property only has a setter. The rationale for this is that we don't have a good value
+ // to return when it has not been explicitely set, as we are using XmlSecureResolver by default
+ set
+ {
+ _xmlResolver = value;
+ _bResolverSet = true;
+ }
+ }
+
+ internal bool ResolverSet
+ {
+ get { return _bResolverSet; }
+ }
+
public void AddObject (DataObject dataObject)
{
m_signature.AddObject (dataObject);
FixupNamespaceNodes (xel, doc.DocumentElement, false);
}
}
- else if (xmlResolver != null) {
+ else if (_xmlResolver != null) {
// TODO: need testing
- Stream s = (Stream) xmlResolver.GetEntity (new Uri (r.Uri), null, typeof (Stream));
+ Stream s = (Stream) _xmlResolver.GetEntity (new Uri (r.Uri), null, typeof (Stream));
doc.Load (s);
}
else if (r.Uri [0] == '#') {
objectName = r.Uri.Substring (1);
}
- else if (xmlResolver != null) {
+ else if (_xmlResolver != null) {
// TODO: test but doc says that Resolver = null -> no access
try {
// no way to know if valid without throwing an exception
Uri uri = new Uri (r.Uri);
- s = (Stream) xmlResolver.GetEntity (uri, null, typeof (Stream));
+ s = (Stream) _xmlResolver.GetEntity (uri, null, typeof (Stream));
}
catch {
// may still be a local file (and maybe not xml)
signatureElement = value;
m_signature.LoadXml (value);
+
+ if (_context == null) {
+ _context = value;
+ }
+
// Need to give the EncryptedXml object to the
// XmlDecryptionTransform to give it a fighting
// chance at decrypting the document.
}
}
}
-
- [ComVisible (false)]
- public XmlResolver Resolver {
- set { xmlResolver = value; }
- }
}
}
+++ /dev/null
-//
-// Transform.cs - Transform implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Atsushi Enomoto <atsushi@ximian.com>
-// Tim Coleman <tim@timcoleman.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2006 Novell Inc. (http://www.novell.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.Collections;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Security.Policy;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public abstract class Transform {
-
- private string algo;
- private XmlResolver xmlResolver;
- private Hashtable propagated_namespaces = new Hashtable ();
-
- protected Transform ()
- {
- if (SecurityManager.SecurityEnabled) {
- xmlResolver = new XmlSecureResolver (new XmlUrlResolver (), (Evidence) new Evidence ());
- } else {
- xmlResolver = new XmlUrlResolver ();
- }
- }
-
- #region Properties
-
- public string Algorithm {
- get { return algo; }
- set { algo = value; }
- }
-
- public abstract Type[] InputTypes {
- get;
- }
-
- public abstract Type[] OutputTypes {
- get;
- }
-
- [ComVisible(false)]
- public XmlResolver Resolver {
- set { xmlResolver = value; }
- }
-
- [MonoTODO]
- [ComVisible (false)]
- public XmlElement Context {
- get { throw new NotImplementedException (); }
- set { throw new NotImplementedException (); }
- }
-
- [ComVisible (false)]
- public Hashtable PropagatedNamespaces {
- get { return propagated_namespaces; }
- }
-
- #endregion // Properties
-
- #region Methods
- [ComVisible (false)]
- public virtual byte[] GetDigestedOutput (HashAlgorithm hash)
- {
- // no null check, MS throws a NullReferenceException here
- return hash.ComputeHash ((Stream) GetOutput (typeof (Stream)));
- }
-
- protected abstract XmlNodeList GetInnerXml ();
-
- public abstract object GetOutput ();
-
- public abstract object GetOutput (Type type);
-
- public XmlElement GetXml ()
- {
- XmlDocument document = new XmlDocument ();
- document.XmlResolver = GetResolver ();
- XmlElement xel = document.CreateElement (XmlSignature.ElementNames.Transform, XmlSignature.NamespaceURI);
- xel.SetAttribute (XmlSignature.AttributeNames.Algorithm, algo);
- XmlNodeList xnl = this.GetInnerXml ();
- if (xnl != null) {
- foreach (XmlNode xn in xnl) {
- XmlNode importedNode = document.ImportNode (xn, true);
- xel.AppendChild (importedNode);
- }
- }
- return xel;
- }
-
- public abstract void LoadInnerXml (XmlNodeList nodeList);
-
- public abstract void LoadInput (object obj);
-
- internal XmlResolver GetResolver ()
- {
- return xmlResolver;
- }
-
- #endregion // Methods
- }
-}
+++ /dev/null
-//
-// TransformChain.cs - TransformChain implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.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.Collections;
-
-namespace System.Security.Cryptography.Xml {
-
- public class TransformChain {
-
- private ArrayList chain;
-
- public TransformChain()
- {
- chain = new ArrayList ();
- }
-
- public int Count {
- get { return chain.Count; }
- }
-
- public Transform this [int index] {
- get { return (Transform) chain [index]; }
- }
-
- public void Add (Transform transform)
- {
- chain.Add (transform);
- }
-
- public IEnumerator GetEnumerator ()
- {
- return chain.GetEnumerator ();
- }
- }
-}
+++ /dev/null
-//
-// XmlDecryptionTransform.cs - XmlDecryptionTransform implementation for XML Encryption
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2004
-
-//
-// 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.Collections;
-using System.IO;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlDecryptionTransform : Transform {
-
- #region Fields
-
- EncryptedXml encryptedXml;
- Type[] inputTypes;
- Type[] outputTypes;
- object inputObj;
- ArrayList exceptUris;
-
- const string NamespaceUri = "http://www.w3.org/2002/07/decrypt#";
-
- #endregion // Fields
-
- #region Constructors
-
- public XmlDecryptionTransform ()
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDecryptionTransform;
- encryptedXml = new EncryptedXml ();
- exceptUris = new ArrayList ();
- }
-
- #endregion // Constructors
-
- #region Properties
-
- public EncryptedXml EncryptedXml {
- get { return encryptedXml; }
- set { encryptedXml = value; }
- }
-
- public override Type[] InputTypes {
- get {
- if (inputTypes == null)
- inputTypes = new Type [2] {typeof (System.IO.Stream), typeof (System.Xml.XmlDocument)};
-
- return inputTypes;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (outputTypes == null)
- outputTypes = new Type [1] {typeof (System.Xml.XmlDocument)};
-
- return outputTypes;
- }
- }
-
- #endregion // Properties
-
- #region Methods
-
- public void AddExceptUri (string uri)
- {
- exceptUris.Add (uri);
- }
-
- private void ClearExceptUris ()
- {
- exceptUris.Clear ();
- }
-
- [MonoTODO ("Verify")]
- protected override XmlNodeList GetInnerXml ()
- {
- XmlDocument doc = new XmlDocument ();
- doc.AppendChild (doc.CreateElement ("DecryptionTransform"));
-
- foreach (object o in exceptUris) {
- XmlElement element = doc.CreateElement ("Except", NamespaceUri);
- element.Attributes.Append (doc.CreateAttribute ("URI", NamespaceUri));
- element.Attributes ["URI", NamespaceUri].Value = (string) o;
- doc.DocumentElement.AppendChild (element);
- }
-
- return doc.GetElementsByTagName ("Except", NamespaceUri);
- }
-
- [MonoTODO ("Verify processing of ExceptURIs")]
- public override object GetOutput ()
- {
- XmlDocument document;
- if (inputObj is Stream) {
- document = new XmlDocument ();
- document.PreserveWhitespace = true;
- document.XmlResolver = GetResolver ();
- document.Load (new XmlSignatureStreamReader (
- new StreamReader (inputObj as Stream)));
- }
- else if (inputObj is XmlDocument) {
- document = inputObj as XmlDocument;
- }
- else
- throw new NullReferenceException ();
-
- XmlNodeList nodes = document.GetElementsByTagName ("EncryptedData", EncryptedXml.XmlEncNamespaceUrl);
- foreach (XmlNode node in nodes) {
- if (node == document.DocumentElement && exceptUris.Contains ("#xpointer(/)"))
- break;
-
- // Need to exclude based on ExceptURI. Only accept #id references.
- foreach (string uri in exceptUris)
- if (IsTargetElement ((XmlElement) node, uri.Substring (1)))
- break;
-
- EncryptedData encryptedData = new EncryptedData ();
- encryptedData.LoadXml ((XmlElement) node);
- SymmetricAlgorithm symAlg = EncryptedXml.GetDecryptionKey (encryptedData, encryptedData.EncryptionMethod.KeyAlgorithm);
- EncryptedXml.ReplaceData ((XmlElement) node, EncryptedXml.DecryptData (encryptedData, symAlg));
- }
-
- return document;
- }
-
- public override object GetOutput (Type type)
- {
- if (type == typeof (Stream))
- return GetOutput ();
- throw new ArgumentException ("type");
- }
-
- [MonoTODO ("verify")]
- protected virtual bool IsTargetElement (XmlElement inputElement, string idValue)
- {
- if ((inputElement == null) || (idValue == null))
- return false;
- return (inputElement.Attributes ["id"].Value == idValue);
- }
-
- [MonoTODO ("This doesn't seem to work in .NET")]
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- if (nodeList == null)
- throw new NullReferenceException ();
-
- ClearExceptUris ();
- foreach (XmlNode node in nodeList) {
- XmlElement element = node as XmlElement;
- if (element.NamespaceURI.Equals (NamespaceUri) && element.LocalName.Equals ("Except")) {
- string uri = element.Attributes ["URI", NamespaceUri].Value;
- if (!uri.StartsWith ("#"))
- throw new CryptographicException ("A Uri attribute is required for a CipherReference element.");
- AddExceptUri (uri);
- }
- }
- }
-
- public override void LoadInput (object obj)
- {
- inputObj = obj;
- }
-
- #endregion // Methods
- }
-}
-
+++ /dev/null
-//
-// XmlDsigBase64Transform.cs - Base64 Transform implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell (http://www.novell.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.IO;
-using System.Security.Cryptography;
-using System.Text;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- // http://www.w3.org/2000/09/xmldsig#base64
- public class XmlDsigBase64Transform : Transform {
-
- private CryptoStream cs;
- private Type[] input;
- private Type[] output;
-
- public XmlDsigBase64Transform ()
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigBase64Transform;
- }
-
- public override Type[] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- output = new Type [1];
- output[0] = typeof (System.IO.Stream);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return null; // THIS IS DOCUMENTED AS SUCH
- }
-
- public override object GetOutput ()
- {
- return (object) cs;
- }
-
- public override object GetOutput (Type type)
- {
- if (type != typeof (System.IO.Stream))
- throw new ArgumentException ("type");
- return GetOutput ();
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // documented as not changing the state of the transform
- }
-
- public override void LoadInput (object obj)
- {
- XmlNodeList xnl = null;
- Stream stream = null;
-
- if (obj is Stream)
- stream = (obj as Stream);
- else if (obj is XmlDocument)
- xnl = (obj as XmlDocument).SelectNodes ("//.");
- else if (obj is XmlNodeList)
- xnl = (XmlNodeList) obj;
-
- if (xnl != null) {
- stream = new MemoryStream ();
- StreamWriter sw = new StreamWriter (stream);
- foreach (XmlNode xn in xnl) {
- switch (xn.NodeType) {
- case XmlNodeType.Attribute:
- case XmlNodeType.Text:
- case XmlNodeType.CDATA:
- case XmlNodeType.SignificantWhitespace:
- case XmlNodeType.Whitespace:
- sw.Write (xn.Value);
- break;
- }
- }
- sw.Flush ();
- // ready to be re-used
- stream.Position = 0;
- }
-
- if (stream != null)
- cs = new CryptoStream (stream, new FromBase64Transform (), CryptoStreamMode.Read);
- // note: there is no default are other types won't throw an exception
- }
- }
-}
+++ /dev/null
-//
-// XmlDsigC14NTransform.cs - C14N Transform implementation for XML Signature
-// http://www.w3.org/TR/xml-c14n
-//
-// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Aleksey Sanin (aleksey@aleksey.com)
-// Tim Coleman (tim@timcoleman.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2003 Aleksey Sanin (aleksey@aleksey.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.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.Collections;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Xml;
-
-using Mono.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlDsigC14NTransform : Transform {
- private Type[] input;
- private Type[] output;
- private XmlCanonicalizer canonicalizer;
- private Stream s;
-
- public XmlDsigC14NTransform () : this (false)
- {
- }
-
- public XmlDsigC14NTransform (bool includeComments)
- {
- if (includeComments)
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigC14NWithCommentsTransform;
- else
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigC14NTransform;
- canonicalizer = new XmlCanonicalizer (includeComments, false, PropagatedNamespaces);
- }
-
- public override Type[] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- output = new Type [1];
- output[0] = typeof (System.IO.Stream);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return null; // THIS IS DOCUMENTED AS SUCH
- }
-
- [ComVisible (false)]
- public override byte[] GetDigestedOutput (HashAlgorithm hash)
- {
- // no null check, MS throws a NullReferenceException here
- return hash.ComputeHash ((Stream) GetOutput ());
- }
-
- public override object GetOutput ()
- {
- return (object) s;
- }
-
- public override object GetOutput (Type type)
- {
- if (type == typeof (Stream))
- return GetOutput ();
- throw new ArgumentException ("type");
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // documented as not changing the state of the transform
- }
-
- public override void LoadInput (object obj)
- {
- // possible input: Stream, XmlDocument, and XmlNodeList
- Stream stream = (obj as Stream);
- if (stream != null) {
- XmlDocument doc = new XmlDocument ();
- doc.PreserveWhitespace = true; // REALLY IMPORTANT
- doc.XmlResolver = GetResolver ();
- doc.Load (new XmlSignatureStreamReader (new StreamReader (stream)));
-// doc.Load ((Stream) obj);
- s = canonicalizer.Canonicalize (doc);
- return;
- }
-
- XmlDocument xd = (obj as XmlDocument);
- if (xd != null) {
- s = canonicalizer.Canonicalize (xd);
- return;
- }
-
- XmlNodeList nl = (obj as XmlNodeList);
- if (nl != null) {
- s = canonicalizer.Canonicalize (nl);
- }
- else
- throw new ArgumentException ("obj");
- }
- }
-}
-
+++ /dev/null
-//
-// XmlDsigC14NWithCommentsTransform.cs -
-// C14N with comments Transform implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.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.Xml {
-
- public class XmlDsigC14NWithCommentsTransform : XmlDsigC14NTransform {
-
- public XmlDsigC14NWithCommentsTransform() : base (true)
- {
- }
- }
-}
+++ /dev/null
-//
-// XmlDsigEnvelopedSignatureTransform.cs -
-// Enveloped Signature Transform implementation for XML Signature
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-// Atsushi Enomoto (atsushi@ximian.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell 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.Collections;
-using System.IO;
-using System.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlDsigEnvelopedSignatureTransform : Transform {
-
- private Type[] input;
- private Type[] output;
- private bool comments;
- private object inputObj;
-
- public XmlDsigEnvelopedSignatureTransform ()
- : this (false)
- {
- }
-
- public XmlDsigEnvelopedSignatureTransform (bool includeComments)
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigEnvelopedSignatureTransform;
- comments = includeComments;
- }
-
- public override Type[] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- output = new Type [2];
- output [0] = typeof (System.Xml.XmlDocument);
- output [1] = typeof (System.Xml.XmlNodeList);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return null; // THIS IS DOCUMENTED AS SUCH
- }
-
- // NOTE: This method never supports the requirements written
- // in xmldsig spec that says its input is canonicalized before
- // transforming. This method just removes Signature element.
- // Canonicalization is done in SignedXml.
- public override object GetOutput ()
- {
- XmlDocument doc = null;
-
- // possible input: Stream, XmlDocument, and XmlNodeList
- if (inputObj is Stream) {
- doc = new XmlDocument ();
- doc.PreserveWhitespace = true;
- doc.XmlResolver = GetResolver ();
- doc.Load (new XmlSignatureStreamReader (
- new StreamReader (inputObj as Stream)));
- return GetOutputFromNode (doc, GetNamespaceManager (doc), true);
- }
- else if (inputObj is XmlDocument) {
- doc = inputObj as XmlDocument;
- return GetOutputFromNode (doc, GetNamespaceManager (doc), true);
- }
- else if (inputObj is XmlNodeList) {
- ArrayList al = new ArrayList ();
- XmlNodeList nl = (XmlNodeList) inputObj;
- if (nl.Count > 0) {
- XmlNamespaceManager m = GetNamespaceManager (nl.Item (0));
- ArrayList tmp = new ArrayList ();
- foreach (XmlNode n in nl)
- tmp.Add (n);
- foreach (XmlNode n in tmp)
- if (n.SelectNodes ("ancestor-or-self::dsig:Signature", m).Count == 0)
- al.Add (GetOutputFromNode (n, m, false));
- }
- return new XmlDsigNodeList (al);
- }
- // Note that it is unexpected behavior with related to InputTypes (MS.NET accepts XmlElement)
- else if (inputObj is XmlElement) {
- XmlElement el = inputObj as XmlElement;
- XmlNamespaceManager m = GetNamespaceManager (el);
- if (el.SelectNodes ("ancestor-or-self::dsig:Signature", m).Count == 0)
- return GetOutputFromNode (el, m, true);
- }
-
- throw new NullReferenceException ();
- }
-
- private XmlNamespaceManager GetNamespaceManager (XmlNode n)
- {
- XmlDocument doc = ((n is XmlDocument) ? (n as XmlDocument) : n.OwnerDocument);
- XmlNamespaceManager nsmgr = new XmlNamespaceManager (doc.NameTable);
- nsmgr.AddNamespace ("dsig", XmlSignature.NamespaceURI);
- return nsmgr;
- }
-
- private XmlNode GetOutputFromNode (XmlNode input, XmlNamespaceManager nsmgr, bool remove)
- {
- if (remove) {
- XmlNodeList nl = input.SelectNodes ("descendant-or-self::dsig:Signature", nsmgr);
- ArrayList al = new ArrayList ();
- foreach (XmlNode n in nl)
- al.Add (n);
- foreach (XmlNode n in al)
- n.ParentNode.RemoveChild (n);
- }
- return input;
- }
-
- public override object GetOutput (Type type)
- {
- if (type == typeof (Stream))
- return GetOutput ();
- throw new ArgumentException ("type");
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // NO CHANGE
- }
-
- public override void LoadInput (object obj)
- {
- inputObj = obj;
- }
- }
-}
+++ /dev/null
-//
-// XmlDsigExcC14NTransform.cs - ExcC14N Transform implementation for XML Signature
-// http://www.w3.org/TR/xml-c14n
-//
-// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Aleksey Sanin (aleksey@aleksey.com)
-// Tim Coleman (tim@timcoleman.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2003 Aleksey Sanin (aleksey@aleksey.com)
-// Copyright (C) Tim Coleman, 2004
-// Copyright (C) 2004-2005 Novell Inc. (http://www.novell.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.Collections;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Text;
-using System.Xml;
-
-using Mono.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlDsigExcC14NTransform : Transform {
- private Type[] input;
- private Type[] output;
- private XmlCanonicalizer canonicalizer;
- private Stream s;
- private string inclusiveNamespacesPrefixList;
-
- public XmlDsigExcC14NTransform ()
- : this (false, null)
- {
- }
-
- public XmlDsigExcC14NTransform (bool includeComments)
- : this (includeComments, null)
- {
- }
-
- public XmlDsigExcC14NTransform (string inclusiveNamespacesPrefixList)
- : this (false, inclusiveNamespacesPrefixList)
- {
- }
-
- public XmlDsigExcC14NTransform (bool includeComments, string inclusiveNamespacesPrefixList)
- {
- if (includeComments)
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NWithCommentsTransform;
- else
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigExcC14NTransform;
- this.inclusiveNamespacesPrefixList = inclusiveNamespacesPrefixList;
- canonicalizer = new XmlCanonicalizer (includeComments, true, PropagatedNamespaces);
- }
-
- public string InclusiveNamespacesPrefixList {
- get { return inclusiveNamespacesPrefixList; }
- set { inclusiveNamespacesPrefixList = value; }
- }
-
- public override Type[] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input[0] = typeof (System.IO.Stream);
- input[1] = typeof (System.Xml.XmlDocument);
- input[2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- output = new Type [1];
- output[0] = typeof (System.IO.Stream);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return null; // THIS IS DOCUMENTED AS SUCH
- }
-
- public override byte[] GetDigestedOutput (HashAlgorithm hash)
- {
- // no null check, MS throws a NullReferenceException here
- return hash.ComputeHash ((Stream) GetOutput ());
- }
-
- public override object GetOutput ()
- {
- return (object) s;
- }
-
- public override object GetOutput (Type type)
- {
- if (type == typeof (Stream))
- return GetOutput ();
- throw new ArgumentException ("type");
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // documented as not changing the state of the transform
- }
-
- public override void LoadInput (object obj)
- {
- canonicalizer.InclusiveNamespacesPrefixList = InclusiveNamespacesPrefixList;
- // possible input: Stream, XmlDocument, and XmlNodeList
- Stream stream = (obj as Stream);
- if (stream != null) {
- XmlDocument doc = new XmlDocument ();
- doc.PreserveWhitespace = true; // REALLY IMPORTANT
- doc.XmlResolver = GetResolver ();
- doc.Load (new XmlSignatureStreamReader (new StreamReader (stream)));
-// doc.Load ((Stream) obj);
- s = canonicalizer.Canonicalize (doc);
- return;
- }
-
- XmlDocument xd = (obj as XmlDocument);
- if (xd != null) {
- s = canonicalizer.Canonicalize (xd);
- return;
- }
-
- XmlNodeList nl = (obj as XmlNodeList);
- if (nl != null) {
- s = canonicalizer.Canonicalize (nl);
- }
- else
- throw new ArgumentException ("obj");
- }
- }
-}
-
+++ /dev/null
-//
-// XmlDsigExcC14NWithCommentsTransform.cs - XmlDsigExcC14NWithCommentsTransform implementation for XML Encryption
-//
-// Author:
-// Tim Coleman (tim@timcoleman.com)
-//
-// Copyright (C) Tim Coleman, 2004
-
-//
-// 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.Xml {
- public class XmlDsigExcC14NWithCommentsTransform : XmlDsigExcC14NTransform {
-
- #region Constructors
-
- public XmlDsigExcC14NWithCommentsTransform ()
- : base (true)
- {
- }
-
- public XmlDsigExcC14NWithCommentsTransform (string inclusiveNamespacesPrefixList)
- : base (true, inclusiveNamespacesPrefixList)
- {
- }
-
- #endregion // Constructors
- }
-}
-
+++ /dev/null
-//\r
-// XmlDsigNodeList.cs - derived node list class for dsig\r
-//\r
-// Author:\r
-// Atsushi Enomoto <atsushi@ximian.com>\r
-//\r
-// (C)2004 Novell Inc.\r
-//\r
-// This class is mostly copied from System.Xml/XmlNodeArrayList.cs\r
-//\r
-
-//
-// 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.
-//
-\r
-using System;\r
-using System.Collections;\r
-using System.Xml;\r
-\r
-namespace System.Security.Cryptography.Xml\r
-{\r
- // Copied from XmlNodeArrayList.cs\r
- internal class XmlDsigNodeList : XmlNodeList\r
- {\r
- ArrayList _rgNodes;\r
-\r
- public XmlDsigNodeList (ArrayList rgNodes)\r
- {\r
- _rgNodes = rgNodes;\r
- }\r
-\r
- public override int Count { get { return _rgNodes.Count; } }\r
-\r
- public override IEnumerator GetEnumerator ()\r
- {\r
- return _rgNodes.GetEnumerator ();\r
- }\r
-\r
- public override XmlNode Item (int index)\r
- {\r
- // Return null if index is out of range. by DOM design.\r
- if (index < 0 || _rgNodes.Count <= index)\r
- return null;\r
-\r
- return (XmlNode) _rgNodes [index];\r
- }\r
- }\r
-}\r
+++ /dev/null
-//
-// XmlDsigXPathTransform.cs -
-// XmlDsigXPathTransform implementation for XML Signature
-// http://www.w3.org/TR/1999/REC-xpath-19991116
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Atsushi Enomoto <atsushi@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.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.Collections;
-using System.IO;
-using System.Text;
-using System.Xml;
-using System.Xml.XPath;
-using System.Xml.Xsl;
-
-namespace System.Security.Cryptography.Xml
-{
-
- // www.w3.org/TR/xmldsig-core/
- // see Section 6.6.3 of the XMLDSIG specification
- public class XmlDsigXPathTransform : Transform
- {
-
- private Type [] input;
- private Type [] output;
- private XmlNodeList xpath;
- private XmlDocument doc;
- private XsltContext ctx;
-
- public XmlDsigXPathTransform ()
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigXPathTransform;
- }
-
- public override Type [] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input [0] = typeof (System.IO.Stream);
- input [1] = typeof (System.Xml.XmlDocument);
- input [2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (output == null) {
- // this way the result is cached if called multiple time
- output = new Type [1];
- output [0] = typeof (System.Xml.XmlNodeList);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- if (xpath == null) {
- // default value
- XmlDocument xpdoc = new XmlDocument ();
- xpdoc.LoadXml ("<XPath xmlns=\"" + XmlSignature.NamespaceURI + "\"></XPath>");
- xpath = xpdoc.ChildNodes;
- }
- return xpath;
- }
-
- [MonoTODO ("Evaluation of extension function here() results in different from MS.NET (is MS.NET really correct??).")]
- public override object GetOutput ()
- {
- if ((xpath == null) || (doc == null))
- return new XmlDsigNodeList (new ArrayList ());
- // evaluate every time since input or xpath might have changed.
- string x = null;
- for (int i = 0; i < xpath.Count; i++) {
- switch (xpath [i].NodeType) {
- case XmlNodeType.Text:
- case XmlNodeType.CDATA:
- case XmlNodeType.Element:
- x += xpath [i].InnerText;
- break;
- }
- }
-
- ctx = new XmlDsigXPathContext (doc);
- foreach (XmlNode n in xpath) {
- XPathNavigator nav = n.CreateNavigator ();
- XPathNodeIterator iter = nav.Select ("namespace::*");
- while (iter.MoveNext ())
- if (iter.Current.LocalName != "xml")
- ctx.AddNamespace (iter.Current.LocalName, iter.Current.Value);
- }
- return EvaluateMatch (doc, x);
- }
-
- public override object GetOutput (Type type)
- {
- if (type != typeof (XmlNodeList))
- throw new ArgumentException ("type");
- return GetOutput ();
- }
-
- private XmlDsigNodeList EvaluateMatch (XmlNode n, string xpath)
- {
- ArrayList al = new ArrayList ();
- // Strictly to say, document node is explicitly
- // excluded by W3C spec (context node is initialized
- // to the document root and XPath expression is
- // "//. | //@* | //namespace::*)
- XPathNavigator nav = n.CreateNavigator ();
- XPathExpression exp = nav.Compile (xpath);
- exp.SetContext (ctx);
- EvaluateMatch (n, exp, al);
- return new XmlDsigNodeList (al);
- }
-
- private void EvaluateMatch (XmlNode n, XPathExpression exp, ArrayList al)
- {
- if (NodeMatches (n, exp))
- al.Add (n);
- if (n.Attributes != null)
- for (int i = 0; i < n.Attributes.Count; i++)
- if (NodeMatches (n.Attributes [i], exp))
- al.Add (n.Attributes [i]);
- for (int i = 0; i < n.ChildNodes.Count; i++)
- EvaluateMatch (n.ChildNodes [i], exp, al);
- }
-
- private bool NodeMatches (XmlNode n, XPathExpression exp)
- {
- // This looks waste of memory since it creates
- // XPathNavigator every time, but even if we use
- // XPathNodeIterator.Current, it also clones every time.
- object ret = n.CreateNavigator ().Evaluate (exp);
- if (ret is bool)
- return (bool) ret;
- if (ret is double) {
- double d = (double) ret;
- return !(d == 0.0 || Double.IsNaN (d));
- }
- if (ret is string)
- return ((string) ret).Length > 0;
- if (ret is XPathNodeIterator) {
- XPathNodeIterator retiter = (XPathNodeIterator) ret;
- return retiter.Count > 0;
- }
- return false;
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- if (nodeList == null)
- throw new CryptographicException ("nodeList");
- xpath = nodeList;
- }
-
- public override void LoadInput (object obj)
- {
- // possible input: Stream, XmlDocument, and XmlNodeList
- if (obj is Stream) {
- doc = new XmlDocument ();
- doc.PreserveWhitespace = true;
- doc.XmlResolver = GetResolver ();
- doc.Load (new XmlSignatureStreamReader (
- new StreamReader ((Stream) obj)));
- }
- else if (obj is XmlDocument) {
- doc = (obj as XmlDocument);
- }
- else if (obj is XmlNodeList) {
- doc = new XmlDocument ();
- doc.XmlResolver = GetResolver ();
- foreach (XmlNode xn in (obj as XmlNodeList)) {
- XmlNode importedNode = doc.ImportNode (xn, true);
- doc.AppendChild (importedNode);
- }
- }
- }
-
- // Internal classes to support XPath extension function here()
-
- internal class XmlDsigXPathContext : XsltContext
- {
- XmlDsigXPathFunctionHere here;
- public XmlDsigXPathContext (XmlNode node)
- {
- here = new XmlDsigXPathFunctionHere (node);
- }
-
- public override IXsltContextFunction ResolveFunction (
- string prefix, string name, XPathResultType [] argType)
- {
- // Here MS.NET incorrectly allows arbitrary
- // name e.g. "heretic()".
- if (name == "here" &&
- prefix == String.Empty &&
- argType.Length == 0)
- return here;
- else
- return null; // ????
- }
-
- public override bool Whitespace {
- get { return true; }
- }
-
- public override bool PreserveWhitespace (XPathNavigator node)
- {
- return true;
- }
-
- public override int CompareDocument (string s1, string s2)
- {
- return String.Compare (s1, s2);
- }
-
- public override IXsltContextVariable ResolveVariable (string prefix, string name)
- {
- throw new InvalidOperationException ();
- }
- }
-
- internal class XmlDsigXPathFunctionHere : IXsltContextFunction
- {
- // Static
-
- static XPathResultType [] types;
- static XmlDsigXPathFunctionHere ()
- {
- types = new XPathResultType [0];
- }
-
- // Instance
-
- XPathNodeIterator xpathNode;
-
- public XmlDsigXPathFunctionHere (XmlNode node)
- {
- xpathNode = node.CreateNavigator ().Select (".");
- }
-
- public XPathResultType [] ArgTypes {
- get { return types; }
- }
-
- public int Maxargs { get { return 0; } }
-
- public int Minargs { get { return 0; } }
-
- public XPathResultType ReturnType {
- get { return XPathResultType.NodeSet; }
- }
-
- public object Invoke (XsltContext ctx, object [] args, XPathNavigator docContext)
- {
- if (args.Length != 0)
- throw new ArgumentException ("Not allowed arguments for function here().", "args");
-
- return xpathNode.Clone ();
- }
- }
- }
-}
+++ /dev/null
-//
-// XmlDsigEnvelopedSignatureTransform.cs -
-// Enveloped Signature Transform implementation for XML Signature
-// http://www.w3.org/TR/1999/REC-xslt-19991116
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-// Atsushi Enomoto (atsushi@ximian.com)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell 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.IO;
-using System.Xml;
-using System.Xml.Xsl;
-
-namespace System.Security.Cryptography.Xml
-{
-
- public class XmlDsigXsltTransform : Transform
- {
-
- private Type [] input;
- private Type [] output;
- private bool comments;
- private XmlNodeList xnl;
- private XmlDocument inputDoc;
-
- public XmlDsigXsltTransform () : this (false)
- {
- }
-
- public XmlDsigXsltTransform (bool includeComments)
- {
- comments = includeComments;
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlDsigXsltTransform;
- }
-
- public override Type [] InputTypes {
- get {
- if (input == null) {
- input = new Type [3];
- input [0] = typeof (System.IO.Stream);
- input [1] = typeof (System.Xml.XmlDocument);
- input [2] = typeof (System.Xml.XmlNodeList);
- }
- return input;
- }
- }
-
- public override Type [] OutputTypes {
- get {
- if (output == null) {
- output = new Type [1];
- output [0] = typeof (System.IO.Stream);
- }
- return output;
- }
- }
-
- protected override XmlNodeList GetInnerXml ()
- {
- return xnl;
- }
-
- public override object GetOutput ()
- {
- if (xnl == null)
- throw new ArgumentNullException ("LoadInnerXml before transformation.");
-
- XmlResolver resolver = GetResolver ();
-
- XslTransform xsl = new XslTransform ();
- XmlDocument doc = new XmlDocument ();
- doc.XmlResolver = resolver;
- foreach (XmlNode n in xnl)
- doc.AppendChild (doc.ImportNode (n, true));
- xsl.Load (doc, resolver);
-
- if (inputDoc == null)
- throw new ArgumentNullException ("LoadInput before transformation.");
-
- MemoryStream stream = new MemoryStream ();
- // only possible output: Stream
- xsl.XmlResolver = resolver;
- xsl.Transform (inputDoc, null, stream);
-
- stream.Seek (0, SeekOrigin.Begin);
- return stream;
- }
-
- public override object GetOutput (Type type)
- {
- if (type != typeof (Stream))
- throw new ArgumentException ("type");
- return GetOutput ();
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- if (nodeList == null)
- throw new CryptographicException ("nodeList");
- xnl = nodeList;
- }
-
- public override void LoadInput (object obj)
- {
- // possible input: Stream, XmlDocument, and XmlNodeList
- Stream s = (obj as Stream);
- if (s != null) {
- inputDoc = new XmlDocument ();
- inputDoc.XmlResolver = GetResolver ();
-// inputDoc.Load (obj as Stream);
- inputDoc.Load (new XmlSignatureStreamReader (new StreamReader (s)));
- return;
- }
-
- XmlDocument xd = (obj as XmlDocument);
- if (xd != null) {
- inputDoc = xd;
- return;
- }
-
- XmlNodeList nl = (obj as XmlNodeList);
- if (nl != null) {
- inputDoc = new XmlDocument ();
- inputDoc.XmlResolver = GetResolver ();
- for (int i = 0; i < nl.Count; i++)
- inputDoc.AppendChild (inputDoc.ImportNode (nl [i], true));
- }
- }
- }
-}
+++ /dev/null
-//
-// System.Security.Cryptography.Xml.XmlLicenseTransform class
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// Copyright (C) 2005 Novell, Inc (http://www.novell.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.Xml;
-
-namespace System.Security.Cryptography.Xml {
-
- public class XmlLicenseTransform : Transform {
-
- private IRelDecryptor _decryptor;
- private Type[] inputTypes;
- private Type[] outputTypes;
-
- public XmlLicenseTransform ()
- {
- Algorithm = XmlSignature.AlgorithmNamespaces.XmlLicenseTransform;
- }
-
- public IRelDecryptor Decryptor {
- get { return _decryptor; }
- set { _decryptor = value; }
- }
-
- public override Type[] InputTypes {
- get {
- if (inputTypes == null)
- inputTypes = new Type [1] { typeof (XmlDocument) };
-
- return inputTypes;
- }
- }
-
- public override Type[] OutputTypes {
- get {
- if (outputTypes == null)
- outputTypes = new Type [1] {typeof (XmlDocument)};
-
- return outputTypes;
- }
- }
-
- [MonoTODO]
- protected override XmlNodeList GetInnerXml ()
- {
- return null;
- }
-
- [MonoTODO]
- public override object GetOutput ()
- {
- return null;
- }
-
- public override object GetOutput (Type type)
- {
- if (type != typeof (XmlDocument))
- throw new ArgumentException ("type");
- return GetOutput ();
- }
-
- public override void LoadInnerXml (XmlNodeList nodeList)
- {
- // documented as not supported
- }
-
- [MonoTODO]
- public override void LoadInput (object obj)
- {
- if (_decryptor == null)
- throw new CryptographicException (Locale.GetText ("missing decryptor"));
- // TODO: check for <issuer> element
- // TODO: check for <license> element
- }
- }
-}
public AttributeNames () {}
}
- public class AlgorithmNamespaces {
- public const string XmlDsigBase64Transform = "http://www.w3.org/2000/09/xmldsig#base64";
- public const string XmlDsigC14NTransform = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315";
- public const string XmlDsigC14NWithCommentsTransform = "http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments";
- public const string XmlDsigEnvelopedSignatureTransform = "http://www.w3.org/2000/09/xmldsig#enveloped-signature";
- public const string XmlDsigXPathTransform = "http://www.w3.org/TR/1999/REC-xpath-19991116";
- public const string XmlDsigXsltTransform = "http://www.w3.org/TR/1999/REC-xslt-19991116";
- public const string XmlDsigExcC14NTransform = "http://www.w3.org/2001/10/xml-exc-c14n#";
- public const string XmlDsigExcC14NWithCommentsTransform = "http://www.w3.org/2001/10/xml-exc-c14n#WithComments";
- public const string XmlDecryptionTransform = "http://www.w3.org/2002/07/decrypt#XML";
- public const string XmlLicenseTransform = "urn:mpeg:mpeg21:2003:01-REL-R-NS:licenseTransform";
- }
-
public class Uri {
public const string Manifest = "http://www.w3.org/2000/09/xmldsig#Manifest";
}
+++ /dev/null
-//
-// XmlSignatureStreamReader.cs: Wrap TextReader and eliminate \r
-//
-// Author:
-// Atsushi Enomoto (atsushi@ximian.com)
-//
-// (C) 2005 Novell 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.
-//
-//
-// Use it to distinguish 
 and \r. \r is removed, while 
 is not.
-//
-//
-
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-
-namespace System.Security.Cryptography.Xml
-{
- internal class XmlSignatureStreamReader : TextReader
- {
- TextReader source;
- int cache = int.MinValue;
-
- public XmlSignatureStreamReader (TextReader input)
- {
- source =input;
- }
-
- public override void Close ()
- {
- source.Close ();
- }
-
- public override int Peek ()
- {
- // If source TextReader does not support Peek(),
- // it does not support too. Or it just returns EOF.
- if (source.Peek () == -1)
- return -1;
-
- if (cache != int.MinValue)
- return cache;
- cache = source.Read ();
- if (cache != '\r')
- return cache;
- // cache must be '\r' here.
- if (source.Peek () != '\n')
- return '\r';
- // Now Peek() returns '\n', so clear cache.
- cache = int.MinValue;
- return '\n';
- }
-
- public override int Read ()
- {
- if (cache != int.MinValue) {
- int ret = cache;
- cache = int.MinValue;
- return ret;
- }
- int i = source.Read ();
- if (i != '\r')
- return i;
- // read one more char (after '\r')
- cache = source.Read ();
- if (cache != '\n')
- return '\r';
- cache = int.MinValue;
- return '\n';
- }
-
- public override int ReadBlock (
- [In, Out] char [] buffer, int index, int count)
- {
- char [] tmp = new char [count];
- source.ReadBlock (tmp, 0, count);
- int j = index;
- for (int i = 0; i < count; j++) {
- if (tmp [i] == '\r') {
- if (++i < tmp.Length && tmp [i] == '\n')
- buffer [j] = tmp [i++];
- else
- buffer [j] = '\r';
- }
- else
- buffer [j] = tmp [i];
- }
- while (j < count) {
- int d = Read ();
- if (d < 0)
- break;
- buffer [j++] = (char) d;
- }
- return j;
- }
-
- // I have no idea what to do here, but I don't think it
- // makes sense.
- public override string ReadLine ()
- {
- return source.ReadLine ();
- }
-
- public override string ReadToEnd ()
- {
- return source.ReadToEnd ().Replace ("\r\n", "\n");
- }
- }
-}
../../build/common/Locale.cs
Mono.Security.Cryptography/ManagedProtection.cs
Mono.Security.Cryptography/NativeDapiProtection.cs
-Mono.Xml/XmlCanonicalizer.cs
System.Security.Cryptography/CryptographicAttribute.cs
System.Security.Cryptography/CryptographicAttributeCollection.cs
System.Security.Cryptography/CryptographicAttributeEnumerator.cs
System.Security.Cryptography.Pkcs/SubjectIdentifierOrKey.cs
System.Security.Cryptography.Pkcs/SubjectIdentifierOrKeyType.cs
System.Security.Cryptography.Pkcs/SubjectIdentifierType.cs
+../System.Core/System.Security.Cryptography.X509Certificates/RSACertificateExtensions.cs
System.Security.Cryptography.X509Certificates/X509Certificate2UI.cs
System.Security.Cryptography.X509Certificates/X509SelectionFlag.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/AncestralNamespaceContextManager.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/AttributeSortOrder.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/C14NAncestralNamespaceContextManager.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalizationDispatcher.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXml.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlAttribute.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlCDataSection.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlComment.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlDocument.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlElement.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlEntityReference.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlNodeList.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlProcessingInstruction.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlSignificantWhitespace.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlText.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CanonicalXmlWhitespace.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CertUsageType.cs
System.Security.Cryptography.Xml/CipherData.cs
System.Security.Cryptography.Xml/CipherReference.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/CryptoHelpers.cs
System.Security.Cryptography.Xml/DataObject.cs
System.Security.Cryptography.Xml/DataReference.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/DocPosition.cs
System.Security.Cryptography.Xml/DSAKeyValue.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/DSASignatureDescription.cs
System.Security.Cryptography.Xml/EncryptedData.cs
System.Security.Cryptography.Xml/EncryptedKey.cs
System.Security.Cryptography.Xml/EncryptedReference.cs
System.Security.Cryptography.Xml/EncryptionMethod.cs
System.Security.Cryptography.Xml/EncryptionProperties.cs
System.Security.Cryptography.Xml/EncryptionProperty.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/ExcAncestralNamespaceContextManager.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/ExcCanonicalXml.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/ICanonicalizableNode.cs
System.Security.Cryptography.Xml/IRelDecryptor.cs
System.Security.Cryptography.Xml/KeyInfoClause.cs
System.Security.Cryptography.Xml/KeyInfo.cs
System.Security.Cryptography.Xml/KeyInfoX509Data.cs
System.Security.Cryptography.Xml/KeyReference.cs
System.Security.Cryptography.Xml/Manifest.cs
-System.Security.Cryptography.Xml/Reference.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/MyXmlDocument.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/NamespaceFrame.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/NamespaceSortOrder.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Reference.cs
System.Security.Cryptography.Xml/ReferenceList.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/ReferenceTargetType.cs
System.Security.Cryptography.Xml/RSAKeyValue.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA1SignatureDescription.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA256SignatureDescription.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA384SignatureDescription.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SHA512SignatureDescription.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/RSAPKCS1SignatureDescription.cs
System.Security.Cryptography.Xml/Signature.cs
System.Security.Cryptography.Xml/SignedInfo.cs
System.Security.Cryptography.Xml/SignedXml.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/SignedXmlDebugLog.cs
System.Security.Cryptography.Xml/SymmetricKeyWrap.cs
-System.Security.Cryptography.Xml/TransformChain.cs
-System.Security.Cryptography.Xml/Transform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Transform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/TransformChain.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/Utils.cs
System.Security.Cryptography.Xml/X509IssuerSerial.cs
-System.Security.Cryptography.Xml/XmlDecryptionTransform.cs
-System.Security.Cryptography.Xml/XmlDsigBase64Transform.cs
-System.Security.Cryptography.Xml/XmlDsigC14NTransform.cs
-System.Security.Cryptography.Xml/XmlDsigC14NWithCommentsTransform.cs
-System.Security.Cryptography.Xml/XmlDsigEnvelopedSignatureTransform.cs
-System.Security.Cryptography.Xml/XmlDsigExcC14NTransform.cs
-System.Security.Cryptography.Xml/XmlDsigExcC14NWithCommentsTransform.cs
-System.Security.Cryptography.Xml/XmlDsigNodeList.cs
-System.Security.Cryptography.Xml/XmlDsigXPathTransform.cs
-System.Security.Cryptography.Xml/XmlDsigXsltTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDecryptionTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigBase64Transform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigC14NTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigC14NWithCommentsTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigEnvelopedSignatureTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigExcC14NTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigExcC14NWithCommentsTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigXPathTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlDsigXsltTransform.cs
System.Security.Cryptography.Xml/XmlEncryption.cs
-System.Security.Cryptography.Xml/XmlLicenseTransform.cs
+../../../external/corefx/src/System.Security.Cryptography.Xml/src/System/Security/Cryptography/Xml/XmlLicenseTransform.cs
System.Security.Cryptography.Xml/XmlSignature.cs
-System.Security.Cryptography.Xml/XmlSignatureStreamReader.cs
../../build/common/MonoTODOAttribute.cs
System.Security.Permissions/DataProtectionPermission.cs
System.Security.Permissions/DataProtectionPermissionAttribute.cs
{
Assert.IsNull (reference.Uri, "Uri (null)");
Assert.IsNotNull (reference.TransformChain, "TransformChain");
- Assert.AreEqual ("System.Security.Cryptography.Xml.Reference", reference.ToString (), "ToString()");
// test uri constructor
string uri = "uri";
reference = new Reference (uri);
- Assert.AreEqual ("http://www.w3.org/2000/09/xmldsig#sha1", reference.DigestMethod, "DigestMethod");
+ Assert.AreEqual (SignedXml.XmlDsigSHA256Url, reference.DigestMethod, "DigestMethod");
Assert.IsNull (reference.DigestValue, "DigestValue");
Assert.IsNull (reference.Id, "Id");
Assert.IsNull (reference.Type, "Type");
}
[Test]
- [Category ("NotDotNet")]
- // MS throws a NullReferenceException (reported as FDBK25886) but only when executed in NUnit
- // http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=3596d1e3-362b-40bd-bca9-2e8be75261ff
public void AddAllTransforms ()
{
- // adding an empty hash value
- byte[] hash = new byte [20];
- reference.DigestValue = hash;
- XmlElement xel = reference.GetXml ();
- // this is the minimal Reference (DigestValue)!
- Assert.IsNotNull (xel, "GetXml");
+ reference.DigestMethod = SignedXml.XmlDsigSHA1Url;
+ reference.DigestValue = new byte [20];
reference.AddTransform (new XmlDsigBase64Transform ());
reference.AddTransform (new XmlDsigC14NTransform ());
reference.AddTransform (new XmlDsigXPathTransform ());
reference.AddTransform (new XmlDsigXsltTransform ());
- // MS's results
- string test1 = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#base64\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\" /><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath></XPath></Transform><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
- // Mono's result (xml is equivalent but not identical)
- string test2 = test1.Replace ("<XPath></XPath>", "<XPath xmlns=\"http://www.w3.org/2000/09/xmldsig#\" />");
- string result = reference.GetXml().OuterXml;
- Assert.IsTrue (((result == test1) || (result == test2)), result);
- // however this value cannot be loaded as it's missing some transform (xslt) parameters
+ const string expected = "<Reference xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><Transforms><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#base64\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><Transform Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments\" /><Transform Algorithm=\"http://www.w3.org/2000/09/xmldsig#enveloped-signature\" /><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xpath-19991116\"><XPath /></Transform><Transform Algorithm=\"http://www.w3.org/TR/1999/REC-xslt-19991116\" /></Transforms><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>AAAAAAAAAAAAAAAAAAAAAAAAAAA=</DigestValue></Reference>";
+ Assert.That (reference.GetXml ().OuterXml, Is.EqualTo (expected), "OuterXml");
// can we add them again ?
reference.AddTransform (new XmlDsigBase64Transform ());
signedXml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl;
Reference reference = new Reference ();
+ reference.DigestMethod = SignedXml.XmlDsigSHA1Url;
reference.Uri = "";
XmlDsigEnvelopedSignatureTransform env = new XmlDsigEnvelopedSignatureTransform ();
}
[Test]
- [Category ("NotDotNet")]
// see LoadInputAsXmlNodeList2 description
public void LoadInputAsXmlNodeList ()
{
transform.LoadInput (doc.ChildNodes);
Stream s = (Stream) transform.GetOutput ();
string output = Stream2String (s);
- Assert.AreEqual ("<Test></Test>", output, "XmlChildNodes");
+ Assert.AreEqual ("<Test xmlns=\"http://www.go-mono.com/\"></Test>", output, "XmlChildNodes");
}
[Test]
- [Category ("NotDotNet")]
// MS has a bug that those namespace declaration nodes in
// the node-set are written to output. Related spec section is:
// http://www.w3.org/TR/2001/REC-xml-c14n-20010315#ProcessingModel
transform.LoadInput (doc.SelectNodes ("//*"));
Stream s = (Stream) transform.GetOutput ();
string output = Stream2String (s);
- string expected = @"<Test><Toto></Toto></Test>";
+ string expected = "<Test xmlns=\"http://www.go-mono.com/\"><Toto></Toto></Test>";
Assert.AreEqual (expected, output, "XmlChildNodes");
}
Assert.AreEqual (xml, output);
}
- [Test]
- public void PrefixlessNamespaceOutput ()
- {
- XmlDocument doc = new XmlDocument ();
- doc.AppendChild (doc.CreateElement ("foo", "urn:foo"));
- doc.DocumentElement.AppendChild (doc.CreateElement ("bar", "urn:bar"));
- Assert.AreEqual (String.Empty, doc.DocumentElement.GetAttribute ("xmlns"), "#1");
- XmlDsigC14NTransform t = new XmlDsigC14NTransform ();
- t.LoadInput (doc);
- Stream s = t.GetOutput () as Stream;
- Assert.AreEqual (new StreamReader (s, Encoding.UTF8).ReadToEnd (), "<foo xmlns=\"urn:foo\"><bar xmlns=\"urn:bar\"></bar></foo>");
- Assert.AreEqual ("urn:foo", doc.DocumentElement.GetAttribute ("xmlns"), "#2");
- }
-
[Test]
[Ignore ("find out how PropagatedNamespaces returns non-null instance on .NET")]
public void PropagatedNamespaces ()
}
[Test]
- [Category ("NotDotNet")]
// see LoadInputAsXmlNodeList2 description
public void LoadInputAsXmlNodeList ()
{
transform.LoadInput (doc.ChildNodes);
Stream s = (Stream) transform.GetOutput ();
string output = Stream2String (s);
- Assert.AreEqual ("<Test></Test>", output, "XmlChildNodes");
+ Assert.AreEqual ("<Test xmlns=\"http://www.go-mono.com/\"></Test>", output, "XmlChildNodes");
}
[Test]
- [Category ("NotDotNet")]
// MS has a bug that those namespace declaration nodes in
// the node-set are written to output. Related spec section is:
// http://www.w3.org/TR/2001/REC-xml-c14n-20010315#ProcessingModel
transform.LoadInput (doc.SelectNodes ("//*"));
Stream s = (Stream) transform.GetOutput ();
string output = Stream2String (s);
- string expected = @"<Test><Toto></Toto></Test>";
+ string expected = "<Test xmlns=\"http://www.go-mono.com/\"><Toto></Toto></Test>";
Assert.AreEqual (expected, output, "XmlChildNodes");
}
public const string Cryptography_Xml_InvalidReference = "Malformed reference element.";
public const string Cryptography_Xml_InvalidSignatureLength = "The length of the signature with a MAC should be less than the hash output length.";
public const string Cryptography_Xml_InvalidSignatureLength2 = "The length in bits of the signature with a MAC should be a multiple of 8.";
+ public const string Cryptography_Xml_InvalidX509IssuerSerialNumber = "X509 issuer serial number is invalid.";
public const string Cryptography_Xml_KeyInfoRequired = "A KeyInfo element is required to check the signature.";
public const string Cryptography_Xml_KW_BadKeySize = "The length of the encrypted data in Key Wrap is either 32, 40 or 48 bytes.";
public const string Cryptography_Xml_LoadKeyFailed = "Signing key is not loaded.";
get { return behaviors; }
}
- [MonoTODO]
public KeyedCollection<Type,IEndpointBehavior> EndpointBehaviors {
- get { throw new NotImplementedException (); }
+ get { return behaviors; }
}
public ContractDescription Contract {
</type>
<!-- appdomain.c: ves_icall_System_AppDomain_GetAssemblies -->
- <type fullname="System.Reflection.Assembly" preserve="fields">
- <method name="MonoDebugger_GetMethodToken" feature="sre" />
- <method name="GetNamespaces" feature="sre" />
- </type>
+ <type fullname="System.Reflection.Assembly" preserve="fields"/>
+
<type fullname="System.Reflection.AssemblyName" preserve="fields" />
<type fullname="System.Reflection.ConstructorInfo" preserve="fields" />
return _tb.InternalResolve ();
}
+ internal override Type RuntimeResolve () {
+ return _tb.RuntimeResolve ();
+ }
public override Assembly Assembly {
get {
make_room (6);
ll_emit (opcode);
int token = token_gen.GetToken (cls, opcode != OpCodes.Ldtoken);
- if (cls is TypeBuilderInstantiation || cls is SymbolType || cls is TypeBuilder || cls is GenericTypeParameterBuilder)
+ if (cls is TypeBuilderInstantiation || cls is SymbolType || cls is TypeBuilder || cls is GenericTypeParameterBuilder || cls is EnumBuilder)
add_token_fixup (cls);
emit_int (token);
}
static int typespec_tokengen = 0x1bffffff;
static int memberref_tokengen = 0x0affffff;
static int methoddef_tokengen = 0x06ffffff;
- Dictionary<MemberInfo, int> inst_tokens = new Dictionary<MemberInfo, int> ();
- Dictionary<MemberInfo, int> inst_tokens_open = new Dictionary<MemberInfo, int> ();
+ Dictionary<MemberInfo, int> inst_tokens, inst_tokens_open;
//
// Assign a pseudo token to the various TypeBuilderInst objects, so the runtime
// still encounter these objects, it will resolve them by calling their
// RuntimeResolve () methods.
//
- int GetPseudoToken (MemberInfo member, bool create_open_instance) {
+ int GetPseudoToken (MemberInfo member, bool create_open_instance)
+ {
int token;
-
- if (create_open_instance) {
- if (inst_tokens_open.TryGetValue (member, out token))
- return token;
- } else {
- if (inst_tokens.TryGetValue (member, out token))
- return token;
+ var dict = create_open_instance ? inst_tokens_open : inst_tokens;
+ if (dict == null) {
+ dict = new Dictionary<MemberInfo, int> (ReferenceEqualityComparer<MemberInfo>.Instance);
+ if (create_open_instance)
+ inst_tokens_open = dict;
+ else
+ inst_tokens = dict;
+ } else if (dict.TryGetValue (member, out token)) {
+ return token;
}
+
// Count backwards to avoid collisions with the tokens
// allocated by the runtime
if (member is TypeBuilderInstantiation || member is SymbolType)
token = typedef_tokengen --;
else
token = typeref_tokengen --;
+ } else if (member is EnumBuilder) {
+ token = GetPseudoToken ((member as EnumBuilder).GetTypeBuilder(), create_open_instance);
+ dict[member] = token;
+ // n.b. don't register with the runtime, the TypeBuilder already did it.
+ return token;
} else if (member is ConstructorBuilder) {
if (member.Module == this && !(member as ConstructorBuilder).TypeBuilder.ContainsGenericParameters)
token = methoddef_tokengen --;
token = typespec_tokengen --;
} else
throw new NotImplementedException ();
- if (create_open_instance)
- inst_tokens_open [member] = token;
- else
- inst_tokens [member] = token;
+
+ dict [member] = token;
RegisterToken (member, token);
return token;
}
}
internal int GetToken (MemberInfo member, bool create_open_instance) {
- if (member is TypeBuilderInstantiation || member is FieldOnTypeBuilderInst || member is ConstructorOnTypeBuilderInst || member is MethodOnTypeBuilderInst || member is SymbolType || member is FieldBuilder || member is TypeBuilder || member is ConstructorBuilder || member is MethodBuilder || member is GenericTypeParameterBuilder)
+ if (member is TypeBuilderInstantiation || member is FieldOnTypeBuilderInst || member is ConstructorOnTypeBuilderInst || member is MethodOnTypeBuilderInst || member is SymbolType || member is FieldBuilder || member is TypeBuilder || member is ConstructorBuilder || member is MethodBuilder || member is GenericTypeParameterBuilder ||
+ member is EnumBuilder)
return GetPseudoToken (member, create_open_instance);
return getToken (this, member, create_open_instance);
}
finished = (member as FieldBuilder).RuntimeResolve ();
} else if (member is TypeBuilder) {
finished = (member as TypeBuilder).RuntimeResolve ();
+ } else if (member is EnumBuilder) {
+ finished = (member as EnumBuilder).RuntimeResolve ();
} else if (member is ConstructorBuilder) {
finished = (member as ConstructorBuilder).RuntimeResolve ();
} else if (member is MethodBuilder) {
//
// Fixup the pseudo tokens assigned to the various SRE objects
//
- void FixupTokens () {
+ void FixupTokens ()
+ {
var token_map = new Dictionary<int, int> ();
var member_map = new Dictionary<int, MemberInfo> ();
- FixupTokens (token_map, member_map, inst_tokens, false);
- FixupTokens (token_map, member_map, inst_tokens_open, true);
+ if (inst_tokens != null)
+ FixupTokens (token_map, member_map, inst_tokens, false);
+ if (inst_tokens_open != null)
+ FixupTokens (token_map, member_map, inst_tokens_open, true);
// Replace the tokens in the IL stream
if (types != null) {
#else
public static bool IsComObject (object o)
{
- throw new PlatformNotSupportedException ();
+ return false;
}
#endif
Assert.Fail ("Expected CreateInstance of a broken type to throw TLE");
}
+ [Test]
+ public void TestEnumBuilderTokenUsable () {
+ // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58361
+ // Create an EnumBuilder and use it in an ILGenerator that consumes its token.
+ var modBuilder = GenerateModule ();
+ EnumBuilder enumBuilder = GenerateEnum (modBuilder);
+
+ var tb = modBuilder.DefineType ("Foo", TypeAttributes.Public);
+
+ var cb = tb.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard,
+ Type.EmptyTypes);
+
+ var ilg = cb.GetILGenerator ();
+
+ ilg.Emit (OpCodes.Ldtoken, enumBuilder);
+ ilg.Emit (OpCodes.Pop);
+ ilg.Emit (OpCodes.Ret);
+
+ var t = tb.CreateType ();
+ enumBuilder.CreateType ();
+
+ var ci = t.GetConstructor (Type.EmptyTypes);
+ var x = ci.Invoke (null);
+ Assert.IsNotNull (x);
+ }
+
+ [Test]
+ public void TestEnumBuilderTokenUsableCrossAssembly () {
+ // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58361
+ // Create an EnumBuilder and use it in an ILGenerator that consumes its token in a different assembly.
+ var modBuilder = GenerateModule ();
+ var modBuilder2 = GenerateModule ();
+ EnumBuilder enumBuilder = GenerateEnum (modBuilder2);
+
+ // N.B. "tb" is in modBuilder but enumBuilder is in modBuilder2
+ var tb = modBuilder.DefineType ("Foo", TypeAttributes.Public);
+
+ var cb = tb.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard,
+ Type.EmptyTypes);
+
+ var ilg = cb.GetILGenerator ();
+
+ ilg.Emit (OpCodes.Ldtoken, enumBuilder);
+ ilg.Emit (OpCodes.Pop);
+ ilg.Emit (OpCodes.Ret);
+
+ var t = tb.CreateType ();
+ enumBuilder.CreateType ();
+
+ var ci = t.GetConstructor (Type.EmptyTypes);
+ var x = ci.Invoke (null);
+ Assert.IsNotNull (x);
+ }
+
+
private static void VerifyType (Type type)
{
Assert.IsNotNull (type.Assembly, "#V1");
--- /dev/null
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Reflection;
+using System.Reflection.Emit;
+using System.Runtime.InteropServices;
+using System.Configuration.Assemblies;
+using NUnit.Framework;
+
+namespace MonoTests.System.Reflection.Emit
+{
+
+[TestFixture]
+public class SaveTest
+{
+ // strongname generated using "sn -k unit.snk"
+ static byte[] strongName = {
+ 0x07, 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x52, 0x53, 0x41, 0x32,
+ 0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x7F, 0x7C, 0xEA, 0x4A,
+ 0x28, 0x33, 0xD8, 0x3C, 0x86, 0x90, 0x86, 0x91, 0x11, 0xBB, 0x30, 0x0D,
+ 0x3D, 0x69, 0x04, 0x4C, 0x48, 0xF5, 0x4F, 0xE7, 0x64, 0xA5, 0x82, 0x72,
+ 0x5A, 0x92, 0xC4, 0x3D, 0xC5, 0x90, 0x93, 0x41, 0xC9, 0x1D, 0x34, 0x16,
+ 0x72, 0x2B, 0x85, 0xC1, 0xF3, 0x99, 0x62, 0x07, 0x32, 0x98, 0xB7, 0xE4,
+ 0xFA, 0x75, 0x81, 0x8D, 0x08, 0xB9, 0xFD, 0xDB, 0x00, 0x25, 0x30, 0xC4,
+ 0x89, 0x13, 0xB6, 0x43, 0xE8, 0xCC, 0xBE, 0x03, 0x2E, 0x1A, 0x6A, 0x4D,
+ 0x36, 0xB1, 0xEB, 0x49, 0x26, 0x6C, 0xAB, 0xC4, 0x29, 0xD7, 0x8F, 0x25,
+ 0x11, 0xA4, 0x7C, 0x81, 0x61, 0x97, 0xCB, 0x44, 0x2D, 0x80, 0x49, 0x93,
+ 0x48, 0xA7, 0xC9, 0xAB, 0xDB, 0xCF, 0xA3, 0x34, 0xCB, 0x6B, 0x86, 0xE0,
+ 0x4D, 0x27, 0xFC, 0xA7, 0x4F, 0x36, 0xCA, 0x13, 0x42, 0xD3, 0x83, 0xC4,
+ 0x06, 0x6E, 0x12, 0xE0, 0xA1, 0x3D, 0x9F, 0xA9, 0xEC, 0xD1, 0xC6, 0x08,
+ 0x1B, 0x3D, 0xF5, 0xDB, 0x4C, 0xD4, 0xF0, 0x2C, 0xAA, 0xFC, 0xBA, 0x18,
+ 0x6F, 0x48, 0x7E, 0xB9, 0x47, 0x68, 0x2E, 0xF6, 0x1E, 0x67, 0x1C, 0x7E,
+ 0x0A, 0xCE, 0x10, 0x07, 0xC0, 0x0C, 0xAD, 0x5E, 0xC1, 0x53, 0x70, 0xD5,
+ 0xE7, 0x25, 0xCA, 0x37, 0x5E, 0x49, 0x59, 0xD0, 0x67, 0x2A, 0xBE, 0x92,
+ 0x36, 0x86, 0x8A, 0xBF, 0x3E, 0x17, 0x04, 0xFB, 0x1F, 0x46, 0xC8, 0x10,
+ 0x5C, 0x93, 0x02, 0x43, 0x14, 0x96, 0x6A, 0xD9, 0x87, 0x17, 0x62, 0x7D,
+ 0x3A, 0x45, 0xBE, 0x35, 0xDE, 0x75, 0x0B, 0x2A, 0xCE, 0x7D, 0xF3, 0x19,
+ 0x85, 0x4B, 0x0D, 0x6F, 0x8D, 0x15, 0xA3, 0x60, 0x61, 0x28, 0x55, 0x46,
+ 0xCE, 0x78, 0x31, 0x04, 0x18, 0x3C, 0x56, 0x4A, 0x3F, 0xA4, 0xC9, 0xB1,
+ 0x41, 0xED, 0x22, 0x80, 0xA1, 0xB3, 0xE2, 0xC7, 0x1B, 0x62, 0x85, 0xE4,
+ 0x81, 0x39, 0xCB, 0x1F, 0x95, 0xCC, 0x61, 0x61, 0xDF, 0xDE, 0xF3, 0x05,
+ 0x68, 0xB9, 0x7D, 0x4F, 0xFF, 0xF3, 0xC0, 0x0A, 0x25, 0x62, 0xD9, 0x8A,
+ 0x8A, 0x9E, 0x99, 0x0B, 0xFB, 0x85, 0x27, 0x8D, 0xF6, 0xD4, 0xE1, 0xB9,
+ 0xDE, 0xB4, 0x16, 0xBD, 0xDF, 0x6A, 0x25, 0x9C, 0xAC, 0xCD, 0x91, 0xF7,
+ 0xCB, 0xC1, 0x81, 0x22, 0x0D, 0xF4, 0x7E, 0xEC, 0x0C, 0x84, 0x13, 0x5A,
+ 0x74, 0x59, 0x3F, 0x3E, 0x61, 0x00, 0xD6, 0xB5, 0x4A, 0xA1, 0x04, 0xB5,
+ 0xA7, 0x1C, 0x29, 0xD0, 0xE1, 0x11, 0x19, 0xD7, 0x80, 0x5C, 0xEE, 0x08,
+ 0x15, 0xEB, 0xC9, 0xA8, 0x98, 0xF5, 0xA0, 0xF0, 0x92, 0x2A, 0xB0, 0xD3,
+ 0xC7, 0x8C, 0x8D, 0xBB, 0x88, 0x96, 0x4F, 0x18, 0xF0, 0x8A, 0xF9, 0x31,
+ 0x9E, 0x44, 0x94, 0x75, 0x6F, 0x78, 0x04, 0x10, 0xEC, 0xF3, 0xB0, 0xCE,
+ 0xA0, 0xBE, 0x7B, 0x25, 0xE1, 0xF7, 0x8A, 0xA8, 0xD4, 0x63, 0xC2, 0x65,
+ 0x47, 0xCC, 0x5C, 0xED, 0x7D, 0x8B, 0x07, 0x4D, 0x76, 0x29, 0x53, 0xAC,
+ 0x27, 0x8F, 0x5D, 0x78, 0x56, 0xFA, 0x99, 0x45, 0xA2, 0xCC, 0x65, 0xC4,
+ 0x54, 0x13, 0x9F, 0x38, 0x41, 0x7A, 0x61, 0x0E, 0x0D, 0x34, 0xBC, 0x11,
+ 0xAF, 0xE2, 0xF1, 0x8B, 0xFA, 0x2B, 0x54, 0x6C, 0xA3, 0x6C, 0x09, 0x1F,
+ 0x0B, 0x43, 0x9B, 0x07, 0x95, 0x83, 0x3F, 0x97, 0x99, 0x89, 0xF5, 0x51,
+ 0x41, 0xF6, 0x8E, 0x5D, 0xEF, 0x6D, 0x24, 0x71, 0x41, 0x7A, 0xAF, 0xBE,
+ 0x81, 0x71, 0xAB, 0x76, 0x2F, 0x1A, 0x5A, 0xBA, 0xF3, 0xA6, 0x65, 0x7A,
+ 0x80, 0x50, 0xCE, 0x23, 0xC3, 0xC7, 0x53, 0xB0, 0x7C, 0x97, 0x77, 0x27,
+ 0x70, 0x98, 0xAE, 0xB5, 0x24, 0x66, 0xE1, 0x60, 0x39, 0x41, 0xDA, 0x54,
+ 0x01, 0x64, 0xFB, 0x10, 0x33, 0xCE, 0x8B, 0xBE, 0x27, 0xD4, 0x21, 0x57,
+ 0xCC, 0x0F, 0x1A, 0xC1, 0x3D, 0xF3, 0xCC, 0x39, 0xF0, 0x2F, 0xAE, 0xF1,
+ 0xC0, 0xCD, 0x3B, 0x23, 0x87, 0x49, 0x7E, 0x40, 0x32, 0x6A, 0xD3, 0x96,
+ 0x4A, 0xE5, 0x5E, 0x6E, 0x26, 0xFD, 0x8A, 0xCF, 0x7E, 0xFC, 0x37, 0xDE,
+ 0x39, 0x0C, 0x53, 0x81, 0x75, 0x08, 0xAF, 0x6B, 0x39, 0x6C, 0xFB, 0xC9,
+ 0x79, 0xC0, 0x9B, 0x5F, 0x34, 0x86, 0xB2, 0xDE, 0xC4, 0x19, 0x84, 0x5F,
+ 0x0E, 0xED, 0x9B, 0xB8, 0xD3, 0x17, 0xDA, 0x78 };
+
+ [Test]
+ public void Save () {
+ // FIXME: Temp dir etc.
+
+ //
+ // Create a test assembly, write it to disk, then read it back
+ //
+ AssemblyName aname = new AssemblyName ("h");
+ // AssemblyName properties
+ aname.ProcessorArchitecture = ProcessorArchitecture.X86;
+ aname.Version = new Version (1, 2, 3, 4);
+ aname.CultureInfo = new CultureInfo ("en");
+ aname.Flags = AssemblyNameFlags.Retargetable;
+ aname.HashAlgorithm = AssemblyHashAlgorithm.SHA256;
+ var ab = AppDomain.CurrentDomain.DefineDynamicAssembly (aname, AssemblyBuilderAccess.RunAndSave);
+
+ string strongfile = "strongname.snk";
+ using (FileStream fs = File.OpenWrite (strongfile)) {
+ fs.Write (strongName, 0, strongName.Length);
+ fs.Close ();
+ }
+ ab.SetCustomAttribute (new CustomAttributeBuilder (typeof (AssemblyKeyFileAttribute).GetConstructor (new Type [] { typeof (string) }), new object [] { strongfile }));
+ ab.SetCustomAttribute (new CustomAttributeBuilder (typeof (AssemblyDelaySignAttribute).GetConstructor (new Type [] { typeof (bool) }), new object [] { true }));
+
+ var cattrb = new CustomAttributeBuilder (typeof (AttributeUsageAttribute).GetConstructor (new Type [] { typeof (AttributeTargets) }), new object [] { AttributeTargets.Class },
+ new PropertyInfo[] { typeof (AttributeUsageAttribute).GetProperty ("AllowMultiple") },
+ new object[] { true },
+ new FieldInfo [0], new object [0]);
+ ab.SetCustomAttribute (cattrb);
+
+ var moduleb = ab.DefineDynamicModule ("h.exe", "h.exe");
+ moduleb.SetCustomAttribute (cattrb);
+
+ TypeBuilder iface1 = moduleb.DefineType ("iface1", TypeAttributes.Public|TypeAttributes.Interface, typeof (object));
+ iface1.CreateType ();
+
+ // Interfaces, attributes, class size, packing size
+ TypeBuilder tb1 = moduleb.DefineType ("type1", TypeAttributes.Public|TypeAttributes.SequentialLayout, typeof (object), PackingSize.Size2, 16);
+ tb1.AddInterfaceImplementation (iface1);
+ tb1.AddInterfaceImplementation (typeof (IComparable));
+ tb1.SetCustomAttribute (cattrb);
+ tb1.CreateType ();
+
+ // Nested type
+ TypeBuilder tb_nested = tb1.DefineNestedType ("type_nested", TypeAttributes.NestedPublic, typeof (object));
+ tb_nested.CreateType ();
+
+ // Generics
+ TypeBuilder tbg = moduleb.DefineType ("gtype1", TypeAttributes.Public, typeof (object));
+ var gparams = tbg.DefineGenericParameters ("K", "T");
+ // Constraints
+ gparams [0].SetBaseTypeConstraint (null);
+ gparams [0].SetInterfaceConstraints (new Type [] { typeof (IComparable) });
+ gparams [0].SetCustomAttribute (cattrb);
+ gparams [1].SetBaseTypeConstraint (tbg);
+ // Type param
+ tbg.DefineField ("field_gparam", tbg.GetGenericArguments () [0], FieldAttributes.Public|FieldAttributes.Static);
+ // Open type
+ tbg.DefineField ("field_open", typeof (List<>).MakeGenericType (new Type [] { tbg.GetGenericArguments () [1] }), FieldAttributes.Public|FieldAttributes.Static);
+ tbg.CreateType ();
+
+ TypeBuilder tbg2 = moduleb.DefineType ("gtype2", TypeAttributes.Public, typeof (object));
+ tbg2.DefineGenericParameters ("K", "T");
+ tbg2.CreateType ();
+
+ TypeBuilder tb3 = moduleb.DefineType ("type3", TypeAttributes.Public, typeof (object));
+ // Nested type
+ tb3.DefineField ("field_nested", tb_nested, FieldAttributes.Public|FieldAttributes.Static);
+ // Nested type ref
+ tb3.DefineField ("field_nested_ref", typeof (TimeZoneInfo.AdjustmentRule), FieldAttributes.Public|FieldAttributes.Static);
+ // Primitive types
+ tb3.DefineField ("field_int", typeof (int), FieldAttributes.Public|FieldAttributes.Static);
+ // Typeref array
+ tb3.DefineField ("field_array_typeref", typeof (object[]), FieldAttributes.Public|FieldAttributes.Static);
+ // Type szarray
+ tb3.DefineField ("field_szarray", tb1.MakeArrayType (), FieldAttributes.Public|FieldAttributes.Static);
+ // Multi-dim non szarray
+ tb3.DefineField ("field_non_szarray", Array.CreateInstance (typeof (int), new int [] { 10 }, new int [] { 1 }).GetType (), FieldAttributes.Public|FieldAttributes.Static);
+ // Multi-dim array
+ tb3.DefineField ("field_multi_dim_array", Array.CreateInstance (typeof (int), new int [] { 10, 10 }, new int [] { 1, 1 }).GetType (), FieldAttributes.Public|FieldAttributes.Static);
+ // Type pointer
+ tb3.DefineField ("field_pointer", tb1.MakePointerType (), FieldAttributes.Public|FieldAttributes.Static);
+ // Generic instance
+ tb3.DefineField ("field_ginst", typeof (List<int>), FieldAttributes.Public|FieldAttributes.Static);
+ // Generic instance of tbuilder
+ tb3.DefineField ("field_ginst_tbuilder", tbg2.MakeGenericType (new Type [] { typeof (int), typeof (string) }), FieldAttributes.Public|FieldAttributes.Static);
+ tb3.CreateType ();
+
+ // Fields
+ TypeBuilder tb_fields = moduleb.DefineType ("type4", TypeAttributes.Public, typeof (object));
+ // Field with a constant
+ tb_fields.DefineField ("field_int", typeof (int), FieldAttributes.Public|FieldAttributes.Static|FieldAttributes.HasDefault).SetConstant (42);
+ // Field with an offset
+ tb_fields.DefineField ("field_offset", typeof (int), FieldAttributes.Public|FieldAttributes.Static).SetOffset (64);
+ // Modreq/modopt
+ tb_fields.DefineField ("field_modopt", typeof (int), new Type [] { typeof (int) }, new Type [] { typeof (uint) }, FieldAttributes.Public|FieldAttributes.Static);
+ // Marshal
+ var fb = tb_fields.DefineField ("field_marshal1", typeof (int), FieldAttributes.Public);
+ fb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.U4 }));
+ fb = tb_fields.DefineField ("field_marshal_byval_array", typeof (int), FieldAttributes.Public);
+ fb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.ByValArray },
+ new FieldInfo[] { typeof (MarshalAsAttribute).GetField ("SizeConst") },
+ new object[] { 16 }));
+ fb = tb_fields.DefineField ("field_marshal_byval_tstr", typeof (int), FieldAttributes.Public);
+ fb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.ByValTStr },
+ new FieldInfo[] { typeof (MarshalAsAttribute).GetField ("SizeConst") },
+ new object[] { 16 }));
+#if false
+ fb = tb_fields.DefineField ("field_marshal_custom", typeof (int), FieldAttributes.Public);
+ fb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.CustomMarshaler },
+ new FieldInfo[] { typeof (MarshalAsAttribute).GetField ("MarshalTypeRef"),
+ typeof (MarshalAsAttribute).GetField ("MarshalCookie") },
+ new object [] { typeof (object), "Cookie" }));
+#endif
+ // Cattr
+ fb = tb_fields.DefineField ("field_cattr", typeof (int), FieldAttributes.Public|FieldAttributes.Static);
+ fb.SetCustomAttribute (cattrb);
+ tb_fields.CreateType ();
+
+ // Data
+ moduleb.DefineUninitializedData ("data1", 16, FieldAttributes.Public);
+ moduleb.DefineInitializedData ("data2", new byte[] { 1, 2, 3, 4, 5, 6 }, FieldAttributes.Public);
+
+ // Methods and signatures
+ TypeBuilder tb5 = moduleb.DefineType ("type_methods", TypeAttributes.Public, typeof (object));
+ // .ctor
+ var cmods_req_1 = new Type [] { typeof (object) };
+ var cmods_opt_1 = new Type [] { typeof (int) };
+ var ctorb = tb5.DefineConstructor (MethodAttributes.Public, CallingConventions.VarArgs, new Type [] { typeof (int), typeof (object) }, new Type[][] { cmods_req_1, null }, new Type [][] { cmods_opt_1, null });
+ ctorb.SetImplementationFlags (MethodImplAttributes.NoInlining);
+ ctorb.GetILGenerator ().Emit (OpCodes.Ret);
+ // Parameters
+ var paramb = ctorb.DefineParameter (1, ParameterAttributes.None, "param1");
+ paramb.SetConstant (16);
+ paramb.SetCustomAttribute (cattrb);
+ paramb = ctorb.DefineParameter (2, ParameterAttributes.Out, "param2");
+ //paramb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.U4 }));
+ // .cctor
+ var ctorb2 = tb5.DefineConstructor (MethodAttributes.Public|MethodAttributes.Static, CallingConventions.Standard, new Type [] { typeof (int), typeof (object) });
+ ctorb2.GetILGenerator ().Emit (OpCodes.Ret);
+ // method
+ var mb = tb5.DefineMethod ("method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), cmods_req_1, cmods_opt_1, new Type [] { typeof (int), typeof (object) }, new Type [][] { cmods_req_1, null }, new Type [][] { cmods_opt_1, null });
+ mb.SetImplementationFlags (MethodImplAttributes.NoInlining);
+ mb.GetILGenerator ().Emit (OpCodes.Ret);
+ gparams = mb.DefineGenericParameters ("K", "T");
+ // Constraints
+ gparams [0].SetBaseTypeConstraint (null);
+ gparams [0].SetInterfaceConstraints (new Type [] { typeof (IComparable) });
+ paramb = mb.DefineParameter (1, ParameterAttributes.None, "param1");
+ paramb.SetConstant (16);
+ paramb = mb.DefineParameter (2, ParameterAttributes.Out, "param2");
+ //paramb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.U4 }));
+ // return value
+ paramb = mb.DefineParameter (0, ParameterAttributes.None, "ret");
+ //paramb.SetCustomAttribute (new CustomAttributeBuilder (typeof (MarshalAsAttribute).GetConstructor (new Type [] { typeof (UnmanagedType) }), new object [] { UnmanagedType.U4 }));
+ paramb.SetCustomAttribute (cattrb);
+ // override method
+ tb5.AddInterfaceImplementation (typeof (IComparable));
+ mb = tb5.DefineMethod ("method_override", MethodAttributes.Public|MethodAttributes.Virtual, CallingConventions.Standard|CallingConventions.HasThis, typeof (int), new Type [] { typeof (object) });
+ mb.GetILGenerator ().Emit (OpCodes.Ret);
+ tb5.DefineMethodOverride (mb, typeof (IComparable).GetMethod ("CompareTo"));
+ tb5.CreateType ();
+
+ // Properties
+ TypeBuilder tb_properties = moduleb.DefineType ("type_properties", TypeAttributes.Public, typeof (object));
+ var mb_get = tb_properties.DefineMethod ("get_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_get.GetILGenerator ().Emit (OpCodes.Ret);
+ var mb_set = tb_properties.DefineMethod ("set_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_set.GetILGenerator ().Emit (OpCodes.Ret);
+ var mb_other = tb_properties.DefineMethod ("other_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_other.GetILGenerator ().Emit (OpCodes.Ret);
+ var propertyb = tb_properties.DefineProperty ("AProperty", PropertyAttributes.HasDefault, typeof (int), new Type[] { typeof (object) });
+ propertyb.SetCustomAttribute (cattrb);
+ propertyb.SetConstant (1);
+ propertyb.SetGetMethod (mb_get);
+ propertyb.SetSetMethod (mb_set);
+ propertyb.AddOtherMethod (mb_other);
+ tb_properties.CreateType ();
+
+ // Events
+ TypeBuilder tb_events = moduleb.DefineType ("type_events", TypeAttributes.Public, typeof (object));
+ var mb_add = tb_events.DefineMethod ("add_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_add.GetILGenerator ().Emit (OpCodes.Ret);
+ var mb_raise = tb_events.DefineMethod ("raise_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_raise.GetILGenerator ().Emit (OpCodes.Ret);
+ var mb_remove = tb_events.DefineMethod ("remove_method1", MethodAttributes.Public, CallingConventions.Standard, typeof (int), new Type [] { });
+ mb_remove.GetILGenerator ().Emit (OpCodes.Ret);
+ var eventb = tb_events.DefineEvent ("Event1", EventAttributes.SpecialName, typeof (int));
+ eventb.SetCustomAttribute (cattrb);
+ eventb.SetAddOnMethod (mb_add);
+ eventb.SetRaiseMethod (mb_raise);
+ eventb.SetRemoveOnMethod (mb_remove);
+ tb_events.CreateType ();
+
+ ab.Save ("h.exe");
+
+ // Read the assembly and check data
+ Assembly a = Assembly.LoadFrom ("h.exe");
+ Assert.IsTrue (a != ab);
+ CheckAssembly (a);
+ }
+
+ void CheckCattr (ICustomAttributeProvider obj) {
+ var cattrs = obj.GetCustomAttributes (typeof (AttributeUsageAttribute), false);
+ Assert.AreEqual (1, cattrs.Length);
+ var cattr = (AttributeUsageAttribute)cattrs [0];
+ Assert.AreEqual (AttributeTargets.Class, cattr.ValidOn);
+ Assert.IsTrue (cattr.AllowMultiple);
+ }
+
+ void CheckAssembly (Assembly a) {
+ // AssemblyName properties
+ var aname = a.GetName (false);
+ Assert.AreEqual (new Version (1, 2, 3, 4), aname.Version);
+ Assert.AreEqual ("en", aname.CultureInfo.Name);
+ Assert.IsTrue ((aname.Flags & AssemblyNameFlags.Retargetable) > 0);
+ //Assert.AreEqual (AssemblyHashAlgorithm.SHA256, aname.HashAlgorithm);
+ CheckCattr (a);
+
+ var iface1 = a.GetType ("iface1");
+ var gtype2 = a.GetType ("gtype2");
+
+ var type1 = a.GetType ("type1");
+ Assert.IsNotNull (type1);
+
+ // Type attributes
+ Assert.AreEqual (TypeAttributes.Public|TypeAttributes.SequentialLayout, type1.Attributes);
+ // Interfaces
+ Assert.AreEqual (2, type1.GetInterfaces ().Length);
+ Assert.AreEqual (iface1, type1.GetInterfaces () [0]);
+ Assert.AreEqual (typeof (IComparable), type1.GetInterfaces () [1]);
+ CheckCattr (type1);
+ // FIXME: Class size/packing size
+
+ // Nested types
+ var type_nested = a.GetType ("type1/type_nested");
+ Assert.IsNotNull (type_nested);
+
+ // Generics
+ var gtype1 = a.GetType ("gtype1");
+ Assert.IsTrue (gtype1.IsGenericTypeDefinition);
+ // Generic parameters
+ var gparams = gtype1.GetGenericArguments ();
+ Assert.AreEqual (2, gparams.Length);
+ Assert.AreEqual ("K", gparams [0].Name);
+ Assert.AreEqual ("T", gparams [1].Name);
+ var constraints = gparams [0].GetGenericParameterConstraints ();
+ Assert.AreEqual (2, constraints.Length);
+ Assert.AreEqual (typeof (object), constraints [0]);
+ Assert.AreEqual (typeof (IComparable), constraints [1]);
+ CheckCattr (gparams [0]);
+ constraints = gparams [1].GetGenericParameterConstraints ();
+ Assert.AreEqual (1, constraints.Length);
+ Assert.AreEqual (gtype1, constraints [0]);
+ // Type param encoding
+ var field = gtype1.GetField ("field_gparam");
+ Assert.AreEqual (gparams [0], field.FieldType);
+ field = gtype1.GetField ("field_open");
+ Assert.AreEqual (typeof (List<>).MakeGenericType (new Type [] { gparams [1] }), field.FieldType);
+
+ // Type encoding
+ var t = a.GetType ("type3");
+ Assert.AreEqual (type_nested, t.GetField ("field_nested").FieldType);
+ Assert.AreEqual (typeof (TimeZoneInfo.AdjustmentRule), t.GetField ("field_nested_ref").FieldType);
+ Assert.AreEqual (typeof (int), t.GetField ("field_int").FieldType);
+ Assert.AreEqual (typeof (object[]), t.GetField ("field_array_typeref").FieldType);
+ Assert.AreEqual (type1.MakeArrayType (), t.GetField ("field_szarray").FieldType);
+ var arraytype1 = Array.CreateInstance (typeof (int), new int [] { 10 }, new int [] { 1 }).GetType ();
+ // FIXME:
+ //Assert.AreEqual (arraytype1, t.GetField ("field_non_szarray").FieldType);
+ arraytype1 = Array.CreateInstance (typeof (int), new int [] { 10, 10 }, new int [] { 1, 1 }).GetType ();
+ Assert.AreEqual (arraytype1, t.GetField ("field_multi_dim_array").FieldType);
+ Assert.AreEqual (type1.MakePointerType (), t.GetField ("field_pointer").FieldType);
+ Assert.AreEqual (typeof (List<int>), t.GetField ("field_ginst").FieldType);
+ var ginsttype = gtype2.MakeGenericType (new Type [] { typeof (int), typeof (string) });
+ Assert.AreEqual (ginsttype, t.GetField ("field_ginst_tbuilder").FieldType);
+
+ // Field properties
+ var type4 = a.GetType ("type4");
+ // FIXME: constant
+ field = type4.GetField ("field_int");
+ // FIXME: field offset
+ field = type4.GetField ("field_offset");
+ //var attrs = field.GetCustomAttributes (typeof (FieldOffsetAttribute), true);
+ field = type4.GetField ("field_modopt");
+ var cmods = field.GetRequiredCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (int), cmods [0]);
+ cmods = field.GetOptionalCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (uint), cmods [0]);
+ // FIXME: marshal
+ // Simple marshal
+ field = type4.GetField ("field_marshal1");
+ var attrs = field.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ var marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.U4, marshal.Value);
+ // ByValArray
+ field = type4.GetField ("field_marshal_byval_array");
+ attrs = field.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.ByValArray, marshal.Value);
+ Assert.AreEqual (16, marshal.SizeConst);
+ // ByValTStr
+ field = type4.GetField ("field_marshal_byval_tstr");
+ attrs = field.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.ByValTStr, marshal.Value);
+ Assert.AreEqual (16, marshal.SizeConst);
+#if false
+ // Custom marshaler
+ field = type4.GetField ("field_marshal_custom");
+ attrs = field.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.CustomMarshaler, marshal.Value);
+ Assert.AreEqual (typeof (object), marshal.MarshalTypeRef);
+ Assert.AreEqual ("Cookie", marshal.MarshalCookie);
+#endif
+ field = type4.GetField ("field_cattr");
+ CheckCattr (field);
+
+ // Global fields
+ field = a.ManifestModule.GetField ("data1");
+ Assert.IsNotNull (field);
+ field = a.ManifestModule.GetField ("data2");
+ Assert.IsNotNull (field);
+
+ // Methods and signatures
+ var type_methods = a.GetType ("type_methods");
+ var ctors = type_methods.GetConstructors (BindingFlags.Public|BindingFlags.Static|BindingFlags.Instance);
+ Assert.AreEqual (2, ctors.Length);
+ // .ctor
+ var ctor = type_methods.GetConstructor (new Type[] { typeof (int), typeof (object) });
+ Assert.IsNotNull (ctor);
+ Assert.AreEqual (MethodImplAttributes.NoInlining|MethodImplAttributes.IL, ctor.GetMethodImplementationFlags ());
+ //Assert.AreEqual (CallingConventions.VarArgs, ctor.CallingConvention);
+ // .cctor
+ ctors = type_methods.GetConstructors (BindingFlags.Public|BindingFlags.Static);
+ Assert.AreEqual (1, ctors.Length);
+ // parameters
+ ctor = type_methods.GetConstructor (new Type[] { typeof (int), typeof (object) });
+ Assert.IsNotNull (ctor);
+ var parameters = ctor.GetParameters ();
+ Assert.AreEqual (2, parameters.Length);
+ Assert.AreEqual ("param1", parameters [0].Name);
+ Assert.AreEqual (typeof (int), parameters [0].ParameterType);
+ Assert.AreEqual (ParameterAttributes.HasDefault, parameters [0].Attributes);
+ Assert.AreEqual (16, parameters [0].RawDefaultValue);
+ CheckCattr (parameters [0]);
+ cmods = parameters [0].GetRequiredCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (object), cmods [0]);
+ cmods = parameters [0].GetOptionalCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (int), cmods [0]);
+ Assert.AreEqual ("param2", parameters [1].Name);
+#if false
+ Assert.AreEqual (ParameterAttributes.Out|ParameterAttributes.HasFieldMarshal, parameters [1].Attributes);
+ Assert.AreEqual (typeof (object), parameters [1].ParameterType);
+ attrs = parameters [1].GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.U4, marshal.Value);
+#endif
+ // methods
+ var method = type_methods.GetMethod ("method1");
+ Assert.IsNotNull (method);
+ Assert.AreEqual (typeof (int), method.ReturnType);
+ Assert.AreEqual (MethodImplAttributes.NoInlining|MethodImplAttributes.IL, method.GetMethodImplementationFlags ());
+ gparams = gtype1.GetGenericArguments ();
+ Assert.AreEqual (2, gparams.Length);
+ Assert.AreEqual ("K", gparams [0].Name);
+ Assert.AreEqual ("T", gparams [1].Name);
+ constraints = gparams [0].GetGenericParameterConstraints ();
+ Assert.AreEqual (2, constraints.Length);
+ Assert.AreEqual (typeof (object), constraints [0]);
+ Assert.AreEqual (typeof (IComparable), constraints [1]);
+ parameters = method.GetParameters ();
+ // method parameters
+ Assert.AreEqual (2, parameters.Length);
+ Assert.AreEqual ("param1", parameters [0].Name);
+ Assert.AreEqual (typeof (int), parameters [0].ParameterType);
+ Assert.AreEqual (ParameterAttributes.HasDefault, parameters [0].Attributes);
+ Assert.AreEqual (16, parameters [0].RawDefaultValue);
+ cmods = parameters [0].GetRequiredCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (object), cmods [0]);
+ cmods = parameters [0].GetOptionalCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (int), cmods [0]);
+ Assert.AreEqual ("param2", parameters [1].Name);
+#if false
+ Assert.AreEqual (ParameterAttributes.Out|ParameterAttributes.HasFieldMarshal, parameters [1].Attributes);
+ Assert.AreEqual (typeof (object), parameters [1].ParameterType);
+ attrs = parameters [1].GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.U4, marshal.Value);
+#endif
+ // return type
+ var rparam = method.ReturnParameter;
+ cmods = rparam.GetRequiredCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (object), cmods [0]);
+ cmods = rparam.GetOptionalCustomModifiers ();
+ Assert.AreEqual (1, cmods.Length);
+ Assert.AreEqual (typeof (int), cmods [0]);
+#if false
+ attrs = rparam.GetCustomAttributes (typeof (MarshalAsAttribute), true);
+ Assert.AreEqual (1, attrs.Length);
+ marshal = attrs [0] as MarshalAsAttribute;
+ Assert.AreEqual (UnmanagedType.U4, marshal.Value);
+#endif
+ CheckCattr (rparam);
+
+ // Properties
+ var type_props = a.GetType ("type_properties");
+ var prop = type_props.GetProperty ("AProperty");
+ Assert.IsNotNull (prop);
+ Assert.AreEqual (PropertyAttributes.HasDefault, prop.Attributes);
+ var getter = prop.GetGetMethod ();
+ Assert.IsNotNull (getter);
+ Assert.AreEqual ("get_method1", getter.Name);
+ var setter = prop.GetSetMethod ();
+ Assert.IsNotNull (setter);
+ Assert.AreEqual ("set_method1", setter.Name);
+ CheckCattr (prop);
+
+ // Events
+ var type_events = a.GetType ("type_events");
+ var ev = type_events.GetEvent ("Event1");
+ Assert.IsNotNull (ev);
+ var m = ev.AddMethod;
+ Assert.IsNotNull (m);
+ Assert.AreEqual ("add_method1", m.Name);
+ m = ev.RemoveMethod;
+ Assert.IsNotNull (m);
+ Assert.AreEqual ("remove_method1", m.Name);
+ m = ev.RaiseMethod;
+ Assert.IsNotNull (m);
+ Assert.AreEqual ("raise_method1", m.Name);
+ Assert.AreEqual (EventAttributes.SpecialName, ev.Attributes);
+ CheckCattr (ev);
+ }
+}
+}
}
}
+ [Test]
+ public void TestEnumWithLateUnderlyingField ()
+ {
+ TypeBuilder enumToCreate = module.DefineType (genTypeName (), TypeAttributes.Public, typeof (Enum));
+ enumToCreate.DefineField ("value__", typeof (Int32),
+ FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
+
+ TypeBuilder enumToCreate2 = module.DefineType (genTypeName (), TypeAttributes.Public, typeof (Enum));
+
+ TypeBuilder ivTypeBld = module.DefineType (genTypeName (), TypeAttributes.Public);
+
+ ConstructorBuilder ivCtor = ivTypeBld.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes);
+
+ ILGenerator ctorIL = ivCtor.GetILGenerator ();
+
+ ctorIL.Emit (OpCodes.Ldtoken, typeof (Object));
+ ctorIL.Emit (OpCodes.Pop);
+ ctorIL.Emit (OpCodes.Ldtoken, enumToCreate);
+ ctorIL.Emit (OpCodes.Pop);
+ ctorIL.Emit (OpCodes.Ldtoken, enumToCreate2);
+ ctorIL.Emit (OpCodes.Pop);
+ ctorIL.Emit (OpCodes.Ret);
+
+ var ivType = ivTypeBld.CreateType ();
+
+ enumToCreate2.DefineField ("value__", typeof (Int32), FieldAttributes.Public | FieldAttributes.SpecialName | FieldAttributes.RTSpecialName);
+
+ FieldBuilder fb = enumToCreate2.DefineField ("A", enumToCreate, FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal);
+ fb.SetConstant (0);
+
+ enumToCreate.CreateType ();
+ enumToCreate2.CreateType ();
+ }
+
[Test]
public void TestIsAbstract ()
{
assembly.Save (ASSEMBLY_NAME + ".dll");
}
+
+ [Test]
+ public void TwoAssembliesMidFlightTest () {
+ // Check that one AssemblyBuilder can refer to a TypeBuilder from another AssemblyBuilder.
+ // Regression test for https://bugzilla.xamarin.com/show_bug.cgi?id=58421
+ var name2 = "MonoTests.System.Reflection.Emit.TypeBuilderTest2";
+ var assemblyName2 = new AssemblyName (name2);
+ var assembly2 =
+ Thread.GetDomain ().DefineDynamicAssembly (
+ assemblyName2, AssemblyBuilderAccess.RunAndSave, tempDir);
+
+ var module2 = assembly2.DefineDynamicModule (name2, name2 + ".dll");
+
+ var tb = module.DefineType ("Foo", TypeAttributes.Public);
+ var tb2 = module2.DefineType ("Foo2", TypeAttributes.Public);
+
+ var cb = tb.DefineConstructor (MethodAttributes.Public, CallingConventions.Standard,
+ Type.EmptyTypes);
+
+ var ilg = cb.GetILGenerator ();
+
+ ilg.Emit (OpCodes.Ldtoken, tb2); // N.B. type from the other AssemblyBuilder
+ ilg.Emit (OpCodes.Pop);
+ ilg.Emit (OpCodes.Ret);
+
+ var t = tb.CreateType ();
+ tb2.CreateType ();
+
+ var ci = t.GetConstructor (Type.EmptyTypes);
+ var x = ci.Invoke (null);
+ assembly.Save (ASSEMBLY_NAME + ".dll");
+ assembly2.Save (name2 + ".dll");
+ }
+
}
}
</PropertyGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<ItemGroup>\r
+ <Compile Include="..\..\..\external\corefx\src\Common\src\System\Collections\Generic\ReferenceEqualityComparer.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\CDSCollectionETWBCLProvider.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentDictionary.cs" />\r
<Compile Include="..\..\..\external\corefx\src\System.Collections.Concurrent\src\System\Collections\Concurrent\ConcurrentQueue.cs" />\r
corefx/SR.cs
+../../../external/corefx/src/Common/src/System/Collections/Generic/ReferenceEqualityComparer.cs
+
../../../external/corefx/src/System.Collections/src/System/Collections/Generic/CollectionExtensions.cs
../../../external/corefx/src/System.Collections.Concurrent/src/System/Collections/Concurrent/CDSCollectionETWBCLProvider.cs
System.Reflection.Emit/PropertyBuilderTest.cs
System.Reflection.Emit/SignatureHelperTest.cs
System.Reflection.Emit/TypeBuilderTest.cs
+System.Reflection.Emit/SaveTest.cs
System.Reflection/ModuleTest.cs
System.Reflection/StrongNameKeyPairTest.cs
System/ResolveEventArgsTest.cs
System.Reflection.Emit/PropertyBuilderTest.cs
System.Reflection.Emit/SignatureHelperTest.cs
System.Reflection.Emit/TypeBuilderTest.cs
+System.Reflection.Emit/SaveTest.cs
System.Runtime.Remoting/ContextTest.cs
System.Runtime.Remoting/RemotingConfigurationTest.cs
System.Runtime.Remoting/RemotingServicesTest.cs
--- /dev/null
+// CS1621: The yield statement cannot be used inside anonymous method blocks
+// Line: 12
+
+using System;
+using System.Collections;
+
+public class Test
+{
+ public IEnumerator Foo ()
+ {
+ Call (() => {
+ yield break;
+ });
+
+ yield break;
+ }
+
+ void Call (Action a)
+ {
+ }
+}
\ No newline at end of file
using System.Reflection;
#endif
-namespace Mono.CSharp {
+namespace Mono.CSharp
+{
public class EnumMember : Const
{
+#if !STATIC
+ class MemberTypeDelegator : TypeDelegator
+ {
+ Type underlyingType;
+
+ public MemberTypeDelegator (Type delegatingType, Type underlyingType)
+ : base (delegatingType)
+ {
+ this.underlyingType = underlyingType;
+ }
+
+ public override Type GetEnumUnderlyingType ()
+ {
+ return underlyingType;
+ }
+
+ public override Type UnderlyingSystemType {
+ get {
+ return underlyingType;
+ }
+ }
+ }
+#endif
+
class EnumTypeExpr : TypeExpr
{
public override TypeSpec ResolveAsType (IMemberContext ec, bool allowUnboundTypeArguments)
if (!ResolveMemberType ())
return false;
+ MetaType ftype = MemberType.GetMetaInfo ();
+#if !STATIC
+ //
+ // Workaround for .net SRE limitation which cannot define field of unbaked enum type
+ // which is how all enums are declared
+ //
+ ftype = new MemberTypeDelegator (ftype, ((Enum)Parent).UnderlyingType.GetMetaInfo ());
+#endif
+
const FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.Literal;
- FieldBuilder = Parent.TypeBuilder.DefineField (Name, MemberType.GetMetaInfo (), attr);
+ FieldBuilder = Parent.TypeBuilder.DefineField (Name, ftype, attr);
spec = new ConstSpec (Parent.Definition, this, MemberType, FieldBuilder, ModFlags, initializer);
Parent.MemberCache.AddMember (spec);
protected override void CloneTo (CloneContext clonectx, Statement target)
{
- throw new NotSupportedException ();
}
protected override bool DoResolve (BlockContext bc)
<AppDesignerFolder>Properties</AppDesignerFolder>\r
<RootNamespace>csharp</RootNamespace>\r
<AssemblyName>csharp</AssemblyName>\r
- <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>\r
+ <TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>\r
<FileAlignment>512</FileAlignment>\r
<FileUpgradeFlags>\r
</FileUpgradeFlags>\r
<SchemaVersion>2.0</SchemaVersion>\r
<ProjectGuid>{ED867AC1-079C-4B5E-ADF9-E7722053B360}</ProjectGuid>\r
<OutputType>Exe</OutputType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<SchemaVersion>2.0</SchemaVersion>\r
<ProjectGuid>{FA920637-C202-4E75-AC0F-1A8DBD631DF1}</ProjectGuid>\r
<OutputType>Exe</OutputType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<SchemaVersion>2.0</SchemaVersion>\r
<ProjectGuid>{647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}</ProjectGuid>\r
<OutputType>Exe</OutputType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>\r
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">\r
<DebugSymbols>true</DebugSymbols>\r
<DebugType>full</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>false</Optimize>\r
- <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>TRACE;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">\r
<DebugType>pdbonly</DebugType>\r
- <NoWarn>1699,1699</NoWarn>\r
+ <NoWarn>1699</NoWarn>\r
<Optimize>true</Optimize>\r
- <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS;NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
+ <DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;MULTIPLEX_OS</DefineConstants>\r
<ErrorReport>prompt</ErrorReport>\r
<WarningLevel>4</WarningLevel>\r
</PropertyGroup>\r
common_sources = \
$(platform_sources) \
+ appdomain.c \
+ domain.c \
appdomain-icalls.h \
assembly.c \
assembly-internals.h \
number-formatter.h \
number-ms.c \
number-ms.h \
+ object.c \
object-internals.h \
opcodes.c \
property-bag.h \
w32process-internals.h \
profiler.c \
profiler-events.h \
+ profiler-legacy.c \
profiler-private.h \
rand.h \
rand.c \
w32handle-namespace.c \
w32handle.h \
w32handle.c \
- w32error.h
+ w32error.h \
+ reflection.c \
+ dynamic-image.c \
+ sre.c \
+ sre-encode.c \
+ sre-save.c \
+ custom-attrs.c
# These source files have compile time dependencies on GC code
gc_dependent_sources = \
- appdomain.c \
- domain.c \
gc-stats.c \
gc.c \
monitor.c \
mono-hash.c \
- mono-conc-hash.c \
- object.c \
- dynamic-image.c \
- sre.c \
- sre-encode.c \
- sre-save.c \
- custom-attrs.c \
- reflection.c
-
+ mono-conc-hash.c
boehm_sources = \
boehm-gc.c
mono_loader_lock (); //FIXME why do we need the loader lock here?
mono_domain_lock (domain);
-#ifdef HAVE_SGEN_GC
/*
* We need to make sure that we don't have any remsets
* pointing into static data of the to-be-freed domain because
for (i = 0; i < domain->class_vtable_array->len; ++i)
zero_static_data ((MonoVTable *)g_ptr_array_index (domain->class_vtable_array, i));
mono_gc_collect (0);
-#endif
for (i = 0; i < domain->class_vtable_array->len; ++i)
clear_cached_vtable ((MonoVTable *)g_ptr_array_index (domain->class_vtable_array, i));
deregister_reflection_info_roots (domain);
}
mono_appdomains_unlock ();
-#ifdef HAVE_BOEHM_GC
- domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "domain object");
-#else
- domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), domain_gc_desc, MONO_ROOT_SOURCE_DOMAIN, "domain object");
- mono_gc_register_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED), G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_LAST_GC_TRACKED) - G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_FIRST_GC_TRACKED), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "misc domain fields");
-#endif
+ if (!mono_gc_is_moving ()) {
+ domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "domain object");
+ } else {
+ domain = (MonoDomain *)mono_gc_alloc_fixed (sizeof (MonoDomain), domain_gc_desc, MONO_ROOT_SOURCE_DOMAIN, "domain object");
+ mono_gc_register_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED), G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_LAST_GC_TRACKED) - G_STRUCT_OFFSET (MonoDomain, MONO_DOMAIN_FIRST_GC_TRACKED), MONO_GC_DESCRIPTOR_NULL, MONO_ROOT_SOURCE_DOMAIN, "misc domain fields");
+ }
domain->shadow_serial = shadow_serial;
domain->domain = NULL;
domain->setup = NULL;
domain->setup = NULL;
-#ifndef HAVE_BOEHM_GC
- mono_gc_deregister_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED));
-#endif
+ if (mono_gc_is_moving ())
+ mono_gc_deregister_root ((char*)&(domain->MONO_DOMAIN_FIRST_GC_TRACKED));
mono_appdomains_lock ();
appdomains_list [domain->domain_id] = NULL;
mono_appdomains_unlock ();
- /* FIXME: anything else required ? */
-
mono_gc_free_fixed (domain);
#ifndef DISABLE_PERFCOUNTERS
} MonoILT;
+typedef enum {
+ MONO_DYN_IMAGE_TOK_NEW, /* assert if same token is registered already */
+ MONO_DYN_IMAGE_TOK_SAME_OK, /* allow collision only with the same object */
+ MONO_DYN_IMAGE_TOK_REPLACE, /* keep the new object, always */
+} MonoDynamicImageTokCollision;
+
void
mono_dynamic_images_init (void);
void
-mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj);
+mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj, int tok_collision);
gboolean
mono_dynamic_image_is_valid_token (MonoDynamicImage *image, guint32 token);
* the Module.ResolveXXXToken () methods to work.
*/
void
-mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj)
+mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj, int how_collide)
{
MONO_REQ_GC_UNSAFE_MODE;
+ g_assert (!MONO_HANDLE_IS_NULL (obj));
+ g_assert (strcmp (mono_handle_class (obj)->name, "EnumBuilder"));
dynamic_image_lock (assembly);
+ MonoObject *prev = (MonoObject *)mono_g_hash_table_lookup (assembly->tokens, GUINT_TO_POINTER (token));
+ if (prev) {
+ switch (how_collide) {
+ case MONO_DYN_IMAGE_TOK_NEW:
+ g_assert_not_reached ();
+ case MONO_DYN_IMAGE_TOK_SAME_OK:
+ g_assert (prev == MONO_HANDLE_RAW (obj));
+ break;
+ case MONO_DYN_IMAGE_TOK_REPLACE:
+ break;
+ default:
+ g_assert_not_reached ();
+ }
+ }
mono_g_hash_table_insert (assembly->tokens, GUINT_TO_POINTER (token), MONO_HANDLE_RAW (obj));
dynamic_image_unlock (assembly);
}
#else
void
-mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj)
+mono_dynamic_image_register_token (MonoDynamicImage *assembly, guint32 token, MonoObjectHandle obj, int how_collide)
{
}
#endif
#include "mempool.h"
#include "mempool-internals.h"
+#include "utils/mono-compiler.h"
/*
* MonoMemPool is for fast allocation of memory. We free
/**
* mono_mempool_new_size:
+ *
+ * clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
+ * * mono_mempool_alloc
+ * * mono_mempool_new_size
+ * * mono_mempool_destroy
+ * while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
+ * the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
+ * https://bugzilla.xamarin.com/show_bug.cgi?id=57936
+ *
* \param initial_size the amount of memory to initially reserve for the memory pool.
* \returns a new memory pool with a specific initial memory reservation.
*/
+MONO_NO_SANITIZE_THREAD
MonoMemPool *
mono_mempool_new_size (int initial_size)
{
/**
* mono_mempool_destroy:
+ *
+ * clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
+ * * mono_mempool_alloc
+ * * mono_mempool_new_size
+ * * mono_mempool_destroy
+ * while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
+ * the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
+ * https://bugzilla.xamarin.com/show_bug.cgi?id=57936
+ *
* \param pool the memory pool to destroy
*
* Free all memory associated with this pool.
*/
+MONO_NO_SANITIZE_THREAD
void
mono_mempool_destroy (MonoMemPool *pool)
{
/**
* mono_mempool_alloc:
+ *
+ * clang's ThreadSanitizer detects races of total_bytes_allocated and pool->d.allocated throughout the functions
+ * * mono_mempool_alloc
+ * * mono_mempool_new_size
+ * * mono_mempool_destroy
+ * while these races could lead to wrong values, total_bytes_allocated is just used for debugging / reporting and since
+ * the mempool.c functions are called quite often, a discussion led the the conclusion of ignoring these races:
+ * https://bugzilla.xamarin.com/show_bug.cgi?id=57936
+ *
* \param pool the memory pool to use
* \param size size of the memory block
*
*
* \returns the address of a newly allocated memory block.
*/
+MONO_NO_SANITIZE_THREAD
gpointer
mono_mempool_alloc (MonoMemPool *pool, guint size)
{
break;
/*
- * CustomAttributeType: TypeDef, TypeRef, MethodDef,
- * MemberRef and String.
+ * CustomAttributeType: MethodDef, MemberRef.
*/
case MONO_MT_CAT_IDX:
- /* String is a heap, if it is wide, we know the size */
- /* See above, nope.
- if (meta->idx_string_wide){
- field_size = 4;
- break;
- }*/
-
- n = MAX (get_nrows (meta, MONO_TABLE_TYPEREF),
- get_nrows (meta, MONO_TABLE_TYPEDEF));
- n = MAX (n, get_nrows (meta, MONO_TABLE_METHOD));
- n = MAX (n, get_nrows (meta, MONO_TABLE_MEMBERREF));
+ n = MAX (get_nrows (meta, MONO_TABLE_METHOD),
+ get_nrows (meta, MONO_TABLE_MEMBERREF));
/* 3 bits to encode */
field_size = rtsize (meta, n, 16-3);
size = max_size;
}
-#ifdef HAVE_SGEN_GC
- /*An Ephemeron cannot be marked by sgen*/
- if (!static_fields && klass->image == mono_defaults.corlib && !strcmp ("Ephemeron", klass->name)) {
+ /* An Ephemeron cannot be marked by sgen */
+ if (mono_gc_is_moving () && !static_fields && klass->image == mono_defaults.corlib && !strcmp ("Ephemeron", klass->name)) {
*max_set = 0;
memset (bitmap, 0, size / 8);
return bitmap;
}
-#endif
for (p = klass; p != NULL; p = p->parent) {
gpointer iter = NULL;
vt->domain = domain;
mono_class_compute_gc_descriptor (klass);
- /*
- * We can't use typed allocation in the non-root domains, since the
- * collector needs the GC descriptor stored in the vtable even after
- * the mempool containing the vtable is destroyed when the domain is
- * unloaded. An alternative might be to allocate vtables in the GC
- * heap, but this does not seem to work (it leads to crashes inside
- * libgc). If that approach is tried, two gc descriptors need to be
- * allocated for each class: one for the root domain, and one for all
- * other domains. The second descriptor should contain a bit for the
- * vtable field in MonoObject, since we can no longer assume the
- * vtable is reachable by other roots after the appdomain is unloaded.
- */
-#ifdef HAVE_BOEHM_GC
- if (domain != mono_get_root_domain () && !mono_dont_free_domains)
+ /*
+ * For Boehm:
+ * We can't use typed allocation in the non-root domains, since the
+ * collector needs the GC descriptor stored in the vtable even after
+ * the mempool containing the vtable is destroyed when the domain is
+ * unloaded. An alternative might be to allocate vtables in the GC
+ * heap, but this does not seem to work (it leads to crashes inside
+ * libgc). If that approach is tried, two gc descriptors need to be
+ * allocated for each class: one for the root domain, and one for all
+ * other domains. The second descriptor should contain a bit for the
+ * vtable field in MonoObject, since we can no longer assume the
+ * vtable is reachable by other roots after the appdomain is unloaded.
+ */
+ if (!mono_gc_is_moving () && domain != mono_get_root_domain () && !mono_dont_free_domains)
vt->gc_descr = MONO_GC_DESCRIPTOR_NULL;
else
-#endif
vt->gc_descr = klass->gc_descr;
gc_bits = mono_gc_get_vtable_bits (klass);
static void
array_full_copy_unchecked_size (MonoArray *src, MonoArray *dest, MonoClass *klass, uintptr_t size)
{
-#ifdef HAVE_SGEN_GC
- if (klass->element_class->valuetype) {
- if (klass->element_class->has_references)
- mono_value_copy_array (dest, 0, mono_array_addr_with_size_fast (src, 0, 0), mono_array_length (src));
- else
- mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
+ if (mono_gc_is_moving ()) {
+ if (klass->element_class->valuetype) {
+ if (klass->element_class->has_references)
+ mono_value_copy_array (dest, 0, mono_array_addr_with_size_fast (src, 0, 0), mono_array_length (src));
+ else
+ mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
+ } else {
+ mono_array_memcpy_refs (dest, 0, src, 0, mono_array_length (src));
+ }
} else {
- mono_array_memcpy_refs (dest, 0, src, 0, mono_array_length (src));
+ mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
}
-#else
- mono_gc_memmove_atomic (&dest->vector, &src->vector, size);
-#endif
}
/**
size = size - sizeof (MonoObject);
-#ifdef HAVE_SGEN_GC
- g_assert (size == mono_class_value_size (klass, NULL));
- mono_gc_wbarrier_value_copy ((char *)res + sizeof (MonoObject), value, 1, klass);
-#else
+ if (mono_gc_is_moving ()) {
+ g_assert (size == mono_class_value_size (klass, NULL));
+ mono_gc_wbarrier_value_copy ((char *)res + sizeof (MonoObject), value, 1, klass);
+ } else {
#if NO_UNALIGNED_ACCESS
- mono_gc_memmove_atomic ((char *)res + sizeof (MonoObject), value, size);
-#else
- switch (size) {
- case 1:
- *((guint8 *) res + sizeof (MonoObject)) = *(guint8 *) value;
- break;
- case 2:
- *(guint16 *)((guint8 *) res + sizeof (MonoObject)) = *(guint16 *) value;
- break;
- case 4:
- *(guint32 *)((guint8 *) res + sizeof (MonoObject)) = *(guint32 *) value;
- break;
- case 8:
- *(guint64 *)((guint8 *) res + sizeof (MonoObject)) = *(guint64 *) value;
- break;
- default:
mono_gc_memmove_atomic ((char *)res + sizeof (MonoObject), value, size);
- }
-#endif
+#else
+ switch (size) {
+ case 1:
+ *((guint8 *) res + sizeof (MonoObject)) = *(guint8 *) value;
+ break;
+ case 2:
+ *(guint16 *)((guint8 *) res + sizeof (MonoObject)) = *(guint16 *) value;
+ break;
+ case 4:
+ *(guint32 *)((guint8 *) res + sizeof (MonoObject)) = *(guint32 *) value;
+ break;
+ case 8:
+ *(guint64 *)((guint8 *) res + sizeof (MonoObject)) = *(guint64 *) value;
+ break;
+ default:
+ mono_gc_memmove_atomic ((char *)res + sizeof (MonoObject), value, size);
+ }
#endif
+ }
if (klass->has_finalize) {
mono_object_register_finalizer (res);
return_val_if_nok (error, NULL);
--- /dev/null
+/*
+ * Licensed to the .NET Foundation under one or more agreements.
+ * The .NET Foundation licenses this file to you under the MIT license.
+ * See the LICENSE file in the project root for more information.
+ */
+
+#include <mono/metadata/profiler-private.h>
+
+/*
+ * The point of this file is to maintain compatibility with a few profiler API
+ * functions used by Xamarin.{Android,iOS,Mac} so that they keep working
+ * regardless of which system Mono version is used.
+ *
+ * TODO: Remove this some day if we're OK with breaking compatibility.
+ */
+
+typedef void *MonoLegacyProfiler;
+
+typedef void (*MonoProfileFunc) (MonoLegacyProfiler *prof);
+typedef void (*MonoProfileThreadFunc) (MonoLegacyProfiler *prof, uintptr_t tid);
+typedef void (*MonoProfileGCFunc) (MonoLegacyProfiler *prof, MonoProfilerGCEvent event, int generation);
+typedef void (*MonoProfileGCResizeFunc) (MonoLegacyProfiler *prof, int64_t new_size);
+typedef void (*MonoProfileJitResult) (MonoLegacyProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo, int result);
+
+struct _MonoProfiler {
+ MonoProfilerHandle handle;
+ MonoLegacyProfiler *profiler;
+ MonoProfileFunc shutdown_callback;
+ MonoProfileThreadFunc thread_start, thread_end;
+ MonoProfileGCFunc gc_event;
+ MonoProfileGCResizeFunc gc_heap_resize;
+ MonoProfileJitResult jit_end2;
+};
+
+static MonoProfiler *current;
+
+MONO_API void mono_profiler_install (MonoLegacyProfiler *prof, MonoProfileFunc callback);
+MONO_API void mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end);
+MONO_API void mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback);
+MONO_API void mono_profiler_install_jit_end (MonoProfileJitResult end);
+MONO_API void mono_profiler_set_events (int flags);
+
+static void
+shutdown_cb (MonoProfiler *prof)
+{
+ prof->shutdown_callback (prof->profiler);
+}
+
+void
+mono_profiler_install (MonoLegacyProfiler *prof, MonoProfileFunc callback)
+{
+ current = g_new0 (MonoProfiler, 1);
+ current->handle = mono_profiler_create (current);
+ current->profiler = prof;
+ current->shutdown_callback = callback;
+
+ if (callback)
+ mono_profiler_set_runtime_shutdown_end_callback (current->handle, shutdown_cb);
+}
+
+static void
+thread_start_cb (MonoProfiler *prof, uintptr_t tid)
+{
+ prof->thread_start (prof->profiler, tid);
+}
+
+static void
+thread_stop_cb (MonoProfiler *prof, uintptr_t tid)
+{
+ prof->thread_end (prof->profiler, tid);
+}
+
+void
+mono_profiler_install_thread (MonoProfileThreadFunc start, MonoProfileThreadFunc end)
+{
+ current->thread_start = start;
+ current->thread_end = end;
+
+ if (start)
+ mono_profiler_set_thread_started_callback (current->handle, thread_start_cb);
+
+ if (end)
+ mono_profiler_set_thread_stopped_callback (current->handle, thread_stop_cb);
+}
+
+static void
+gc_event_cb (MonoProfiler *prof, MonoProfilerGCEvent event, uint32_t generation)
+{
+ prof->gc_event (prof->profiler, event, generation);
+}
+
+static void
+gc_resize_cb (MonoProfiler *prof, uintptr_t size)
+{
+ prof->gc_heap_resize (prof->profiler, size);
+}
+
+void
+mono_profiler_install_gc (MonoProfileGCFunc callback, MonoProfileGCResizeFunc heap_resize_callback)
+{
+ current->gc_event = callback;
+ current->gc_heap_resize = heap_resize_callback;
+
+ if (callback)
+ mono_profiler_set_gc_event_callback (current->handle, gc_event_cb);
+
+ if (heap_resize_callback)
+ mono_profiler_set_gc_resize_callback (current->handle, gc_resize_cb);
+}
+
+static void
+jit_done_cb (MonoProfiler *prof, MonoMethod *method, MonoJitInfo *jinfo)
+{
+ prof->jit_end2 (prof->profiler, method, jinfo, 0);
+}
+
+static void
+jit_failed_cb (MonoProfiler *prof, MonoMethod *method)
+{
+ prof->jit_end2 (prof->profiler, method, NULL, 1);
+}
+
+void
+mono_profiler_install_jit_end (MonoProfileJitResult end)
+{
+ current->jit_end2 = end;
+
+ if (end) {
+ mono_profiler_set_jit_done_callback (current->handle, jit_done_cb);
+ mono_profiler_set_jit_failed_callback (current->handle, jit_failed_cb);
+ }
+}
+
+void
+mono_profiler_set_events (int flags)
+{
+ /* Do nothing. */
+}
}
MonoProfilerHandle
-mono_profiler_install (MonoProfiler *prof)
+mono_profiler_create (MonoProfiler *prof)
{
MonoProfilerHandle handle = g_new0 (struct _MonoProfilerDesc, 1);
* };
*
* MonoProfiler *prof = calloc (1, sizeof (MonoProfiler));
- * MonoProfilerHandle handle = mono_profiler_install (prof);
+ * MonoProfilerHandle handle = mono_profiler_create (prof);
* mono_profiler_set_shutdown_callback (handle, my_shutdown_cb);
*
* This function is not async safe.
*/
-MONO_API MonoProfilerHandle mono_profiler_install (MonoProfiler *prof);
+MONO_API MonoProfilerHandle mono_profiler_create (MonoProfiler *prof);
typedef mono_bool (*MonoProfilerCoverageFilterCallback) (MonoProfiler *prof, MonoMethod *method);
guint
reflected_hash (gconstpointer a);
-#ifdef HAVE_BOEHM_GC
-/* ReflectedEntry doesn't need to be GC tracked */
-#define ALLOC_REFENTRY g_new0 (ReflectedEntry, 1)
-#define FREE_REFENTRY(entry) g_free ((entry))
-#define REFENTRY_REQUIRES_CLEANUP
-#else
-#define ALLOC_REFENTRY (ReflectedEntry *)mono_mempool_alloc (domain->mp, sizeof (ReflectedEntry))
-/* FIXME: */
-#define FREE_REFENTRY(entry)
-#endif
+static inline ReflectedEntry*
+alloc_reflected_entry (MonoDomain *domain)
+{
+ if (!mono_gc_is_moving ())
+ return g_new0 (ReflectedEntry, 1);
+ else
+ return (ReflectedEntry *)mono_mempool_alloc (domain->mp, sizeof (ReflectedEntry));
+}
+
+static void
+free_reflected_entry (ReflectedEntry *entry)
+{
+ if (!mono_gc_is_moving ())
+ g_free (entry);
+}
static inline MonoObject*
cache_object (MonoDomain *domain, MonoClass *klass, gpointer item, MonoObject* o)
obj = (MonoObject*) mono_conc_g_hash_table_lookup (domain->refobject_hash, &pe);
if (obj == NULL) {
- ReflectedEntry *e = ALLOC_REFENTRY;
+ ReflectedEntry *e = alloc_reflected_entry (domain);
e->item = item;
e->refclass = klass;
mono_conc_g_hash_table_insert (domain->refobject_hash, e, o);
MonoObjectHandle obj = MONO_HANDLE_NEW (MonoObject, mono_conc_g_hash_table_lookup (domain->refobject_hash, &pe));
if (MONO_HANDLE_IS_NULL (obj)) {
- ReflectedEntry *e = ALLOC_REFENTRY;
+ ReflectedEntry *e = alloc_reflected_entry (domain);
e->item = item;
e->refclass = klass;
mono_conc_g_hash_table_insert (domain->refobject_hash, e, MONO_HANDLE_RAW (o));
}
}
-
/**
* mono_custom_attrs_free:
*/
g_free (ainfo);
}
-
gboolean
reflected_equal (gconstpointer a, gconstpointer b)
{
return seed;
}
-
static void
clear_cached_object (MonoDomain *domain, gpointer o, MonoClass *klass)
{
if (mono_conc_g_hash_table_lookup_extended (domain->refobject_hash, &pe, &orig_pe, &orig_value)) {
mono_conc_g_hash_table_remove (domain->refobject_hash, &pe);
- FREE_REFENTRY (orig_pe);
+ free_reflected_entry (orig_pe);
}
}
mono_domain_unlock (domain);
}
-#ifdef REFENTRY_REQUIRES_CLEANUP
static void
cleanup_refobject_hash (gpointer key, gpointer value, gpointer user_data)
{
- FREE_REFENTRY (key);
+ free_reflected_entry (key);
}
-#endif
void
mono_reflection_cleanup_domain (MonoDomain *domain)
{
if (domain->refobject_hash) {
-/*let's avoid scanning the whole hashtable if not needed*/
-#ifdef REFENTRY_REQUIRES_CLEANUP
mono_conc_g_hash_table_foreach (domain->refobject_hash, cleanup_refobject_hash, NULL);
-#endif
mono_conc_g_hash_table_destroy (domain->refobject_hash);
domain->refobject_hash = NULL;
}
}
-
/**
* mono_assembly_get_object:
* \param domain an app domain
if ((klass->image == &assembly->image) && (type->type != MONO_TYPE_VAR) &&
(type->type != MONO_TYPE_MVAR)) {
token = MONO_TYPEDEFORREF_TYPEDEF | (MONO_HANDLE_GETVAL (tb, table_idx) << MONO_TYPEDEFORREF_BITS);
- mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, tb));
+ /* This function is called multiple times from sre and sre-save, so same object is okay */
+ mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, tb), MONO_DYN_IMAGE_TOK_SAME_OK);
goto leave;
}
token = MONO_TYPEDEFORREF_TYPEREF | (table->next_idx << MONO_TYPEDEFORREF_BITS); /* typeref */
g_hash_table_insert (assembly->typeref, type, GUINT_TO_POINTER(token));
table->next_idx ++;
- mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, tb));
+
+
+ if (!MONO_HANDLE_IS_NULL (tb)) {
+ /* This function is called multiple times from sre and sre-save, so same object is okay */
+ mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, tb), MONO_DYN_IMAGE_TOK_SAME_OK);
+ }
+
leave:
HANDLE_FUNCTION_RETURN_VAL (token);
}
g_assert_not_reached ();
}
break;
+ case MONO_TABLE_TYPEREF:
+ g_assert (!strcmp (iltoken->member->vtable->klass->name, "RuntimeType"));
+ MonoClass *k = mono_class_from_mono_type (((MonoReflectionType*)iltoken->member)->type);
+ MonoObject *obj = mono_class_get_ref_info_raw (k); /* FIXME use handles */
+ g_assert (obj);
+ g_assert (!strcmp (mono_object_class (obj)->name, "TypeBuilder"));
+ g_assert (((MonoReflectionTypeBuilder*)obj)->module->dynamic_image != assembly);
+ continue;
case MONO_TABLE_MEMBERREF:
if (!strcmp (iltoken->member->vtable->klass->name, "MonoArrayMethod")) {
am = (MonoReflectionArrayMethod*)iltoken->member;
}
token = MONO_TOKEN_STRING | idx;
- mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, str));
+ mono_dynamic_image_register_token (assembly, token, MONO_HANDLE_CAST (MonoObject, str), MONO_DYN_IMAGE_TOK_NEW);
leave:
HANDLE_FUNCTION_RETURN_VAL (token);
g_error ("requested method token for %s\n", klass->name);
}
- mono_dynamic_image_register_token (assembly, token, obj);
+ mono_dynamic_image_register_token (assembly, token, obj, MONO_DYN_IMAGE_TOK_NEW);
return token;
fail:
g_assert (!mono_error_ok (error));
return 0;
}
+ /* This function is called from ModuleBuilder:getToken multiple times for the same objects */
+ int how_collide = MONO_DYN_IMAGE_TOK_SAME_OK;
+
if (strcmp (klass->name, "RuntimeType") == 0) {
MonoType *type = mono_reflection_type_handle_mono_type (MONO_HANDLE_CAST (MonoReflectionType, obj), error);
return_val_if_nok (error, 0);
MonoClass *mc = mono_class_from_mono_type (type);
token = mono_metadata_token_from_dor (
mono_dynimage_encode_typedef_or_ref_full (assembly, type, !mono_class_is_gtd (mc) || create_open_instance));
+ /* If it's a RuntimeType now, we could have registered a
+ * TypeBuilder for it before, so replacing is okay. */
+ how_collide = MONO_DYN_IMAGE_TOK_REPLACE;
} else if (strcmp (klass->name, "MonoCMethod") == 0 ||
strcmp (klass->name, "MonoMethod") == 0) {
MonoReflectionMethodHandle m = MONO_HANDLE_CAST (MonoReflectionMethod, obj);
* FIXME: do the equivalent for Fields.
*/
token = method->token;
+ how_collide = MONO_DYN_IMAGE_TOK_REPLACE;
} else {
/*
* Each token should have a unique index, but the indexes are
*/
method_table_idx --;
token = MONO_TOKEN_METHOD_DEF | method_table_idx;
+ how_collide = MONO_DYN_IMAGE_TOK_NEW;
}
} else {
token = mono_image_get_methodref_token (assembly, method, create_open_instance);
static guint32 field_table_idx = 0xffffff;
field_table_idx --;
token = MONO_TOKEN_FIELD_DEF | field_table_idx;
+ how_collide = MONO_DYN_IMAGE_TOK_NEW;
} else {
token = mono_image_get_fieldref_token (assembly, obj, field);
}
MonoReflectionSigHelperHandle s = MONO_HANDLE_CAST (MonoReflectionSigHelper, obj);
token = MONO_TOKEN_SIGNATURE | mono_image_get_sighelper_token (assembly, s, error);
return_val_if_nok (error, 0);
- } else if (strcmp (klass->name, "EnumBuilder") == 0) {
- MonoType *type = mono_reflection_type_handle_mono_type (MONO_HANDLE_CAST (MonoReflectionType, obj), error);
- return_val_if_nok (error, 0);
- token = mono_metadata_token_from_dor (
- mono_image_typedef_or_ref (assembly, type));
} else {
g_error ("requested token for %s\n", klass->name);
}
if (register_token)
- mono_dynamic_image_register_token (assembly, token, obj);
+ mono_dynamic_image_register_token (assembly, token, obj, how_collide);
return token;
}
*/
mono_image_append_class_to_reflection_info_set (klass);
- mono_dynamic_image_register_token (dynamic_image, MONO_TOKEN_TYPE_DEF | table_idx, MONO_HANDLE_CAST (MonoObject, ref_tb));
+ mono_dynamic_image_register_token (dynamic_image, MONO_TOKEN_TYPE_DEF | table_idx, MONO_HANDLE_CAST (MonoObject, ref_tb), MONO_DYN_IMAGE_TOK_NEW);
if ((!strcmp (klass->name, "ValueType") && !strcmp (klass->name_space, "System")) ||
(!strcmp (klass->name, "Object") && !strcmp (klass->name_space, "System")) ||
ves_icall_ModuleBuilder_RegisterToken (MonoReflectionModuleBuilderHandle mb, MonoObjectHandle obj, guint32 token, MonoError *error)
{
error_init (error);
- mono_dynamic_image_register_token (MONO_HANDLE_GETVAL (mb, dynamic_image), token, obj);
+ /* This function may be called by ModuleBuilder.FixupTokens to update
+ * an existing token, so replace is okay here. */
+ mono_dynamic_image_register_token (MONO_HANDLE_GETVAL (mb, dynamic_image), token, obj, MONO_DYN_IMAGE_TOK_REPLACE);
}
MonoObjectHandle
MonoClass *klass;
} EventInfo;
-/* Dummy structure used for the profiler callbacks */
-typedef struct {
- void* dummy;
-} DebuggerProfiler;
-
typedef struct {
guint8 *buf, *p, *end;
} Buffer;
/* Mutex for the cond var above */
static MonoCoopMutex debugger_thread_exited_mutex;
-static DebuggerProfiler debugger_profiler;
-
/* The single step request instance */
static SingleStepReq *ss_req;
mono_coop_mutex_init (&debugger_thread_exited_mutex);
mono_coop_cond_init (&debugger_thread_exited_cond);
- MonoProfilerHandle prof = mono_profiler_install ((MonoProfiler*)&debugger_profiler);
+ MonoProfilerHandle prof = mono_profiler_create (NULL);
mono_profiler_set_runtime_shutdown_end_callback (prof, runtime_shutdown);
mono_profiler_set_runtime_initialized_callback (prof, runtime_initialized);
mono_profiler_set_domain_loaded_callback (prof, appdomain_load);
#endif
} stackval;
-typedef struct _MonoInvocation MonoInvocation;
+typedef struct _InterpFrame InterpFrame;
typedef void (*MonoFuncV) (void);
typedef void (*MonoPIFunc) (MonoFuncV callme, void *margs);
* Structure representing a method transformed for the interpreter
* This is domain specific
*/
-typedef struct _RuntimeMethod
+typedef struct _InterpMethod
{
/* NOTE: These first two elements (method and
next_jit_code_hash) must be in the same order and at the
same offset as in MonoJitInfo, because of the jit_code_hash
internal hash table in MonoDomain. */
MonoMethod *method;
- struct _RuntimeMethod *next_jit_code_hash;
+ struct _InterpMethod *next_jit_code_hash;
guint32 locals_size;
guint32 args_size;
guint32 stack_size;
MonoType **param_types;
MonoJitInfo *jinfo;
MonoDomain *domain;
-} RuntimeMethod;
+} InterpMethod;
-struct _MonoInvocation {
- MonoInvocation *parent; /* parent */
- RuntimeMethod *runtime_method; /* parent */
+struct _InterpFrame {
+ InterpFrame *parent; /* parent */
+ InterpMethod *imethod; /* parent */
MonoMethod *method; /* parent */
stackval *retval; /* parent */
char *args;
typedef struct {
MonoDomain *original_domain;
- MonoInvocation *base_frame;
- MonoInvocation *current_frame;
- MonoInvocation *env_frame;
+ InterpFrame *base_frame;
+ InterpFrame *current_frame;
+ InterpFrame *env_frame;
jmp_buf *current_env;
unsigned char search_for_handler;
unsigned char managed_code;
/* Resume state for resuming execution in mixed mode */
gboolean has_resume_state;
/* Frame to resume execution at */
- MonoInvocation *handler_frame;
+ InterpFrame *handler_frame;
/* IP to resume execution at */
gpointer handler_ip;
} ThreadContext;
extern GSList *jit_classes;
MonoException *
-mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context);
+mono_interp_transform_method (InterpMethod *imethod, ThreadContext *context);
void
mono_interp_transform_init (void);
-RuntimeMethod *
-mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoError *error);
+InterpMethod *
+mono_interp_get_imethod (MonoDomain *domain, MonoMethod *method, MonoError *error);
#endif /* __MONO_MINI_INTERPRETER_INTERNALS_H__ */
#endif
static inline void
-init_frame (MonoInvocation *frame, MonoInvocation *parent_frame, RuntimeMethod *rmethod, stackval *method_args, stackval *method_retval)
+init_frame (InterpFrame *frame, InterpFrame *parent_frame, InterpMethod *rmethod, stackval *method_args, stackval *method_retval)
{
frame->parent = parent_frame;
frame->stack_args = method_args;
frame->retval = method_retval;
- frame->runtime_method = rmethod;
+ frame->imethod = rmethod;
frame->ex = NULL;
frame->ip = NULL;
frame->invoke_trap = 0;
}
#define INIT_FRAME(frame,parent_frame,method_args,method_retval,domain,mono_method,error) do { \
- RuntimeMethod *_rmethod = mono_interp_get_runtime_method ((domain), (mono_method), (error)); \
+ InterpMethod *_rmethod = mono_interp_get_imethod ((domain), (mono_method), (error)); \
init_frame ((frame), (parent_frame), _rmethod, (method_args), (method_retval)); \
} while (0)
/* If TRUE, interpreted code will be interrupted at function entry/backward branches */
static gboolean ss_enabled;
-void ves_exec_method (MonoInvocation *frame);
+void ves_exec_method (InterpFrame *frame);
-static char* dump_frame (MonoInvocation *inv);
-static MonoArray *get_trace_ips (MonoDomain *domain, MonoInvocation *top);
-static void ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, unsigned short *start_with_ip, MonoException *filter_exception, int exit_at_finally);
+static char* dump_frame (InterpFrame *inv);
+static MonoArray *get_trace_ips (MonoDomain *domain, InterpFrame *top);
+static void ves_exec_method_with_context (InterpFrame *frame, ThreadContext *context, unsigned short *start_with_ip, MonoException *filter_exception, int exit_at_finally);
-typedef void (*ICallMethod) (MonoInvocation *frame);
+typedef void (*ICallMethod) (InterpFrame *frame);
static guint32 die_on_exception = 0;
static MonoNativeTlsKey thread_context_id;
-static char* dump_args (MonoInvocation *inv);
+static char* dump_args (InterpFrame *inv);
#define DEBUG_INTERP 0
#define COUNT_OPS 0
}
static void
-debug_enter (MonoInvocation *frame, int *tracing)
+debug_enter (InterpFrame *frame, int *tracing)
{
if (db_methods) {
- g_list_foreach (db_methods, db_match_method, (gpointer)frame->runtime_method->method);
+ g_list_foreach (db_methods, db_match_method, (gpointer)frame->imethod->method);
if (break_on_method)
*tracing = nested_trace ? (global_tracing = 2, 3) : 2;
break_on_method = 0;
}
if (*tracing) {
- MonoMethod *method = frame->runtime_method->method;
+ MonoMethod *method = frame->imethod->method;
char *mn, *args = dump_args (frame);
debug_indent_level++;
output_indent ();
g_print ("%s)\n", args);
g_free (args);
}
- if (mono_profiler_should_instrument_method (frame->runtime_method->method, TRUE))
- MONO_PROFILER_RAISE (method_enter, (frame->runtime_method->method));
+ if (mono_profiler_should_instrument_method (frame->imethod->method, TRUE))
+ MONO_PROFILER_RAISE (method_enter, (frame->imethod->method));
}
char *mn, *args; \
args = dump_retval (frame); \
output_indent (); \
- mn = mono_method_full_name (frame->runtime_method->method, FALSE); \
+ mn = mono_method_full_name (frame->imethod->method, FALSE); \
g_print ("(%p) Leaving %s", mono_thread_internal_current (), mn); \
g_free (mn); \
g_print (" => %s\n", args); \
debug_indent_level--; \
if (tracing == 3) global_tracing = 0; \
} \
- if (mono_profiler_should_instrument_method (frame->runtime_method->method, FALSE)) \
- MONO_PROFILER_RAISE (method_enter, (frame->runtime_method->method));
+ if (mono_profiler_should_instrument_method (frame->imethod->method, FALSE)) \
+ MONO_PROFILER_RAISE (method_leave, (frame->imethod->method));
#else
int mono_interp_traceopt = 0;
-static void debug_enter (MonoInvocation *frame, int *tracing)
+static void debug_enter (InterpFrame *frame, int *tracing)
{
}
#define DEBUG_LEAVE()
#define ves_abort() \
do {\
- ves_real_abort(__LINE__, frame->runtime_method->method, ip, frame->stack, sp); \
+ ves_real_abort(__LINE__, frame->imethod->method, ip, frame->stack, sp); \
THROW_EX (mono_get_exception_execution_engine (NULL), ip); \
} while (0);
-static RuntimeMethod*
-lookup_runtime_method (MonoDomain *domain, MonoMethod *method)
+static InterpMethod*
+lookup_imethod (MonoDomain *domain, MonoMethod *method)
{
- RuntimeMethod *rtm;
+ InterpMethod *rtm;
MonoJitDomainInfo *info;
info = domain_jit_info (domain);
return rtm;
}
-RuntimeMethod*
-mono_interp_get_runtime_method (MonoDomain *domain, MonoMethod *method, MonoError *error)
+InterpMethod*
+mono_interp_get_imethod (MonoDomain *domain, MonoMethod *method, MonoError *error)
{
- RuntimeMethod *rtm;
+ InterpMethod *rtm;
MonoJitDomainInfo *info;
MonoMethodSignature *sig;
int i;
sig = mono_method_signature (method);
- rtm = mono_domain_alloc0 (domain, sizeof (RuntimeMethod));
+ rtm = mono_domain_alloc0 (domain, sizeof (InterpMethod));
rtm->method = method;
rtm->domain = domain;
rtm->param_count = sig->param_count;
{
if (method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
method = mono_marshal_get_synchronized_wrapper (method);
- return mono_interp_get_runtime_method (domain, method, error);
+ return mono_interp_get_imethod (domain, method, error);
}
/*
* be able to do stack walks.
*/
static void
-interp_push_lmf (MonoLMFExt *ext, MonoInvocation *frame)
+interp_push_lmf (MonoLMFExt *ext, InterpFrame *frame)
{
memset (ext, 0, sizeof (MonoLMFExt));
ext->interp_exit = TRUE;
mono_pop_lmf (&ext->lmf);
}
-static inline RuntimeMethod*
-get_virtual_method (RuntimeMethod *runtime_method, MonoObject *obj)
+static inline InterpMethod*
+get_virtual_method (InterpMethod *imethod, MonoObject *obj)
{
- MonoMethod *m = runtime_method->method;
- MonoDomain *domain = runtime_method->domain;
- RuntimeMethod *ret = NULL;
+ MonoMethod *m = imethod->method;
+ MonoDomain *domain = imethod->domain;
+ InterpMethod *ret = NULL;
MonoError error;
#ifndef DISABLE_REMOTING
if (mono_object_is_transparent_proxy (obj)) {
- ret = mono_interp_get_runtime_method (domain, mono_marshal_get_remoting_invoke (m), &error);
+ ret = mono_interp_get_imethod (domain, mono_marshal_get_remoting_invoke (m), &error);
mono_error_assert_ok (&error);
return ret;
}
if ((m->flags & METHOD_ATTRIBUTE_FINAL) || !(m->flags & METHOD_ATTRIBUTE_VIRTUAL)) {
if (m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) {
- ret = mono_interp_get_runtime_method (domain, mono_marshal_get_synchronized_wrapper (m), &error);
+ ret = mono_interp_get_imethod (domain, mono_marshal_get_synchronized_wrapper (m), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
} else {
- ret = runtime_method;
+ ret = imethod;
}
return ret;
}
virtual_method = mono_marshal_get_synchronized_wrapper (virtual_method);
}
- RuntimeMethod *virtual_runtime_method = mono_interp_get_runtime_method (domain, virtual_method, &error);
+ InterpMethod *virtual_imethod = mono_interp_get_imethod (domain, virtual_method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- return virtual_runtime_method;
+ return virtual_imethod;
}
static void inline
}
static void
-fill_in_trace (MonoException *exception, MonoInvocation *frame)
+fill_in_trace (MonoException *exception, InterpFrame *frame)
{
MonoError error;
char *stack_trace = dump_frame (frame);
- MonoDomain *domain = frame->runtime_method->domain;
+ MonoDomain *domain = frame->imethod->domain;
(exception)->stack_trace = mono_string_new_checked (domain, stack_trace, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
(exception)->trace_ips = get_trace_ips (domain, frame);
#define THROW_EX(exception,ex_ip) THROW_EX_GENERAL ((exception), (ex_ip), FALSE)
static MonoObject*
-ves_array_create (MonoInvocation *frame, MonoDomain *domain, MonoClass *klass, MonoMethodSignature *sig, stackval *values)
+ves_array_create (InterpFrame *frame, MonoDomain *domain, MonoClass *klass, MonoMethodSignature *sig, stackval *values)
{
uintptr_t *lengths;
intptr_t *lower_bounds;
}
static gint32
-ves_array_calculate_index (MonoArray *ao, stackval *sp, MonoInvocation *frame, gboolean safe)
+ves_array_calculate_index (MonoArray *ao, stackval *sp, InterpFrame *frame, gboolean safe)
{
g_assert (!frame->ex);
MonoClass *ac = ((MonoObject *) ao)->vtable->klass;
}
static void
-ves_array_set (MonoInvocation *frame)
+ves_array_set (InterpFrame *frame)
{
stackval *sp = frame->stack_args + 1;
gint32 esize = mono_array_element_size (ac);
gpointer ea = mono_array_addr_with_size (ao, esize, pos);
- MonoType *mt = mono_method_signature (frame->runtime_method->method)->params [ac->rank];
+ MonoType *mt = mono_method_signature (frame->imethod->method)->params [ac->rank];
stackval_to_data (mt, &sp [ac->rank], ea, FALSE);
}
static void
-ves_array_get (MonoInvocation *frame, gboolean safe)
+ves_array_get (InterpFrame *frame, gboolean safe)
{
stackval *sp = frame->stack_args + 1;
gint32 esize = mono_array_element_size (ac);
gpointer ea = mono_array_addr_with_size (ao, esize, pos);
- MonoType *mt = mono_method_signature (frame->runtime_method->method)->ret;
+ MonoType *mt = mono_method_signature (frame->imethod->method)->ret;
stackval_from_data (mt, frame->retval, ea, FALSE);
}
static gpointer
-ves_array_element_address (MonoInvocation *frame, MonoClass *required_type, MonoArray *ao, stackval *sp, gboolean needs_typecheck)
+ves_array_element_address (InterpFrame *frame, MonoClass *required_type, MonoArray *ao, stackval *sp, gboolean needs_typecheck)
{
MonoClass *ac = ((MonoObject *) ao)->vtable->klass;
if (!context)
return;
- MonoInvocation *frame = context->current_frame;
+ InterpFrame *frame = context->current_frame;
while (frame) {
MonoStackFrameInfo fi;
memset (&fi, 0, sizeof (MonoStackFrameInfo));
/* TODO: hack to make some asserts happy. */
- fi.ji = (MonoJitInfo *) frame->runtime_method;
+ fi.ji = (MonoJitInfo *) frame->imethod;
- if (frame->runtime_method)
- fi.method = fi.actual_method = frame->runtime_method->method;
+ if (frame->imethod)
+ fi.method = fi.actual_method = frame->imethod->method;
if (!fi.method || (fi.method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) || (fi.method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))) {
fi.il_offset = -1;
static MonoPIFunc mono_interp_enter_icall_trampoline = NULL;
-static InterpMethodArguments* build_args_from_sig (MonoMethodSignature *sig, MonoInvocation *frame)
+static InterpMethodArguments* build_args_from_sig (MonoMethodSignature *sig, InterpFrame *frame)
{
InterpMethodArguments *margs = g_malloc0 (sizeof (InterpMethodArguments));
}
static void
-ves_pinvoke_method (MonoInvocation *frame, MonoMethodSignature *sig, MonoFuncV addr, gboolean string_ctor, ThreadContext *context)
+ves_pinvoke_method (InterpFrame *frame, MonoMethodSignature *sig, MonoFuncV addr, gboolean string_ctor, ThreadContext *context)
{
jmp_buf env;
- MonoInvocation *old_frame = context->current_frame;
- MonoInvocation *old_env_frame = context->env_frame;
+ InterpFrame *old_frame = context->current_frame;
+ InterpFrame *old_env_frame = context->env_frame;
jmp_buf *old_env = context->current_env;
MonoLMFExt ext;
context->env_frame = frame;
context->current_env = &env;
- g_assert (!frame->runtime_method);
+ g_assert (!frame->imethod);
if (!mono_interp_enter_icall_trampoline) {
if (mono_aot_only) {
mono_interp_enter_icall_trampoline = mono_aot_get_trampoline ("enter_icall_trampoline");
if (del->method)
return;
/* shouldn't need a write barrier because we don't write a MonoObject into the field */
- del->method = ((RuntimeMethod *) del->method_ptr)->method;
+ del->method = ((InterpMethod *) del->method_ptr)->method;
}
/*
* provided by the runtime and is primarily used for the methods of delegates.
*/
static void
-ves_runtime_method (MonoInvocation *frame, ThreadContext *context)
+ves_imethod (InterpFrame *frame, ThreadContext *context)
{
- MonoMethod *method = frame->runtime_method->method;
+ MonoMethod *method = frame->imethod->method;
const char *name = method->name;
MonoObject *obj = (MonoObject*) frame->stack_args->data.p;
MonoObject *isinst_obj;
#if DEBUG_INTERP
static char*
-dump_retval (MonoInvocation *inv)
+dump_retval (InterpFrame *inv)
{
GString *str = g_string_new ("");
- MonoType *ret = mono_method_signature (inv->runtime_method->method)->ret;
+ MonoType *ret = mono_method_signature (inv->imethod->method)->ret;
if (ret->type != MONO_TYPE_VOID)
dump_stackval (str, inv->retval, ret);
#endif
static char*
-dump_args (MonoInvocation *inv)
+dump_args (InterpFrame *inv)
{
GString *str = g_string_new ("");
int i;
- MonoMethodSignature *signature = mono_method_signature (inv->runtime_method->method);
+ MonoMethodSignature *signature = mono_method_signature (inv->imethod->method);
if (signature->param_count == 0 && !signature->hasthis)
return g_string_free (str, FALSE);
if (signature->hasthis) {
- MonoMethod *method = inv->runtime_method->method;
+ MonoMethod *method = inv->imethod->method;
dump_stackval (str, inv->stack_args, &method->klass->byval_arg);
}
}
static char*
-dump_frame (MonoInvocation *inv)
+dump_frame (InterpFrame *inv)
{
GString *str = g_string_new ("");
int i;
MonoError error;
for (i = 0; inv; inv = inv->parent) {
- if (inv->runtime_method != NULL) {
- MonoMethod *method = inv->runtime_method->method;
+ if (inv->imethod != NULL) {
+ MonoMethod *method = inv->imethod->method;
MonoClass *k;
int codep = 0;
if (hd != NULL) {
if (inv->ip) {
opname = mono_interp_opname [*inv->ip];
- codep = inv->ip - inv->runtime_method->code;
+ codep = inv->ip - inv->imethod->code;
source = g_strdup_printf ("%s:%d // (TODO: proper stacktrace)", method->name, codep);
} else
opname = "";
}
static MonoArray *
-get_trace_ips (MonoDomain *domain, MonoInvocation *top)
+get_trace_ips (MonoDomain *domain, InterpFrame *top)
{
int i;
MonoArray *res;
- MonoInvocation *inv;
+ InterpFrame *inv;
MonoError error;
for (i = 0, inv = top; inv; inv = inv->parent)
- if (inv->runtime_method != NULL)
+ if (inv->imethod != NULL)
++i;
res = mono_array_new_checked (domain, mono_defaults.int_class, 2 * i, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
for (i = 0, inv = top; inv; inv = inv->parent)
- if (inv->runtime_method != NULL) {
- mono_array_set (res, gpointer, i, inv->runtime_method);
+ if (inv->imethod != NULL) {
+ mono_array_set (res, gpointer, i, inv->imethod);
++i;
mono_array_set (res, gpointer, i, (gpointer)inv->ip);
++i;
MonoObject*
mono_interp_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc, MonoError *error)
{
- MonoInvocation frame;
+ InterpFrame frame;
ThreadContext * volatile context = mono_native_tls_get_value (thread_context_id);
MonoObject *retval = NULL;
MonoMethodSignature *sig = mono_method_signature (method);
stackval result;
stackval *args;
ThreadContext context_struct;
- MonoInvocation *old_frame = NULL;
+ InterpFrame *old_frame = NULL;
jmp_buf env;
error_init (error);
}
typedef struct {
- RuntimeMethod *rmethod;
+ InterpMethod *rmethod;
gpointer this_arg;
gpointer res;
gpointer args [16];
static void
interp_entry (InterpEntryData *data)
{
- MonoInvocation frame;
- RuntimeMethod *rmethod = data->rmethod;
+ InterpFrame frame;
+ InterpMethod *rmethod = data->rmethod;
ThreadContext *context = mono_native_tls_get_value (thread_context_id);
ThreadContext context_struct;
- MonoInvocation *old_frame;
+ InterpFrame *old_frame;
stackval result;
stackval *args;
MonoMethod *method;
static stackval *
do_icall (ThreadContext *context, int op, stackval *sp, gpointer ptr)
{
- MonoInvocation *old_frame = context->current_frame;
- MonoInvocation *old_env_frame = context->env_frame;
+ InterpFrame *old_frame = context->current_frame;
+ InterpFrame *old_env_frame = context->env_frame;
jmp_buf *old_env = context->current_env;
jmp_buf env;
}
static stackval *
-do_jit_call (stackval *sp, unsigned char *vt_sp, ThreadContext *context, MonoInvocation *frame, RuntimeMethod *rmethod)
+do_jit_call (stackval *sp, unsigned char *vt_sp, ThreadContext *context, InterpFrame *frame, InterpMethod *rmethod)
{
MonoMethodSignature *sig;
MonoFtnDesc ftndesc;
}
static void
-do_debugger_tramp (void (*tramp) (void), MonoInvocation *frame)
+do_debugger_tramp (void (*tramp) (void), InterpFrame *frame)
{
MonoLMFExt ext;
interp_push_lmf (&ext, frame);
}
static void
-do_transform_method (MonoInvocation *frame, ThreadContext *context)
+do_transform_method (InterpFrame *frame, ThreadContext *context)
{
MonoLMFExt ext;
/* Use the parent frame as the current frame is not complete yet */
interp_push_lmf (&ext, frame->parent);
- frame->ex = mono_interp_transform_method (frame->runtime_method, context);
+ frame->ex = mono_interp_transform_method (frame->imethod, context);
context->managed_code = 1;
interp_pop_lmf (&ext);
interp_entry (&data); \
}
-#define ARGLIST0 RuntimeMethod *rmethod
-#define ARGLIST1 gpointer arg1, RuntimeMethod *rmethod
-#define ARGLIST2 gpointer arg1, gpointer arg2, RuntimeMethod *rmethod
-#define ARGLIST3 gpointer arg1, gpointer arg2, gpointer arg3, RuntimeMethod *rmethod
-#define ARGLIST4 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, RuntimeMethod *rmethod
-#define ARGLIST5 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, RuntimeMethod *rmethod
-#define ARGLIST6 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, RuntimeMethod *rmethod
-#define ARGLIST7 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, gpointer arg7, RuntimeMethod *rmethod
-#define ARGLIST8 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, gpointer arg7, gpointer arg8, RuntimeMethod *rmethod
+#define ARGLIST0 InterpMethod *rmethod
+#define ARGLIST1 gpointer arg1, InterpMethod *rmethod
+#define ARGLIST2 gpointer arg1, gpointer arg2, InterpMethod *rmethod
+#define ARGLIST3 gpointer arg1, gpointer arg2, gpointer arg3, InterpMethod *rmethod
+#define ARGLIST4 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, InterpMethod *rmethod
+#define ARGLIST5 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, InterpMethod *rmethod
+#define ARGLIST6 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, InterpMethod *rmethod
+#define ARGLIST7 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, gpointer arg7, InterpMethod *rmethod
+#define ARGLIST8 gpointer arg1, gpointer arg2, gpointer arg3, gpointer arg4, gpointer arg5, gpointer arg6, gpointer arg7, gpointer arg8, InterpMethod *rmethod
static void interp_entry_static_0 (ARGLIST0) INTERP_ENTRY0 (NULL, NULL, rmethod)
static void interp_entry_static_1 (ARGLIST1) INTERP_ENTRY1 (NULL, NULL, rmethod)
gpointer addr;
MonoMethodSignature *sig = mono_method_signature (method);
MonoMethod *wrapper;
- RuntimeMethod *rmethod = mono_interp_get_runtime_method (mono_domain_get (), method, error);
+ InterpMethod *rmethod = mono_interp_get_imethod (mono_domain_get (), method, error);
/* HACK: method_ptr of delegate should point to a runtime method*/
if (method->wrapper_type && method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD)
} \
sp->data.l = 0; \
output_indent (); \
- char *mn = mono_method_full_name (frame->runtime_method->method, FALSE); \
+ char *mn = mono_method_full_name (frame->imethod->method, FALSE); \
g_print ("(%p) %s -> ", mono_thread_internal_current (), mn); \
g_free (mn); \
mono_interp_dis_mintop(rtm->code, ip); \
* If EXIT_AT_FINALLY is not -1, exit after exiting the finally clause with that index.
*/
static void
-ves_exec_method_with_context (MonoInvocation *frame, ThreadContext *context, unsigned short *start_with_ip, MonoException *filter_exception, int exit_at_finally)
+ves_exec_method_with_context (InterpFrame *frame, ThreadContext *context, unsigned short *start_with_ip, MonoException *filter_exception, int exit_at_finally)
{
- MonoInvocation child_frame;
+ InterpFrame child_frame;
GSList *finally_ips = NULL;
const unsigned short *endfinally_ip = NULL;
const unsigned short *ip = NULL;
register stackval *sp;
- RuntimeMethod *rtm;
+ InterpMethod *rtm;
#if DEBUG_INTERP
gint tracing = global_tracing;
unsigned char *vtalloc;
debug_enter (frame, &tracing);
- if (!frame->runtime_method->transformed) {
+ if (!frame->imethod->transformed) {
context->managed_code = 0;
#if DEBUG_INTERP
- char *mn = mono_method_full_name (frame->runtime_method->method, TRUE);
+ char *mn = mono_method_full_name (frame->imethod->method, TRUE);
g_print ("(%p) Transforming %s\n", mono_thread_internal_current (), mn);
g_free (mn);
#endif
}
}
- rtm = frame->runtime_method;
+ rtm = frame->imethod;
if (!start_with_ip ) {
frame->args = alloca (rtm->alloca_size);
memset (frame->args, 0, rtm->alloca_size);
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_JMP) {
- RuntimeMethod *new_method = rtm->data_items [* (guint16 *)(ip + 1)];
+ InterpMethod *new_method = rtm->data_items [* (guint16 *)(ip + 1)];
if (!new_method->transformed) {
frame->ip = ip;
frame->ex = mono_interp_transform_method (new_method, context);
ip += 2;
if (new_method->alloca_size > rtm->alloca_size)
g_error ("MINT_JMP to method which needs more stack space (%d > %d)", new_method->alloca_size, rtm->alloca_size);
- rtm = frame->runtime_method = new_method;
+ rtm = frame->imethod = new_method;
vt_sp = (unsigned char *) sp + rtm->stack_size;
#if DEBUG_INTERP
vtalloc = vt_sp;
ip += 2;
--sp;
--endsp;
- child_frame.runtime_method = sp->data.p;
+ child_frame.imethod = sp->data.p;
sp->data.p = vt_sp;
child_frame.retval = sp;
#ifndef DISABLE_REMOTING
/* `this' can be NULL for string:.ctor */
if (csignature->hasthis && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
- child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+ child_frame.imethod = mono_interp_get_imethod (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.imethod->method), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
} else
#endif
- if (child_frame.runtime_method->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
- child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_native_wrapper (child_frame.runtime_method->method, FALSE, FALSE), &error);
+ if (child_frame.imethod->method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) {
+ child_frame.imethod = mono_interp_get_imethod (rtm->domain, mono_marshal_get_native_wrapper (child_frame.imethod->method, FALSE, FALSE), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
--sp;
--endsp;
code = sp->data.p;
- child_frame.runtime_method = NULL;
+ child_frame.imethod = NULL;
sp->data.p = vt_sp;
child_frame.retval = sp;
frame->ip = ip;
- child_frame.runtime_method = rtm->data_items [* (guint16 *)(ip + 1)];
+ child_frame.imethod = rtm->data_items [* (guint16 *)(ip + 1)];
ip += 2;
sp->data.p = vt_sp;
child_frame.retval = sp;
/* decrement by the actual number of args */
- sp -= child_frame.runtime_method->param_count;
- if (child_frame.runtime_method->hasthis)
+ sp -= child_frame.imethod->param_count;
+ if (child_frame.imethod->hasthis)
--sp;
child_frame.stack_args = sp;
#ifndef DISABLE_REMOTING
/* `this' can be NULL for string:.ctor */
- if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
- child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+ if (child_frame.imethod->hasthis && !child_frame.imethod->method->klass->valuetype && sp->data.p && mono_object_is_transparent_proxy (sp->data.p)) {
+ child_frame.imethod = mono_interp_get_imethod (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.imethod->method), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
#endif
MINT_IN_CASE(MINT_VCALL) {
frame->ip = ip;
- child_frame.runtime_method = rtm->data_items [* (guint16 *)(ip + 1)];
+ child_frame.imethod = rtm->data_items [* (guint16 *)(ip + 1)];
ip += 2;
sp->data.p = vt_sp;
child_frame.retval = sp;
/* decrement by the actual number of args */
- sp -= child_frame.runtime_method->param_count;
- if (child_frame.runtime_method->hasthis) {
+ sp -= child_frame.imethod->param_count;
+ if (child_frame.imethod->hasthis) {
--sp;
MonoObject *this_arg = sp->data.p;
if (!this_arg)
child_frame.stack_args = sp;
#ifndef DISABLE_REMOTING
- if (child_frame.runtime_method->hasthis && !child_frame.runtime_method->method->klass->valuetype && mono_object_is_transparent_proxy (sp->data.p)) {
- child_frame.runtime_method = mono_interp_get_runtime_method (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.runtime_method->method), &error);
+ if (child_frame.imethod->hasthis && !child_frame.imethod->method->klass->valuetype && mono_object_is_transparent_proxy (sp->data.p)) {
+ child_frame.imethod = mono_interp_get_imethod (rtm->domain, mono_marshal_get_remoting_invoke (child_frame.imethod->method), &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
#endif
}
MINT_IN_CASE(MINT_JIT_CALL) {
- RuntimeMethod *rmethod = rtm->data_items [* (guint16 *)(ip + 1)];
+ InterpMethod *rmethod = rtm->data_items [* (guint16 *)(ip + 1)];
frame->ip = ip;
ip += 2;
sp = do_jit_call (sp, vt_sp, context, frame, rmethod);
token = * (unsigned short *)(ip + 1);
ip += 2;
- child_frame.runtime_method = rtm->data_items [token];
+ child_frame.imethod = rtm->data_items [token];
sp->data.p = vt_sp;
child_frame.retval = sp;
/* decrement by the actual number of args */
- sp -= child_frame.runtime_method->param_count + 1;
+ sp -= child_frame.imethod->param_count + 1;
child_frame.stack_args = sp;
this_arg = sp->data.p;
if (!this_arg)
THROW_EX (mono_get_exception_null_reference(), ip - 2);
- child_frame.runtime_method = get_virtual_method (child_frame.runtime_method, this_arg);
+ child_frame.imethod = get_virtual_method (child_frame.imethod, this_arg);
MonoClass *this_class = this_arg->vtable->klass;
- if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
+ if (this_class->valuetype && child_frame.imethod->method->klass->valuetype) {
/* unbox */
gpointer *unboxed = mono_object_unbox (this_arg);
sp [0].data.p = unboxed;
token = * (unsigned short *)(ip + 1);
ip += 2;
- child_frame.runtime_method = rtm->data_items [token];
+ child_frame.imethod = rtm->data_items [token];
sp->data.p = vt_sp;
child_frame.retval = sp;
/* decrement by the actual number of args */
- sp -= child_frame.runtime_method->param_count + 1;
+ sp -= child_frame.imethod->param_count + 1;
child_frame.stack_args = sp;
this_arg = sp->data.p;
if (!this_arg)
THROW_EX (mono_get_exception_null_reference(), ip - 2);
- child_frame.runtime_method = get_virtual_method (child_frame.runtime_method, this_arg);
+ child_frame.imethod = get_virtual_method (child_frame.imethod, this_arg);
MonoClass *this_class = this_arg->vtable->klass;
- if (this_class->valuetype && child_frame.runtime_method->method->klass->valuetype) {
+ if (this_class->valuetype && child_frame.imethod->method->klass->valuetype) {
gpointer *unboxed = mono_object_unbox (this_arg);
sp [0].data.p = unboxed;
}
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_CALLRUN)
- ves_runtime_method (frame, context);
+ ves_imethod (frame, context);
if (frame->ex) {
rtm = NULL;
goto handle_exception;
goto exit_frame;
MINT_IN_CASE(MINT_RET_VOID)
if (sp > frame->stack)
- g_warning ("ret.void: more values on stack: %d %s", sp-frame->stack, mono_method_full_name (frame->runtime_method->method, TRUE));
+ g_warning ("ret.void: more values on stack: %d %s", sp-frame->stack, mono_method_full_name (frame->imethod->method, TRUE));
goto exit_frame;
MINT_IN_CASE(MINT_RET_VT)
i32 = READ32(ip + 1);
child_frame.ip = NULL;
child_frame.ex = NULL;
- child_frame.runtime_method = rtm->data_items [token];
- csig = mono_method_signature (child_frame.runtime_method->method);
- newobj_class = child_frame.runtime_method->method->klass;
+ child_frame.imethod = rtm->data_items [token];
+ csig = mono_method_signature (child_frame.imethod->method);
+ newobj_class = child_frame.imethod->method->klass;
/*if (profiling_classes) {
guint count = GPOINTER_TO_UINT (g_hash_table_lookup (profiling_classes, newobj_class));
count++;
MINT_IN_CASE(MINT_MONO_RETOBJ)
++ip;
sp--;
- stackval_from_data (mono_method_signature (frame->runtime_method->method)->ret, frame->retval, sp->data.p,
- mono_method_signature (frame->runtime_method->method)->pinvoke);
+ stackval_from_data (mono_method_signature (frame->imethod->method)->ret, frame->retval, sp->data.p,
+ mono_method_signature (frame->imethod->method)->pinvoke);
if (sp > frame->stack)
g_warning ("retobj: more values on stack: %d", sp-frame->stack);
goto exit_frame;
MINT_IN_BREAK;
}
MINT_IN_CASE(MINT_LDVIRTFTN) {
- RuntimeMethod *m = rtm->data_items [* (guint16 *)(ip + 1)];
+ InterpMethod *m = rtm->data_items [* (guint16 *)(ip + 1)];
ip += 2;
--sp;
if (!sp->data.p)
int len = sp [-1].data.i;
sp [-1].data.p = alloca (len);
- MonoMethodHeader *header = mono_method_get_header_checked (frame->runtime_method->method, &error);
+ MonoMethodHeader *header = mono_method_get_header_checked (frame->imethod->method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
if (header && header->init_locals)
memset (sp [-1].data.p, 0, len);
{
int i;
guint32 ip_offset;
- MonoInvocation *inv;
+ InterpFrame *inv;
MonoExceptionClause *clause;
/*char *message;*/
MonoObject *ex_obj;
for (inv = frame; inv; inv = inv->parent) {
MonoMethod *method;
- if (inv->runtime_method == NULL)
+ if (inv->imethod == NULL)
continue;
- method = inv->runtime_method->method;
+ method = inv->imethod->method;
if (method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)
continue;
if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME))
continue;
if (inv->ip == NULL)
continue;
- ip_offset = inv->ip - inv->runtime_method->code;
+ ip_offset = inv->ip - inv->imethod->code;
inv->ex_handler = NULL; /* clear this in case we are trhowing an exception while handling one - this one wins */
- for (i = 0; i < inv->runtime_method->num_clauses; ++i) {
- clause = &inv->runtime_method->clauses [i];
+ for (i = 0; i < inv->imethod->num_clauses; ++i) {
+ clause = &inv->imethod->clauses [i];
#if DEBUG_INTERP
g_print ("* clause [%d]: %p\n", i, clause);
#endif
if (tracing)
g_print ("* Filter found at '%s'\n", method->name);
#endif
- MonoInvocation dup_frame;
+ InterpFrame dup_frame;
stackval retval;
- memcpy (&dup_frame, inv, sizeof (MonoInvocation));
+ memcpy (&dup_frame, inv, sizeof (InterpFrame));
dup_frame.retval = &retval;
- ves_exec_method_with_context (&dup_frame, context, inv->runtime_method->code + clause->data.filter_offset, frame->ex, -1);
+ ves_exec_method_with_context (&dup_frame, context, inv->imethod->code + clause->data.filter_offset, frame->ex, -1);
if (dup_frame.retval->data.i) {
#if DEBUG_INTERP
if (tracing)
g_print ("* Matched Filter at '%s'\n", method->name);
#endif
inv->ex_handler = clause;
- *(MonoException**)(inv->locals + inv->runtime_method->exvar_offsets [i]) = frame->ex;
+ *(MonoException**)(inv->locals + inv->imethod->exvar_offsets [i]) = frame->ex;
goto handle_finally;
}
} else if (clause->flags == MONO_EXCEPTION_CLAUSE_NONE) {
g_print ("* Found handler at '%s'\n", method->name);
#endif
inv->ex_handler = clause;
- *(MonoException**)(inv->locals + inv->runtime_method->exvar_offsets [i]) = frame->ex;
+ *(MonoException**)(inv->locals + inv->imethod->exvar_offsets [i]) = frame->ex;
goto handle_finally;
}
}
guint32 ip_offset;
MonoExceptionClause *clause;
GSList *old_list = finally_ips;
- MonoMethod *method = frame->runtime_method->method;
+ MonoMethod *method = frame->imethod->method;
MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
guint32 ip_offset;
MonoExceptionClause *clause;
GSList *old_list = finally_ips;
- MonoMethod *method = frame->runtime_method->method;
+ MonoMethod *method = frame->imethod->method;
MonoMethodHeader *header = mono_method_get_header_checked (method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
void
-ves_exec_method (MonoInvocation *frame)
+ves_exec_method (InterpFrame *frame)
{
ThreadContext *context = mono_native_tls_get_value (thread_context_id);
ThreadContext context_struct;
- MonoDomain *domain = frame->runtime_method->domain;
+ MonoDomain *domain = frame->imethod->domain;
MonoError error;
jmp_buf env;
}
frame->ip = NULL;
frame->parent = context->current_frame;
- frame->runtime_method = mono_interp_get_runtime_method (domain, frame->method, &error);
+ frame->imethod = mono_interp_get_imethod (domain, frame->method, &error);
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
context->managed_code = 1;
ves_exec_method_with_context (frame, context, NULL, NULL, -1);
void
mono_interp_run_finally (StackFrameInfo *frame, int clause_index, gpointer handler_ip)
{
- MonoInvocation *iframe = frame->interp_frame;
+ InterpFrame *iframe = frame->interp_frame;
ThreadContext *context = mono_native_tls_get_value (thread_context_id);
ves_exec_method_with_context (iframe, context, handler_ip, NULL, clause_index);
}
typedef struct {
- MonoInvocation *current;
+ InterpFrame *current;
} StackIter;
/*
{
StackIter *stack_iter = (StackIter*)iter;
- stack_iter->current = (MonoInvocation*)interp_exit_data;
+ stack_iter->current = (InterpFrame*)interp_exit_data;
}
gboolean
mono_interp_frame_iter_next (MonoInterpStackIter *iter, StackFrameInfo *frame)
{
StackIter *stack_iter = (StackIter*)iter;
- MonoInvocation *iframe = stack_iter->current;
+ InterpFrame *iframe = stack_iter->current;
memset (frame, 0, sizeof (StackFrameInfo));
- /* pinvoke frames doesn't have runtime_method set */
- while (iframe && !(iframe->runtime_method && iframe->runtime_method->code))
+ /* pinvoke frames doesn't have imethod set */
+ while (iframe && !(iframe->imethod && iframe->imethod->code))
iframe = iframe->parent;
if (!iframe)
return FALSE;
// FIXME:
frame->domain = mono_domain_get ();
frame->interp_frame = iframe;
- frame->method = iframe->runtime_method->method;
+ frame->method = iframe->imethod->method;
frame->actual_method = frame->method;
/* This is the offset in the interpreter IR */
- frame->native_offset = (guint8*)iframe->ip - (guint8*)iframe->runtime_method->code;
- frame->ji = iframe->runtime_method->jinfo;
+ frame->native_offset = (guint8*)iframe->ip - (guint8*)iframe->imethod->code;
+ frame->ji = iframe->imethod->jinfo;
stack_iter->current = iframe->parent;
MonoJitInfo*
mono_interp_find_jit_info (MonoDomain *domain, MonoMethod *method)
{
- RuntimeMethod* rtm;
+ InterpMethod* rtm;
- rtm = lookup_runtime_method (domain, method);
+ rtm = lookup_imethod (domain, method);
if (rtm)
return rtm->jinfo;
else
MonoJitInfo*
mono_interp_frame_get_jit_info (MonoInterpFrameHandle frame)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
- return iframe->runtime_method->jinfo;
+ g_assert (iframe->imethod);
+ return iframe->imethod->jinfo;
}
gpointer
mono_interp_frame_get_ip (MonoInterpFrameHandle frame)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
+ g_assert (iframe->imethod);
return (gpointer)iframe->ip;
}
gpointer
mono_interp_frame_get_arg (MonoInterpFrameHandle frame, int pos)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
+ g_assert (iframe->imethod);
- int arg_offset = iframe->runtime_method->arg_offsets [pos + (iframe->runtime_method->hasthis ? 1 : 0)];
+ int arg_offset = iframe->imethod->arg_offsets [pos + (iframe->imethod->hasthis ? 1 : 0)];
return iframe->args + arg_offset;
}
gpointer
mono_interp_frame_get_local (MonoInterpFrameHandle frame, int pos)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
+ g_assert (iframe->imethod);
- return iframe->locals + iframe->runtime_method->local_offsets [pos];
+ return iframe->locals + iframe->imethod->local_offsets [pos];
}
gpointer
mono_interp_frame_get_this (MonoInterpFrameHandle frame)
{
- MonoInvocation *iframe = (MonoInvocation*)frame;
+ InterpFrame *iframe = (InterpFrame*)frame;
- g_assert (iframe->runtime_method);
- g_assert (iframe->runtime_method->hasthis);
+ g_assert (iframe->imethod);
+ g_assert (iframe->imethod->hasthis);
- int arg_offset = iframe->runtime_method->arg_offsets [0];
+ int arg_offset = iframe->imethod->arg_offsets [0];
return iframe->args + arg_offset;
}
{
MonoMethod *method;
MonoMethodHeader *header;
- RuntimeMethod *rtm;
+ InterpMethod *rtm;
const unsigned char *il_code;
const unsigned char *ip;
const unsigned char *last_ip;
#define SIMPLE_OP(td, op) \
do { \
- ADD_CODE(&td, op); \
- ++td.ip; \
+ ADD_CODE(td, op); \
+ ++td->ip; \
} while (0)
static guint16
}
} else if (!calli && !virtual && jit_call_supported (target_method, csignature)) {
ADD_CODE(td, MINT_JIT_CALL);
- ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_runtime_method (domain, target_method, &error)));
+ ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_imethod (domain, target_method, &error)));
mono_error_assert_ok (&error);
} else {
if (calli)
if (calli) {
ADD_CODE(td, get_data_item_index (td, (void *)csignature));
} else {
- ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_runtime_method (domain, target_method, &error)));
+ ADD_CODE(td, get_data_item_index (td, (void *)mono_interp_get_imethod (domain, target_method, &error)));
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
}
}
}
static void
-interp_save_debug_info (RuntimeMethod *rtm, MonoMethodHeader *header, TransformData *td, GArray *line_numbers)
+interp_save_debug_info (InterpMethod *rtm, MonoMethodHeader *header, TransformData *td, GArray *line_numbers)
{
MonoDebugMethodJitInfo *dinfo;
int i;
static void
save_seq_points (TransformData *td)
{
- RuntimeMethod *rtm = td->rtm;
+ InterpMethod *rtm = td->rtm;
GByteArray *array;
int i, seq_info_size;
MonoSeqPointInfo *info;
#define BARRIER_IF_VOLATILE(td) \
do { \
if (volatile_) { \
- ADD_CODE (&td, MINT_MONO_MEMORY_BARRIER); \
+ ADD_CODE (td, MINT_MONO_MEMORY_BARRIER); \
volatile_ = FALSE; \
} \
} while (0)
static void
-generate (MonoMethod *method, RuntimeMethod *rtm, unsigned char *is_bb_start, MonoGenericContext *generic_context)
+generate (MonoMethod *method, InterpMethod *rtm, unsigned char *is_bb_start, MonoGenericContext *generic_context)
{
MonoMethodHeader *header = mono_method_get_header (method);
MonoMethodSignature *signature = mono_method_signature (method);
int body_start_offset;
int target;
guint32 token;
- TransformData td;
+ TransformData transform_data;
+ TransformData *td;
int generating_code = 1;
GArray *line_numbers;
MonoDebugMethodInfo *minfo;
verbose_method_inited = TRUE;
}
- memset (&td, 0, sizeof(td));
- td.method = method;
- td.rtm = rtm;
- td.is_bb_start = is_bb_start;
- td.il_code = header->code;
- td.code_size = header->code_size;
- td.header = header;
- td.max_code_size = td.code_size;
- td.new_code = (unsigned short *)g_malloc(td.max_code_size * sizeof(gushort));
- td.new_code_end = td.new_code + td.max_code_size;
- td.mempool = mono_mempool_new ();
- td.in_offsets = g_malloc0(header->code_size * sizeof(int));
- td.stack_state = g_malloc0(header->code_size * sizeof(StackInfo *));
- td.stack_height = g_malloc(header->code_size * sizeof(int));
- td.vt_stack_size = g_malloc(header->code_size * sizeof(int));
- td.n_data_items = 0;
- td.max_data_items = 0;
- td.data_items = NULL;
- td.data_hash = g_hash_table_new (NULL, NULL);
- td.clause_indexes = g_malloc (header->code_size * sizeof (int));
- td.gen_sdb_seq_points = debug_options.gen_sdb_seq_points;
- td.seq_points = g_ptr_array_new ();
- td.relocs = g_ptr_array_new ();
- td.verbose_level = mono_interp_traceopt;
- rtm->data_items = td.data_items;
+ memset (&transform_data, 0, sizeof(transform_data));
+ td = &transform_data;
+
+ td->method = method;
+ td->rtm = rtm;
+ td->is_bb_start = is_bb_start;
+ td->il_code = header->code;
+ td->code_size = header->code_size;
+ td->header = header;
+ td->max_code_size = td->code_size;
+ td->new_code = (unsigned short *)g_malloc(td->max_code_size * sizeof(gushort));
+ td->new_code_end = td->new_code + td->max_code_size;
+ td->mempool = mono_mempool_new ();
+ td->in_offsets = g_malloc0(header->code_size * sizeof(int));
+ td->stack_state = g_malloc0(header->code_size * sizeof(StackInfo *));
+ td->stack_height = g_malloc(header->code_size * sizeof(int));
+ td->vt_stack_size = g_malloc(header->code_size * sizeof(int));
+ td->n_data_items = 0;
+ td->max_data_items = 0;
+ td->data_items = NULL;
+ td->data_hash = g_hash_table_new (NULL, NULL);
+ td->clause_indexes = g_malloc (header->code_size * sizeof (int));
+ td->gen_sdb_seq_points = debug_options.gen_sdb_seq_points;
+ td->seq_points = g_ptr_array_new ();
+ td->relocs = g_ptr_array_new ();
+ td->verbose_level = mono_interp_traceopt;
+ rtm->data_items = td->data_items;
for (i = 0; i < header->code_size; i++) {
- td.stack_height [i] = -1;
- td.clause_indexes [i] = -1;
+ td->stack_height [i] = -1;
+ td->clause_indexes [i] = -1;
}
if (verbose_method_name) {
desc = mono_method_desc_new (name, TRUE);
if (mono_method_desc_full_match (desc, method)) {
- td.verbose_level = 4;
+ td->verbose_level = 4;
}
mono_method_desc_free (desc);
} else {
if (strcmp (method->name, name) == 0)
- td.verbose_level = 4;
+ td->verbose_level = 4;
}
}
- if (td.gen_sdb_seq_points) {
- get_basic_blocks (&td);
+ if (td->gen_sdb_seq_points) {
+ get_basic_blocks (td);
minfo = mono_debug_lookup_method (method);
mono_debug_get_seq_points (minfo, NULL, NULL, NULL, &sps, &n_il_offsets);
// FIXME: Free
- seq_point_locs = mono_bitset_mem_new (mono_mempool_alloc0 (td.mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
- seq_point_set_locs = mono_bitset_mem_new (mono_mempool_alloc0 (td.mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
+ seq_point_locs = mono_bitset_mem_new (mono_mempool_alloc0 (td->mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
+ seq_point_set_locs = mono_bitset_mem_new (mono_mempool_alloc0 (td->mempool, mono_bitset_alloc_size (header->code_size, 0)), header->code_size, 0);
sym_seq_points = TRUE;
for (i = 0; i < n_il_offsets; ++i) {
}
}
- td.new_ip = td.new_code;
- td.last_new_ip = NULL;
+ td->new_ip = td->new_code;
+ td->last_new_ip = NULL;
- td.stack = g_malloc0 ((header->max_stack + 1) * sizeof (td.stack [0]));
- td.sp = td.stack;
- td.max_stack_height = 0;
+ td->stack = g_malloc0 ((header->max_stack + 1) * sizeof (td->stack [0]));
+ td->sp = td->stack;
+ td->max_stack_height = 0;
line_numbers = g_array_new (FALSE, TRUE, sizeof (MonoDebugLineNumberEntry));
for (i = 0; i < header->num_clauses; i++) {
MonoExceptionClause *c = header->clauses + i;
- td.stack_height [c->handler_offset] = 0;
- td.vt_stack_size [c->handler_offset] = 0;
- td.is_bb_start [c->handler_offset] = 1;
+ td->stack_height [c->handler_offset] = 0;
+ td->vt_stack_size [c->handler_offset] = 0;
+ td->is_bb_start [c->handler_offset] = 1;
- td.stack_height [c->handler_offset] = 1;
- td.stack_state [c->handler_offset] = g_malloc0(sizeof(StackInfo));
- td.stack_state [c->handler_offset][0].type = STACK_TYPE_O;
- td.stack_state [c->handler_offset][0].klass = NULL; /*FIX*/
+ td->stack_height [c->handler_offset] = 1;
+ td->stack_state [c->handler_offset] = g_malloc0(sizeof(StackInfo));
+ td->stack_state [c->handler_offset][0].type = STACK_TYPE_O;
+ td->stack_state [c->handler_offset][0].klass = NULL; /*FIX*/
if (c->flags & MONO_EXCEPTION_CLAUSE_FILTER) {
- td.stack_height [c->data.filter_offset] = 0;
- td.vt_stack_size [c->data.filter_offset] = 0;
- td.is_bb_start [c->data.filter_offset] = 1;
-
- td.stack_height [c->data.filter_offset] = 1;
- td.stack_state [c->data.filter_offset] = g_malloc0(sizeof(StackInfo));
- td.stack_state [c->data.filter_offset][0].type = STACK_TYPE_O;
- td.stack_state [c->data.filter_offset][0].klass = NULL; /*FIX*/
+ td->stack_height [c->data.filter_offset] = 0;
+ td->vt_stack_size [c->data.filter_offset] = 0;
+ td->is_bb_start [c->data.filter_offset] = 1;
+
+ td->stack_height [c->data.filter_offset] = 1;
+ td->stack_state [c->data.filter_offset] = g_malloc0(sizeof(StackInfo));
+ td->stack_state [c->data.filter_offset][0].type = STACK_TYPE_O;
+ td->stack_state [c->data.filter_offset][0].klass = NULL; /*FIX*/
}
for (int j = c->handler_offset; j < c->handler_offset + c->handler_len; ++j) {
- if (td.clause_indexes [j] == -1)
- td.clause_indexes [j] = i;
+ if (td->clause_indexes [j] == -1)
+ td->clause_indexes [j] = i;
}
}
- td.ip = header->code;
- end = td.ip + header->code_size;
+ td->ip = header->code;
+ end = td->ip + header->code_size;
- if (td.verbose_level) {
- char *tmp = mono_disasm_code (NULL, method, td.ip, end);
+ if (td->verbose_level) {
+ char *tmp = mono_disasm_code (NULL, method, td->ip, end);
char *name = mono_method_full_name (method, TRUE);
g_print ("Method %s, original code:\n", name);
g_print ("%s\n", tmp);
}
if (signature->hasthis)
- store_inarg (&td, 0);
+ store_inarg (td, 0);
for (i = 0; i < signature->param_count; i++)
- store_inarg (&td, i + !!signature->hasthis);
+ store_inarg (td, i + !!signature->hasthis);
- body_start_offset = td.new_ip - td.new_code;
+ body_start_offset = td->new_ip - td->new_code;
for (i = 0; i < header->num_locals; i++) {
int mt = mint_type(header->locals [i]);
if (mt == MINT_TYPE_VT || mt == MINT_TYPE_O || mt == MINT_TYPE_P) {
- ADD_CODE(&td, MINT_INITLOCALS);
+ ADD_CODE(td, MINT_INITLOCALS);
break;
}
}
if (sym_seq_points) {
- InterpBasicBlock *cbb = td.offset_to_bb [0];
+ InterpBasicBlock *cbb = td->offset_to_bb [0];
g_assert (cbb);
- emit_seq_point (&td, METHOD_ENTRY_IL_OFFSET, cbb, FALSE);
+ emit_seq_point (td, METHOD_ENTRY_IL_OFFSET, cbb, FALSE);
}
- while (td.ip < end) {
+ while (td->ip < end) {
int in_offset;
- g_assert (td.sp >= td.stack);
- g_assert (td.vt_sp < 0x10000000);
- in_offset = td.ip - header->code;
- td.in_offsets [in_offset] = td.new_ip - td.new_code;
- new_in_start_offset = td.new_ip - td.new_code;
- td.in_start = td.ip;
+ g_assert (td->sp >= td->stack);
+ g_assert (td->vt_sp < 0x10000000);
+ in_offset = td->ip - header->code;
+ td->in_offsets [in_offset] = td->new_ip - td->new_code;
+ new_in_start_offset = td->new_ip - td->new_code;
+ td->in_start = td->ip;
MonoDebugLineNumberEntry lne;
- lne.native_offset = (guint8*)td.new_ip - (guint8*)td.new_code;
+ lne.native_offset = (guint8*)td->new_ip - (guint8*)td->new_code;
lne.il_offset = in_offset;
g_array_append_val (line_numbers, lne);
- if (td.stack_height [in_offset] >= 0) {
+ if (td->stack_height [in_offset] >= 0) {
g_assert (is_bb_start [in_offset]);
- if (td.stack_height [in_offset] > 0)
- memcpy (td.stack, td.stack_state [in_offset], td.stack_height [in_offset] * sizeof(td.stack [0]));
- td.sp = td.stack + td.stack_height [in_offset];
- td.vt_sp = td.vt_stack_size [in_offset];
+ if (td->stack_height [in_offset] > 0)
+ memcpy (td->stack, td->stack_state [in_offset], td->stack_height [in_offset] * sizeof(td->stack [0]));
+ td->sp = td->stack + td->stack_height [in_offset];
+ td->vt_sp = td->vt_stack_size [in_offset];
}
if (is_bb_start [in_offset]) {
generating_code = 1;
}
if (!generating_code) {
- while (td.ip < end && !is_bb_start [td.ip - td.il_code])
- ++td.ip;
+ while (td->ip < end && !is_bb_start [td->ip - td->il_code])
+ ++td->ip;
continue;
}
- if (td.verbose_level > 1) {
+ if (td->verbose_level > 1) {
printf("IL_%04lx %s %-10s -> IL_%04lx, sp %ld, %s %-12s vt_sp %u (max %u)\n",
- td.ip - td.il_code,
- td.is_bb_start [td.ip - td.il_code] == 3 ? "<>" :
- td.is_bb_start [td.ip - td.il_code] == 2 ? "< " :
- td.is_bb_start [td.ip - td.il_code] == 1 ? " >" : " ",
- mono_opcode_name (*td.ip), td.new_ip - td.new_code, td.sp - td.stack,
- td.sp > td.stack ? stack_type_string [td.sp [-1].type] : " ",
- (td.sp > td.stack && (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_VT)) ? (td.sp [-1].klass == NULL ? "?" : td.sp [-1].klass->name) : "",
- td.vt_sp, td.max_vt_sp);
+ td->ip - td->il_code,
+ td->is_bb_start [td->ip - td->il_code] == 3 ? "<>" :
+ td->is_bb_start [td->ip - td->il_code] == 2 ? "< " :
+ td->is_bb_start [td->ip - td->il_code] == 1 ? " >" : " ",
+ mono_opcode_name (*td->ip), td->new_ip - td->new_code, td->sp - td->stack,
+ td->sp > td->stack ? stack_type_string [td->sp [-1].type] : " ",
+ (td->sp > td->stack && (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_VT)) ? (td->sp [-1].klass == NULL ? "?" : td->sp [-1].klass->name) : "",
+ td->vt_sp, td->max_vt_sp);
}
- if (sym_seq_points && mono_bitset_test_fast (seq_point_locs, td.ip - header->code)) {
- InterpBasicBlock *cbb = td.offset_to_bb [td.ip - header->code];
+ if (sym_seq_points && mono_bitset_test_fast (seq_point_locs, td->ip - header->code)) {
+ InterpBasicBlock *cbb = td->offset_to_bb [td->ip - header->code];
g_assert (cbb);
/*
* backward branches.
*/
if (in_offset == 0 || g_slist_length (cbb->preds) > 1)
- ADD_CODE (&td, MINT_SDB_INTR_LOC);
+ ADD_CODE (td, MINT_SDB_INTR_LOC);
- emit_seq_point (&td, in_offset, cbb, FALSE);
+ emit_seq_point (td, in_offset, cbb, FALSE);
- mono_bitset_set_fast (seq_point_set_locs, td.ip - header->code);
+ mono_bitset_set_fast (seq_point_set_locs, td->ip - header->code);
}
if (sym_seq_points)
- bb_exit = td.offset_to_bb [td.ip - header->code];
+ bb_exit = td->offset_to_bb [td->ip - header->code];
- switch (*td.ip) {
+ switch (*td->ip) {
case CEE_NOP:
/* lose it */
- ++td.ip;
+ ++td->ip;
break;
case CEE_BREAK:
SIMPLE_OP(td, MINT_BREAK);
case CEE_LDARG_1:
case CEE_LDARG_2:
case CEE_LDARG_3:
- load_arg (&td, *td.ip - CEE_LDARG_0);
- ++td.ip;
+ load_arg (td, *td->ip - CEE_LDARG_0);
+ ++td->ip;
break;
case CEE_LDLOC_0:
case CEE_LDLOC_1:
case CEE_LDLOC_2:
case CEE_LDLOC_3:
- load_local (&td, *td.ip - CEE_LDLOC_0);
- ++td.ip;
+ load_local (td, *td->ip - CEE_LDLOC_0);
+ ++td->ip;
break;
case CEE_STLOC_0:
case CEE_STLOC_1:
case CEE_STLOC_2:
case CEE_STLOC_3:
- store_local (&td, *td.ip - CEE_STLOC_0);
- ++td.ip;
+ store_local (td, *td->ip - CEE_STLOC_0);
+ ++td->ip;
break;
case CEE_LDARG_S:
- load_arg (&td, ((guint8 *)td.ip)[1]);
- td.ip += 2;
+ load_arg (td, ((guint8 *)td->ip)[1]);
+ td->ip += 2;
break;
case CEE_LDARGA_S: {
/* NOTE: n includes this */
- int n = ((guint8 *) td.ip) [1];
- ADD_CODE (&td, MINT_LDARGA);
- ADD_CODE (&td, td.rtm->arg_offsets [n]);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
- td.ip += 2;
+ int n = ((guint8 *) td->ip) [1];
+ ADD_CODE (td, MINT_LDARGA);
+ ADD_CODE (td, td->rtm->arg_offsets [n]);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
+ td->ip += 2;
break;
}
case CEE_STARG_S:
- store_arg (&td, ((guint8 *)td.ip)[1]);
- td.ip += 2;
+ store_arg (td, ((guint8 *)td->ip)[1]);
+ td->ip += 2;
break;
case CEE_LDLOC_S:
- load_local (&td, ((guint8 *)td.ip)[1]);
- td.ip += 2;
+ load_local (td, ((guint8 *)td->ip)[1]);
+ td->ip += 2;
break;
case CEE_LDLOCA_S:
- ADD_CODE(&td, MINT_LDLOCA_S);
- ADD_CODE(&td, td.rtm->local_offsets [((guint8 *)td.ip)[1]]);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
- td.ip += 2;
+ ADD_CODE(td, MINT_LDLOCA_S);
+ ADD_CODE(td, td->rtm->local_offsets [((guint8 *)td->ip)[1]]);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
+ td->ip += 2;
break;
case CEE_STLOC_S:
- store_local (&td, ((guint8 *)td.ip)[1]);
- td.ip += 2;
+ store_local (td, ((guint8 *)td->ip)[1]);
+ td->ip += 2;
break;
case CEE_LDNULL:
SIMPLE_OP(td, MINT_LDNULL);
- PUSH_TYPE(&td, STACK_TYPE_O, NULL);
+ PUSH_TYPE(td, STACK_TYPE_O, NULL);
break;
case CEE_LDC_I4_M1:
SIMPLE_OP(td, MINT_LDC_I4_M1);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
case CEE_LDC_I4_0:
- if (!td.is_bb_start[td.ip + 1 - td.il_code] && td.ip [1] == 0xfe && td.ip [2] == CEE_CEQ &&
- td.sp > td.stack && td.sp [-1].type == STACK_TYPE_I4) {
+ if (!td->is_bb_start[td->ip + 1 - td->il_code] && td->ip [1] == 0xfe && td->ip [2] == CEE_CEQ &&
+ td->sp > td->stack && td->sp [-1].type == STACK_TYPE_I4) {
SIMPLE_OP(td, MINT_CEQ0_I4);
- td.ip += 2;
+ td->ip += 2;
} else {
SIMPLE_OP(td, MINT_LDC_I4_0);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
}
break;
case CEE_LDC_I4_1:
- if (!td.is_bb_start[td.ip + 1 - td.il_code] &&
- (td.ip [1] == CEE_ADD || td.ip [1] == CEE_SUB) && td.sp [-1].type == STACK_TYPE_I4) {
- ADD_CODE(&td, td.ip [1] == CEE_ADD ? MINT_ADD1_I4 : MINT_SUB1_I4);
- td.ip += 2;
+ if (!td->is_bb_start[td->ip + 1 - td->il_code] &&
+ (td->ip [1] == CEE_ADD || td->ip [1] == CEE_SUB) && td->sp [-1].type == STACK_TYPE_I4) {
+ ADD_CODE(td, td->ip [1] == CEE_ADD ? MINT_ADD1_I4 : MINT_SUB1_I4);
+ td->ip += 2;
} else {
SIMPLE_OP(td, MINT_LDC_I4_1);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
}
break;
case CEE_LDC_I4_2:
case CEE_LDC_I4_6:
case CEE_LDC_I4_7:
case CEE_LDC_I4_8:
- SIMPLE_OP(td, (*td.ip - CEE_LDC_I4_0) + MINT_LDC_I4_0);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ SIMPLE_OP(td, (*td->ip - CEE_LDC_I4_0) + MINT_LDC_I4_0);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
case CEE_LDC_I4_S:
- ADD_CODE(&td, MINT_LDC_I4_S);
- ADD_CODE(&td, ((gint8 *) td.ip) [1]);
- td.ip += 2;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ ADD_CODE(td, MINT_LDC_I4_S);
+ ADD_CODE(td, ((gint8 *) td->ip) [1]);
+ td->ip += 2;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
case CEE_LDC_I4:
- i32 = read32 (td.ip + 1);
- ADD_CODE(&td, MINT_LDC_I4);
- WRITE32(&td, &i32);
- td.ip += 5;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ i32 = read32 (td->ip + 1);
+ ADD_CODE(td, MINT_LDC_I4);
+ WRITE32(td, &i32);
+ td->ip += 5;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
case CEE_LDC_I8: {
- gint64 val = read64 (td.ip + 1);
- ADD_CODE(&td, MINT_LDC_I8);
- WRITE64(&td, &val);
- td.ip += 9;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I8);
+ gint64 val = read64 (td->ip + 1);
+ ADD_CODE(td, MINT_LDC_I8);
+ WRITE64(td, &val);
+ td->ip += 9;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I8);
break;
}
case CEE_LDC_R4: {
float val;
- readr4 (td.ip + 1, &val);
- ADD_CODE(&td, MINT_LDC_R4);
- WRITE32(&td, &val);
- td.ip += 5;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_R8);
+ readr4 (td->ip + 1, &val);
+ ADD_CODE(td, MINT_LDC_R4);
+ WRITE32(td, &val);
+ td->ip += 5;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_R8);
break;
}
case CEE_LDC_R8: {
double val;
- readr8 (td.ip + 1, &val);
- ADD_CODE(&td, MINT_LDC_R8);
- WRITE64(&td, &val);
- td.ip += 9;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_R8);
+ readr8 (td->ip + 1, &val);
+ ADD_CODE(td, MINT_LDC_R8);
+ WRITE64(td, &val);
+ td->ip += 9;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_R8);
break;
}
case CEE_DUP: {
- int type = td.sp [-1].type;
- MonoClass *klass = td.sp [-1].klass;
- if (td.sp [-1].type == STACK_TYPE_VT) {
+ int type = td->sp [-1].type;
+ MonoClass *klass = td->sp [-1].klass;
+ if (td->sp [-1].type == STACK_TYPE_VT) {
gint32 size = mono_class_value_size (klass, NULL);
- PUSH_VT(&td, size);
- ADD_CODE(&td, MINT_DUP_VT);
- WRITE32(&td, &size);
- td.ip ++;
+ PUSH_VT(td, size);
+ ADD_CODE(td, MINT_DUP_VT);
+ WRITE32(td, &size);
+ td->ip ++;
} else
SIMPLE_OP(td, MINT_DUP);
- PUSH_TYPE(&td, type, klass);
+ PUSH_TYPE(td, type, klass);
break;
}
case CEE_POP:
- CHECK_STACK(&td, 1);
+ CHECK_STACK(td, 1);
SIMPLE_OP(td, MINT_POP);
- ADD_CODE (&td, 0);
- if (td.sp [-1].type == STACK_TYPE_VT) {
- int size = mono_class_value_size (td.sp [-1].klass, NULL);
+ ADD_CODE (td, 0);
+ if (td->sp [-1].type == STACK_TYPE_VT) {
+ int size = mono_class_value_size (td->sp [-1].klass, NULL);
size = (size + 7) & ~7;
- ADD_CODE(&td, MINT_VTRESULT);
- ADD_CODE(&td, 0);
- WRITE32(&td, &size);
- td.vt_sp -= size;
+ ADD_CODE(td, MINT_VTRESULT);
+ ADD_CODE(td, 0);
+ WRITE32(td, &size);
+ td->vt_sp -= size;
}
- --td.sp;
+ --td->sp;
break;
case CEE_JMP: {
MonoMethod *m;
- if (td.sp > td.stack)
+ if (td->sp > td->stack)
g_warning ("CEE_JMP: stack must be empty");
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
m = mono_get_method_full (image, token, NULL, generic_context);
- ADD_CODE (&td, MINT_JMP);
- ADD_CODE (&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
+ ADD_CODE (td, MINT_JMP);
+ ADD_CODE (td, get_data_item_index (td, mono_interp_get_imethod (domain, m, &error)));
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- td.ip += 5;
+ td->ip += 5;
break;
}
case CEE_CALLVIRT: /* Fall through */
case CEE_CALL: {
gboolean need_seq_point = FALSE;
- if (sym_seq_points && !mono_bitset_test_fast (seq_point_locs, td.ip + 5 - header->code))
+ if (sym_seq_points && !mono_bitset_test_fast (seq_point_locs, td->ip + 5 - header->code))
need_seq_point = TRUE;
- interp_transform_call (&td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, constrained_class, readonly);
+ interp_transform_call (td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, constrained_class, readonly);
if (need_seq_point) {
- InterpBasicBlock *cbb = td.offset_to_bb [td.ip - header->code];
+ InterpBasicBlock *cbb = td->offset_to_bb [td->ip - header->code];
g_assert (cbb);
- emit_seq_point (&td, td.ip - header->code, cbb, TRUE);
+ emit_seq_point (td, td->ip - header->code, cbb, TRUE);
}
constrained_class = NULL;
case CEE_RET: {
int vt_size = 0;
if (signature->ret->type != MONO_TYPE_VOID) {
- --td.sp;
+ --td->sp;
MonoClass *klass = mono_class_from_mono_type (signature->ret);
if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
vt_size = mono_class_value_size (klass, NULL);
vt_size = (vt_size + 7) & ~7;
}
}
- if (td.sp > td.stack)
- g_warning ("%s.%s: CEE_RET: more values on stack: %d", td.method->klass->name, td.method->name, td.sp - td.stack);
- if (td.vt_sp != vt_size)
- g_error ("%s.%s: CEE_RET: value type stack: %d vs. %d", td.method->klass->name, td.method->name, td.vt_sp, vt_size);
+ if (td->sp > td->stack)
+ g_warning ("%s.%s: CEE_RET: more values on stack: %d", td->method->klass->name, td->method->name, td->sp - td->stack);
+ if (td->vt_sp != vt_size)
+ g_error ("%s.%s: CEE_RET: value type stack: %d vs. %d", td->method->klass->name, td->method->name, td->vt_sp, vt_size);
if (sym_seq_points) {
- InterpBasicBlock *cbb = td.offset_to_bb [td.ip - header->code];
+ InterpBasicBlock *cbb = td->offset_to_bb [td->ip - header->code];
g_assert (cbb);
- emit_seq_point (&td, METHOD_EXIT_IL_OFFSET, bb_exit, FALSE);
+ emit_seq_point (td, METHOD_EXIT_IL_OFFSET, bb_exit, FALSE);
}
if (vt_size == 0)
SIMPLE_OP(td, signature->ret->type == MONO_TYPE_VOID ? MINT_RET_VOID : MINT_RET);
else {
- ADD_CODE(&td, MINT_RET_VT);
- WRITE32(&td, &vt_size);
- ++td.ip;
+ ADD_CODE(td, MINT_RET_VT);
+ WRITE32(td, &vt_size);
+ ++td->ip;
}
generating_code = 0;
break;
}
case CEE_BR:
- handle_branch (&td, MINT_BR_S, MINT_BR, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ handle_branch (td, MINT_BR_S, MINT_BR, 5 + read32 (td->ip + 1));
+ td->ip += 5;
generating_code = 0;
break;
case CEE_BR_S:
- handle_branch (&td, MINT_BR_S, MINT_BR, 2 + (gint8)td.ip [1]);
- td.ip += 2;
+ handle_branch (td, MINT_BR_S, MINT_BR, 2 + (gint8)td->ip [1]);
+ td->ip += 2;
generating_code = 0;
break;
case CEE_BRFALSE:
- one_arg_branch (&td, MINT_BRFALSE_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ one_arg_branch (td, MINT_BRFALSE_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BRFALSE_S:
- one_arg_branch (&td, MINT_BRFALSE_I4, 2 + (gint8)td.ip [1]);
- td.ip += 2;
+ one_arg_branch (td, MINT_BRFALSE_I4, 2 + (gint8)td->ip [1]);
+ td->ip += 2;
break;
case CEE_BRTRUE:
- one_arg_branch (&td, MINT_BRTRUE_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ one_arg_branch (td, MINT_BRTRUE_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BRTRUE_S:
- one_arg_branch (&td, MINT_BRTRUE_I4, 2 + (gint8)td.ip [1]);
- td.ip += 2;
+ one_arg_branch (td, MINT_BRTRUE_I4, 2 + (gint8)td->ip [1]);
+ td->ip += 2;
break;
case CEE_BEQ:
- two_arg_branch (&td, MINT_BEQ_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BEQ_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BEQ_S:
- two_arg_branch (&td, MINT_BEQ_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BEQ_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BGE:
- two_arg_branch (&td, MINT_BGE_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BGE_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BGE_S:
- two_arg_branch (&td, MINT_BGE_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BGE_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BGT:
- two_arg_branch (&td, MINT_BGT_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BGT_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BGT_S:
- two_arg_branch (&td, MINT_BGT_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BGT_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BLT:
- two_arg_branch (&td, MINT_BLT_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BLT_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BLT_S:
- two_arg_branch (&td, MINT_BLT_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BLT_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BLE:
- two_arg_branch (&td, MINT_BLE_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BLE_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BLE_S:
- two_arg_branch (&td, MINT_BLE_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BLE_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BNE_UN:
- two_arg_branch (&td, MINT_BNE_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BNE_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BNE_UN_S:
- two_arg_branch (&td, MINT_BNE_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BNE_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BGE_UN:
- two_arg_branch (&td, MINT_BGE_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BGE_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BGE_UN_S:
- two_arg_branch (&td, MINT_BGE_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BGE_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BGT_UN:
- two_arg_branch (&td, MINT_BGT_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BGT_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BGT_UN_S:
- two_arg_branch (&td, MINT_BGT_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BGT_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BLE_UN:
- two_arg_branch (&td, MINT_BLE_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BLE_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BLE_UN_S:
- two_arg_branch (&td, MINT_BLE_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BLE_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_BLT_UN:
- two_arg_branch (&td, MINT_BLT_UN_I4, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ two_arg_branch (td, MINT_BLT_UN_I4, 5 + read32 (td->ip + 1));
+ td->ip += 5;
break;
case CEE_BLT_UN_S:
- two_arg_branch (&td, MINT_BLT_UN_I4, 2 + (gint8) td.ip [1]);
- td.ip += 2;
+ two_arg_branch (td, MINT_BLT_UN_I4, 2 + (gint8) td->ip [1]);
+ td->ip += 2;
break;
case CEE_SWITCH: {
guint32 n;
const unsigned char *next_ip;
- ++td.ip;
- n = read32 (td.ip);
- ADD_CODE (&td, MINT_SWITCH);
- WRITE32 (&td, &n);
- td.ip += 4;
- next_ip = td.ip + n * 4;
- --td.sp;
- int stack_height = td.sp - td.stack;
+ ++td->ip;
+ n = read32 (td->ip);
+ ADD_CODE (td, MINT_SWITCH);
+ WRITE32 (td, &n);
+ td->ip += 4;
+ next_ip = td->ip + n * 4;
+ --td->sp;
+ int stack_height = td->sp - td->stack;
for (i = 0; i < n; i++) {
- offset = read32 (td.ip);
- target = next_ip - td.il_code + offset;
+ offset = read32 (td->ip);
+ target = next_ip - td->il_code + offset;
if (offset < 0) {
#if DEBUG_INTERP
- if (stack_height > 0 && stack_height != td.stack_height [target])
+ if (stack_height > 0 && stack_height != td->stack_height [target])
g_warning ("SWITCH with back branch and non-empty stack");
#endif
- target = td.in_offsets [target] - (td.new_ip - td.new_code);
+ target = td->in_offsets [target] - (td->new_ip - td->new_code);
} else {
- td.stack_height [target] = stack_height;
- td.vt_stack_size [target] = td.vt_sp;
+ td->stack_height [target] = stack_height;
+ td->vt_stack_size [target] = td->vt_sp;
if (stack_height > 0)
- td.stack_state [target] = g_memdup (td.stack, stack_height * sizeof (td.stack [0]));
+ td->stack_state [target] = g_memdup (td->stack, stack_height * sizeof (td->stack [0]));
- Reloc *reloc = mono_mempool_alloc0 (td.mempool, sizeof (Reloc));
+ Reloc *reloc = mono_mempool_alloc0 (td->mempool, sizeof (Reloc));
reloc->type = RELOC_SWITCH;
- reloc->offset = td.new_ip - td.new_code;
+ reloc->offset = td->new_ip - td->new_code;
reloc->target = target;
- g_ptr_array_add (td.relocs, reloc);
+ g_ptr_array_add (td->relocs, reloc);
target = 0xffff;
}
- WRITE32 (&td, &target);
- td.ip += 4;
+ WRITE32 (td, &target);
+ td->ip += 4;
}
break;
}
case CEE_LDIND_I1:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I1);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_U1:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_U1);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_I2:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I2);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_U2:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_U2);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_I4:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I4);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_U4:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_U4);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_I8:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I8);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_I:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_I);
- ADD_CODE (&td, 0);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ ADD_CODE (td, 0);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_R4:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_R4);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_R8:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_R8);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
BARRIER_IF_VOLATILE (td);
break;
case CEE_LDIND_REF:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDIND_REF);
BARRIER_IF_VOLATILE (td);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_O);
break;
case CEE_STIND_REF:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_REF);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I1:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I1);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I2:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I2);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I4:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I4);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_I8:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_I8);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_R4:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_R4);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_STIND_R8:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
BARRIER_IF_VOLATILE (td);
SIMPLE_OP (td, MINT_STIND_R8);
- td.sp -= 2;
+ td->sp -= 2;
break;
case CEE_ADD:
- binary_arith_op(&td, MINT_ADD_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_ADD_I4);
+ ++td->ip;
break;
case CEE_SUB:
- binary_arith_op(&td, MINT_SUB_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_SUB_I4);
+ ++td->ip;
break;
case CEE_MUL:
- binary_arith_op(&td, MINT_MUL_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_MUL_I4);
+ ++td->ip;
break;
case CEE_DIV:
- binary_arith_op(&td, MINT_DIV_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_DIV_I4);
+ ++td->ip;
break;
case CEE_DIV_UN:
- binary_arith_op(&td, MINT_DIV_UN_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_DIV_UN_I4);
+ ++td->ip;
break;
case CEE_REM:
- binary_arith_op (&td, MINT_REM_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_REM_I4);
+ ++td->ip;
break;
case CEE_REM_UN:
- binary_arith_op (&td, MINT_REM_UN_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_REM_UN_I4);
+ ++td->ip;
break;
case CEE_AND:
- binary_arith_op (&td, MINT_AND_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_AND_I4);
+ ++td->ip;
break;
case CEE_OR:
- binary_arith_op (&td, MINT_OR_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_OR_I4);
+ ++td->ip;
break;
case CEE_XOR:
- binary_arith_op (&td, MINT_XOR_I4);
- ++td.ip;
+ binary_arith_op (td, MINT_XOR_I4);
+ ++td->ip;
break;
case CEE_SHL:
- shift_op (&td, MINT_SHL_I4);
- ++td.ip;
+ shift_op (td, MINT_SHL_I4);
+ ++td->ip;
break;
case CEE_SHR:
- shift_op (&td, MINT_SHR_I4);
- ++td.ip;
+ shift_op (td, MINT_SHR_I4);
+ ++td->ip;
break;
case CEE_SHR_UN:
- shift_op (&td, MINT_SHR_UN_I4);
- ++td.ip;
+ shift_op (td, MINT_SHR_UN_I4);
+ ++td->ip;
break;
case CEE_NEG:
- unary_arith_op (&td, MINT_NEG_I4);
- ++td.ip;
+ unary_arith_op (td, MINT_NEG_I4);
+ ++td->ip;
break;
case CEE_NOT:
- unary_arith_op (&td, MINT_NOT_I4);
- ++td.ip;
+ unary_arith_op (td, MINT_NOT_I4);
+ ++td->ip;
break;
case CEE_CONV_U1:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_U1_R8);
+ ADD_CODE(td, MINT_CONV_U1_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_U1_I4);
+ ADD_CODE(td, MINT_CONV_U1_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_U1_I8);
+ ADD_CODE(td, MINT_CONV_U1_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_I1:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_I1_R8);
+ ADD_CODE(td, MINT_CONV_I1_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I1_I4);
+ ADD_CODE(td, MINT_CONV_I1_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_I1_I8);
+ ADD_CODE(td, MINT_CONV_I1_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_U2:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_U2_R8);
+ ADD_CODE(td, MINT_CONV_U2_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_U2_I4);
+ ADD_CODE(td, MINT_CONV_U2_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_U2_I8);
+ ADD_CODE(td, MINT_CONV_U2_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_I2:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_I2_R8);
+ ADD_CODE(td, MINT_CONV_I2_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I2_I4);
+ ADD_CODE(td, MINT_CONV_I2_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_I2_I8);
+ ADD_CODE(td, MINT_CONV_I2_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_U:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_U4_R8);
+ ADD_CODE(td, MINT_CONV_U4_R8);
#else
- ADD_CODE(&td, MINT_CONV_U8_R8);
+ ADD_CODE(td, MINT_CONV_U8_R8);
#endif
break;
case STACK_TYPE_I4:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_U8_I4);
+ ADD_CODE(td, MINT_CONV_U8_I4);
#endif
break;
case STACK_TYPE_I8:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_U4_I8);
+ ADD_CODE(td, MINT_CONV_U4_I8);
#endif
break;
case STACK_TYPE_MP:
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
break;
case CEE_CONV_I:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_I8_R8);
+ ADD_CODE(td, MINT_CONV_I8_R8);
#else
- ADD_CODE(&td, MINT_CONV_I4_R8);
+ ADD_CODE(td, MINT_CONV_I4_R8);
#endif
break;
case STACK_TYPE_I4:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_I8_I4);
+ ADD_CODE(td, MINT_CONV_I8_I4);
#endif
break;
case STACK_TYPE_O:
break;
case STACK_TYPE_I8:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_I4_I8);
+ ADD_CODE(td, MINT_CONV_I4_I8);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
break;
case CEE_CONV_U4:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_U4_R8);
+ ADD_CODE(td, MINT_CONV_U4_R8);
break;
case STACK_TYPE_I4:
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_U4_I8);
+ ADD_CODE(td, MINT_CONV_U4_I8);
break;
case STACK_TYPE_MP:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_U4_I8);
+ ADD_CODE(td, MINT_CONV_U4_I8);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_I4:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_I4_R8);
+ ADD_CODE(td, MINT_CONV_I4_R8);
break;
case STACK_TYPE_I4:
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_I4_I8);
+ ADD_CODE(td, MINT_CONV_I4_I8);
break;
case STACK_TYPE_MP:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_I4_I8);
+ ADD_CODE(td, MINT_CONV_I4_I8);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_I8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_I8_R8);
+ ADD_CODE(td, MINT_CONV_I8_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I8_I4);
+ ADD_CODE(td, MINT_CONV_I8_I4);
break;
case STACK_TYPE_I8:
break;
case STACK_TYPE_MP:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_I8_I4);
+ ADD_CODE(td, MINT_CONV_I8_I4);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case CEE_CONV_R4:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_R4_R8);
+ ADD_CODE(td, MINT_CONV_R4_R8);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_R4_I8);
+ ADD_CODE(td, MINT_CONV_R4_I8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_R4_I4);
+ ADD_CODE(td, MINT_CONV_R4_I4);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case CEE_CONV_R8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_R8_I4);
+ ADD_CODE(td, MINT_CONV_R8_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_R8_I8);
+ ADD_CODE(td, MINT_CONV_R8_I8);
break;
case STACK_TYPE_R8:
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case CEE_CONV_U8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_U8_I4);
+ ADD_CODE(td, MINT_CONV_U8_I4);
break;
case STACK_TYPE_I8:
break;
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_U8_R8);
+ ADD_CODE(td, MINT_CONV_U8_R8);
break;
case STACK_TYPE_MP:
#if SIZEOF_VOID_P == 4
- ADD_CODE(&td, MINT_CONV_U8_I4);
+ ADD_CODE(td, MINT_CONV_U8_I4);
#endif
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case CEE_CPOBJ: {
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
klass = mono_class_get_full (image, token, generic_context);
if (klass->valuetype) {
- ADD_CODE (&td, MINT_CPOBJ);
- ADD_CODE (&td, get_data_item_index(&td, klass));
+ ADD_CODE (td, MINT_CPOBJ);
+ ADD_CODE (td, get_data_item_index(td, klass));
} else {
- ADD_CODE (&td, MINT_LDIND_REF);
- ADD_CODE (&td, MINT_STIND_REF);
+ ADD_CODE (td, MINT_LDIND_REF);
+ ADD_CODE (td, MINT_STIND_REF);
}
- td.ip += 5;
- td.sp -= 2;
+ td->ip += 5;
+ td->sp -= 2;
break;
}
case CEE_LDOBJ: {
int size;
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
else
klass = mono_class_get_full (image, token, generic_context);
- ADD_CODE(&td, MINT_LDOBJ);
- ADD_CODE(&td, get_data_item_index(&td, klass));
+ ADD_CODE(td, MINT_LDOBJ);
+ ADD_CODE(td, get_data_item_index(td, klass));
if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
size = mono_class_value_size (klass, NULL);
- PUSH_VT(&td, size);
+ PUSH_VT(td, size);
}
- td.ip += 5;
- SET_TYPE(td.sp - 1, stack_type[mint_type(&klass->byval_arg)], klass);
+ td->ip += 5;
+ SET_TYPE(td->sp - 1, stack_type[mint_type(&klass->byval_arg)], klass);
BARRIER_IF_VOLATILE (td);
break;
}
case CEE_LDSTR: {
MonoString *s;
- token = mono_metadata_token_index (read32 (td.ip + 1));
- td.ip += 5;
+ token = mono_metadata_token_index (read32 (td->ip + 1));
+ td->ip += 5;
if (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD) {
s = mono_method_get_wrapper_data (method, token);
} else if (method->wrapper_type != MONO_WRAPPER_NONE) {
} else {
s = mono_ldstr (domain, image, token);
}
- ADD_CODE(&td, MINT_LDSTR);
- ADD_CODE(&td, get_data_item_index (&td, s));
- PUSH_TYPE(&td, STACK_TYPE_O, mono_defaults.string_class);
+ ADD_CODE(td, MINT_LDSTR);
+ ADD_CODE(td, get_data_item_index (td, s));
+ PUSH_TYPE(td, STACK_TYPE_O, mono_defaults.string_class);
break;
}
case CEE_NEWOBJ: {
guint32 vt_stack_used = 0;
guint32 vt_res_size = 0;
- td.ip++;
- token = read32 (td.ip);
- td.ip += 4;
+ td->ip++;
+ token = read32 (td->ip);
+ td->ip += 4;
if (method->wrapper_type != MONO_WRAPPER_NONE)
m = (MonoMethod *)mono_method_get_wrapper_data (method, token);
csignature = mono_method_signature (m);
klass = m->klass;
- td.sp -= csignature->param_count;
- ADD_CODE(&td, MINT_NEWOBJ);
- ADD_CODE(&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
+ td->sp -= csignature->param_count;
+ ADD_CODE(td, MINT_NEWOBJ);
+ ADD_CODE(td, get_data_item_index (td, mono_interp_get_imethod (domain, m, &error)));
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
if (mint_type (&klass->byval_arg) == MINT_TYPE_VT) {
vt_res_size = mono_class_value_size (klass, NULL);
- PUSH_VT (&td, vt_res_size);
+ PUSH_VT (td, vt_res_size);
}
for (i = 0; i < csignature->param_count; ++i) {
int mt = mint_type(csignature->params [i]);
}
}
if (vt_stack_used != 0 || vt_res_size != 0) {
- ADD_CODE(&td, MINT_VTRESULT);
- ADD_CODE(&td, vt_res_size);
- WRITE32(&td, &vt_stack_used);
- td.vt_sp -= vt_stack_used;
+ ADD_CODE(td, MINT_VTRESULT);
+ ADD_CODE(td, vt_res_size);
+ WRITE32(td, &vt_stack_used);
+ td->vt_sp -= vt_stack_used;
}
- PUSH_TYPE (&td, stack_type [mint_type (&klass->byval_arg)], klass);
+ PUSH_TYPE (td, stack_type [mint_type (&klass->byval_arg)], klass);
break;
}
case CEE_CASTCLASS:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
- ADD_CODE(&td, MINT_CASTCLASS);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- td.sp [-1].klass = klass;
- td.ip += 5;
+ ADD_CODE(td, MINT_CASTCLASS);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ td->sp [-1].klass = klass;
+ td->ip += 5;
break;
case CEE_ISINST:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
- ADD_CODE(&td, MINT_ISINST);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- td.ip += 5;
+ ADD_CODE(td, MINT_ISINST);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ td->ip += 5;
break;
case CEE_CONV_R_UN:
- switch (td.sp [-1].type) {
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_R_UN_I8);
+ ADD_CODE(td, MINT_CONV_R_UN_I8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_R_UN_I4);
+ ADD_CODE(td, MINT_CONV_R_UN_I4);
break;
default:
g_assert_not_reached ();
}
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
- ++td.ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
+ ++td->ip;
break;
case CEE_UNBOX:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
g_error ("cee_unbox: implement Nullable");
}
- ADD_CODE(&td, MINT_UNBOX);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
- td.ip += 5;
+ ADD_CODE(td, MINT_UNBOX);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
+ td->ip += 5;
break;
case CEE_UNBOX_ANY:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
if (mini_type_is_reference (&klass->byval_arg)) {
int mt = mint_type (&klass->byval_arg);
- ADD_CODE (&td, MINT_CASTCLASS);
- ADD_CODE (&td, get_data_item_index (&td, klass));
- SET_TYPE (td.sp - 1, stack_type [mt], klass);
- td.ip += 5;
+ ADD_CODE (td, MINT_CASTCLASS);
+ ADD_CODE (td, get_data_item_index (td, klass));
+ SET_TYPE (td->sp - 1, stack_type [mt], klass);
+ td->ip += 5;
} else if (mono_class_is_nullable (klass)) {
MonoMethod *target_method = mono_class_get_method_from_name (klass, "Unbox", 1);
- /* td.ip is incremented by interp_transform_call */
- interp_transform_call (&td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
+ /* td->ip is incremented by interp_transform_call */
+ interp_transform_call (td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
} else {
int mt = mint_type (&klass->byval_arg);
- ADD_CODE (&td, MINT_UNBOX);
- ADD_CODE (&td, get_data_item_index (&td, klass));
+ ADD_CODE (td, MINT_UNBOX);
+ ADD_CODE (td, get_data_item_index (td, klass));
- ADD_CODE (&td, MINT_LDOBJ);
- ADD_CODE (&td, get_data_item_index(&td, klass));
- SET_TYPE (td.sp - 1, stack_type [mt], klass);
+ ADD_CODE (td, MINT_LDOBJ);
+ ADD_CODE (td, get_data_item_index(td, klass));
+ SET_TYPE (td->sp - 1, stack_type [mt], klass);
if (mt == MINT_TYPE_VT) {
int size = mono_class_value_size (klass, NULL);
- PUSH_VT (&td, size);
+ PUSH_VT (td, size);
}
- td.ip += 5;
+ td->ip += 5;
}
break;
case CEE_THROW:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_THROW);
- --td.sp;
+ --td->sp;
generating_code = 0;
break;
case CEE_LDFLDA:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
gboolean is_static = !!(field->type->attrs & FIELD_ATTRIBUTE_STATIC);
mono_class_init (klass);
if (is_static) {
- ADD_CODE (&td, MINT_POP);
- ADD_CODE (&td, 0);
- ADD_CODE (&td, MINT_LDSFLDA);
- ADD_CODE (&td, get_data_item_index (&td, field));
+ ADD_CODE (td, MINT_POP);
+ ADD_CODE (td, 0);
+ ADD_CODE (td, MINT_LDSFLDA);
+ ADD_CODE (td, get_data_item_index (td, field));
} else {
- if ((td.sp - 1)->type == STACK_TYPE_O) {
- ADD_CODE (&td, MINT_LDFLDA);
+ if ((td->sp - 1)->type == STACK_TYPE_O) {
+ ADD_CODE (td, MINT_LDFLDA);
} else {
- g_assert ((td.sp -1)->type == STACK_TYPE_MP);
- ADD_CODE (&td, MINT_LDFLDA_UNSAFE);
+ g_assert ((td->sp -1)->type == STACK_TYPE_MP);
+ ADD_CODE (td, MINT_LDFLDA_UNSAFE);
}
- ADD_CODE (&td, klass->valuetype ? field->offset - sizeof (MonoObject) : field->offset);
+ ADD_CODE (td, klass->valuetype ? field->offset - sizeof (MonoObject) : field->offset);
}
- td.ip += 5;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ td->ip += 5;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
case CEE_LDFLD: {
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
gboolean is_static = !!(field->type->attrs & FIELD_ATTRIBUTE_STATIC);
mono_class_init (klass);
#ifndef DISABLE_REMOTING
if (klass->marshalbyref) {
g_assert (!is_static);
- ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDRMFLD_VT : MINT_LDRMFLD);
- ADD_CODE(&td, get_data_item_index (&td, field));
+ ADD_CODE(td, mt == MINT_TYPE_VT ? MINT_LDRMFLD_VT : MINT_LDRMFLD);
+ ADD_CODE(td, get_data_item_index (td, field));
} else
#endif
{
if (is_static) {
- ADD_CODE (&td, MINT_POP);
- ADD_CODE (&td, 0);
- ADD_CODE (&td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
- ADD_CODE (&td, get_data_item_index (&td, field));
+ ADD_CODE (td, MINT_POP);
+ ADD_CODE (td, 0);
+ ADD_CODE (td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
+ ADD_CODE (td, get_data_item_index (td, field));
} else {
- ADD_CODE (&td, MINT_LDFLD_I1 + mt - MINT_TYPE_I1);
- ADD_CODE (&td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
+ ADD_CODE (td, MINT_LDFLD_I1 + mt - MINT_TYPE_I1);
+ ADD_CODE (td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
}
}
if (mt == MINT_TYPE_VT) {
int size = mono_class_value_size (field_klass, NULL);
- PUSH_VT(&td, size);
- WRITE32(&td, &size);
+ PUSH_VT(td, size);
+ WRITE32(td, &size);
}
- if (td.sp [-1].type == STACK_TYPE_VT) {
+ if (td->sp [-1].type == STACK_TYPE_VT) {
int size = mono_class_value_size (klass, NULL);
size = (size + 7) & ~7;
- td.vt_sp -= size;
- ADD_CODE (&td, MINT_VTRESULT);
- ADD_CODE (&td, 0);
- WRITE32 (&td, &size);
+ td->vt_sp -= size;
+ ADD_CODE (td, MINT_VTRESULT);
+ ADD_CODE (td, 0);
+ WRITE32 (td, &size);
}
- td.ip += 5;
- SET_TYPE(td.sp - 1, stack_type [mt], field_klass);
+ td->ip += 5;
+ SET_TYPE(td->sp - 1, stack_type [mt], field_klass);
BARRIER_IF_VOLATILE (td);
break;
}
case CEE_STFLD: {
- CHECK_STACK (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 2);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
gboolean is_static = !!(field->type->attrs & FIELD_ATTRIBUTE_STATIC);
mono_class_init (klass);
#ifndef DISABLE_REMOTING
if (klass->marshalbyref) {
g_assert (!is_static);
- ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STRMFLD_VT : MINT_STRMFLD);
- ADD_CODE(&td, get_data_item_index (&td, field));
+ ADD_CODE(td, mt == MINT_TYPE_VT ? MINT_STRMFLD_VT : MINT_STRMFLD);
+ ADD_CODE(td, get_data_item_index (td, field));
} else
#endif
{
if (is_static) {
- ADD_CODE (&td, MINT_POP);
- ADD_CODE (&td, 1);
- ADD_CODE (&td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
- ADD_CODE (&td, get_data_item_index (&td, field));
+ ADD_CODE (td, MINT_POP);
+ ADD_CODE (td, 1);
+ ADD_CODE (td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
+ ADD_CODE (td, get_data_item_index (td, field));
} else {
- ADD_CODE (&td, MINT_STFLD_I1 + mt - MINT_TYPE_I1);
- ADD_CODE (&td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
+ ADD_CODE (td, MINT_STFLD_I1 + mt - MINT_TYPE_I1);
+ ADD_CODE (td, klass->valuetype ? field->offset - sizeof(MonoObject) : field->offset);
}
}
if (mt == MINT_TYPE_VT) {
MonoClass *klass = mono_class_from_mono_type (field->type);
int size = mono_class_value_size (klass, NULL);
- POP_VT(&td, size);
- WRITE32(&td, &size);
+ POP_VT(td, size);
+ WRITE32(td, &size);
}
- td.ip += 5;
- td.sp -= 2;
+ td->ip += 5;
+ td->sp -= 2;
break;
}
case CEE_LDSFLDA:
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
- ADD_CODE(&td, MINT_LDSFLDA);
- ADD_CODE(&td, get_data_item_index (&td, field));
- td.ip += 5;
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
+ ADD_CODE(td, MINT_LDSFLDA);
+ ADD_CODE(td, get_data_item_index (td, field));
+ td->ip += 5;
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
break;
case CEE_LDSFLD:
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
mt = mint_type(field->type);
- ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
- ADD_CODE(&td, get_data_item_index (&td, field));
+ ADD_CODE(td, mt == MINT_TYPE_VT ? MINT_LDSFLD_VT : MINT_LDSFLD);
+ ADD_CODE(td, get_data_item_index (td, field));
klass = NULL;
if (mt == MINT_TYPE_VT) {
MonoClass *klass = mono_class_from_mono_type (field->type);
int size = mono_class_value_size (klass, NULL);
- PUSH_VT(&td, size);
- WRITE32(&td, &size);
+ PUSH_VT(td, size);
+ WRITE32(td, &size);
klass = field->type->data.klass;
} else {
if (mt == MINT_TYPE_O)
klass = mono_class_from_mono_type (field->type);
}
- td.ip += 5;
- PUSH_TYPE(&td, stack_type [mt], klass);
+ td->ip += 5;
+ PUSH_TYPE(td, stack_type [mt], klass);
break;
case CEE_STSFLD:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
field = interp_field_from_token (method, token, &klass, generic_context);
mt = mint_type(field->type);
- ADD_CODE(&td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
- ADD_CODE(&td, get_data_item_index (&td, field));
+ ADD_CODE(td, mt == MINT_TYPE_VT ? MINT_STSFLD_VT : MINT_STSFLD);
+ ADD_CODE(td, get_data_item_index (td, field));
if (mt == MINT_TYPE_VT) {
MonoClass *klass = mono_class_from_mono_type (field->type);
int size = mono_class_value_size (klass, NULL);
- POP_VT (&td, size);
- WRITE32 (&td, &size);
+ POP_VT (td, size);
+ WRITE32 (td, &size);
}
- td.ip += 5;
- --td.sp;
+ td->ip += 5;
+ --td->sp;
break;
case CEE_STOBJ: {
int size;
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
klass = mini_get_class (method, token, generic_context);
BARRIER_IF_VOLATILE (td);
- ADD_CODE(&td, td.sp [-1].type == STACK_TYPE_VT ? MINT_STOBJ_VT : MINT_STOBJ);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- if (td.sp [-1].type == STACK_TYPE_VT) {
+ ADD_CODE(td, td->sp [-1].type == STACK_TYPE_VT ? MINT_STOBJ_VT : MINT_STOBJ);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ if (td->sp [-1].type == STACK_TYPE_VT) {
size = mono_class_value_size (klass, NULL);
size = (size + 7) & ~7;
- td.vt_sp -= size;
+ td->vt_sp -= size;
}
- td.ip += 5;
- td.sp -= 2;
+ td->ip += 5;
+ td->sp -= 2;
break;
}
case CEE_CONV_OVF_I_UN:
case CEE_CONV_OVF_U_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_OVF_I8_UN_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I8_UN_R8);
#else
- ADD_CODE(&td, MINT_CONV_OVF_I4_UN_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I4_UN_R8);
#endif
break;
case STACK_TYPE_I8:
#if SIZEOF_VOID_P == 4
- ADD_CODE (&td, MINT_CONV_OVF_I4_UN_I8);
+ ADD_CODE (td, MINT_CONV_OVF_I4_UN_I8);
#endif
break;
case STACK_TYPE_I4:
#if SIZEOF_VOID_P == 8
- ADD_CODE(&td, MINT_CONV_I8_U4);
+ ADD_CODE(td, MINT_CONV_I8_U4);
#elif SIZEOF_VOID_P == 4
- if (*td.ip == CEE_CONV_OVF_I_UN)
- ADD_CODE(&td, MINT_CONV_OVF_I4_U4);
+ if (*td->ip == CEE_CONV_OVF_I_UN)
+ ADD_CODE(td, MINT_CONV_OVF_I4_U4);
#endif
break;
default:
g_assert_not_reached ();
break;
}
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
- ++td.ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
+ ++td->ip;
break;
case CEE_CONV_OVF_I8_UN:
case CEE_CONV_OVF_U8_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I8_UN_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I8_UN_R8);
break;
case STACK_TYPE_I8:
- if (*td.ip == CEE_CONV_OVF_I8_UN)
- ADD_CODE (&td, MINT_CONV_OVF_I8_U8);
+ if (*td->ip == CEE_CONV_OVF_I8_UN)
+ ADD_CODE (td, MINT_CONV_OVF_I8_U8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I8_U4);
+ ADD_CODE(td, MINT_CONV_I8_U4);
break;
default:
g_assert_not_reached ();
break;
}
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
- ++td.ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
+ ++td->ip;
break;
case CEE_BOX: {
int size;
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
else
if (mono_class_is_nullable (klass)) {
MonoMethod *target_method = mono_class_get_method_from_name (klass, "Box", 1);
- /* td.ip is incremented by interp_transform_call */
- interp_transform_call (&td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
+ /* td->ip is incremented by interp_transform_call */
+ interp_transform_call (td, method, target_method, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
} else if (!klass->valuetype) {
/* already boxed, do nothing. */
- td.ip += 5;
+ td->ip += 5;
} else {
if (mint_type (&klass->byval_arg) == MINT_TYPE_VT && !klass->enumtype) {
size = mono_class_value_size (klass, NULL);
size = (size + 7) & ~7;
- td.vt_sp -= size;
+ td->vt_sp -= size;
}
- ADD_CODE(&td, MINT_BOX);
- ADD_CODE(&td, get_data_item_index (&td, klass));
- ADD_CODE (&td, 0);
- SET_TYPE(td.sp - 1, STACK_TYPE_O, klass);
- td.ip += 5;
+ ADD_CODE(td, MINT_BOX);
+ ADD_CODE(td, get_data_item_index (td, klass));
+ ADD_CODE (td, 0);
+ SET_TYPE(td->sp - 1, STACK_TYPE_O, klass);
+ td->ip += 5;
}
break;
}
case CEE_NEWARR: {
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
else
klass = mini_get_class (method, token, generic_context);
- unsigned char lentype = (td.sp - 1)->type;
+ unsigned char lentype = (td->sp - 1)->type;
if (lentype == STACK_TYPE_I8) {
/* mimic mini behaviour */
- ADD_CODE (&td, MINT_CONV_OVF_U4_I8);
+ ADD_CODE (td, MINT_CONV_OVF_U4_I8);
} else {
g_assert (lentype == STACK_TYPE_I4);
- ADD_CODE (&td, MINT_CONV_OVF_U4_I4);
+ ADD_CODE (td, MINT_CONV_OVF_U4_I4);
}
- SET_SIMPLE_TYPE (td.sp - 1, STACK_TYPE_I4);
- ADD_CODE (&td, MINT_NEWARR);
- ADD_CODE (&td, get_data_item_index (&td, klass));
- SET_TYPE (td.sp - 1, STACK_TYPE_O, klass);
- td.ip += 5;
+ SET_SIMPLE_TYPE (td->sp - 1, STACK_TYPE_I4);
+ ADD_CODE (td, MINT_NEWARR);
+ ADD_CODE (td, get_data_item_index (td, klass));
+ SET_TYPE (td->sp - 1, STACK_TYPE_O, klass);
+ td->ip += 5;
break;
}
case CEE_LDLEN:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_LDLEN);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
break;
case CEE_LDELEMA:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
klass = (MonoClass *) mono_method_get_wrapper_data (method, token);
klass = mini_get_class (method, token, generic_context);
if (!klass->valuetype && method->wrapper_type == MONO_WRAPPER_NONE && !readonly) {
- ADD_CODE (&td, MINT_LDELEMA_TC);
+ ADD_CODE (td, MINT_LDELEMA_TC);
} else {
- ADD_CODE (&td, MINT_LDELEMA);
+ ADD_CODE (td, MINT_LDELEMA);
}
- ADD_CODE (&td, get_data_item_index (&td, klass));
+ ADD_CODE (td, get_data_item_index (td, klass));
/* according to spec, ldelema bytecode is only used for 1-dim arrays */
- ADD_CODE (&td, 2);
+ ADD_CODE (td, 2);
readonly = FALSE;
- td.ip += 5;
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ td->ip += 5;
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
case CEE_LDELEM_I1:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I1);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_U1:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U1);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_I2:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I2);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_U2:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U2);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_I4:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_U4:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_LDELEM_I8:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I8);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case CEE_LDELEM_I:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
break;
case CEE_LDELEM_R4:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_R4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case CEE_LDELEM_R8:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_R8);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case CEE_LDELEM_REF:
- CHECK_STACK (&td, 2);
- ENSURE_I4 (&td, 1);
+ CHECK_STACK (td, 2);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_REF);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_O);
break;
case CEE_LDELEM:
- CHECK_STACK (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 2);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
switch (mint_type (&klass->byval_arg)) {
case MINT_TYPE_I1:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I1);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_U1:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U1);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_U2:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_U2);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_I2:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I2);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_I4:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case MINT_TYPE_I8:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_I8);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case MINT_TYPE_R4:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_R4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case MINT_TYPE_R8:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_R8);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_R8);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_R8);
break;
case MINT_TYPE_O:
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_REF);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_O);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_O);
break;
case MINT_TYPE_VT: {
int size = mono_class_value_size (klass, NULL);
- ENSURE_I4 (&td, 1);
+ ENSURE_I4 (td, 1);
SIMPLE_OP (td, MINT_LDELEM_VT);
- ADD_CODE (&td, get_data_item_index (&td, klass));
- WRITE32 (&td, &size);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_VT);
- PUSH_VT (&td, size);
+ ADD_CODE (td, get_data_item_index (td, klass));
+ WRITE32 (td, &size);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_VT);
+ PUSH_VT (td, size);
break;
}
default: {
break;
}
}
- td.ip += 4;
+ td->ip += 4;
break;
case CEE_STELEM_I:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_I1:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I1);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_I2:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I2);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_I4:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I4);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_I8:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_I8);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_R4:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_R4);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_R8:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_R8);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM_REF:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
SIMPLE_OP (td, MINT_STELEM_REF);
- td.sp -= 3;
+ td->sp -= 3;
break;
case CEE_STELEM:
- CHECK_STACK (&td, 3);
- ENSURE_I4 (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 3);
+ ENSURE_I4 (td, 2);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
switch (mint_type (&klass->byval_arg)) {
case MINT_TYPE_U1:
case MINT_TYPE_VT: {
int size = mono_class_value_size (klass, NULL);
SIMPLE_OP (td, MINT_STELEM_VT);
- ADD_CODE (&td, get_data_item_index (&td, klass));
- WRITE32 (&td, &size);
- POP_VT (&td, size);
+ ADD_CODE (td, get_data_item_index (td, klass));
+ WRITE32 (td, &size);
+ POP_VT (td, size);
break;
}
default: {
break;
}
}
- td.ip += 4;
- td.sp -= 3;
+ td->ip += 4;
+ td->sp -= 3;
break;
#if 0
case CEE_CONV_OVF_U1:
#endif
#endif
case CEE_CKFINITE:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
SIMPLE_OP (td, MINT_CKFINITE);
break;
case CEE_MKREFANY:
- CHECK_STACK (&td, 1);
- ENSURE_I4 (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ ENSURE_I4 (td, 2);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
- ADD_CODE (&td, MINT_MKREFANY);
- ADD_CODE (&td, get_data_item_index (&td, klass));
+ ADD_CODE (td, MINT_MKREFANY);
+ ADD_CODE (td, get_data_item_index (td, klass));
- td.ip += 5;
- PUSH_VT (&td, sizeof (MonoTypedRef));
- SET_TYPE(td.sp - 1, STACK_TYPE_VT, mono_defaults.typed_reference_class);
+ td->ip += 5;
+ PUSH_VT (td, sizeof (MonoTypedRef));
+ SET_TYPE(td->sp - 1, STACK_TYPE_VT, mono_defaults.typed_reference_class);
break;
case CEE_REFANYVAL: {
- CHECK_STACK (&td, 1);
- ENSURE_I4 (&td, 2);
- token = read32 (td.ip + 1);
+ CHECK_STACK (td, 1);
+ ENSURE_I4 (td, 2);
+ token = read32 (td->ip + 1);
- ADD_CODE (&td, MINT_REFANYVAL);
+ ADD_CODE (td, MINT_REFANYVAL);
- POP_VT (&td, sizeof (MonoTypedRef));
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ POP_VT (td, sizeof (MonoTypedRef));
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
- td.ip += 5;
+ td->ip += 5;
break;
}
case CEE_CONV_OVF_I1:
case CEE_CONV_OVF_I1_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I1_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I1_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_I1_I4);
+ ADD_CODE(td, MINT_CONV_OVF_I1_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_I1_I8);
+ ADD_CODE(td, MINT_CONV_OVF_I1_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_OVF_U1:
case CEE_CONV_OVF_U1_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_U1_R8);
+ ADD_CODE(td, MINT_CONV_OVF_U1_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_U1_I4);
+ ADD_CODE(td, MINT_CONV_OVF_U1_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_U1_I8);
+ ADD_CODE(td, MINT_CONV_OVF_U1_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_OVF_I2:
case CEE_CONV_OVF_I2_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I2_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I2_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_I2_I4);
+ ADD_CODE(td, MINT_CONV_OVF_I2_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_I2_I8);
+ ADD_CODE(td, MINT_CONV_OVF_I2_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
case CEE_CONV_OVF_U2_UN:
case CEE_CONV_OVF_U2:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_U2_R8);
+ ADD_CODE(td, MINT_CONV_OVF_U2_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_U2_I4);
+ ADD_CODE(td, MINT_CONV_OVF_U2_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_U2_I8);
+ ADD_CODE(td, MINT_CONV_OVF_U2_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
#if SIZEOF_VOID_P == 4
case CEE_CONV_OVF_I:
#endif
case CEE_CONV_OVF_I4:
case CEE_CONV_OVF_I4_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I4_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I4_R8);
break;
case STACK_TYPE_I4:
- if (*td.ip == CEE_CONV_OVF_I4_UN)
- ADD_CODE(&td, MINT_CONV_OVF_I4_U4);
+ if (*td->ip == CEE_CONV_OVF_I4_UN)
+ ADD_CODE(td, MINT_CONV_OVF_I4_U4);
break;
case STACK_TYPE_I8:
- if (*td.ip == CEE_CONV_OVF_I4_UN)
- ADD_CODE (&td, MINT_CONV_OVF_I4_U8);
+ if (*td->ip == CEE_CONV_OVF_I4_UN)
+ ADD_CODE (td, MINT_CONV_OVF_I4_U8);
else
- ADD_CODE (&td, MINT_CONV_OVF_I4_I8);
+ ADD_CODE (td, MINT_CONV_OVF_I4_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
#if SIZEOF_VOID_P == 4
case CEE_CONV_OVF_U:
#endif
case CEE_CONV_OVF_U4:
case CEE_CONV_OVF_U4_UN:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_U4_R8);
+ ADD_CODE(td, MINT_CONV_OVF_U4_R8);
break;
case STACK_TYPE_I4:
- if (*td.ip != CEE_CONV_OVF_U4_UN)
- ADD_CODE(&td, MINT_CONV_OVF_U4_I4);
+ if (*td->ip != CEE_CONV_OVF_U4_UN)
+ ADD_CODE(td, MINT_CONV_OVF_U4_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE(&td, MINT_CONV_OVF_U4_I8);
+ ADD_CODE(td, MINT_CONV_OVF_U4_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
break;
#if SIZEOF_VOID_P == 8
case CEE_CONV_OVF_I:
#endif
case CEE_CONV_OVF_I8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_I8_R8);
+ ADD_CODE(td, MINT_CONV_OVF_I8_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_I8_I4);
+ ADD_CODE(td, MINT_CONV_I8_I4);
break;
case STACK_TYPE_I8:
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
#if SIZEOF_VOID_P == 8
case CEE_CONV_OVF_U:
#endif
case CEE_CONV_OVF_U8:
- CHECK_STACK (&td, 1);
- switch (td.sp [-1].type) {
+ CHECK_STACK (td, 1);
+ switch (td->sp [-1].type) {
case STACK_TYPE_R8:
- ADD_CODE(&td, MINT_CONV_OVF_U8_R8);
+ ADD_CODE(td, MINT_CONV_OVF_U8_R8);
break;
case STACK_TYPE_I4:
- ADD_CODE(&td, MINT_CONV_OVF_U8_I4);
+ ADD_CODE(td, MINT_CONV_OVF_U8_I4);
break;
case STACK_TYPE_I8:
- ADD_CODE (&td, MINT_CONV_OVF_U8_I8);
+ ADD_CODE (td, MINT_CONV_OVF_U8_I8);
break;
default:
g_assert_not_reached ();
}
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I8);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I8);
break;
case CEE_LDTOKEN: {
int size;
gpointer handle;
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type == MONO_WRAPPER_DYNAMIC_METHOD || method->wrapper_type == MONO_WRAPPER_SYNCHRONIZED) {
handle = mono_method_get_wrapper_data (method, token);
klass = (MonoClass *) mono_method_get_wrapper_data (method, token + 1);
g_assert (mt == MINT_TYPE_VT);
size = mono_class_value_size (klass, NULL);
g_assert (size == sizeof(gpointer));
- PUSH_VT (&td, sizeof(gpointer));
- ADD_CODE (&td, MINT_LDTOKEN);
- ADD_CODE (&td, get_data_item_index (&td, handle));
+ PUSH_VT (td, sizeof(gpointer));
+ ADD_CODE (td, MINT_LDTOKEN);
+ ADD_CODE (td, get_data_item_index (td, handle));
- SET_TYPE (td.sp, stack_type [mt], klass);
- td.sp++;
- td.ip += 5;
+ SET_TYPE (td->sp, stack_type [mt], klass);
+ td->sp++;
+ td->ip += 5;
break;
}
case CEE_ADD_OVF:
- binary_arith_op(&td, MINT_ADD_OVF_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_ADD_OVF_I4);
+ ++td->ip;
break;
case CEE_ADD_OVF_UN:
- binary_arith_op(&td, MINT_ADD_OVF_UN_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_ADD_OVF_UN_I4);
+ ++td->ip;
break;
case CEE_MUL_OVF:
- binary_arith_op(&td, MINT_MUL_OVF_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_MUL_OVF_I4);
+ ++td->ip;
break;
case CEE_MUL_OVF_UN:
- binary_arith_op(&td, MINT_MUL_OVF_UN_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_MUL_OVF_UN_I4);
+ ++td->ip;
break;
case CEE_SUB_OVF:
- binary_arith_op(&td, MINT_SUB_OVF_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_SUB_OVF_I4);
+ ++td->ip;
break;
case CEE_SUB_OVF_UN:
- binary_arith_op(&td, MINT_SUB_OVF_UN_I4);
- ++td.ip;
+ binary_arith_op(td, MINT_SUB_OVF_UN_I4);
+ ++td->ip;
break;
case CEE_ENDFINALLY:
- g_assert (td.clause_indexes [in_offset] != -1);
- td.sp = td.stack;
+ g_assert (td->clause_indexes [in_offset] != -1);
+ td->sp = td->stack;
SIMPLE_OP (td, MINT_ENDFINALLY);
- ADD_CODE (&td, td.clause_indexes [in_offset]);
+ ADD_CODE (td, td->clause_indexes [in_offset]);
generating_code = 0;
break;
case CEE_LEAVE:
- td.sp = td.stack;
- handle_branch (&td, MINT_LEAVE_S, MINT_LEAVE, 5 + read32 (td.ip + 1));
- td.ip += 5;
+ td->sp = td->stack;
+ handle_branch (td, MINT_LEAVE_S, MINT_LEAVE, 5 + read32 (td->ip + 1));
+ td->ip += 5;
generating_code = 0;
break;
case CEE_LEAVE_S:
- td.sp = td.stack;
- handle_branch (&td, MINT_LEAVE_S, MINT_LEAVE, 2 + (gint8)td.ip [1]);
- td.ip += 2;
+ td->sp = td->stack;
+ handle_branch (td, MINT_LEAVE_S, MINT_LEAVE, 2 + (gint8)td->ip [1]);
+ td->ip += 2;
generating_code = 0;
break;
case CEE_UNUSED41:
- ++td.ip;
- switch (*td.ip) {
+ ++td->ip;
+ switch (*td->ip) {
case CEE_MONO_CALLI_EXTRA_ARG:
/* Same as CEE_CALLI, except that we drop the extra arg required for llvm specific behaviour */
- ADD_CODE (&td, MINT_POP);
- ADD_CODE (&td, 1);
- --td.sp;
- interp_transform_call (&td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
+ ADD_CODE (td, MINT_POP);
+ ADD_CODE (td, 1);
+ --td->sp;
+ interp_transform_call (td, method, NULL, domain, generic_context, is_bb_start, body_start_offset, NULL, FALSE);
break;
case CEE_MONO_JIT_ICALL_ADDR: {
guint32 token;
gpointer func;
MonoJitICallInfo *info;
- token = read32 (td.ip + 1);
- td.ip += 5;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
func = mono_method_get_wrapper_data (method, token);
info = mono_find_jit_icall_by_addr (func);
- ADD_CODE (&td, MINT_LDFTN);
- ADD_CODE (&td, get_data_item_index (&td, func));
- PUSH_SIMPLE_TYPE (&td, STACK_TYPE_I);
+ ADD_CODE (td, MINT_LDFTN);
+ ADD_CODE (td, get_data_item_index (td, func));
+ PUSH_SIMPLE_TYPE (td, STACK_TYPE_I);
break;
}
case CEE_MONO_ICALL: {
gpointer func;
MonoJitICallInfo *info;
- token = read32 (td.ip + 1);
- td.ip += 5;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
func = mono_method_get_wrapper_data (method, token);
info = mono_find_jit_icall_by_addr (func);
g_assert (info);
- CHECK_STACK (&td, info->sig->param_count);
+ CHECK_STACK (td, info->sig->param_count);
switch (info->sig->param_count) {
case 0:
if (MONO_TYPE_IS_VOID (info->sig->ret))
- ADD_CODE (&td,MINT_ICALL_V_V);
+ ADD_CODE (td,MINT_ICALL_V_V);
else
- ADD_CODE (&td, MINT_ICALL_V_P);
+ ADD_CODE (td, MINT_ICALL_V_P);
break;
case 1:
if (MONO_TYPE_IS_VOID (info->sig->ret))
- ADD_CODE (&td,MINT_ICALL_P_V);
+ ADD_CODE (td,MINT_ICALL_P_V);
else
- ADD_CODE (&td,MINT_ICALL_P_P);
+ ADD_CODE (td,MINT_ICALL_P_P);
break;
case 2:
if (MONO_TYPE_IS_VOID (info->sig->ret)) {
if (info->sig->params [1]->type == MONO_TYPE_I4)
- ADD_CODE (&td,MINT_ICALL_PI_V);
+ ADD_CODE (td,MINT_ICALL_PI_V);
else
- ADD_CODE (&td,MINT_ICALL_PP_V);
+ ADD_CODE (td,MINT_ICALL_PP_V);
} else {
if (info->sig->params [1]->type == MONO_TYPE_I4)
- ADD_CODE (&td,MINT_ICALL_PI_P);
+ ADD_CODE (td,MINT_ICALL_PI_P);
else
- ADD_CODE (&td,MINT_ICALL_PP_P);
+ ADD_CODE (td,MINT_ICALL_PP_P);
}
break;
case 3:
g_assert (MONO_TYPE_IS_VOID (info->sig->ret));
if (info->sig->params [2]->type == MONO_TYPE_I4)
- ADD_CODE (&td,MINT_ICALL_PPI_V);
+ ADD_CODE (td,MINT_ICALL_PPI_V);
else
- ADD_CODE (&td,MINT_ICALL_PPP_V);
+ ADD_CODE (td,MINT_ICALL_PPP_V);
break;
default:
g_assert_not_reached ();
if (func == mono_ftnptr_to_delegate) {
g_error ("TODO: ?");
}
- ADD_CODE(&td, get_data_item_index (&td, func));
- td.sp -= info->sig->param_count;
+ ADD_CODE(td, get_data_item_index (td, func));
+ td->sp -= info->sig->param_count;
if (!MONO_TYPE_IS_VOID (info->sig->ret)) {
- td.sp ++;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I);
+ td->sp ++;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I);
}
break;
}
case CEE_MONO_VTADDR: {
int size;
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
if (method->wrapper_type == MONO_WRAPPER_MANAGED_TO_NATIVE)
- size = mono_class_native_size(td.sp [-1].klass, NULL);
+ size = mono_class_native_size(td->sp [-1].klass, NULL);
else
- size = mono_class_value_size(td.sp [-1].klass, NULL);
+ size = mono_class_value_size(td->sp [-1].klass, NULL);
size = (size + 7) & ~7;
- ADD_CODE(&td, MINT_VTRESULT);
- ADD_CODE(&td, 0);
- WRITE32(&td, &size);
- td.vt_sp -= size;
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ ADD_CODE(td, MINT_VTRESULT);
+ ADD_CODE(td, 0);
+ WRITE32(td, &size);
+ td->vt_sp -= size;
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
}
case CEE_MONO_LDPTR:
case CEE_MONO_CLASSCONST:
- token = read32 (td.ip + 1);
- td.ip += 5;
- ADD_CODE(&td, MINT_MONO_LDPTR);
- ADD_CODE(&td, get_data_item_index (&td, mono_method_get_wrapper_data (method, token)));
- td.sp [0].type = STACK_TYPE_I;
- ++td.sp;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
+ ADD_CODE(td, MINT_MONO_LDPTR);
+ ADD_CODE(td, get_data_item_index (td, mono_method_get_wrapper_data (method, token)));
+ td->sp [0].type = STACK_TYPE_I;
+ ++td->sp;
break;
case CEE_MONO_OBJADDR:
- CHECK_STACK (&td, 1);
- ++td.ip;
- td.sp[-1].type = STACK_TYPE_MP;
+ CHECK_STACK (td, 1);
+ ++td->ip;
+ td->sp[-1].type = STACK_TYPE_MP;
/* do nothing? */
break;
case CEE_MONO_NEWOBJ:
- token = read32 (td.ip + 1);
- td.ip += 5;
- ADD_CODE(&td, MINT_MONO_NEWOBJ);
- ADD_CODE(&td, get_data_item_index (&td, mono_method_get_wrapper_data (method, token)));
- td.sp [0].type = STACK_TYPE_O;
- ++td.sp;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
+ ADD_CODE(td, MINT_MONO_NEWOBJ);
+ ADD_CODE(td, get_data_item_index (td, mono_method_get_wrapper_data (method, token)));
+ td->sp [0].type = STACK_TYPE_O;
+ ++td->sp;
break;
case CEE_MONO_RETOBJ:
- CHECK_STACK (&td, 1);
- token = read32 (td.ip + 1);
- td.ip += 5;
- ADD_CODE(&td, MINT_MONO_RETOBJ);
- td.sp--;
+ CHECK_STACK (td, 1);
+ token = read32 (td->ip + 1);
+ td->ip += 5;
+ ADD_CODE(td, MINT_MONO_RETOBJ);
+ td->sp--;
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
/*stackval_from_data (signature->ret, frame->retval, sp->data.vt, signature->pinvoke);*/
- if (td.sp > td.stack)
- g_warning ("CEE_MONO_RETOBJ: more values on stack: %d", td.sp-td.stack);
+ if (td->sp > td->stack)
+ g_warning ("CEE_MONO_RETOBJ: more values on stack: %d", td->sp-td->stack);
break;
case CEE_MONO_LDNATIVEOBJ:
- token = read32 (td.ip + 1);
- td.ip += 5;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
klass = (MonoClass *)mono_method_get_wrapper_data (method, token);
g_assert(klass->valuetype);
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
case CEE_MONO_TLS: {
- gint32 key = read32 (td.ip + 1);
- td.ip += 5;
+ gint32 key = read32 (td->ip + 1);
+ td->ip += 5;
g_assert (key < TLS_KEY_NUM);
- ADD_CODE (&td, MINT_MONO_TLS);
- WRITE32 (&td, &key);
- PUSH_SIMPLE_TYPE (&td, STACK_TYPE_MP);
+ ADD_CODE (td, MINT_MONO_TLS);
+ WRITE32 (td, &key);
+ PUSH_SIMPLE_TYPE (td, STACK_TYPE_MP);
break;
}
case CEE_MONO_ATOMIC_STORE_I4:
- CHECK_STACK (&td, 2);
+ CHECK_STACK (td, 2);
SIMPLE_OP (td, MINT_MONO_ATOMIC_STORE_I4);
- td.sp -= 2;
- td.ip++;
+ td->sp -= 2;
+ td->ip++;
break;
case CEE_MONO_SAVE_LMF:
case CEE_MONO_RESTORE_LMF:
case CEE_MONO_NOT_TAKEN:
- ++td.ip;
+ ++td->ip;
break;
case CEE_MONO_LDPTR_INT_REQ_FLAG:
- ADD_CODE (&td, MINT_MONO_LDPTR);
- ADD_CODE (&td, get_data_item_index (&td, mono_thread_interruption_request_flag ()));
- PUSH_TYPE (&td, STACK_TYPE_MP, NULL);
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_LDPTR);
+ ADD_CODE (td, get_data_item_index (td, mono_thread_interruption_request_flag ()));
+ PUSH_TYPE (td, STACK_TYPE_MP, NULL);
+ ++td->ip;
break;
case CEE_MONO_MEMORY_BARRIER:
- ADD_CODE (&td, MINT_MONO_MEMORY_BARRIER);
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_MEMORY_BARRIER);
+ ++td->ip;
break;
case CEE_MONO_JIT_ATTACH:
- ADD_CODE (&td, MINT_MONO_JIT_ATTACH);
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_JIT_ATTACH);
+ ++td->ip;
break;
case CEE_MONO_JIT_DETACH:
- ADD_CODE (&td, MINT_MONO_JIT_DETACH);
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_JIT_DETACH);
+ ++td->ip;
break;
case CEE_MONO_LDDOMAIN:
- ADD_CODE (&td, MINT_MONO_LDDOMAIN);
- td.sp [0].type = STACK_TYPE_I;
- ++td.sp;
- ++td.ip;
+ ADD_CODE (td, MINT_MONO_LDDOMAIN);
+ td->sp [0].type = STACK_TYPE_I;
+ ++td->sp;
+ ++td->ip;
break;
default:
- g_error ("transform.c: Unimplemented opcode: 0xF0 %02x at 0x%x\n", *td.ip, td.ip-header->code);
+ g_error ("transform.c: Unimplemented opcode: 0xF0 %02x at 0x%x\n", *td->ip, td->ip-header->code);
}
break;
#if 0
* throw point is just (ip - n_prefix_bytes).
*/
case CEE_PREFIX1:
- ++td.ip;
- switch (*td.ip) {
+ ++td->ip;
+ switch (*td->ip) {
#if 0
case CEE_ARGLIST: ves_abort(); break;
#endif
case CEE_CEQ:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CEQ_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CEQ_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CEQ_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CEQ_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_CGT:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CGT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CGT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CGT_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CGT_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_CGT_UN:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CGT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CGT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CGT_UN_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CGT_UN_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_CLT:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CLT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CLT_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CLT_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CLT_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_CLT_UN:
- CHECK_STACK(&td, 2);
- if (td.sp [-1].type == STACK_TYPE_O || td.sp [-1].type == STACK_TYPE_MP)
- ADD_CODE(&td, MINT_CLT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
+ CHECK_STACK(td, 2);
+ if (td->sp [-1].type == STACK_TYPE_O || td->sp [-1].type == STACK_TYPE_MP)
+ ADD_CODE(td, MINT_CLT_UN_I4 + STACK_TYPE_I - STACK_TYPE_I4);
else
- ADD_CODE(&td, MINT_CLT_UN_I4 + td.sp [-1].type - STACK_TYPE_I4);
- --td.sp;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_I4);
- ++td.ip;
+ ADD_CODE(td, MINT_CLT_UN_I4 + td->sp [-1].type - STACK_TYPE_I4);
+ --td->sp;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_I4);
+ ++td->ip;
break;
case CEE_LDVIRTFTN: /* fallthrough */
case CEE_LDFTN: {
MonoMethod *m;
- if (*td.ip == CEE_LDVIRTFTN) {
- CHECK_STACK (&td, 1);
- --td.sp;
+ if (*td->ip == CEE_LDVIRTFTN) {
+ CHECK_STACK (td, 1);
+ --td->sp;
}
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
if (method->wrapper_type != MONO_WRAPPER_NONE)
m = (MonoMethod *)mono_method_get_wrapper_data (method, token);
else
if (method->wrapper_type == MONO_WRAPPER_NONE && m->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED)
m = mono_marshal_get_synchronized_wrapper (m);
- ADD_CODE(&td, *td.ip == CEE_LDFTN ? MINT_LDFTN : MINT_LDVIRTFTN);
- ADD_CODE(&td, get_data_item_index (&td, mono_interp_get_runtime_method (domain, m, &error)));
+ ADD_CODE(td, *td->ip == CEE_LDFTN ? MINT_LDFTN : MINT_LDVIRTFTN);
+ ADD_CODE(td, get_data_item_index (td, mono_interp_get_imethod (domain, m, &error)));
mono_error_cleanup (&error); /* FIXME: don't swallow the error */
- td.ip += 5;
- PUSH_SIMPLE_TYPE (&td, STACK_TYPE_F);
+ td->ip += 5;
+ PUSH_SIMPLE_TYPE (td, STACK_TYPE_F);
break;
}
case CEE_LDARG:
- load_arg (&td, read16 (td.ip + 1));
- td.ip += 3;
+ load_arg (td, read16 (td->ip + 1));
+ td->ip += 3;
break;
case CEE_LDARGA: {
- int n = read16 (td.ip + 1);
- ADD_CODE (&td, MINT_LDARGA);
- ADD_CODE (&td, td.rtm->arg_offsets [n]); /* FIX for large offsets */
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
- td.ip += 3;
+ int n = read16 (td->ip + 1);
+ ADD_CODE (td, MINT_LDARGA);
+ ADD_CODE (td, td->rtm->arg_offsets [n]); /* FIX for large offsets */
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
+ td->ip += 3;
break;
}
case CEE_STARG:
- store_arg (&td, read16 (td.ip + 1));
- td.ip += 3;
+ store_arg (td, read16 (td->ip + 1));
+ td->ip += 3;
break;
case CEE_LDLOC:
- load_local (&td, read16 (td.ip + 1));
- td.ip += 3;
+ load_local (td, read16 (td->ip + 1));
+ td->ip += 3;
break;
case CEE_LDLOCA:
- ADD_CODE(&td, MINT_LDLOCA_S);
- ADD_CODE(&td, td.rtm->local_offsets [read16 (td.ip + 1)]);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_MP);
- td.ip += 3;
+ ADD_CODE(td, MINT_LDLOCA_S);
+ ADD_CODE(td, td->rtm->local_offsets [read16 (td->ip + 1)]);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_MP);
+ td->ip += 3;
break;
case CEE_STLOC:
- store_local (&td, read16 (td.ip + 1));
- td.ip += 3;
+ store_local (td, read16 (td->ip + 1));
+ td->ip += 3;
break;
case CEE_LOCALLOC:
- CHECK_STACK (&td, 1);
+ CHECK_STACK (td, 1);
#if SIZEOF_VOID_P == 8
- if (td.sp [-1].type == STACK_TYPE_I8)
- ADD_CODE(&td, MINT_CONV_I4_I8);
+ if (td->sp [-1].type == STACK_TYPE_I8)
+ ADD_CODE(td, MINT_CONV_I4_I8);
#endif
- ADD_CODE(&td, MINT_LOCALLOC);
- if (td.sp != td.stack + 1)
+ ADD_CODE(td, MINT_LOCALLOC);
+ if (td->sp != td->stack + 1)
g_warning("CEE_LOCALLOC: stack not empty");
- ++td.ip;
- SET_SIMPLE_TYPE(td.sp - 1, STACK_TYPE_MP);
+ ++td->ip;
+ SET_SIMPLE_TYPE(td->sp - 1, STACK_TYPE_MP);
break;
#if 0
case CEE_UNUSED57: ves_abort(); break;
#endif
case CEE_ENDFILTER:
- ADD_CODE (&td, MINT_ENDFILTER);
- ++td.ip;
+ ADD_CODE (td, MINT_ENDFILTER);
+ ++td->ip;
break;
case CEE_UNALIGNED_:
- td.ip += 2;
+ td->ip += 2;
break;
case CEE_VOLATILE_:
- ++td.ip;
+ ++td->ip;
volatile_ = TRUE;
break;
case CEE_TAIL_:
- ++td.ip;
+ ++td->ip;
/* FIX: should do something? */;
break;
case CEE_INITOBJ:
- CHECK_STACK(&td, 1);
- token = read32 (td.ip + 1);
+ CHECK_STACK(td, 1);
+ token = read32 (td->ip + 1);
klass = mini_get_class (method, token, generic_context);
if (klass->valuetype) {
- ADD_CODE (&td, MINT_INITOBJ);
+ ADD_CODE (td, MINT_INITOBJ);
i32 = mono_class_value_size (klass, NULL);
- WRITE32 (&td, &i32);
+ WRITE32 (td, &i32);
} else {
- ADD_CODE (&td, MINT_LDNULL);
- ADD_CODE (&td, MINT_STIND_REF);
+ ADD_CODE (td, MINT_LDNULL);
+ ADD_CODE (td, MINT_STIND_REF);
}
- td.ip += 5;
- --td.sp;
+ td->ip += 5;
+ --td->sp;
break;
case CEE_CPBLK:
- CHECK_STACK(&td, 3);
+ CHECK_STACK(td, 3);
/* FIX? convert length to I8? */
if (volatile_)
- ADD_CODE (&td, MINT_MONO_MEMORY_BARRIER);
- ADD_CODE(&td, MINT_CPBLK);
+ ADD_CODE (td, MINT_MONO_MEMORY_BARRIER);
+ ADD_CODE(td, MINT_CPBLK);
BARRIER_IF_VOLATILE (td);
- td.sp -= 3;
- ++td.ip;
+ td->sp -= 3;
+ ++td->ip;
break;
case CEE_READONLY_:
readonly = TRUE;
- td.ip += 1;
+ td->ip += 1;
break;
case CEE_CONSTRAINED_:
- token = read32 (td.ip + 1);
+ token = read32 (td->ip + 1);
constrained_class = mini_get_class (method, token, generic_context);
mono_class_init (constrained_class);
- td.ip += 5;
+ td->ip += 5;
break;
case CEE_INITBLK:
- CHECK_STACK(&td, 3);
+ CHECK_STACK(td, 3);
BARRIER_IF_VOLATILE (td);
- ADD_CODE(&td, MINT_INITBLK);
- td.sp -= 3;
- td.ip += 1;
+ ADD_CODE(td, MINT_INITBLK);
+ td->sp -= 3;
+ td->ip += 1;
break;
case CEE_NO_:
/* FIXME: implement */
- td.ip += 2;
+ td->ip += 2;
break;
case CEE_RETHROW: {
- int clause_index = td.clause_indexes [in_offset];
+ int clause_index = td->clause_indexes [in_offset];
g_assert (clause_index != -1);
SIMPLE_OP (td, MINT_RETHROW);
- ADD_CODE (&td, rtm->exvar_offsets [clause_index]);
+ ADD_CODE (td, rtm->exvar_offsets [clause_index]);
generating_code = 0;
break;
}
case CEE_SIZEOF: {
gint32 size;
- token = read32 (td.ip + 1);
- td.ip += 5;
+ token = read32 (td->ip + 1);
+ td->ip += 5;
if (mono_metadata_token_table (token) == MONO_TABLE_TYPESPEC && !image_is_dynamic (method->klass->image) && !generic_context) {
int align;
MonoType *type = mono_type_create_from_typespec (image, token);
#endif
size = mono_type_size (&szclass->byval_arg, &align);
}
- ADD_CODE(&td, MINT_LDC_I4);
- WRITE32(&td, &size);
- PUSH_SIMPLE_TYPE(&td, STACK_TYPE_I4);
+ ADD_CODE(td, MINT_LDC_I4);
+ WRITE32(td, &size);
+ PUSH_SIMPLE_TYPE(td, STACK_TYPE_I4);
break;
}
case CEE_REFANYTYPE:
- ADD_CODE (&td, MINT_REFANYTYPE);
- td.ip += 1;
- POP_VT (&td, sizeof (MonoTypedRef));
- PUSH_VT (&td, sizeof (gpointer));
- SET_TYPE(td.sp - 1, STACK_TYPE_VT, NULL);
+ ADD_CODE (td, MINT_REFANYTYPE);
+ td->ip += 1;
+ POP_VT (td, sizeof (MonoTypedRef));
+ PUSH_VT (td, sizeof (gpointer));
+ SET_TYPE(td->sp - 1, STACK_TYPE_VT, NULL);
break;
default:
- g_error ("transform.c: Unimplemented opcode: 0xFE %02x (%s) at 0x%x\n", *td.ip, mono_opcode_name (256 + *td.ip), td.ip-header->code);
+ g_error ("transform.c: Unimplemented opcode: 0xFE %02x (%s) at 0x%x\n", *td->ip, mono_opcode_name (256 + *td->ip), td->ip-header->code);
}
break;
default:
- g_error ("transform.c: Unimplemented opcode: %02x at 0x%x\n", *td.ip, td.ip-header->code);
+ g_error ("transform.c: Unimplemented opcode: %02x at 0x%x\n", *td->ip, td->ip-header->code);
}
- if (td.new_ip - td.new_code != new_in_start_offset)
- td.last_new_ip = td.new_code + new_in_start_offset;
- else if (td.is_bb_start [td.in_start - td.il_code])
- td.is_bb_start [td.ip - td.il_code] = 1;
+ if (td->new_ip - td->new_code != new_in_start_offset)
+ td->last_new_ip = td->new_code + new_in_start_offset;
+ else if (td->is_bb_start [td->in_start - td->il_code])
+ td->is_bb_start [td->ip - td->il_code] = 1;
- td.last_ip = td.in_start;
+ td->last_ip = td->in_start;
}
/* Handle relocations */
- for (int i = 0; i < td.relocs->len; ++i) {
- Reloc *reloc = g_ptr_array_index (td.relocs, i);
+ for (int i = 0; i < td->relocs->len; ++i) {
+ Reloc *reloc = g_ptr_array_index (td->relocs, i);
- int offset = td.in_offsets [reloc->target] - reloc->offset;
+ int offset = td->in_offsets [reloc->target] - reloc->offset;
switch (reloc->type) {
case RELOC_SHORT_BRANCH:
- g_assert (td.new_code [reloc->offset + 1] == 0xffff);
- td.new_code [reloc->offset + 1] = offset;
+ g_assert (td->new_code [reloc->offset + 1] == 0xffff);
+ td->new_code [reloc->offset + 1] = offset;
break;
case RELOC_LONG_BRANCH: {
guint16 *v = (guint16 *) &offset;
- g_assert (td.new_code [reloc->offset + 1] == 0xbeef);
- g_assert (td.new_code [reloc->offset + 2] == 0xdead);
- td.new_code [reloc->offset + 1] = *(guint16 *) v;
- td.new_code [reloc->offset + 2] = *(guint16 *) (v + 1);
+ g_assert (td->new_code [reloc->offset + 1] == 0xbeef);
+ g_assert (td->new_code [reloc->offset + 2] == 0xdead);
+ td->new_code [reloc->offset + 1] = *(guint16 *) v;
+ td->new_code [reloc->offset + 2] = *(guint16 *) (v + 1);
break;
}
case RELOC_SWITCH: {
guint16 *v = (guint16*)&offset;
- td.new_code [reloc->offset] = *(guint16*)v;
- td.new_code [reloc->offset + 1] = *(guint16*)(v + 1);
+ td->new_code [reloc->offset] = *(guint16*)v;
+ td->new_code [reloc->offset + 1] = *(guint16*)(v + 1);
break;
}
default:
}
}
- if (td.verbose_level) {
- const guint16 *p = td.new_code;
- printf("Runtime method: %s %p, VT stack size: %d\n", mono_method_full_name (method, TRUE), rtm, td.max_vt_sp);
- printf("Calculated stack size: %d, stated size: %d\n", td.max_stack_height, header->max_stack);
- while (p < td.new_ip) {
- p = mono_interp_dis_mintop(td.new_code, p);
+ if (td->verbose_level) {
+ const guint16 *p = td->new_code;
+ printf("Runtime method: %s %p, VT stack size: %d\n", mono_method_full_name (method, TRUE), rtm, td->max_vt_sp);
+ printf("Calculated stack size: %d, stated size: %d\n", td->max_stack_height, header->max_stack);
+ while (p < td->new_ip) {
+ p = mono_interp_dis_mintop(td->new_code, p);
printf("\n");
}
}
- g_assert (td.max_stack_height <= (header->max_stack + 1));
+ g_assert (td->max_stack_height <= (header->max_stack + 1));
- int code_len = td.new_ip - td.new_code;
+ int code_len = td->new_ip - td->new_code;
rtm->clauses = mono_domain_alloc0 (domain, header->num_clauses * sizeof (MonoExceptionClause));
memcpy (rtm->clauses, header->clauses, header->num_clauses * sizeof(MonoExceptionClause));
- rtm->code = mono_domain_alloc0 (domain, (td.new_ip - td.new_code) * sizeof (gushort));
- memcpy (rtm->code, td.new_code, (td.new_ip - td.new_code) * sizeof(gushort));
- g_free (td.new_code);
+ rtm->code = mono_domain_alloc0 (domain, (td->new_ip - td->new_code) * sizeof (gushort));
+ memcpy (rtm->code, td->new_code, (td->new_ip - td->new_code) * sizeof(gushort));
+ g_free (td->new_code);
rtm->new_body_start = rtm->code + body_start_offset;
rtm->num_clauses = header->num_clauses;
for (i = 0; i < header->num_clauses; i++) {
MonoExceptionClause *c = rtm->clauses + i;
int end_off = c->try_offset + c->try_len;
- c->try_offset = td.in_offsets [c->try_offset];
- c->try_len = td.in_offsets [end_off] - c->try_offset;
+ c->try_offset = td->in_offsets [c->try_offset];
+ c->try_len = td->in_offsets [end_off] - c->try_offset;
end_off = c->handler_offset + c->handler_len;
- c->handler_offset = td.in_offsets [c->handler_offset];
- c->handler_len = td.in_offsets [end_off] - c->handler_offset;
+ c->handler_offset = td->in_offsets [c->handler_offset];
+ c->handler_len = td->in_offsets [end_off] - c->handler_offset;
if (c->flags & MONO_EXCEPTION_CLAUSE_FILTER)
- c->data.filter_offset = td.in_offsets [c->data.filter_offset];
+ c->data.filter_offset = td->in_offsets [c->data.filter_offset];
}
- rtm->vt_stack_size = td.max_vt_sp;
+ rtm->vt_stack_size = td->max_vt_sp;
rtm->alloca_size = rtm->locals_size + rtm->args_size + rtm->vt_stack_size + rtm->stack_size;
- rtm->data_items = mono_domain_alloc0 (domain, td.n_data_items * sizeof (td.data_items [0]));
- memcpy (rtm->data_items, td.data_items, td.n_data_items * sizeof (td.data_items [0]));
+ rtm->data_items = mono_domain_alloc0 (domain, td->n_data_items * sizeof (td->data_items [0]));
+ memcpy (rtm->data_items, td->data_items, td->n_data_items * sizeof (td->data_items [0]));
/* Save debug info */
- interp_save_debug_info (rtm, header, &td, line_numbers);
+ interp_save_debug_info (rtm, header, td, line_numbers);
/* Create a MonoJitInfo for the interpreted method by creating the interpreter IR as the native code. */
int jinfo_len = mono_jit_info_size (0, header->num_clauses, 0);
}
}
- save_seq_points (&td);
+ save_seq_points (td);
- g_free (td.in_offsets);
+ g_free (td->in_offsets);
for (i = 0; i < header->code_size; ++i)
- g_free (td.stack_state [i]);
- g_free (td.stack_state);
- g_free (td.stack_height);
- g_free (td.vt_stack_size);
- g_free (td.data_items);
- g_free (td.stack);
- g_hash_table_destroy (td.data_hash);
- g_free (td.clause_indexes);
- g_ptr_array_free (td.seq_points, TRUE);
+ g_free (td->stack_state [i]);
+ g_free (td->stack_state);
+ g_free (td->stack_height);
+ g_free (td->vt_stack_size);
+ g_free (td->data_items);
+ g_free (td->stack);
+ g_hash_table_destroy (td->data_hash);
+ g_free (td->clause_indexes);
+ g_ptr_array_free (td->seq_points, TRUE);
g_array_free (line_numbers, TRUE);
- g_ptr_array_free (td.relocs, TRUE);
- mono_mempool_destroy (td.mempool);
+ g_ptr_array_free (td->relocs, TRUE);
+ mono_mempool_destroy (td->mempool);
}
static mono_mutex_t calc_section;
}
MonoException *
-mono_interp_transform_method (RuntimeMethod *runtime_method, ThreadContext *context)
+mono_interp_transform_method (InterpMethod *imethod, ThreadContext *context)
{
int i, align, size, offset;
- MonoMethod *method = runtime_method->method;
+ MonoMethod *method = imethod->method;
MonoImage *image = method->klass->image;
MonoMethodHeader *header = mono_method_get_header (method);
MonoMethodSignature *signature = mono_method_signature (method);
MonoVTable *method_class_vt;
int backwards;
MonoGenericContext *generic_context = NULL;
- MonoDomain *domain = runtime_method->domain;
+ MonoDomain *domain = imethod->domain;
// g_printerr ("TRANSFORM(0x%016lx): begin %s::%s\n", mono_thread_current (), method->klass->name, method->name);
- method_class_vt = mono_class_vtable (domain, runtime_method->method->klass);
+ method_class_vt = mono_class_vtable (domain, imethod->method->klass);
if (!method_class_vt->initialized) {
MonoError error;
jmp_buf env;
- MonoInvocation *last_env_frame = context->env_frame;
+ InterpFrame *last_env_frame = context->env_frame;
jmp_buf *old_env = context->current_env;
error_init (&error);
if (method->iflags & (METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL | METHOD_IMPL_ATTRIBUTE_RUNTIME)) {
MonoMethod *nm = NULL;
mono_os_mutex_lock(&calc_section);
- if (runtime_method->transformed) {
+ if (imethod->transformed) {
mono_os_mutex_unlock(&calc_section);
- MONO_PROFILER_RAISE (jit_done, (method, runtime_method->jinfo));
+ MONO_PROFILER_RAISE (jit_done, (method, imethod->jinfo));
return NULL;
}
}
}
if (nm == NULL) {
- runtime_method->code = g_malloc(sizeof(short));
- runtime_method->code[0] = MINT_CALLRUN;
+ imethod->code = g_malloc(sizeof(short));
+ imethod->code[0] = MINT_CALLRUN;
}
}
if (nm == NULL) {
- runtime_method->stack_size = sizeof (stackval); /* for tracing */
- runtime_method->alloca_size = runtime_method->stack_size;
- runtime_method->transformed = TRUE;
+ imethod->stack_size = sizeof (stackval); /* for tracing */
+ imethod->alloca_size = imethod->stack_size;
+ imethod->transformed = TRUE;
mono_os_mutex_unlock(&calc_section);
MONO_PROFILER_RAISE (jit_done, (method, NULL));
return NULL;
} else if (method->klass == mono_defaults.array_class) {
if (!strcmp (method->name, "UnsafeMov") || !strcmp (method->name, "UnsafeLoad")) {
mono_os_mutex_lock (&calc_section);
- if (!runtime_method->transformed) {
- runtime_method->code = g_malloc (sizeof (short));
- runtime_method->code[0] = MINT_CALLRUN;
- runtime_method->stack_size = sizeof (stackval); /* for tracing */
- runtime_method->alloca_size = runtime_method->stack_size;
- runtime_method->transformed = TRUE;
+ if (!imethod->transformed) {
+ imethod->code = g_malloc (sizeof (short));
+ imethod->code[0] = MINT_CALLRUN;
+ imethod->stack_size = sizeof (stackval); /* for tracing */
+ imethod->alloca_size = imethod->stack_size;
+ imethod->transformed = TRUE;
}
mono_os_mutex_unlock(&calc_section);
MONO_PROFILER_RAISE (jit_done, (method, NULL));
/* the rest needs to be locked so it is only done once */
mono_os_mutex_lock(&calc_section);
- if (runtime_method->transformed) {
+ if (imethod->transformed) {
mono_os_mutex_unlock(&calc_section);
g_free (is_bb_start);
- MONO_PROFILER_RAISE (jit_done, (method, runtime_method->jinfo));
+ MONO_PROFILER_RAISE (jit_done, (method, imethod->jinfo));
return NULL;
}
- runtime_method->local_offsets = g_malloc (header->num_locals * sizeof(guint32));
- runtime_method->stack_size = (sizeof (stackval)) * (header->max_stack + 2); /* + 1 for returns of called functions + 1 for 0-ing in trace*/
- runtime_method->stack_size = (runtime_method->stack_size + 7) & ~7;
+ imethod->local_offsets = g_malloc (header->num_locals * sizeof(guint32));
+ imethod->stack_size = (sizeof (stackval)) * (header->max_stack + 2); /* + 1 for returns of called functions + 1 for 0-ing in trace*/
+ imethod->stack_size = (imethod->stack_size + 7) & ~7;
offset = 0;
for (i = 0; i < header->num_locals; ++i) {
size = mono_type_size (header->locals [i], &align);
offset += align - 1;
offset &= ~(align - 1);
- runtime_method->local_offsets [i] = offset;
+ imethod->local_offsets [i] = offset;
offset += size;
}
offset = (offset + 7) & ~7;
- runtime_method->exvar_offsets = g_malloc (header->num_clauses * sizeof (guint32));
+ imethod->exvar_offsets = g_malloc (header->num_clauses * sizeof (guint32));
for (i = 0; i < header->num_clauses; i++) {
offset += sizeof (MonoObject*);
- runtime_method->exvar_offsets [i] = offset;
+ imethod->exvar_offsets [i] = offset;
}
offset = (offset + 7) & ~7;
- runtime_method->locals_size = offset;
- g_assert (runtime_method->locals_size < 65536);
+ imethod->locals_size = offset;
+ g_assert (imethod->locals_size < 65536);
offset = 0;
- runtime_method->arg_offsets = g_malloc ((!!signature->hasthis + signature->param_count) * sizeof(guint32));
+ imethod->arg_offsets = g_malloc ((!!signature->hasthis + signature->param_count) * sizeof(guint32));
if (signature->hasthis) {
g_assert (!signature->pinvoke);
size = mono_type_stack_size (&method->klass->byval_arg, &align);
offset += align - 1;
offset &= ~(align - 1);
- runtime_method->arg_offsets [0] = offset;
+ imethod->arg_offsets [0] = offset;
offset += size;
}
size = mono_type_stack_size (signature->params [i], &align);
offset += align - 1;
offset &= ~(align - 1);
- runtime_method->arg_offsets [i + !!signature->hasthis] = offset;
+ imethod->arg_offsets [i + !!signature->hasthis] = offset;
offset += size;
}
offset = (offset + 7) & ~7;
- runtime_method->args_size = offset;
- g_assert (runtime_method->args_size < 10000);
+ imethod->args_size = offset;
+ g_assert (imethod->args_size < 10000);
- generate (method, runtime_method, is_bb_start, generic_context);
+ generate (method, imethod, is_bb_start, generic_context);
g_free (is_bb_start);
// FIXME: Add a different callback ?
- MONO_PROFILER_RAISE (jit_done, (method, runtime_method->jinfo));
- runtime_method->transformed = TRUE;
+ MONO_PROFILER_RAISE (jit_done, (method, imethod->jinfo));
+ imethod->transformed = TRUE;
mono_os_mutex_unlock(&calc_section);
return NULL;
return src->sreg1;
} else if (spec [MONO_INST_DEST] == 'x') {
return src->dreg;
- } else if (src->opcode == OP_VCALL) {
+ } else if (src->opcode == OP_VCALL || src->opcode == OP_VCALL_MEMBASE) {
return src->dreg;
}
mono_os_mutex_init (&mutex);
- MonoProfilerHandle handle = mono_profiler_install (prof);
+ MonoProfilerHandle handle = mono_profiler_create (prof);
mono_profiler_set_runtime_shutdown_end_callback (handle, prof_shutdown);
mono_profiler_set_jit_done_callback (handle, prof_jit_leave);
}
prof->saved_strings_hash = g_hash_table_new (NULL, NULL);
prof->string_locations_hash = g_hash_table_new (mismatched_files_guint32_hash, mismatched_files_guint32_equal);
- MonoProfilerHandle handle = mono_profiler_install (prof);
+ MonoProfilerHandle handle = mono_profiler_create (prof);
mono_profiler_set_runtime_shutdown_end_callback (handle, profiler_shutdown);
mono_profiler_set_runtime_initialized_callback (handle, runtime_initialized_cb);
mono_profiler_set_iomap_report_callback (handle, mono_portability_iomap_event);
mono_lls_init (&log_profiler.profiler_thread_list, NULL);
- MonoProfilerHandle handle = log_profiler.handle = mono_profiler_install (&log_profiler);
+ MonoProfilerHandle handle = log_profiler.handle = mono_profiler_create (&log_profiler);
/*
* Required callbacks. These are either necessary for the profiler itself
iJIT_IsProfilingActiveFlags flags = iJIT_IsProfilingActive();
if (flags == iJIT_SAMPLING_ON)
{
- MonoProfilerHandle handle = mono_profiler_install (NULL);
+ MonoProfilerHandle handle = mono_profiler_create (NULL);
mono_profiler_set_runtime_shutdown_end_callback (handle, codeanalyst_shutdown);
mono_profiler_set_jit_done_callback (handle, method_jit_done);
mono_profiler_set_jit_code_buffer_callback (handle, code_buffer_new);
#define MONO_GNUC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif
+/* Used to tell clang's ThreadSanitizer to not report data races that occur within a certain function */
+#if defined(__has_feature)
+#if __has_feature(thread_sanitizer)
+#define MONO_NO_SANITIZE_THREAD __attribute__ ((no_sanitize("thread")))
+#else
+#define MONO_NO_SANITIZE_THREAD
+#endif
+#else
+#define MONO_NO_SANITIZE_THREAD
+#endif
+
#endif /* __UTILS_MONO_COMPILER_H__*/
<ClCompile Include="..\mono\metadata\number-ms.c" />\r
<ClCompile Include="..\mono\metadata\object.c" />\r
<ClCompile Include="..\mono\metadata\opcodes.c" />\r
+ <ClCompile Include="..\mono\metadata\profiler-legacy.c" />\r
<ClCompile Include="..\mono\metadata\profiler.c" />\r
<ClCompile Include="..\mono\metadata\rand.c" />\r
<ClCompile Include="..\mono\metadata\reflection.c" />\r
<ClInclude Include="..\mono\metadata\object-internals.h" />\r
<ClInclude Include="..\mono\metadata\object.h" />\r
<ClInclude Include="..\mono\metadata\opcodes.h" />\r
+ <ClInclude Include="..\mono\metadata\profiler-events.h" />\r
<ClInclude Include="..\mono\metadata\profiler-private.h" />\r
<ClInclude Include="..\mono\metadata\profiler.h" />\r
<ClInclude Include="..\mono\metadata\rand.h" />\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
<ClCompile Include="..\mono\metadata\w32process-win32.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\mono\metadata\profiler-legacy.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
<ClCompile Include="..\mono\metadata\profiler.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
<ClInclude Include="..\mono\metadata\w32process-win32-internals.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
- <ClInclude Include="..\mono\metadata\profiler.h">\r
+ <ClInclude Include="..\mono\metadata\profiler-events.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
<ClInclude Include="..\mono\metadata\profiler-private.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\mono\metadata\profiler.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
<ClInclude Include="..\mono\metadata\rand.h">\r
<Filter>Header Files</Filter>\r
</ClInclude>\r
<Filter>Resource Files</Filter>\r
</None>\r
</ItemGroup>\r
-</Project>
\ No newline at end of file
+</Project>\r
mono_counters_register
mono_counters_register_with_size
mono_counters_sample
+mono_cpu_count
mono_custom_attrs_construct
mono_custom_attrs_free
mono_custom_attrs_from_assembly
mono_print_thread_dump
mono_print_thread_dump_from_ctx
mono_print_unhandled_exception
+mono_profiler_create
mono_profiler_enable_allocations
mono_profiler_enable_sampling
mono_profiler_get_coverage_data
mono_profiler_get_sample_mode
mono_profiler_install
+mono_profiler_install_gc
+mono_profiler_install_jit_end
+mono_profiler_install_thread
mono_profiler_load
mono_profiler_set_assembly_loaded_callback
mono_profiler_set_assembly_loading_callback
mono_profiler_set_domain_name_callback
mono_profiler_set_domain_unloaded_callback
mono_profiler_set_domain_unloading_callback
+mono_profiler_set_events
mono_profiler_set_exception_clause_callback
mono_profiler_set_exception_throw_callback
mono_profiler_set_gc_allocation_callback
mono_trace_set_mask_string
mono_trace_set_print_handler
mono_trace_set_printerr_handler
+mono_tracev_inner
mono_type_create_from_typespec
mono_type_full_name
mono_type_generic_inst_is_valuetype
mono_counters_register
mono_counters_register_with_size
mono_counters_sample
+mono_cpu_count
mono_custom_attrs_construct
mono_custom_attrs_free
mono_custom_attrs_from_assembly
mono_print_thread_dump
mono_print_thread_dump_from_ctx
mono_print_unhandled_exception
+mono_profiler_create
mono_profiler_enable_allocations
mono_profiler_enable_sampling
mono_profiler_get_coverage_data
mono_profiler_get_sample_mode
mono_profiler_install
+mono_profiler_install_gc
+mono_profiler_install_jit_end
+mono_profiler_install_thread
mono_profiler_load
mono_profiler_set_assembly_loaded_callback
mono_profiler_set_assembly_loading_callback
mono_profiler_set_domain_name_callback
mono_profiler_set_domain_unloaded_callback
mono_profiler_set_domain_unloading_callback
+mono_profiler_set_events
mono_profiler_set_exception_clause_callback
mono_profiler_set_exception_throw_callback
mono_profiler_set_gc_allocation_callback
mono_trace_set_mask_string
mono_trace_set_print_handler
mono_trace_set_printerr_handler
+mono_tracev_inner
mono_type_create_from_typespec
mono_type_full_name
mono_type_generic_inst_is_valuetype
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ilasm-net_4_x", "mcs/ilasm/ilasm-net_4_x.csproj", "{D32B01EF-8E8D-41C1-848D-6DAEAA3FCA6C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resgen-net_4_x", "mcs/tools/resgen/resgen-net_4_x.csproj", "{647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}"
-EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "gacutil-net_4_x", "mcs/tools/gacutil/gacutil-net_4_x.csproj", "{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "culevel-net_4_x", "mcs/tools/culevel/culevel-net_4_x.csproj", "{ED867AC1-079C-4B5E-ADF9-E7722053B360}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "cil-stringreplacer-net_4_x", "mcs/tools/cil-stringreplacer/cil-stringreplacer-net_4_x.csproj", "{FD725431-CB26-466D-BD55-C739485A50C9}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "commoncryptogenerator-net_4_x", "mcs/tools/commoncryptogenerator/commoncryptogenerator-net_4_x.csproj", "{12527E95-60D3-4A66-91C6-7F8031519299}"
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resx2sr-net_4_x", "mcs/tools/resx2sr/resx2sr-net_4_x.csproj", "{07D30676-A919-4763-8C3C-B2C4DAFFC662}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "al-net_4_x", "mcs/tools/al/al-net_4_x.csproj", "{D237CE6E-EA8F-4E8E-8413-295B27714AC6}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monolinker-net_4_x", "mcs/tools/linker/monolinker-net_4_x.csproj", "{FA920637-C202-4E75-AC0F-1A8DBD631DF1}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "al-net_4_x", "mcs/tools/al/al-net_4_x.csproj", "{D237CE6E-EA8F-4E8E-8413-295B27714AC6}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "culevel-net_4_x", "mcs/tools/culevel/culevel-net_4_x.csproj", "{ED867AC1-079C-4B5E-ADF9-E7722053B360}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "genxs-net_4_x", "mcs/tools/genxs/genxs-net_4_x.csproj", "{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}"
EndProject
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "xsd-net_4_x", "mcs/tools/mono-xsd/xsd-net_4_x.csproj", "{3CB8E3C0-0EFA-4AB3-9F60-02DC274F77F8}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "resgen-net_4_x", "mcs/tools/resgen/resgen-net_4_x.csproj", "{647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}"
+EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wsdl-net_4_x", "mcs/tools/wsdl/wsdl-net_4_x.csproj", "{69D00FEC-59AA-43A0-90AD-87F400B8613C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "csharp-net_4_x", "mcs/tools/csharp/csharp-net_4_x.csproj", "{3E3DE804-DF6C-43D0-9DFC-13C7FFD949CA}"
{D32B01EF-8E8D-41C1-848D-6DAEAA3FCA6C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D32B01EF-8E8D-41C1-848D-6DAEAA3FCA6C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D32B01EF-8E8D-41C1-848D-6DAEAA3FCA6C}.Release|Any CPU.Build.0 = Release|Any CPU
- {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Release|Any CPU.Build.0 = Release|Any CPU
{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6B9993FC-E28D-4D55-8F96-C8A35B2BC6E7}.Release|Any CPU.Build.0 = Release|Any CPU
- {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Release|Any CPU.Build.0 = Release|Any CPU
- {FD725431-CB26-466D-BD55-C739485A50C9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FD725431-CB26-466D-BD55-C739485A50C9}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FD725431-CB26-466D-BD55-C739485A50C9}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FD725431-CB26-466D-BD55-C739485A50C9}.Release|Any CPU.Build.0 = Release|Any CPU
- {12527E95-60D3-4A66-91C6-7F8031519299}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {12527E95-60D3-4A66-91C6-7F8031519299}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {12527E95-60D3-4A66-91C6-7F8031519299}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {12527E95-60D3-4A66-91C6-7F8031519299}.Release|Any CPU.Build.0 = Release|Any CPU
- {07D30676-A919-4763-8C3C-B2C4DAFFC662}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {07D30676-A919-4763-8C3C-B2C4DAFFC662}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {07D30676-A919-4763-8C3C-B2C4DAFFC662}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {07D30676-A919-4763-8C3C-B2C4DAFFC662}.Release|Any CPU.Build.0 = Release|Any CPU
- {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.Build.0 = Release|Any CPU
{D237CE6E-EA8F-4E8E-8413-295B27714AC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D237CE6E-EA8F-4E8E-8413-295B27714AC6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D237CE6E-EA8F-4E8E-8413-295B27714AC6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D237CE6E-EA8F-4E8E-8413-295B27714AC6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA920637-C202-4E75-AC0F-1A8DBD631DF1}.Release|Any CPU.Build.0 = Release|Any CPU
+ {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {ED867AC1-079C-4B5E-ADF9-E7722053B360}.Release|Any CPU.Build.0 = Release|Any CPU
{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DCD2613C-B1A0-489B-BCA1-79BEBB9B9541}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CB8E3C0-0EFA-4AB3-9F60-02DC274F77F8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3CB8E3C0-0EFA-4AB3-9F60-02DC274F77F8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CB8E3C0-0EFA-4AB3-9F60-02DC274F77F8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {647DC12E-A4EE-424A-9EC7-CE6643EE2EF7}.Release|Any CPU.Build.0 = Release|Any CPU
{69D00FEC-59AA-43A0-90AD-87F400B8613C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{69D00FEC-59AA-43A0-90AD-87F400B8613C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{69D00FEC-59AA-43A0-90AD-87F400B8613C}.Release|Any CPU.ActiveCfg = Release|Any CPU
self.cpp_flags = []
def arch_build(self, arch):
+ Package.profile.arch_build(arch, self)
if arch == 'darwin-64': # 64-bit build pass
- self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0']
+ self.local_configure_flags.extend(['--build=x86_64-apple-darwin11.2.0'])
if arch == 'darwin-32':
- self.local_configure_flags = ['--build=i386-apple-darwin11.2.0']
+ self.local_configure_flags.extend(['--build=i386-apple-darwin11.2.0'])
# LLVM says that libstdc++4.6 is broken and we should use libstdc++4.7.
# This switches it to the right libstdc++.
self.sh('patch -p1 < "%{local_sources[' + str(p) + ']}"')
def arch_build(self, arch):
+ Package.profile.arch_build(arch, self)
if arch == 'darwin-64': # 64-bit build pass
- self.local_gcc_flags = ['-m64']
- self.local_configure_flags = ['--build=x86_64-apple-darwin11.2.0', '--disable-boehm']
+ self.local_configure_flags.extend (['--build=x86_64-apple-darwin11.2.0', '--disable-boehm'])
if arch == 'darwin-32': # 32-bit build pass
- self.local_gcc_flags = ['-m32']
- self.local_configure_flags = ['--build=i386-apple-darwin11.2.0']
+ self.local_configure_flags.extend (['--build=i386-apple-darwin11.2.0'])
self.local_configure_flags.extend(
['--cache-file=%s/%s-%s.cache' % (self.profile.bockbuild.build_root, self.name, arch)])
prof = g_new0 (MonoProfiler, 1);
- MonoProfilerHandle handle = mono_profiler_install (prof);
+ MonoProfilerHandle handle = mono_profiler_create (prof);
mono_profiler_set_runtime_shutdown_callback (handle, sample_shutdown);
mono_profiler_set_call_instrumentation_filter_callback (handle, sample_instrumentation_filter);
mono_profiler_set_method_enter_callback (handle, sample_method_enter);
void
mono_profiler_init_size (const char *desc)
{
- MonoProfilerHandle handle = mono_profiler_install (NULL);
+ MonoProfilerHandle handle = mono_profiler_create (NULL);
mono_profiler_set_jit_done_callback (handle, install_icall);
}