mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5e0d7eaf3 |
No files matched your search
@@ -20,4 +20,3 @@ mono.spec
|
||||
autom4te.cache
|
||||
mint.pc
|
||||
stamp-h1
|
||||
config.h.in
|
||||
@@ -1,403 +1,3 @@
|
||||
2004-05-29 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: export CC instead of passing it to libgc/configure.
|
||||
|
||||
2004-05-28 Duncan Mak <[email protected]>
|
||||
|
||||
* runtime/Makefile.am:
|
||||
* scripts/Makefile.am: Include mono-find-provides and
|
||||
mono-find-requires.
|
||||
|
||||
* scripts/mono-find-provides.in:
|
||||
* scripts/mono-find-requires.in: New wrapper scripts.
|
||||
|
||||
2004-05-27 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Pass CC to libgc configure.
|
||||
|
||||
2004-05-27 Gert Driesen ([email protected])
|
||||
|
||||
* monowiz.win32.nsi: normalized line-endings to unix (LF)
|
||||
|
||||
2004-05-27 Gert Driesen ([email protected])
|
||||
|
||||
* monowiz.win32.nsi: do not include mono subdirectory in
|
||||
MonoConfigDir registry key, to match batch files
|
||||
|
||||
2004-05-26 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* data/DefaultWsdlHelpGenerator.aspx: fixed querystring attribute
|
||||
values. Now they are URlEncoded.
|
||||
|
||||
* data/browscap.ini.gz: updated.
|
||||
|
||||
2004-05-26 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile.am (mcs-do-basic-build): No need to set MCS here.
|
||||
* runtime/net_1_1/Makefile.am (gac_assemblies_list): Update to
|
||||
reflect new names for nunit.util and nunit.framework. Add
|
||||
nunit.core.
|
||||
* runtime/net_2_0/Makefile.am (gac_assemblies_list): Likewise.
|
||||
|
||||
2004-05-25 Ben Maurer <[email protected]>
|
||||
|
||||
* config.h.in: remove
|
||||
|
||||
2004-05-25 18:30 CET Patrik Torstensson <[email protected]>
|
||||
|
||||
* configure.in: Check for trunc instead of truncl (HAVE_TRUNC)
|
||||
|
||||
2004-05-21 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* Makefile.am:
|
||||
* monowiz.win32.nsi: improved windows installer script.
|
||||
|
||||
2004-05-21 Raja R Harinath <[email protected]>
|
||||
|
||||
* README: Update to include instructions for the various new
|
||||
bootstrap-like targets.
|
||||
|
||||
2004-05-20 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile.am (get-monolite-latest, monolite-bootstrap):
|
||||
New bootstrap targets to build from monolite.
|
||||
Based on idea from Jaroslaw Kowalski <[email protected]>.
|
||||
|
||||
2004-05-20 Raja R Harinath <[email protected]>
|
||||
|
||||
* configure.in (AC_OUTPUT): Add tools/Makefile and
|
||||
tools/locale-builder/Makefile.
|
||||
* Makefile.am (SUBDIRS): Remove tools.
|
||||
(DIST_SUBDIRS): Add 'tools'.
|
||||
(bootstrap): Rewrite so that we get two new targets.
|
||||
(faststrap): New two-stage build.
|
||||
(fasterstrap): New one-stage build.
|
||||
|
||||
2004-05-19 Jackson Harper <[email protected]>
|
||||
|
||||
* tools/
|
||||
* tools/Makefile.am: Add tools directory
|
||||
* tools/locale-builder: Add the locale-builder tool, this tool is
|
||||
not built by default as it is only needed by people that wish to
|
||||
moidify culture data.
|
||||
* Makefile.am: Add tools to build
|
||||
|
||||
Wed May 19 13:22:19 EDT 2004 Paolo Molaro <[email protected]>
|
||||
|
||||
* configure.in: make MacOSX default to use the included libgc.
|
||||
|
||||
2004-05-18 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Get rid of -DMONO_USE_EXC_TABLES.
|
||||
|
||||
2004-05-19 Raja R Harinath <[email protected]>
|
||||
|
||||
* configure.in: Use proper autoconf idiom to pass additional
|
||||
arguments to libgc/configure.
|
||||
(PLATFORM_WIN32, NEED_LINK_UNLINK): Use three-argument AC_DEFINE.
|
||||
* acconfig.h: Update to reflect changes.
|
||||
|
||||
2004-05-17 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile.am (tmpinst-dir): Creates _tmpinst tree if
|
||||
necessary. Move body ...
|
||||
(tmpinst-dir.stamp): ... here.
|
||||
(stage3): Don't remove _tmpinst tree.
|
||||
(bootstrap-clean, bootstrap-check): New rules. They run the
|
||||
corresponding rules in the mcs/ tree.
|
||||
|
||||
2004-05-14 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile.am: Revert unlogged unexplained changes.
|
||||
(stage3): Make 'all-profiles' since the mono source tarball
|
||||
carries all the net_2_0 preview dlls.
|
||||
|
||||
2004-05-11 Jackson Harper <[email protected]>
|
||||
|
||||
* runtime/net_1_1/Makefile.am:
|
||||
* runtime/net_2_0/Makefile.am: cscompmgd.dll is lowercase now.
|
||||
|
||||
2004-05-10 Raja R Harinath <[email protected]>
|
||||
|
||||
* Makefile.am (tmpinst-dir): Always add $tmpinst/lib to MONO_PATH.
|
||||
Fix quoting of commands.
|
||||
|
||||
2004-05-08 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* monowiz.win32.nsi: some changes i made to build the 0.91 win32 setup
|
||||
file.
|
||||
|
||||
2004-05-07 Bernie Solomon <[email protected]>
|
||||
|
||||
* man/mono.1: mention MONO_EGD_SOCKET
|
||||
|
||||
2004-05-07 Raja R Harinath <[email protected]>
|
||||
|
||||
Goodbye 'fullbuild', hello 'bootstrap'.
|
||||
* Makefile.am (bootstrap): New target for building from CVS. New
|
||||
improved version of 'fullbuild' -- does not install any files.
|
||||
(fullbuild): Obsolete target. Bootstraps and installs tree.
|
||||
(mcs-tree-safe-build,xinstall-runtime,mcs-rest,remove-binaries):
|
||||
Removed.
|
||||
(stage1,stage1-mcs,stage1-mono,stage2,stage3)
|
||||
(tmpinst-dir,tmpinst-runtime): New targets used to implement a
|
||||
two-stage bootstrap.
|
||||
|
||||
2004-05-05 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* configure.in: scandir check is no longer needed.
|
||||
|
||||
2004-05-05 Bernie Solomon <[email protected]>
|
||||
|
||||
* configure.in: set LIBC on HPUX
|
||||
|
||||
2004-05-05 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Detect JNI headers in GNU classpath sources as well.
|
||||
|
||||
2004-05-05 Raja R Harinath <[email protected]>
|
||||
|
||||
* runtime/net_2_0/Makefile.am (install-data-local, uninstall-local):
|
||||
Only disable this if INSTALL_2_0 is disabled.
|
||||
|
||||
2004-05-05 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* data/DefaultWsdlHelpGenerator.aspx: add any cookie in the request to
|
||||
the request we do for the actual web service.
|
||||
|
||||
2004-05-04 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* configure.in: check for SIGEV_THREAD being defined before checking
|
||||
for AIO support. Fixes compilation under FreeBSD.
|
||||
|
||||
2004-05-04 Raja R Harinath <[email protected]>
|
||||
|
||||
* runtime/net_1_1/Makefile.am (mono_runtime): Use USE_JIT, not
|
||||
JIT_SUPPORTED.
|
||||
(install-data-local, uninstall-data-local): Run runtime with
|
||||
libtool.
|
||||
* runtime/net_2_0/Makefile.am: Likewise.
|
||||
Report from Urs C Muff <[email protected]>.
|
||||
|
||||
2004-05-03 Jackson Harper <[email protected]>
|
||||
|
||||
* man/gacutil.1: Basic man page for gacutil. This doesn't include
|
||||
the new non-standard options yet.
|
||||
|
||||
2004-05-03 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* data/machine.config: added version and publickeytoken.
|
||||
|
||||
2004-05-01 Duncan Mak <[email protected]>
|
||||
|
||||
* runtime/net_1_1/Makefile.am:
|
||||
* runtime/net_2_0/Makefile.am (gac_assemblies_list): Add NUnit
|
||||
dlls here.
|
||||
(non_gac_assemblies): Removed, every thing is migrated over to gac_assemblies.
|
||||
(EXTRA_DIST): Include only gac_assemblies.
|
||||
(dist_assemblies_DATA): It's referring to $(non_gac_assemblies)
|
||||
and that is no gone now. So remove as well.
|
||||
($(non_gac_assemblies)): Bye bye.
|
||||
|
||||
2004-05-01 Duncan Mak <[email protected]>
|
||||
|
||||
* runtime/net_1_1/Makefile.am (gac_assemblies_list): Add
|
||||
System.Web.Services. Someone accidentally took the line out.
|
||||
|
||||
2004-04-30 Jackson Harper <[email protected]>
|
||||
|
||||
* runtime/net_1_1/Makefile.am:
|
||||
* runtime/net_2_0/Makefile.am: These assemblies are signed now.
|
||||
|
||||
2004-04-30 Raja R Harinath <[email protected]>
|
||||
|
||||
* runtime/net_1_1/Makefile.am (gac_assemblies_list): Remove .dll
|
||||
suffix.
|
||||
(gac_assemblies, non_gac_assemblies, corlibdir, dist_corlib_DATA):
|
||||
New variables. Use Automake idioms.
|
||||
(dist-hook): Remove.
|
||||
(install-local, uninstall-local): Use mscorlib.dll from current
|
||||
tree when running gacutil.
|
||||
(mono_runtime): New variable. Points to either JIT compiler or
|
||||
interpreter.
|
||||
Report from Bernie Solomon <[email protected]>
|
||||
* runtime/net_2_0/Makefile.am: Likewise.
|
||||
* runtime/Makefile.am (dist_monobins_DATA): Rename from
|
||||
monobins_DATA.
|
||||
(EXTRA_DIST): Remove.
|
||||
* Makefile.am (fullbuild): Update to changes.
|
||||
|
||||
2004-04-30 Jackson Harper <[email protected]>
|
||||
|
||||
* runtime/net_2_0/Makefile.am:
|
||||
* runtime/net_1_1/Makefile.am: /lib/mono/gac. Dont forget the mono.
|
||||
|
||||
2004-04-30 Duncan Mak <[email protected]>
|
||||
|
||||
* runtime/Makefile.am ($(monobins_DATA)): Add sn.exe and sn.
|
||||
|
||||
2004-04-29 Duncan Mak <[email protected]>
|
||||
|
||||
* scripts/gmcs.in: New file.
|
||||
|
||||
* scripts/Makefile.am (EXTRA_DIST, bin_SCRIPTS, CLEANFILES): Add
|
||||
gmcs script.
|
||||
|
||||
2004-04-29 Jackson Harper <[email protected]>
|
||||
|
||||
* runtime/net_2_0/Makefile.am: install 2.0 corlib to its own
|
||||
special little place.
|
||||
|
||||
2004-04-29 Zoltan Varga <[email protected]>
|
||||
|
||||
* acconfig.h configure.in: Add check for scandir.
|
||||
|
||||
2004-04-29 Raja R Harinath <[email protected]>
|
||||
|
||||
* runtime/Makefile.am (monobins_DATA): Add gacutil.exe.
|
||||
(SUBDIRS): Build here before building subdirs.
|
||||
* runtime/net_1_1/Makefile.am (all-local): Copy
|
||||
$(gac_assemblies_list) here.
|
||||
(install-data-local): Install dll from $(srcdir).
|
||||
(gacutil): Pick from current tree.
|
||||
* runtime/net_2_0/Makefile.am: Likewise.
|
||||
|
||||
* Makefile.am (fullbuild): Update to changes in tree layout.
|
||||
* runtime/net_1_1/Makefile.am (install-data-local): Allow empty
|
||||
$(gac_assemblies_list).
|
||||
($(gac_assemblies_list)): Pick libraries from 'class/lib/default',
|
||||
not 'class/lib/net_1_1'.
|
||||
|
||||
2004-04-28 Jackson Harper <[email protected]>
|
||||
|
||||
* runtime/net_1_1/Makefile.am: Grab libs from proper directory, do
|
||||
not assume gacutil is installed.
|
||||
* runtime/net_2_0/Makefile.am: Do not assume gacutil is installed.
|
||||
|
||||
2004-04-28 Jackson Harper <[email protected]>
|
||||
|
||||
* configure.in: Add new Makefile.amS
|
||||
* runtime/Makefile.am: libs are now in profile dependant
|
||||
directories.
|
||||
* runtime/net_1_1/Makefile.am: Install and Uninstall the .net 1.1
|
||||
libs to the GAC.
|
||||
* runtime/net_2_0/Makefile.am: Install and Uninstall the .net 2.0
|
||||
libs to the GAC.
|
||||
* data/Makefile.am: cleanup browscap.ini
|
||||
|
||||
2004-04-28 Bernie Solomon <[email protected]>
|
||||
|
||||
* configure.in: reword message re EGD support
|
||||
now it is there
|
||||
|
||||
2004-04-28 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* config.h.in:
|
||||
* configure.in: added check for sys/aio.h. Also check the field name
|
||||
in 'union sigval'.
|
||||
|
||||
2004-04-28 Jackson Harper <[email protected]>
|
||||
|
||||
* scripts/Makefile.am:
|
||||
* scripts/gacutil.in: Add a gacutil script
|
||||
|
||||
2004-04-26 Jackson Harper <[email protected]>
|
||||
|
||||
* Makefile.am: Grab libraries from lib/default now.
|
||||
* runtime/Makefile.am: Grab libraries from lib/default now.
|
||||
|
||||
2004-04-26 Bernie Solomon <[email protected]>
|
||||
|
||||
* configure.in: move setting of NO_VERSION_SCRIPT
|
||||
until after checking for GNU ld
|
||||
|
||||
2004-04-22 Urs C Muff <[email protected]>
|
||||
|
||||
move .net assemblies from $prefix/bin/*.exe to $prefix/lib/*.exe on
|
||||
windows/cygwin refactor .nsi to simply maintenance on script/batch
|
||||
generation
|
||||
* runtime/Makefile.am
|
||||
* script/Makefile.am
|
||||
* monowiz.win32.nsi
|
||||
|
||||
2004-04-14 Raja R Harinath <[email protected]>
|
||||
|
||||
* runtime/Makefile.am ($(assemblies_DATA)): Copy file into
|
||||
$(srcdir). Clean up output.
|
||||
($(monobins_DATA)): Likewise.
|
||||
|
||||
* Makefile.am (mcs-tree-safe-build): Fix typo.
|
||||
|
||||
2004-04-13 Sebastien Pouliot <[email protected]>
|
||||
|
||||
* configure.in: Added rules to check for getgrgid_r, getgrnam_r,
|
||||
getpwnam_r, getpwuid_r, getresuid and setresuid.
|
||||
|
||||
2004-04-13 Raja R Harinath <[email protected]>
|
||||
|
||||
Allow 'make fullbuild' to work on non-srcdir build.
|
||||
* Makefile.am (mcs_topdir): New variable.
|
||||
(mcs-tree-safe-build,mcs-rest,remove-binaries): Work in non-srcdir
|
||||
build.
|
||||
(xinstall-runtime): Likewise. Use $(libgc_dir) directly, don't
|
||||
grep for 'libgc'.
|
||||
(fullbuild): Make ordering dependencies explicit.
|
||||
|
||||
2004-04-12 Sachin Kumar <[email protected]>
|
||||
|
||||
* Makefile.am: Added 'web' in SUBDIRS
|
||||
|
||||
2004-04-07 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* configure.in: don't try-run the tests for nptl and/or sigaltstack
|
||||
if they are disabled in the command line.
|
||||
|
||||
2004-04-05 Jackson Harper <[email protected]>
|
||||
|
||||
* man/ilasm.1: Show /output instead of /out as the switch for
|
||||
specifying output file names.
|
||||
|
||||
2004-04-05 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Check for pthread_getattr_np and pthread_attr_get_np.
|
||||
|
||||
2004-04-02 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* config.h.in: added HAVE_GETPWUID_R
|
||||
* configure.in: check for getpwuid_r.
|
||||
|
||||
2004-03-23 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Fix GNU ld check.
|
||||
|
||||
2004-03-22 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Use amd64 instead of x86-64 as directory name. Fixes
|
||||
#55840.
|
||||
|
||||
* configure.in: Disable -version-script if not using GNU ld. Fixes
|
||||
#55910.
|
||||
|
||||
* configure.in: Speedup successful sigaltstack test.
|
||||
|
||||
|
||||
* configure.in: don't try-run the tests for nptl and/or sigaltstack
|
||||
if they are disabled in the command line.
|
||||
|
||||
2004-04-05 Jackson Harper <[email protected]>
|
||||
|
||||
* man/ilasm.1: Show /output instead of /out as the switch for
|
||||
specifying output file names.
|
||||
|
||||
2004-04-05 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Check for pthread_getattr_np and pthread_attr_get_np.
|
||||
|
||||
2004-04-02 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* config.h.in: added HAVE_GETPWUID_R
|
||||
* configure.in: check for getpwuid_r.
|
||||
|
||||
2004-03-23 Zoltan Varga <[email protected]>
|
||||
|
||||
* configure.in: Fix GNU ld check.
|
||||
@@ -957,6 +557,7 @@ Thu Jul 31 16:19:07 CEST 2003 Paolo Molaro <[email protected]>
|
||||
* man/sqlsharp.1: changed pass= to password= for the
|
||||
PostgreSql provider.
|
||||
|
||||
>>>>>>> 1.166
|
||||
2003-03-31 Gonzalo Paniagua Javier <[email protected]>
|
||||
|
||||
* data/machine.config: added SessionStateModule to httpModules section.
|
||||
|
||||
+24
-132
@@ -1,10 +1,8 @@
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
|
||||
SUBDIRS = @libgc_dir@ mono @ikvm_jni_dir@ docs runtime scripts man data samples support web
|
||||
SUBDIRS = @libgc_dir@ mono web docs runtime scripts man data samples support
|
||||
|
||||
# Keep in sync with SUBDIRS
|
||||
## 'tools' is not normally built
|
||||
DIST_SUBDIRS = libgc mono ikvm-jni docs runtime scripts man data samples support web tools
|
||||
# EXTRA_SUBDIRS = libgc
|
||||
|
||||
EXTRA_DIST= mono.pc.in mono.spec.in mint.pc.in
|
||||
|
||||
@@ -22,138 +20,26 @@ DISTCLEANFILES= mono.pc mint.pc
|
||||
# problems by doing the compilation in the right order.
|
||||
#
|
||||
|
||||
mcs_topdir=$(top_srcdir)/../mcs
|
||||
fullbuild: remove-binaries mcs-tree-safe-build xinstall-runtime mcs-rest install
|
||||
|
||||
.PHONY: tmpinst-dir tmpinst-basic-build tmpinst-short-build tmpinst-full-build
|
||||
.PHONY: bootstrap faststrap fasterstrap one-stage-strap two-stage-strap three-stage-strap bootstrap-clean bootstrap-check
|
||||
.PHONY: mono-do-basic-build mcs-do-basic-build mcs-do-short-build mcs-do-full-build mcs-do-clean-profiles mcs-do-run-test
|
||||
mcs-tree-safe-build:
|
||||
(cd ../mcs/jay; $(MAKE))
|
||||
(cd ../mcs/mcs; $(MAKE) MCS=mcs BOOTSTRAP_MCS=mcs)
|
||||
(cd ../mcs/class/corlib; $(MAKE) MCS=mcs BOOTSTRAP_MCS=mcs)
|
||||
cp ../mcs/class/lib/mscorlib.dll runtime
|
||||
cp ../mcs/mcs/mcs.exe runtime
|
||||
|
||||
if USE_JIT
|
||||
mono_runtime = mono/mini/mono
|
||||
else
|
||||
mono_runtime = mono/interpreter/mint
|
||||
endif
|
||||
xinstall-runtime:
|
||||
if echo $(SUBDIRS) | grep "libgc " > /dev/null; then (cd libgc; $(MAKE) && $(MAKE) install); fi
|
||||
(cd mono; $(MAKE) && $(MAKE) install)
|
||||
(cd runtime; $(MAKE) install assemblies_DATA=mscorlib.dll monobins_DATA=mcs.exe)
|
||||
|
||||
bootstrap: three-stage-strap
|
||||
mcs-rest:
|
||||
(cd ../mcs/class; $(MAKE))
|
||||
|
||||
faststrap: mono-do-basic-build
|
||||
$(MAKE) two-stage-strap
|
||||
remove-binaries:
|
||||
rm ../mcs/class/lib/mscorlib.dll ../mcs/mcs/mcs.exe runtime/*dll runtime/*.exe > /dev/null 2>&1; echo
|
||||
|
||||
fasterstrap: mono-do-basic-build
|
||||
$(MAKE) one-stage-strap
|
||||
|
||||
three-stage-strap: tmpinst-basic-build
|
||||
$(MAKE) two-stage-strap
|
||||
|
||||
two-stage-strap: tmpinst-short-build
|
||||
$(MAKE) one-stage-strap
|
||||
|
||||
one-stage-strap: tmpinst-full-build
|
||||
rm -f $(top_srcdir)/runtime/*/*.dll $(top_srcdir)/runtime/*.exe
|
||||
$(MAKE)
|
||||
|
||||
bootstrap-clean: clean mcs-do-clean-profiles
|
||||
bootstrap-check: check mcs-do-run-test
|
||||
|
||||
# (takes advantage of 'make -j': independent subtasks are separate dependencies)
|
||||
tmpinst-basic-build: mcs-do-basic-build mono-do-basic-build tmpinst-dir
|
||||
mv -f $(mcs_topdir)/mcs/mcs.exe \
|
||||
$(mcs_topdir)/class/lib/default/mscorlib.dll \
|
||||
$(mcs_topdir)/class/lib/default/System.dll \
|
||||
_tmpinst/lib
|
||||
|
||||
tmpinst-short-build: mcs-do-short-build
|
||||
mv -f $(mcs_topdir)/mcs/mcs.exe \
|
||||
$(mcs_topdir)/class/lib/default/mscorlib.dll \
|
||||
$(mcs_topdir)/class/lib/default/System.dll \
|
||||
$(mcs_topdir)/class/lib/default/System.Xml.dll \
|
||||
$(mcs_topdir)/class/lib/default/Mono.CSharp.Debugger.dll \
|
||||
_tmpinst/lib
|
||||
|
||||
tmpinst-full-build: mcs-do-full-build
|
||||
cp -f $(mcs_topdir)/mcs/mcs.exe \
|
||||
$(mcs_topdir)/class/lib/default/mscorlib.dll \
|
||||
$(mcs_topdir)/class/lib/default/System.dll \
|
||||
$(mcs_topdir)/class/lib/default/System.Xml.dll \
|
||||
$(mcs_topdir)/class/lib/default/Mono.CSharp.Debugger.dll \
|
||||
_tmpinst/lib
|
||||
|
||||
# Build enough of 'mono' to run the stage1 mcs.exe
|
||||
mono-do-basic-build: $(CONFIG_HEADER)
|
||||
if test -z "$(libgc_dir)"; then :; else cd libgc && $(MAKE) ; fi
|
||||
cd mono && $(MAKE)
|
||||
|
||||
# Build stripped down versions of 'mcs', 'mscorlib.dll' and 'System.dll' with installed 'mcs'
|
||||
## remove System.Xml.dll since it's a soft-dependency of System.dll
|
||||
mcs-do-basic-build:
|
||||
rm -f $(mcs_topdir)/mcs/mcs.exe $(mcs_topdir)/class/lib/default/mscorlib.dll
|
||||
rm -f $(mcs_topdir)/class/lib/default/System.dll $(mcs_topdir)/class/lib/default/System.Xml.dll
|
||||
cd $(mcs_topdir)/jay && $(MAKE)
|
||||
cd $(mcs_topdir)/mcs && $(MAKE) PROFILE=default BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB"
|
||||
cd $(mcs_topdir)/class/corlib && $(MAKE) PROFILE=default BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB"
|
||||
cd $(mcs_topdir)/class/System && $(MAKE) PROFILE=default BOOTSTRAP_MCS="mcs -d:BOOTSTRAP_WITH_OLDLIB"
|
||||
|
||||
mcs-do-short-build:
|
||||
tmpinst=`cd _tmpinst && pwd` ; \
|
||||
PATH=$$tmpinst/bin:$$PATH; export PATH ; \
|
||||
for dir in jay mcs class/corlib class/System class/System.XML class/System class/Mono.CSharp.Debugger; do \
|
||||
(cd $(mcs_topdir)/$$dir && $(MAKE) PROFILE=default) || exit 1 ; \
|
||||
done
|
||||
|
||||
mcs-do-full-build:
|
||||
tmpinst=`cd _tmpinst && pwd` ; \
|
||||
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
|
||||
cd $(mcs_topdir) && $(MAKE) all-profiles
|
||||
|
||||
mcs-do-clean-profiles:
|
||||
cd $(mcs_topdir) && $(MAKE) clean-profiles
|
||||
|
||||
mcs-do-run-test: tmpinst-dir
|
||||
tmpinst=`cd _tmpinst && pwd` ; \
|
||||
PATH=$$tmpinst/bin:$$PATH ; export PATH ; \
|
||||
cd $(mcs_topdir) && $(MAKE) PROFILE=default run-test
|
||||
|
||||
tmpinst-dir.stamp: Makefile.am
|
||||
set -e ; \
|
||||
rootme=`pwd`; tmpinst=$$rootme/_tmpinst ; \
|
||||
mkdir -p $$tmpinst $$tmpinst/bin $$tmpinst/lib ; \
|
||||
echo '#! /bin/sh' > $$tmpinst/bin/mono ; \
|
||||
echo 'if test -z "$$MONO_PATH" ; then MONO_PATH="'"$$tmpinst/lib"'"' >> $$tmpinst/bin/mono ; \
|
||||
echo 'else MONO_PATH=$${MONO_PATH}:"'"$$tmpinst/lib"'" ; fi' >> $$tmpinst/bin/mono ; \
|
||||
echo 'export MONO_PATH' >> $$tmpinst/bin/mono ; \
|
||||
echo 'exec "'"$$rootme/libtool"'" --mode=execute "'"$$rootme/$(mono_runtime)"'" "$$@"' >> $$tmpinst/bin/mono ; \
|
||||
echo '#! /bin/sh' > $$tmpinst/bin/mcs ; \
|
||||
echo 'exec "'"$$tmpinst/bin/mono"'" "'"$$tmpinst/lib/mcs.exe"'" "$$@"' >> $$tmpinst/bin/mcs ; \
|
||||
chmod +x $$tmpinst/bin/mono $$tmpinst/bin/mcs
|
||||
echo "stamp" > $@
|
||||
|
||||
tmpinst-dir: tmpinst-dir.stamp
|
||||
@if test -d _tmpinst; then :; else rm -f tmpinst-dir.stamp; $(MAKE) tmpinst-dir.stamp; fi
|
||||
|
||||
|
||||
# building with monolite
|
||||
|
||||
get-monolite-latest:
|
||||
wget -O $(srcdir)/../monolite-latest.tar.gz http://www.go-mono.com/daily/monolite-latest.tar.gz
|
||||
|
||||
tmpinst-monolite: tmpinst-dir
|
||||
-rm -f _tmpinst/lib/mcs.exe _tmpinst/lib/*.dll
|
||||
-rm -fr _tmpinst/monolite-*
|
||||
srcdir=`cd $(srcdir) && pwd` && cd _tmpinst && ( gzip -d -c $$srcdir/../monolite-latest.tar.gz | tar xf - )
|
||||
mv -f _tmpinst/monolite-*/mcs.exe _tmpinst/monolite-*/*.dll _tmpinst/lib
|
||||
rm -fr _tmpinst/monolite-*
|
||||
|
||||
monolite-bootstrap: tmpinst-monolite mono-do-basic-build
|
||||
rm -f $(mcs_topdir)/mcs/mcs.exe $(mcs_topdir)/class/lib/default/mscorlib.dll
|
||||
rm -f $(mcs_topdir)/class/lib/default/System.dll $(mcs_topdir)/class/lib/default/System.Xml.dll Mono.CSharp.Debugger.dll
|
||||
$(MAKE) two-stage-strap
|
||||
|
||||
# Obsolete target -- don't use.
|
||||
.PHONY: fullbuild
|
||||
fullbuild: bootstrap
|
||||
$(MAKE) install
|
||||
echo "*** 'fullbuild' is an obsolete target. Use 'make bootstrap && make install'."
|
||||
exit 1
|
||||
|
||||
win32getdeps:
|
||||
wget http://www.go-mono.com/archive/pkgconfig-0.11-20020310.zip
|
||||
@@ -172,4 +58,10 @@ win32getdeps:
|
||||
unzip -n -d / nsis4cygwin.zip
|
||||
|
||||
win32setup:
|
||||
makensis /DMILESTONE=$(VERSION) /DSOURCE_INSTALL_DIR=$(SOURCE_INSTALL_DIR) /DBUILDNUM=$(BUILDNUM) monowiz.win32.nsi
|
||||
cp /usr/lib/libglib-2.0-0.dll @prefix@/lib
|
||||
cp /usr/lib/iconv.dll @prefix@/lib
|
||||
cp /usr/lib/libgmodule-2.0-0.dll @prefix@/lib
|
||||
cp /usr/lib/libgobject-2.0-0.dll @prefix@/lib
|
||||
cp /usr/lib/libgthread-2.0-0.dll @prefix@/lib
|
||||
cp /usr/lib/libintl-1.dll @prefix@/lib
|
||||
makensis /DMILESTONE=@VERSION@ /DSOURCE_INSTALL_DIR=`cygpath -a -w @prefix@`\\* monowiz.win32.nsi
|
||||
@@ -59,31 +59,14 @@ This is Mono.
|
||||
|
||||
tar xzf mcs-XXXX.tar.gz
|
||||
tar xzf mono-XXXX.tar.gz
|
||||
mv mono-XXX mono
|
||||
mv mcs-XXX mcs
|
||||
cd mono
|
||||
cd mono-XXXX
|
||||
./autogen.sh --prefix=/usr/local
|
||||
make bootstrap
|
||||
make fullbuild
|
||||
|
||||
c. Building the software from CVS
|
||||
---------------------------------
|
||||
|
||||
If you are building the software from CVS, make sure that you
|
||||
have up-to-date mcs and mono sources:
|
||||
|
||||
cvs co mono mcs
|
||||
|
||||
Then, go into the mono directory, and configure:
|
||||
|
||||
cd mono
|
||||
./autogen.sh --prefix=/usr/local
|
||||
|
||||
Depending on whether you have an existing Mono installation or
|
||||
not, you can try the following:
|
||||
|
||||
i. If you have an existing Mono installation
|
||||
-----------------------------------------
|
||||
c. Upgrade from CVS
|
||||
-------------------
|
||||
|
||||
If you are upgrading from CVS you will need an existing Mono installation.
|
||||
First verify that you have a working installation:
|
||||
|
||||
echo 'class X { static void Main () { System.Console.Write("OK");}}' > x.cs
|
||||
@@ -96,86 +79,25 @@ This is Mono.
|
||||
|
||||
mono x.exe
|
||||
|
||||
If you get the output `OK' and no errors, and you have mono
|
||||
version 0.31 or later, continue. Otherwise, you can try option
|
||||
(ii) below.
|
||||
If you get the output `OK' and no errors, you are ready to start your CVS upgrade.
|
||||
|
||||
You are ready to start your CVS upgrade. Compile with
|
||||
First, make sure that you have up-to-date mcs and mono sources:
|
||||
|
||||
make bootstrap
|
||||
cvs co mono mcs
|
||||
|
||||
This will automatically go into the mcs/ tree and build the
|
||||
binaries there, and copy them into the appropriate
|
||||
sub-directories of mono/runtime/.
|
||||
Then, go into the mono directory, and configure:
|
||||
|
||||
Now, go to step (iii) below.
|
||||
cd mono
|
||||
./autogen.sh --prefix=/usr/local
|
||||
|
||||
ii. If you don't have a working Mono installation
|
||||
---------------------------------------------
|
||||
Then compile using the special target `fullbuild':
|
||||
|
||||
If you don't have a working Mono installation, an obvious choice
|
||||
is to install the latest released packages of 'mono' for your
|
||||
distribution and go back to step (i).
|
||||
make fullbuild
|
||||
|
||||
You can also try a slightly more risky approach that should work
|
||||
almost all the time.
|
||||
|
||||
This works by first getting the latest version of the 'monolite'
|
||||
distribution, which contains just enough to run the 'mcs'
|
||||
compiler. You do this by
|
||||
|
||||
make get-monolite-latest
|
||||
|
||||
This should place a monolite-latest.tar.gz in the parent
|
||||
directory of the 'mono' source tree. You can then run:
|
||||
|
||||
make monolite-bootstrap
|
||||
|
||||
This will automatically gunzip and untar the tarball, place the
|
||||
files appropriately, and then complete the bootstrap.
|
||||
|
||||
iii. Testing and Installation
|
||||
------------------------
|
||||
|
||||
You can run the mono and mcs testsuites with the command:
|
||||
|
||||
make -k bootstrap-check
|
||||
|
||||
Expect to find several testsuite failures, especially in the
|
||||
mcs/ tree. As a sanity check, you can compare the failures you
|
||||
got with
|
||||
|
||||
http://go-mono.com/tests/displayTestResults.php
|
||||
|
||||
You can now install it:
|
||||
|
||||
make install
|
||||
This step will compile and install at the same time.
|
||||
|
||||
Failure to follow these steps will result in a broken installation.
|
||||
|
||||
iv. Other useful "bootstrap"-like facilities
|
||||
----------------------------------------
|
||||
|
||||
If you have a CVS snapshot that you keep updating periodically,
|
||||
and/or do your development in, you may try using a couple of
|
||||
specialty make targets that may be slightly faster than a
|
||||
"make bootstrap".
|
||||
|
||||
You can try a two-stage bootstrap with:
|
||||
|
||||
make faststrap
|
||||
|
||||
This assumes that you have already run a "make bootstrap" on the
|
||||
tree before.
|
||||
|
||||
If you want to avoid waiting even for that, you can try the
|
||||
riskier one-stage build:
|
||||
|
||||
make fasterstrap
|
||||
|
||||
This should be attempted only if you're sure that the sources of
|
||||
the mcs compiler itself and the sources of the libraries used by
|
||||
it have not been changed.
|
||||
|
||||
2. Using Mono
|
||||
=============
|
||||
|
||||
+2
-1
@@ -10,6 +10,7 @@
|
||||
#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
||||
#undef USE_MONO_MUTEX
|
||||
#undef HAVE_LARGE_FILE_SUPPORT
|
||||
#undef PLATFORM_WIN32
|
||||
#undef HAVE_NEW_ICONV
|
||||
#undef NAME_DEV_RANDOM
|
||||
#undef HAVE_CRYPT_RNG
|
||||
@@ -20,6 +21,7 @@
|
||||
#undef HAVE_TM_GMTOFF
|
||||
#undef MONO_SIZEOF_SUNPATH
|
||||
#undef MONO_ZERO_ARRAY_LENGTH
|
||||
#undef NEED_LINK_UNLINK
|
||||
#undef PTHREAD_POINTER_ID
|
||||
#undef HAVE_GC_H
|
||||
#undef HAVE_GC_GCJ_MALLOC
|
||||
@@ -33,5 +35,4 @@
|
||||
#undef HAVE_SOCKLEN_T
|
||||
#undef HAVE_TRUNCL
|
||||
#undef HAVE_AINTL
|
||||
#undef HAVE_SCANDIR
|
||||
#undef HAVE_WORKING_SIGALTSTACK
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
#undef HAVE_INET_PTON
|
||||
#undef HAVE_INET_ATON
|
||||
#undef HAVE_MSG_NOSIGNAL
|
||||
#undef HAVE_SOL_IP
|
||||
#undef HAVE_SOL_TCP
|
||||
#undef HAVE_SOL_IPV6
|
||||
#undef HAVE_IP_PKTINFO
|
||||
#undef HAVE_STRUCT_IP_MREQN
|
||||
#undef HAVE_STRUCT_IP_MREQ
|
||||
#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
||||
#undef USE_MONO_MUTEX
|
||||
#undef HAVE_LARGE_FILE_SUPPORT
|
||||
#undef PLATFORM_WIN32
|
||||
#undef HAVE_NEW_ICONV
|
||||
#undef NAME_DEV_RANDOM
|
||||
#undef HAVE_CRYPT_RNG
|
||||
#undef HAVE_BOEHM_GC
|
||||
#undef USE_INCLUDED_LIBGC
|
||||
#undef DISABLE_SHARED_HANDLES
|
||||
#undef HAVE_TIMEZONE
|
||||
#undef HAVE_TM_GMTOFF
|
||||
#undef MONO_SIZEOF_SUNPATH
|
||||
#undef MONO_ZERO_ARRAY_LENGTH
|
||||
#undef NEED_LINK_UNLINK
|
||||
#undef PTHREAD_POINTER_ID
|
||||
#undef HAVE_GC_H
|
||||
#undef HAVE_GC_GCJ_MALLOC
|
||||
#undef HAVE_GC_ENABLE
|
||||
#undef WITH_BUNDLE
|
||||
#undef HAVE_GETHOSTBYNAME2_R
|
||||
#undef HAVE_ICU
|
||||
#undef HAVE_KW_THREAD
|
||||
#undef HAVE_SIGNBIT
|
||||
#undef USE_MACH_SEMA
|
||||
#undef HAVE_SOCKLEN_T
|
||||
#undef HAVE_TRUNCL
|
||||
#undef HAVE_AINTL
|
||||
#undef HAVE_WORKING_SIGALTSTACK
|
||||
|
||||
/* Define to 1 if you have the <aio.h> header file. */
|
||||
#undef HAVE_AIO_H
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the <elf.h> header file. */
|
||||
#undef HAVE_ELF_H
|
||||
|
||||
/* Define to 1 if you have the `finite' function. */
|
||||
#undef HAVE_FINITE
|
||||
|
||||
/* Define to 1 if you have the <gc/gc.h> header file. */
|
||||
#undef HAVE_GC_GC_H
|
||||
|
||||
/* Define to 1 if you have the <gc.h> header file. */
|
||||
#undef HAVE_GC_H
|
||||
|
||||
/* Define to 1 if you have the `inet_aton' function. */
|
||||
#undef HAVE_INET_ATON
|
||||
|
||||
/* Define to 1 if you have the `inet_pton' function. */
|
||||
#undef HAVE_INET_PTON
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `isfinite' function. */
|
||||
#undef HAVE_ISFINITE
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <netdb.h> header file. */
|
||||
#undef HAVE_NETDB_H
|
||||
|
||||
/* Define to 1 if you have the `poll' function. */
|
||||
#undef HAVE_POLL
|
||||
|
||||
/* Define to 1 if you have the `pthread_attr_setstacksize' function. */
|
||||
#undef HAVE_PTHREAD_ATTR_SETSTACKSIZE
|
||||
|
||||
/* Define to 1 if you have the <pthread.h> header file. */
|
||||
#undef HAVE_PTHREAD_H
|
||||
|
||||
/* Define to 1 if you have the `pthread_mutex_timedlock' function. */
|
||||
#undef HAVE_PTHREAD_MUTEX_TIMEDLOCK
|
||||
|
||||
/* Define to 1 if you have the <semaphore.h> header file. */
|
||||
#undef HAVE_SEMAPHORE_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/filio.h> header file. */
|
||||
#undef HAVE_SYS_FILIO_H
|
||||
|
||||
/* Define to 1 if you have the <sys/sockio.h> header file. */
|
||||
#undef HAVE_SYS_SOCKIO_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <sys/un.h> header file. */
|
||||
#undef HAVE_SYS_UN_H
|
||||
|
||||
/* Define to 1 if you have the `truncl' function. */
|
||||
#undef HAVE_TRUNCL
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to 1 if you have the <utime.h> header file. */
|
||||
#undef HAVE_UTIME_H
|
||||
|
||||
/* Define to 1 if you have the <valgrind/memcheck.h> header file. */
|
||||
#undef HAVE_VALGRIND_MEMCHECK_H
|
||||
|
||||
/* Define to 1 if you have the <wchar.h> header file. */
|
||||
#undef HAVE_WCHAR_H
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* The size of a `void *', as computed by sizeof. */
|
||||
#undef SIZEOF_VOID_P
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
+148
-285
@@ -1,7 +1,7 @@
|
||||
AC_INIT(README)
|
||||
AC_CANONICAL_SYSTEM
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AM_INIT_AUTOMAKE(mono,0.94)
|
||||
AM_INIT_AUTOMAKE(mono,0.31.99)
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
dnl
|
||||
@@ -30,20 +30,15 @@ AC_SUBST(libmono_ldflags)
|
||||
dnl if linker handles the version script
|
||||
no_version_script=no
|
||||
|
||||
# Set to yes if Unix sockets cannot be created in an anonymous namespace
|
||||
need_link_unlink=no
|
||||
|
||||
# Thread configuration inspired by sleepycat's db
|
||||
AC_MSG_CHECKING([host platform characteristics])
|
||||
libgc_threads=no
|
||||
case "$host" in
|
||||
*-*-mingw*|*-*-cygwin*)
|
||||
platform_win32=yes
|
||||
AC_DEFINE(PLATFORM_WIN32,1,[Platform is Win32])
|
||||
AC_DEFINE(PLATFORM_WIN32)
|
||||
CC="gcc -mno-cygwin"
|
||||
HOST_CC="gcc"
|
||||
# So libgc configure gets -mno-cygwin
|
||||
export CC
|
||||
# latest libgc already defines GC_WIN32_THREADS
|
||||
# CPPFLAGS="$CPPFLAGS -DGC_WIN32_THREADS -DWIN32_THREADS"
|
||||
CPPFLAGS="$CPPFLAGS -DWIN32_THREADS"
|
||||
@@ -57,25 +52,25 @@ case "$host" in
|
||||
libmono_cflags="-D_REENTRANT"
|
||||
LDFLAGS="$LDFLAGS -pthread"
|
||||
libmono_ldflags="-pthread"
|
||||
need_link_unlink=yes
|
||||
AC_DEFINE(NEED_LINK_UNLINK)
|
||||
libdl=
|
||||
libgc_threads=no
|
||||
libgc_threads=pthreads
|
||||
;;
|
||||
*-*-*freebsd*|*-*-*openbsd*)
|
||||
platform_win32=no
|
||||
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE -DGC_FREEBSD_THREADS"
|
||||
CPPFLAGS="$CPPFLAGS -D_THREAD_SAFE"
|
||||
libmono_cflags="-D_THREAD_SAFE"
|
||||
LDFLAGS="$LDFLAGS -pthread"
|
||||
libmono_ldflags="-pthread"
|
||||
need_link_unlink=yes
|
||||
AC_DEFINE(NEED_LINK_UNLINK)
|
||||
AC_DEFINE(PTHREAD_POINTER_ID)
|
||||
libdl=
|
||||
libgc_threads=pthreads
|
||||
;;
|
||||
*-*-linux*)
|
||||
platform_win32=no
|
||||
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -D_GNU_SOURCE -D_REENTRANT"
|
||||
libmono_cflags="-D_REENTRANT"
|
||||
CPPFLAGS="$CPPFLAGS -DGC_LINUX_THREADS -DMONO_USE_EXC_TABLES -D_GNU_SOURCE -D_REENTRANT -fexceptions"
|
||||
libmono_cflags="-DMONO_USE_EXC_TABLES -fexceptions -D_REENTRANT"
|
||||
libmono_ldflags="-lpthread"
|
||||
libdl="-ldl"
|
||||
libgc_threads=pthreads
|
||||
@@ -88,27 +83,28 @@ case "$host" in
|
||||
libmono_cflags="-D_REENTRANT"
|
||||
libmono_ldflags="-lpthread"
|
||||
libgc_threads=pthreads
|
||||
need_link_unlink=yes
|
||||
AC_DEFINE(NEED_LINK_UNLINK)
|
||||
;;
|
||||
*-*-solaris*)
|
||||
platform_win32=no
|
||||
CPPFLAGS="$CPPFLAGS -DGC_SOLARIS_THREADS -DGC_SOLARIS_PTHREADS -D_REENTRANT"
|
||||
need_link_unlink=yes
|
||||
AC_DEFINE(NEED_LINK_UNLINK)
|
||||
libmono_cflags="-D_REENTRANT"
|
||||
libgc_threads=pthreads
|
||||
;;
|
||||
*-*-darwin*)
|
||||
platform_win32=no
|
||||
CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE -DGC_MACOSX_THREADS"
|
||||
CPPFLAGS="$CPPFLAGS -no-cpp-precomp -D_THREAD_SAFE"
|
||||
libmono_cflags="-D_THREAD_SAFE"
|
||||
LDFLAGS="$LDFLAGS -pthread"
|
||||
libmono_ldflags="-pthread"
|
||||
need_link_unlink=yes
|
||||
AC_DEFINE(NEED_LINK_UNLINK)
|
||||
AC_DEFINE(PTHREAD_POINTER_ID)
|
||||
AC_DEFINE(USE_MACH_SEMA)
|
||||
no_version_script=yes
|
||||
libdl=
|
||||
libgc_threads=pthreads
|
||||
libgc_threads=no
|
||||
gc_default=none
|
||||
;;
|
||||
*)
|
||||
AC_MSG_WARN([*** Please add $host to configure.in checks!])
|
||||
@@ -117,13 +113,10 @@ case "$host" in
|
||||
;;
|
||||
esac
|
||||
AC_MSG_RESULT(ok)
|
||||
|
||||
if test x$need_link_unlink = xyes; then
|
||||
AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(PLATFORM_WIN32, test x$platform_win32 = xyes)
|
||||
|
||||
AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
|
||||
|
||||
AC_CHECK_TOOL(CC, gcc, gcc)
|
||||
AC_PROG_CC
|
||||
AM_PROG_CC_STDC
|
||||
@@ -166,8 +159,6 @@ if test "x$lt_cv_prog_gnu_ld" = "xno"; then
|
||||
no_version_script=yes
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(NO_VERSION_SCRIPT, test x$no_version_script = xyes)
|
||||
|
||||
AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h semaphore.h sys/un.h)
|
||||
|
||||
# for mono/mini/tramp-x86.c
|
||||
@@ -317,9 +308,9 @@ case "x$gc" in
|
||||
;;
|
||||
esac
|
||||
|
||||
|
||||
# tell libgc/configure about what we want
|
||||
ac_configure_args="$ac_configure_args --disable-embed-check --with-libgc-threads=$libgc_threads"
|
||||
we_are_embedded_in_mono=yes
|
||||
export we_are_embedded_in_mono
|
||||
export libgc_threads
|
||||
|
||||
AM_CONDITIONAL(INCLUDED_LIBGC, test x$use_included_gc = xyes)
|
||||
AC_SUBST(LIBGC_CFLAGS)
|
||||
@@ -331,68 +322,6 @@ dnl End of libgc checks
|
||||
dnl
|
||||
|
||||
if test x$platform_win32 = xno; then
|
||||
|
||||
dnl ******************************************************************
|
||||
dnl *** Checks for the IKVM JNI interface library ***
|
||||
dnl ******************************************************************
|
||||
AC_ARG_WITH(ikvm-jni, [ --with-ikvm-jni=yes,no build the IKVM JNI interface library],[with_ikvm_jni=$withval],[with_ikvm_jni=yes])
|
||||
AC_ARG_WITH(jdk, [ --with-jdk=DIRECTORY Use JDK from DIRECTORY],[with_jdk_dir=$withval],[with_jdk_dir=])
|
||||
|
||||
ikvm_jni_dir=
|
||||
if test x$with_ikvm_jni = xyes; then
|
||||
AC_MSG_CHECKING([JDK headers])
|
||||
|
||||
if test x$with_jdk_dir = x; then
|
||||
# Try JAVA_HOME variable
|
||||
if test x$JAVA_HOME != x; then
|
||||
with_jdk_dir=$JAVA_HOME
|
||||
fi
|
||||
fi
|
||||
|
||||
jdk_platform=
|
||||
if test -d $with_jdk_dir/include; then
|
||||
jdk_headers_found=yes
|
||||
|
||||
if test -d $with_jdk_dir/include/linux; then
|
||||
jdk_platform=linux
|
||||
else
|
||||
if test -d $with_jdk_dir/include/solaris; then
|
||||
jdk_platform=solaris
|
||||
else
|
||||
if test -f $with_jdk_dir/include/jni_md.h; then
|
||||
# GNU Classpath sources
|
||||
jdk_platform=
|
||||
else
|
||||
jdk_headers_found=no
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
else
|
||||
jdk_headers_found=no
|
||||
fi
|
||||
|
||||
if test x$jdk_headers_found = xyes; then
|
||||
AC_MSG_RESULT($with_jdk_dir/include $with_jdk_dir/include/$jdk_platform)
|
||||
else
|
||||
AC_MSG_RESULT(not found)
|
||||
fi
|
||||
|
||||
if test x$jdk_headers_found = xyes; then
|
||||
ikvm_jni_dir=ikvm-jni
|
||||
IKVM_JNI_CFLAGS="-I$with_jdk_dir/include -I$with_jdk_dir/include/$jdk_platform"
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_SUBST(ikvm_jni_dir)
|
||||
AC_SUBST(IKVM_JNI_CFLAGS)
|
||||
|
||||
AC_CHECK_FUNCS(getgrgid_r)
|
||||
AC_CHECK_FUNCS(getgrnam_r)
|
||||
AC_CHECK_FUNCS(getpwnam_r)
|
||||
AC_CHECK_FUNCS(getpwuid_r)
|
||||
AC_CHECK_FUNCS(getresuid)
|
||||
AC_CHECK_FUNCS(setresuid)
|
||||
|
||||
dnl ******************************************************************
|
||||
dnl *** Check for large file support ***
|
||||
dnl *** (If we were using autoconf 2.50 we'd use AC_SYS_LARGEFILE) ***
|
||||
@@ -637,7 +566,6 @@ if test x$platform_win32 = xno; then
|
||||
AC_CHECK_LIB(pthread, main, LIBS="$LIBS -lpthread")
|
||||
AC_CHECK_HEADERS(pthread.h)
|
||||
AC_CHECK_FUNCS(pthread_mutex_timedlock)
|
||||
AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np)
|
||||
AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
|
||||
AC_TRY_COMPILE([ #include <pthread.h>], [
|
||||
pthread_mutexattr_t attr;
|
||||
@@ -655,145 +583,145 @@ if test x$platform_win32 = xno; then
|
||||
dnl *** Checks for working __thread ***
|
||||
dnl ***********************************
|
||||
AC_MSG_CHECKING(for working __thread)
|
||||
if test "x$with_nptl" != "xyes"; then
|
||||
AC_MSG_RESULT(disabled)
|
||||
else
|
||||
AC_TRY_RUN([
|
||||
#include <pthread.h>
|
||||
AC_TRY_RUN([
|
||||
#include <pthread.h>
|
||||
|
||||
__thread int i;
|
||||
static int res1, res2;
|
||||
__thread int i;
|
||||
static int res1, res2;
|
||||
|
||||
void thread_main (void *arg)
|
||||
{
|
||||
i = arg;
|
||||
sleep (1);
|
||||
if (arg == 1)
|
||||
res1 = (i == arg);
|
||||
else
|
||||
res2 = (i == arg);
|
||||
}
|
||||
void thread_main (void *arg)
|
||||
{
|
||||
i = arg;
|
||||
sleep (1);
|
||||
if (arg == 1)
|
||||
res1 = (i == arg);
|
||||
else
|
||||
res2 = (i == arg);
|
||||
}
|
||||
|
||||
int main () {
|
||||
pthread_t t1, t2;
|
||||
int main () {
|
||||
pthread_t t1, t2;
|
||||
|
||||
i = 5;
|
||||
i = 5;
|
||||
|
||||
pthread_create (&t1, NULL, thread_main, 1);
|
||||
pthread_create (&t2, NULL, thread_main, 2);
|
||||
pthread_create (&t1, NULL, thread_main, 1);
|
||||
pthread_create (&t2, NULL, thread_main, 2);
|
||||
|
||||
pthread_join (t1, NULL);
|
||||
pthread_join (t2, NULL);
|
||||
pthread_join (t1, NULL);
|
||||
pthread_join (t2, NULL);
|
||||
|
||||
return !(res1 + res2 == 2);
|
||||
}
|
||||
], [
|
||||
return !(res1 + res2 == 2);
|
||||
}
|
||||
], [
|
||||
if test "x$with_nptl" != "xyes"; then
|
||||
AC_MSG_RESULT(disabled)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_KW_THREAD)
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
fi
|
||||
fi
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
dnl **************************************
|
||||
dnl *** Checks for working sigaltstack ***
|
||||
dnl **************************************
|
||||
AC_MSG_CHECKING(for working sigaltstack)
|
||||
if test "x$with_sigaltstack" != "xyes"; then
|
||||
AC_MSG_RESULT(disabled)
|
||||
else
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/wait.h>
|
||||
AC_TRY_RUN([
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <pthread.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
static void
|
||||
sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
|
||||
{
|
||||
exit (0);
|
||||
static void
|
||||
sigsegv_signal_handler (int _dummy, siginfo_t *info, void *context)
|
||||
{
|
||||
exit (0);
|
||||
}
|
||||
|
||||
static void *
|
||||
loop (void *ignored)
|
||||
{
|
||||
char *ptr = NULL;
|
||||
|
||||
*ptr = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
child ()
|
||||
{
|
||||
struct sigaction sa;
|
||||
struct sigaltstack sas;
|
||||
pthread_t id;
|
||||
pthread_attr_t attr;
|
||||
|
||||
sa.sa_sigaction = sigsegv_signal_handler;
|
||||
sigemptyset (&sa.sa_mask);
|
||||
sa.sa_flags = SA_SIGINFO | SA_STACK;
|
||||
if (sigaction (SIGSEGV, &sa, NULL) == -1) {
|
||||
perror ("lala");
|
||||
return;
|
||||
}
|
||||
|
||||
static void *
|
||||
loop (void *ignored)
|
||||
{
|
||||
char *ptr = NULL;
|
||||
|
||||
*ptr = 0;
|
||||
return NULL;
|
||||
sas.ss_sp = malloc (SIGSTKSZ);
|
||||
sas.ss_size = SIGSTKSZ;
|
||||
sas.ss_flags = SS_ONSTACK;
|
||||
if (sigaltstack (&sas, NULL) == -1) {
|
||||
perror ("lala");
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
child ()
|
||||
{
|
||||
struct sigaction sa;
|
||||
struct sigaltstack sas;
|
||||
pthread_t id;
|
||||
pthread_attr_t attr;
|
||||
|
||||
sa.sa_sigaction = sigsegv_signal_handler;
|
||||
sigemptyset (&sa.sa_mask);
|
||||
sa.sa_flags = SA_SIGINFO | SA_STACK;
|
||||
if (sigaction (SIGSEGV, &sa, NULL) == -1) {
|
||||
perror ("lala");
|
||||
return;
|
||||
}
|
||||
|
||||
sas.ss_sp = malloc (SIGSTKSZ);
|
||||
sas.ss_size = SIGSTKSZ;
|
||||
sas.ss_flags = SS_ONSTACK;
|
||||
if (sigaltstack (&sas, NULL) == -1) {
|
||||
perror ("lala");
|
||||
return;
|
||||
}
|
||||
|
||||
pthread_attr_init (&attr);
|
||||
if (pthread_create(&id, &attr, loop, &attr) != 0) {
|
||||
printf ("failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sleep (100);
|
||||
pthread_attr_init (&attr);
|
||||
if (pthread_create(&id, &attr, loop, &attr) != 0) {
|
||||
printf ("failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
pid_t son;
|
||||
int status;
|
||||
int i;
|
||||
sleep (100);
|
||||
}
|
||||
|
||||
son = fork ();
|
||||
if (son == -1) {
|
||||
return 1;
|
||||
}
|
||||
int
|
||||
main ()
|
||||
{
|
||||
pid_t son;
|
||||
int status;
|
||||
int i;
|
||||
|
||||
if (son == 0) {
|
||||
child ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
sleep (1);
|
||||
waitpid (son, &status, WNOHANG);
|
||||
if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
kill (son, SIGKILL);
|
||||
son = fork ();
|
||||
if (son == -1) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
], [
|
||||
if (son == 0) {
|
||||
child ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; ++i) {
|
||||
sleep (1);
|
||||
waitpid (son, &status, WNOHANG);
|
||||
if (WIFEXITED (status) && WEXITSTATUS (status) == 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
kill (son, SIGKILL);
|
||||
return 1;
|
||||
}
|
||||
|
||||
], [
|
||||
if test "x$with_sigaltstack" != "xyes"; then
|
||||
AC_MSG_RESULT(disabled)
|
||||
else
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_WORKING_SIGALTSTACK)
|
||||
], [
|
||||
with_sigaltstack=no
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
fi
|
||||
fi
|
||||
], [
|
||||
with_sigaltstack=no
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
dnl ********************************
|
||||
dnl *** Checks for semaphore lib ***
|
||||
@@ -866,37 +794,8 @@ if test x$platform_win32 = xno; then
|
||||
dnl *********************
|
||||
dnl *** Check for AIO ***
|
||||
dnl *********************
|
||||
AC_MSG_CHECKING([for SIGEV_THREAD definition])
|
||||
dnl Some systems (FreeBSD at least) may have aio_read
|
||||
dnl but don't support/define SIGEV_THREAD.
|
||||
AC_TRY_COMPILE([
|
||||
#include <sys/signal.h>
|
||||
],[
|
||||
int x = SIGEV_THREAD;
|
||||
],[
|
||||
ac_cv_c_sigev_thread=yes
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
if test "$ac_cv_c_sigev_thread" = "yes" ; then
|
||||
AC_CHECK_HEADERS(aio.h sys/aio.h)
|
||||
AC_CHECK_LIB(rt, aio_read, [ LIBS="$LIBS -lrt" ],)
|
||||
SIGVAL_PTR="undefined"
|
||||
if test "$ac_cv_header_aio_h" = "yes" -o "$ac_cv_header_sys_aio_h" = "yes" ; then
|
||||
AC_CHECK_MEMBER(union sigval.sigval_ptr,SIGVAL_PTR="sigval_ptr",, [
|
||||
#include <sys/signal.h>
|
||||
])
|
||||
AC_CHECK_MEMBER(union sigval.sival_ptr,SIGVAL_PTR="sival_ptr",, [
|
||||
#include <sys/signal.h>
|
||||
])
|
||||
if test "$SIGVAL_PTR" = "undefined" ; then
|
||||
AC_MSG_ERROR([Unable to detect field name in 'union sigval'])
|
||||
fi
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(SIGVAL_PTR,$SIGVAL_PTR,[Pointer field name in 'union sigval'])
|
||||
fi
|
||||
AC_CHECK_HEADERS(aio.h)
|
||||
AC_CHECK_LIB(rt, aio_read, [ LIBS="$LIBS -lrt" ],)
|
||||
else
|
||||
AC_CHECK_LIB(ws2_32, main, LIBS="$LIBS -lws2_32", AC_ERROR(bad mingw install?))
|
||||
AC_CHECK_LIB(psapi, main, LIBS="$LIBS -lpsapi", AC_ERROR(bad mingw install?))
|
||||
@@ -917,13 +816,13 @@ ac_cv_c_socklen_t=yes
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
|
||||
AC_CHECK_FUNCS(trunc, , AC_MSG_CHECKING(for trunc in math.h)
|
||||
AC_CHECK_FUNCS(truncl, , AC_MSG_CHECKING(for truncl in math.h)
|
||||
AC_TRY_LINK([#include <math.h>],
|
||||
[ trunc(0.0); ],
|
||||
[ truncl(0.0); ],
|
||||
[
|
||||
AC_DEFINE(HAVE_TRUNC)
|
||||
AC_DEFINE(HAVE_TRUNCL)
|
||||
AC_MSG_RESULT(yes)
|
||||
ac_cv_trunc=yes
|
||||
ac_cv_truncl=yes
|
||||
],
|
||||
AC_MSG_RESULT(no)))
|
||||
|
||||
@@ -992,8 +891,7 @@ if test "x$ac_cv_have_dev_random" = "xno" \
|
||||
*** entropy collection in place, please contact <[email protected]> and
|
||||
*** provide information about the system and how to access the random device.
|
||||
***
|
||||
*** Otherwise you can install either egd or prngd and set the environment
|
||||
*** variable MONO_EGD_SOCKET to point to the daemon's socket to use that.
|
||||
*** For those systems who lack a random device, EGD support is forthcoming.
|
||||
***]])
|
||||
fi
|
||||
|
||||
@@ -1005,32 +903,18 @@ if test "x$try_shared_handles" != "xyes"; then
|
||||
AC_SUBST(DISABLE_SHARED_HANDLES)
|
||||
fi
|
||||
|
||||
#
|
||||
# ICU
|
||||
#
|
||||
ICU_CFLAGS=""
|
||||
ICU_LIBS=""
|
||||
enable_icu=no
|
||||
|
||||
probe_icu=true
|
||||
AC_ARG_WITH(icu, [ --with-icu=yes/no],
|
||||
if test x$with_icu = xno; then
|
||||
probe_icu=false;
|
||||
AC_MSG_RESULT(Will not probe for ICU)
|
||||
fi
|
||||
)
|
||||
|
||||
if $probe_icu; then
|
||||
AC_PATH_PROG(ICU_CONFIG, icu-config, no)
|
||||
if test "x$ICU_CONFIG" = "xno" -o ! -x "$ICU_CONFIG"; then
|
||||
AC_MSG_WARN([Only invariant locale available; install ICU for I18N support])
|
||||
enable_icu="no, if you want full i18n support download it from: http://oss.software.ibm.com/icu/index.html"
|
||||
else
|
||||
enable_icu="yes. Version: `$ICU_CONFIG --version`"
|
||||
AC_DEFINE(HAVE_ICU)
|
||||
ICU_CFLAGS=`$ICU_CONFIG --cppflags`
|
||||
ICU_LIBS=`$ICU_CONFIG --ldflags`
|
||||
fi
|
||||
AC_PATH_PROG(ICU_CONFIG, icu-config, no)
|
||||
if test "x$ICU_CONFIG" = "xno" -o ! -x "$ICU_CONFIG"; then
|
||||
AC_MSG_WARN([Only invariant locale available; install ICU for I18N support])
|
||||
enable_icu="no, if you want full i18n support download it from: http://oss.software.ibm.com/icu/index.html"
|
||||
else
|
||||
enable_icu="yes. Version: `$ICU_CONFIG --version`"
|
||||
AC_DEFINE(HAVE_ICU)
|
||||
ICU_CFLAGS=`$ICU_CONFIG --cppflags`
|
||||
ICU_LIBS=`$ICU_CONFIG --ldflags`
|
||||
fi
|
||||
AC_SUBST(ICU_CFLAGS)
|
||||
AC_SUBST(ICU_LIBS)
|
||||
@@ -1063,7 +947,6 @@ case "$host" in
|
||||
arch_target=sparc;
|
||||
JIT_SUPPORTED=yes
|
||||
ACCESS_UNALIGNED="no"
|
||||
LIBC="libc.so"
|
||||
jit_wanted=true
|
||||
;;
|
||||
# alpha*-*-linux* | alpha*-*-osf*)
|
||||
@@ -1086,7 +969,6 @@ case "$host" in
|
||||
hppa2.0w-hp-hpux11.00 | hppa64-hp-hpux11.00)
|
||||
TARGET=HPPA;
|
||||
arch_target=hppa;
|
||||
LIBC="libc.sl"
|
||||
ACCESS_UNALIGNED="no"
|
||||
;;
|
||||
macppc-*-openbsd* | powerpc-*-linux* | powerpc-*-openbsd* | \
|
||||
@@ -1094,7 +976,6 @@ case "$host" in
|
||||
TARGET=POWERPC;
|
||||
arch_target=ppc;
|
||||
JIT_SUPPORTED=yes
|
||||
jit_wanted=true
|
||||
;;
|
||||
arm-*-linux-* | armv4l-*-linux-*)
|
||||
TARGET=ARM;
|
||||
@@ -1105,11 +986,10 @@ case "$host" in
|
||||
TARGET=S390;
|
||||
arch_target=s390;
|
||||
ACCESS_UNALIGNED="no"
|
||||
JIT_SUPPORTED=yes
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(jit, [ --with-jit=yes,no If you want to build scripts that default to the JIT],[
|
||||
AC_ARG_WITH(jit, [ --with-jit=yes,no If you want to build scripts that default to the JIT],[
|
||||
jit_wanted=true
|
||||
])
|
||||
|
||||
@@ -1132,7 +1012,6 @@ libsuffix=".so"
|
||||
case "$host" in
|
||||
powerpc-*-darwin*)
|
||||
libsuffix=".dylib"
|
||||
LIBC="libc.dylib"
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(libsuffix)
|
||||
@@ -1165,15 +1044,6 @@ if test ${ACCESS_UNALIGNED} = no; then
|
||||
CPPFLAGS="$CPPFLAGS -DNO_UNALIGNED_ACCESS"
|
||||
fi
|
||||
|
||||
PREVIEW=no
|
||||
AC_ARG_WITH(preview, [ --with-preview=yes,no If you want to install the 2.0 FX preview],[
|
||||
if test x$with_preview = xyes; then
|
||||
PREVIEW=yes
|
||||
fi
|
||||
])
|
||||
|
||||
AM_CONDITIONAL(INSTALL_2_0, test x$PREVIEW = xyes)
|
||||
|
||||
AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
|
||||
AM_CONDITIONAL(MIPS_SGI, test ${TARGET}${ac_cv_prog_gcc} = MIPSno)
|
||||
AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC)
|
||||
@@ -1227,10 +1097,7 @@ mono/io-layer/Makefile
|
||||
mono/handles/Makefile
|
||||
mono/mini/Makefile
|
||||
mono/profiler/Makefile
|
||||
ikvm-jni/Makefile
|
||||
runtime/Makefile
|
||||
runtime/net_1_1/Makefile
|
||||
runtime/net_2_0/Makefile
|
||||
scripts/Makefile
|
||||
man/Makefile
|
||||
web/Makefile
|
||||
@@ -1240,8 +1107,6 @@ samples/Makefile
|
||||
support/Makefile
|
||||
data/config
|
||||
mono.spec
|
||||
tools/Makefile
|
||||
tools/locale-builder/Makefile
|
||||
])
|
||||
|
||||
echo "
|
||||
@@ -1251,7 +1116,5 @@ echo "
|
||||
NPTL: $with_nptl
|
||||
SIGALTSTACK: $with_sigaltstack
|
||||
Engine: $jit_status
|
||||
2.0 Alpha: $PREVIEW
|
||||
JNI support: $jdk_headers_found
|
||||
|
||||
|
||||
"
|
||||
@@ -61,9 +61,6 @@ void Page_Load(object sender, EventArgs e)
|
||||
|
||||
Service service = desc.Services[0];
|
||||
WebServiceName = service.Name;
|
||||
if (desc.Bindings.Count == 0)
|
||||
return;
|
||||
|
||||
DefaultBinding = desc.Bindings[0].Name;
|
||||
WebServiceDescription = service.Documentation;
|
||||
ServiceProtocols = FindServiceProtocols (null);
|
||||
@@ -316,7 +313,7 @@ string GetTestResult ()
|
||||
{
|
||||
if (fill) {
|
||||
if (qs != "") qs += "&";
|
||||
qs += Request.QueryString.GetKey(n) + "=" + Server.UrlEncode (Request.QueryString [n]);
|
||||
qs += Request.QueryString.GetKey(n) + "=" + Request.QueryString [n];
|
||||
}
|
||||
if (Request.QueryString.GetKey(n) == "ext") fill = true;
|
||||
}
|
||||
@@ -338,17 +335,6 @@ string GetTestResult ()
|
||||
try
|
||||
{
|
||||
WebRequest req = WebRequest.Create (location + "/" + CurrentOperationName + "?" + qs);
|
||||
HttpCookieCollection cookies = Request.Cookies;
|
||||
int last = cookies.Count;
|
||||
if (last > 0) {
|
||||
CookieContainer container = new CookieContainer ();
|
||||
for (int i = 0; i < last; i++) {
|
||||
HttpCookie hcookie = cookies [i];
|
||||
Cookie cookie = new Cookie (hcookie.Name, hcookie.Value, hcookie.Path, hcookie.Domain);
|
||||
container.Add (cookie);
|
||||
}
|
||||
((HttpWebRequest) req).CookieContainer = container;
|
||||
}
|
||||
WebResponse resp = req.GetResponse();
|
||||
StreamReader sr = new StreamReader (resp.GetResponseStream());
|
||||
string s = sr.ReadToEnd ();
|
||||
@@ -1596,9 +1582,7 @@ function clearForm ()
|
||||
<p class="label">Web Service Overview</p>
|
||||
<%#WebServiceDescription%>
|
||||
|
||||
<%} if (DefaultBinding == null) {%>
|
||||
This service does not contain any public web method.
|
||||
<%} else if (CurrentPage == "op") {%>
|
||||
<%} if (CurrentPage == "op") {%>
|
||||
|
||||
<!--
|
||||
**********************************************************
|
||||
@@ -1726,7 +1710,9 @@ This service does not contain any public web method.
|
||||
<% } %>
|
||||
|
||||
<% } %>
|
||||
<%} else if (CurrentPage == "proxy") {%>
|
||||
<%}%>
|
||||
|
||||
<% if (CurrentPage == "proxy") {%>
|
||||
<!--
|
||||
**********************************************************
|
||||
Client Proxy
|
||||
@@ -1747,7 +1733,9 @@ This service does not contain any public web method.
|
||||
<div class="codePanel">
|
||||
<div class="code-<%#CurrentLanguage%>"><%#GetProxyCode ()%></div>
|
||||
</div>
|
||||
<%} else if (CurrentPage == "wsdl") {%>
|
||||
<%}%>
|
||||
|
||||
<% if (CurrentPage == "wsdl") {%>
|
||||
<!--
|
||||
**********************************************************
|
||||
Service description
|
||||
|
||||
@@ -10,8 +10,6 @@ mono_DATA = config \
|
||||
DefaultWsdlHelpGenerator.aspx \
|
||||
browscap.ini
|
||||
|
||||
CLEANFILES = browscap.ini
|
||||
|
||||
browscap.ini: browscap.ini.gz
|
||||
gunzip -c $^ > $@
|
||||
|
||||
Binary file not shown.
@@ -4,6 +4,17 @@
|
||||
<dllmap dll="libxslt.dll" target="libxslt@libsuffix@" />
|
||||
<dllmap dll="libmySQL.dll" target="libmysqlclient@libsuffix@" />
|
||||
<dllmap dll="odbc32.dll" target="libodbc@libsuffix@" />
|
||||
<dllmap dll="libglib-2.0-0.dll" target="libglib-2.0@libsuffix@" />
|
||||
<dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0@libsuffix@" />
|
||||
<dllmap dll="libgthread-2.0-0.dll" target="libgthread-2.0@libsuffix@" />
|
||||
<dllmap dll="libpango-1.0-0.dll" target="libpango-1.0@libsuffix@" />
|
||||
<dllmap dll="libatk-1.0-0.dll" target="libatk-1.0@libsuffix@" />
|
||||
<dllmap dll="libgdk-win32-2.0-0.dll" target="libgdk-x11-2.0@libsuffix@" />
|
||||
<dllmap dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0@libsuffix@" />
|
||||
<dllmap dll="libgtk-win32-2.0-0.dll" target="libgtk-x11-2.0@libsuffix@" />
|
||||
<dllmap dll="libglade-2.0-0.dll" target="libglade-2.0@libsuffix@" />
|
||||
<dllmap dll="oci" target="clntsh" />
|
||||
<dllmap dll="gtkhtml-3.0" target="libgtkhtml-3.0@libsuffix@" />
|
||||
<dllmap dll="db2cli" target="libdb2_36@libsuffix@"/>
|
||||
<dllmap dll="gstreamer" target="libgstreamer-0.6@libsuffix@" />
|
||||
</configuration>
|
||||
+60
-59
@@ -3,61 +3,61 @@
|
||||
<configuration>
|
||||
|
||||
<configSections>
|
||||
<section name="appSettings" type="System.Configuration.NameValueFileSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.diagnostics" type="System.Diagnostics.DiagnosticsConfigurationHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.runtime.remoting" type="System.Configuration.IgnoreSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowLocation="false"/>
|
||||
<section name="appSettings" type="System.Configuration.NameValueFileSectionHandler, System" />
|
||||
<section name="system.diagnostics" type="System.Diagnostics.DiagnosticsConfigurationHandler, System" />
|
||||
<section name="system.runtime.remoting" type="System.Configuration.IgnoreSectionHandler, System" allowLocation="false"/>
|
||||
<sectionGroup name="system.web">
|
||||
<section name="httpHandlers"
|
||||
type="System.Web.Configuration.HttpHandlersSectionHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.HttpHandlersSectionHandler, System.Web" />
|
||||
<section name="httpModules"
|
||||
type="System.Web.Configuration.HttpModulesConfigurationHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.HttpModulesConfigurationHandler, System.Web" />
|
||||
<section name="machineKey"
|
||||
type="System.Web.Configuration.MachineKeyConfigHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.MachineKeyConfigHandler, System.Web" />
|
||||
<section name="authentication"
|
||||
type="System.Web.Configuration.AuthenticationConfigHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.AuthenticationConfigHandler, System.Web" />
|
||||
<section name="authorization"
|
||||
type="System.Web.Configuration.AuthorizationConfigHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.AuthorizationConfigHandler, System.Web" />
|
||||
<section name="globalization"
|
||||
type="System.Web.Configuration.GlobalizationConfigurationHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.GlobalizationConfigurationHandler, System.Web" />
|
||||
<section name="sessionState"
|
||||
type="System.Web.SessionState.SessionStateSectionHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.SessionState.SessionStateSectionHandler, System.Web" />
|
||||
<section name="trace"
|
||||
type="System.Web.Configuration.TraceConfigurationHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.TraceConfigurationHandler, System.Web" />
|
||||
<section name="webServices"
|
||||
type="System.Web.Services.Configuration.WebServicesConfigurationSectionHandler, System.Web.Services, Version=1.0.5000.0 Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Services.Configuration.WebServicesConfigurationSectionHandler, System.Web.Services" />
|
||||
<section name="webControls"
|
||||
type="System.Web.Configuration.WebControlsSectionHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.WebControlsSectionHandler, System.Web" />
|
||||
<section name="compilation"
|
||||
type="System.Web.Configuration.CompilationConfigurationHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.CompilationConfigurationHandler, System.Web" />
|
||||
<section name="httpRuntime"
|
||||
type="System.Web.Configuration.HttpRuntimeConfigurationHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.HttpRuntimeConfigurationHandler, System.Web" />
|
||||
<section name="customErrors"
|
||||
type="System.Web.Configuration.CustomErrorsConfigHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
type="System.Web.Configuration.CustomErrorsConfigHandler, System.Web" />
|
||||
<section name="pages"
|
||||
type="System.Web.Configuration.PagesConfigurationHandler, System.Web, Version=1.0.5000.0, Culture=neutral" />
|
||||
type="System.Web.Configuration.PagesConfigurationHandler, System.Web" />
|
||||
</sectionGroup>
|
||||
<sectionGroup name="system.net">
|
||||
<section name="settings"
|
||||
type="System.Net.Configuration.NetConfigurationHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.NetConfigurationHandler, System" />
|
||||
<section name="connectionManagement"
|
||||
type="System.Net.Configuration.ConnectionManagementHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.ConnectionManagementHandler, System" />
|
||||
<section name="authenticationModules"
|
||||
type="System.Net.Configuration.NetAuthenticationModuleHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.NetAuthenticationModuleHandler, System" />
|
||||
<section name="defaultProxy"
|
||||
type="System.Net.Configuration.DefaultProxyHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.DefaultProxyHandler, System" />
|
||||
<section name="webRequestModules"
|
||||
type="System.Net.Configuration.WebRequestModuleHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="System.Net.Configuration.WebRequestModuleHandler, System" />
|
||||
</sectionGroup>
|
||||
<section name="system.drawing" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<section name="system.drawing" type="System.Configuration.NameValueSectionHandler" />
|
||||
</configSections>
|
||||
<system.net>
|
||||
<connectionManagement>
|
||||
<add address="*" maxconnection="2" />
|
||||
</connectionManagement>
|
||||
<authenticationModules>
|
||||
<add type="System.Net.BasicClient, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add type="System.Net.DigestClient, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add type="System.Net.NtlmClient, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add type="System.Net.BasicClient" />
|
||||
<add type="System.Net.DigestClient" />
|
||||
<add type="System.Net.NtlmClient" />
|
||||
</authenticationModules>
|
||||
<defaultProxy>
|
||||
<proxy />
|
||||
@@ -65,9 +65,9 @@
|
||||
<!-- usessystemdefault is not supported -->
|
||||
</defaultProxy>
|
||||
<webRequestModules>
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="https" type="System.Net.HttpRequestCreator, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="file" type="System.Net.FileWebRequestCreator, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<add prefix="http" type="System.Net.HttpRequestCreator, System" />
|
||||
<add prefix="https" type="System.Net.HttpRequestCreator, System" />
|
||||
<add prefix="file" type="System.Net.FileWebRequestCreator, System" />
|
||||
</webRequestModules>
|
||||
<settings>
|
||||
<ipv6 enabled="false"/>
|
||||
@@ -75,25 +75,26 @@
|
||||
</system.net>
|
||||
<system.web>
|
||||
<httpHandlers>
|
||||
<add verb="*" path="Trace.axd" type="System.Web.Handlers.TraceHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="GET" path="WebResource.axd" type="System.Web.Handlers.AssemblyResourceLoader, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.asax" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.ascx" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Culture=neutral, PublicKeyToken=b77a5c561934e089" validate="false" />
|
||||
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add verb="*" path="Trace.axd" type="System.Web.Handlers.TraceHandler, System.Web" />
|
||||
<add verb="*" path="*.aspx" type="System.Web.UI.PageHandlerFactory, System.Web" />
|
||||
<add verb="*" path="*.asmx" validate="false"
|
||||
type="System.Web.Services.Protocols.WebServiceHandlerFactory, System.Web.Services" />
|
||||
<add verb="*" path="*.ashx" type="System.Web.UI.SimpleHandlerFactory, System.Web" />
|
||||
<add verb="GET" path="WebResource.axd" type="System.Web.Handlers.AssemblyResourceLoader, System.Web" />
|
||||
<add verb="*" path="*.asax" type="System.Web.HttpForbiddenHandler, System.Web" />
|
||||
<add verb="*" path="*.ascx" type="System.Web.HttpForbiddenHandler, System.Web" />
|
||||
<add verb="*" path="*.config" type="System.Web.HttpForbiddenHandler, System.Web" />
|
||||
<add verb="*" path="*.cs" type="System.Web.HttpForbiddenHandler, System.Web" />
|
||||
<add verb="*" path="*.rem" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting" validate="false" />
|
||||
<add verb="*" path="*.soap" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting" validate="false" />
|
||||
<add verb="GET,HEAD" path="*" type="System.Web.StaticFileHandler, System.Web" />
|
||||
<add verb="*" path="*" type="System.Web.HttpMethodNotAllowedHandler, System.Web" />
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule, System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule, System.Web" />
|
||||
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule, System.Web" />
|
||||
<add name="Session" type="System.Web.SessionState.SessionStateModule, System.Web" />
|
||||
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule, System.Web" />
|
||||
</httpModules>
|
||||
<authentication mode="Forms">
|
||||
<forms name=".MONOAUTH" loginUrl="login.aspx" protection="All" timeout="30" path="/">
|
||||
@@ -124,10 +125,10 @@
|
||||
<compilation debug="false" defaultLanguage="c#">
|
||||
<compilers>
|
||||
<compiler language="cs;c#;csharp" extension=".cs" warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System" />
|
||||
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
|
||||
warningLevel="1" compilerOptions=""
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
type="Microsoft.VisualBasic.VBCodeProvider, System" />
|
||||
</compilers>
|
||||
<assemblies>
|
||||
<!--<add assembly="mscorlib" /> -->
|
||||
@@ -160,22 +161,22 @@
|
||||
</channels>
|
||||
</application>
|
||||
<channels>
|
||||
<channel id="http" type="System.Runtime.Remoting.Channels.Http.HttpChannel, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="http client" type="System.Runtime.Remoting.Channels.Http.HttpClientChannel, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="http server" type="System.Runtime.Remoting.Channels.Http.HttpServerChannel, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="tcp" type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="tcp client" type="System.Runtime.Remoting.Channels.Tcp.TcpClientChannel, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="tcp server" type="System.Runtime.Remoting.Channels.Tcp.TcpServerChannel, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<channel id="http" type="System.Runtime.Remoting.Channels.Http.HttpChannel, System.Runtime.Remoting" />
|
||||
<channel id="http client" type="System.Runtime.Remoting.Channels.Http.HttpClientChannel, System.Runtime.Remoting" />
|
||||
<channel id="http server" type="System.Runtime.Remoting.Channels.Http.HttpServerChannel, System.Runtime.Remoting" />
|
||||
<channel id="tcp" type="System.Runtime.Remoting.Channels.Tcp.TcpChannel, System.Runtime.Remoting" />
|
||||
<channel id="tcp client" type="System.Runtime.Remoting.Channels.Tcp.TcpClientChannel, System.Runtime.Remoting" />
|
||||
<channel id="tcp server" type="System.Runtime.Remoting.Channels.Tcp.TcpServerChannel, System.Runtime.Remoting" />
|
||||
</channels>
|
||||
<channelSinkProviders>
|
||||
<clientProviders>
|
||||
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapClientFormatterSinkProvider, System.Runtime.Remoting" />
|
||||
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider, System.Runtime.Remoting" />
|
||||
</clientProviders>
|
||||
<serverProviders>
|
||||
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<provider id="wsdl" type="System.Runtime.Remoting.MetadataServices.SdlChannelSinkProvider, System.Runtime.Remoting, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<formatter id="soap" type="System.Runtime.Remoting.Channels.SoapServerFormatterSinkProvider, System.Runtime.Remoting" />
|
||||
<formatter id="binary" type="System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider, System.Runtime.Remoting" />
|
||||
<provider id="wsdl" type="System.Runtime.Remoting.MetadataServices.SdlChannelSinkProvider, System.Runtime.Remoting" />
|
||||
</serverProviders>
|
||||
</channelSinkProviders>
|
||||
</system.runtime.remoting>
|
||||
|
||||
@@ -1,525 +0,0 @@
|
||||
|
||||
Here "abc" stays for "array bounds check", or "array bound checks", or
|
||||
some combination of the two...
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
USAGE
|
||||
|
||||
Simply use the "abcrem" optimization invoking mono.
|
||||
|
||||
To see if bound checks are actually removed, use "mono -v" and grep for
|
||||
"ARRAY-ACCESS" in the output, there should be a message for each check
|
||||
that has been removed.
|
||||
|
||||
To trace the algorithm execution, use "-v -v -v", and be prepared to be
|
||||
totally submersed by debugging messages...
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
EFFECTIVENESS
|
||||
|
||||
The abc removal code can now always remove bound checks from "clean"
|
||||
array scans in loops, and generally anyway there are clear conditions that
|
||||
already state that the index is "safe".
|
||||
|
||||
To be clearer, and give an idea of what the algorithm can and cannot do
|
||||
without describing it in detail... keep in mind that only "redunant" checks
|
||||
cannot be removed. By "redundant", I mean "already explicitly checked" in
|
||||
the method code.
|
||||
|
||||
Unfortunately, analyzing complex expressions is not so easy (see below for
|
||||
details), so the capabilities of this "abc remover" are limited.
|
||||
|
||||
These are simple guidelines:
|
||||
- Only simple comparisons between variables are understood.
|
||||
- Only increment-decrement operations are handled.
|
||||
- "switch" statements are not yet handled.
|
||||
|
||||
This means that code like this will be handled well:
|
||||
|
||||
for (int i = 0; i < a.Length; i++) {
|
||||
a [i] = .....
|
||||
}
|
||||
|
||||
The "i" variable could be declared out of the "for", the "for" could be a
|
||||
"while", and maybe even implemented with "goto", the array could be scanned
|
||||
in reverse order, and everything would still work.
|
||||
I could have a temporary variable storing the array length, and check on
|
||||
it inside the loop, and the abc removal would still occurr, like this:
|
||||
|
||||
int i = 0;
|
||||
int l = a.Length;
|
||||
while ( i < l ) {
|
||||
a [i] ......
|
||||
}
|
||||
|
||||
or this:
|
||||
|
||||
int l = a.Length;
|
||||
for (int i = l; i > 0; i--) {
|
||||
a [i] = .....
|
||||
}
|
||||
|
||||
|
||||
But just something like this
|
||||
|
||||
for (int i = 0; i < (a.Length -1); i++) .....
|
||||
|
||||
or like this
|
||||
|
||||
for (int i = 0; i < a.Length; i += 2) .....
|
||||
|
||||
would not work, the check would stay there, sorry :-(
|
||||
|
||||
Just to make you understand how things are tricky... this would work!
|
||||
|
||||
int limit = a.Length - 1;
|
||||
for (int i = 0; i < limit; i++) {
|
||||
a [i] = .....
|
||||
}
|
||||
|
||||
|
||||
A detailed explanation of the reason why things are done like this is given
|
||||
below...
|
||||
|
||||
All in all, the compiling phase is generally non so fast, and the abc removed
|
||||
are so few, that there is hardly a performance gain in using the "abcrem"
|
||||
flag in the compiling options for short programs like the ones I tried.
|
||||
|
||||
Anyway, various bound checks *are* removed, and this is good :-)
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
THE ALGORITHM
|
||||
|
||||
Unfortunately, this time google has not been my friend, and I did not
|
||||
find an algorithm I could reasonably implement in the time frame I had,
|
||||
so I had to invent one. The two cleasses of algorithms I found were either
|
||||
simply an analisys of variable ranges (which is not very different from
|
||||
what I'm doing), or they were based on type systems richer than the .NET
|
||||
one (particularly, they required integer types to have an explicit range,
|
||||
which could be related to array ranges). By the way, it seems that the
|
||||
gcj people do not have an array bound check removal optimization (they
|
||||
just have a compiler flag that unconditionally removes all the checks,
|
||||
but this is not what we want).
|
||||
|
||||
This array bound check removal (abc removal) algorithm is based on
|
||||
symbolic execution concepts. I handle the removal like an "unreachable
|
||||
code elimination" (and in fact the optimization could be extended to remove
|
||||
also other unreachable sections of code, due to branches that "always go the
|
||||
same way").
|
||||
|
||||
In symbolic execution, variables do not have actual (numeric) values, but
|
||||
instead symbolic expressions (like "a", or "x+y").
|
||||
Also, branch conditions are handled like symbolic conditions (like "i<k"),
|
||||
which state relations between variable values.
|
||||
|
||||
The SSA representation inside mini is somewhat close to a symbolic
|
||||
representation of the execution of the compiled method.
|
||||
Particularly, the representation of variable values is exactly a symbolic
|
||||
one. It is enough to find all CEE_STIND_* instructions which store to a
|
||||
local variable, and their second argument is exactly the variable value.
|
||||
Actually, "cfg->vars [<variable-index>]->def" should contain exactly
|
||||
those store instructions, and the "get_variable_value_from_ssa_store"
|
||||
function extracts the variable value from there.
|
||||
|
||||
On the other hand, the conditions under which each basic block is
|
||||
executed are not made fully explicit.
|
||||
|
||||
However, it is not difficult to make them so.
|
||||
Each BB that has more than one exit BB, in practice must end either with
|
||||
a conditional branch instruction or with a switch instruction.
|
||||
In the first case, the BB has exactly two exit BBs, and their execution
|
||||
conditions are easy to get from the condition of the branch (see the
|
||||
"get_relation_from_branch_instruction" function, and expecially the end of
|
||||
"analyze_block" in abcremoval.c.
|
||||
If there is a switch, the jump condition of every exit BB is the equality
|
||||
of the switch argument with the particular index associated with its case
|
||||
(but the current implementation does not handle switch statements yet).
|
||||
|
||||
These individual conditions are in practice associated to each arc that
|
||||
connects BBs in the CFG (with the simple case that unconditional branches
|
||||
have a "TRUE" condition, because they always happen).
|
||||
|
||||
So, for each BB, its *proper* entry condition is the union of all the
|
||||
conditions associated to arcs that enter the BB. The "union" is like a
|
||||
logical "or", in the sense that either of the condition could be true,
|
||||
they are not necessarily all true. This means that if I can enter a BB
|
||||
in two ways, and in one case I know that "x>0", and in the other that
|
||||
"x==0", actually in the BB I know that "x>=0", which is a weaker
|
||||
condition (the union of the two).
|
||||
|
||||
Also, the *complete* entry condition for a BB is the "intersection" of all
|
||||
the entry conditions of its dominators. This is true because each dominator
|
||||
is the only way to reach the BB, so the entry condition of each dominator
|
||||
must be true if the control flow reached the BB. This translates to the
|
||||
logical "and" of all the "proper" conditions of the BBs met walking up in the
|
||||
dominator tree. So, if one says "x>0", and another "x==1", then I know
|
||||
that "x==1", which is a stronger condition (the intersection of the two).
|
||||
Note that, if the two conditions were "x>0" and "x==0", then the block would
|
||||
be unreachable (the intersection is empty), because some branch is impossible.
|
||||
|
||||
Another observation is that, inside each BB, every variable is subject to the
|
||||
complete entry condition of that very same BB, and not the one in which it is
|
||||
defined (with the "complete entry condition" being the thing I defined before,
|
||||
sorry if these terms "proper" and "complete" are strange, I found nothing
|
||||
better).
|
||||
This happens because the branch conditions are related to the control flow.
|
||||
I can define "i=a", and if I am in a BB where "a>0", then "i>0", but not
|
||||
otherwise.
|
||||
|
||||
So, intuitively, if the available conditions say "i>=0", and i is used as an
|
||||
index in an array access, then the lower bound check can be omitted.
|
||||
If the condition also says "(i>=0)&&(i<array.length)", the abc removal can
|
||||
occur.
|
||||
|
||||
So, a complete solution to the problem of abc removal would be the following:
|
||||
for each array access, build a system of equations containing:
|
||||
[1] all the symbolic variable definitions
|
||||
[2] the complete entry condition of the BB in which the array access occurs
|
||||
[3] the two "goal functions" ("index >=0" and "index < array.length")
|
||||
If the system is valid for *each possible* variable value, then the goal
|
||||
functions are always true, and the abc can be removed.
|
||||
|
||||
All this discussion is useful to give a precise specification to the problem
|
||||
we are trying to solve.
|
||||
The trouble is that, in the general case, the resulting system of equations
|
||||
is like a predicate in first order logic, which is semi-decidable, and its
|
||||
general solution is anyway too complex to be attempted in a JIT compiler
|
||||
(which should not contain a full fledged theorem prover).
|
||||
|
||||
Therefore, we must cut some corner.
|
||||
|
||||
|
||||
By the way, there is also another big problem, which is caused by "recursive"
|
||||
symbolic definitions. These definition can (and generally do) happen every
|
||||
time there is a loop. For instance, in the following piece of code
|
||||
|
||||
for ( int i = 0; i < array.length; i++ ) {
|
||||
Console.WriteLine( "array [i] = " + array [i] );
|
||||
}
|
||||
|
||||
one of the definitions of i is a PHI that can be either 0 or "i + 1".
|
||||
|
||||
Now, we know that mathematically "i = i + 1" does not make sense, and in
|
||||
fact symbolic values are not "equations", they are "symbolic definitions".
|
||||
|
||||
The symbolic value of i is a generic "n", where "n" is the number of
|
||||
iterations of the loop, but this is terrible to handle (and in more complex
|
||||
examples the symbolic definition of i simply cannot be written, because i is
|
||||
calculated in an iterative way).
|
||||
|
||||
However, the definition "i = i + 1" tells us something about i: it tells us
|
||||
that i "grows". So (from the PHI definition) we know that i is either 0, or
|
||||
"grows". This is enough to tell that "i>=0", which is what we want!
|
||||
It is important to note that recursive definitions can only occurr inside
|
||||
PHI definitions, because actually a variable cannot be defined *only* in terms
|
||||
of itself!
|
||||
|
||||
|
||||
At this point, I can explain which corners I want to cut to make the
|
||||
problem solvable. It will not remove all the abc that could theoretically
|
||||
be removed, but at least it will work.
|
||||
|
||||
The easiest way to cut corners is to only handle expressions which are
|
||||
"reasonably simple", and ignore the rest.
|
||||
Keep in mind that ignoring an expression is not harmful in itself.
|
||||
The algorithm will be simply "less powerful", because it will ignore
|
||||
conditions that could have caused to the removal of an abc, but will
|
||||
not remove checks "by mistake" (so the resulting code will be in any case
|
||||
correct).
|
||||
|
||||
In a first attempt, we can consider only conditions that have the simple
|
||||
possible form, which is "(compare simpleExpression simpleExpression)",
|
||||
where "simpleExpression" is either "(ldind.* local[*])" or
|
||||
"(ldlen (ldind.ref local[*]))" (or a constant, of course).
|
||||
|
||||
We can also "summarize" variable definitions, keeping only what is relevant
|
||||
to know: if they are greater or smaller than zero or other variables.
|
||||
|
||||
One particular note on PHI functions: they work (obviously) like the logical
|
||||
"or" of their definitions, and therefore are equivalent to the "logical or"
|
||||
of the summarization of their definitions.
|
||||
|
||||
About recursive definitions (which, believe me, are the worst thing in all
|
||||
this mess), we handle only "monotonic" ones. That is, we try to understand
|
||||
if the recursive definition (which, as we said above, must happen because
|
||||
of a loop) always "grows" or "gets smaller". In all other cases, we decide
|
||||
we cannot handle it.
|
||||
|
||||
So, the algorithm to optimize one method could be something like:
|
||||
|
||||
[1] Build the SSA representation.
|
||||
[2] Analyze each BB. Particularly, do the following:
|
||||
[2a] summarize its exit conditions
|
||||
[2b] summarize all the variable definitions occurring in the BB
|
||||
[2c] check if it contains array accesses (only as optimization, so that
|
||||
step 3 will be performed only when necessary)
|
||||
[3] Perform the removal. For each BB that contains array accesses, do:
|
||||
[3a] build an evaluation area where for each variable we keep track
|
||||
of its relations with zero and with each other variable.
|
||||
[3b] populate the evaluation area with the initial data (the variable
|
||||
definitions and the complete entry condition of the BB)
|
||||
[3c] propagate the relations between variables (so that from "a<b" and
|
||||
"b<c" we know that "a<c") in the evaluation area
|
||||
[3d] for each array access in the BB, use the evaluation area to "match
|
||||
conditions", to see if the goal functions are satisfied
|
||||
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
LOW LEVEL DESIGN DECISIONS
|
||||
|
||||
One of the problems I had to solve was the representation of the relations
|
||||
between symbolic values.
|
||||
The "canonical" solution would be to have a complex, potentially recursive
|
||||
data structure, somewhat similar to MonoInst, and use it all the time (maybe
|
||||
MonoInst could be used "as is").
|
||||
The problem is that, at this point, the software would have to "play" with
|
||||
these structures, for instance to deduce "b < a-1" from "a > b+1", because we
|
||||
are interested in what value b has, and not a. And maybe the software should
|
||||
be able to do this without modifying the original condition, because it was
|
||||
used elsewhere (or could be reused).
|
||||
Then, the software should also be able to apply logical relations to
|
||||
conditions (like "(a>0)||(c<1)"), and manipulate them, too.
|
||||
|
||||
In my opinion, an optimizer written in this way risks to be too complex, and
|
||||
its performance not acceptable in a JIT compiler.
|
||||
Therefore, I decided to represent values in a "summarized" way.
|
||||
For instance, "x = a + 1" becomes "x > a" (and, by the way, "x = x + 1"
|
||||
would look like "x > x", which means that "x grows").
|
||||
So, each variable value is simply a "relation" of the variable with other
|
||||
variables or constants. Anything more complex is ignored.
|
||||
Relations are represented with flags (EQ, LT and GT), so that it is easy
|
||||
to combine them logically (it is enough to perform the bitwise operations
|
||||
on the flags). The condition (EQ|LT|GT) means we know nothing special, any
|
||||
value is possible. The empty condition would mean an unreachable statement
|
||||
(because no value is acceptable).
|
||||
|
||||
There is still the problem of identifying variables, and where to store all
|
||||
these relations. After some thinking, I decided that a "brute force" approach
|
||||
is the easier, and probably also the fastest. In practice, I keep in memory
|
||||
an array of "variable relations", where for each variable I record its
|
||||
relation with the constants 0 and 1 and an array of its relations with all
|
||||
other variables. The evaluation area, therefore, looks like a square matrix
|
||||
as large as the number of variables. I *know* that the matrix is rather sparse
|
||||
(in the sense that only few of its cells are significant), but I decided that
|
||||
this data structure was the simplest and more efficient anyway. After all,
|
||||
each cell takes just one byte, and any other data structure must be some
|
||||
kind of associative array (like a g_hash_table). Such a data structue is
|
||||
difficult to use with a MonoMemPool, and in the end is slower than a plain
|
||||
array, and has the storage overhead of all the pointers... in the end, maybe
|
||||
the full matrix is not a waste at all.
|
||||
<note>
|
||||
After a few benchmarks, I clearly see that the matrix works well if the
|
||||
variables are not too much, otherwise it gets "too sparse", and much time
|
||||
is wasted in the propagation phase. Maybe the data structure could be changed
|
||||
after a more careful evaluation of the problem...
|
||||
</note>
|
||||
|
||||
With these assumptions, all the memory used to represent values, conditions
|
||||
and the evaluation area can be allocated in advance (from a MonoMemPool), and
|
||||
used for all the analysis of one method. Moreover, the performance of logical
|
||||
operations is high (they are simple bitwise operations on bytes).
|
||||
<note>
|
||||
For the propagation phase, there was a function I could not easily code
|
||||
with bitwise operations. As that phase is a real pain for the performance
|
||||
(the complexity is quadratic, and it must be executed iteratively until
|
||||
nothing changes), I decided to code it in perl, and generate a precomputed
|
||||
table then used by the C code (just 64 bytes). I think this is faster than
|
||||
all those branches... Really, I could think again to phases 3c and 3d (see
|
||||
above), maybe there is a better way to do them.
|
||||
</note>
|
||||
|
||||
Of course not all expressions can be handled by the summarization, so the
|
||||
optimizer is not as effective as a full blown theorem prover...
|
||||
|
||||
Another thing related to design... the implementation is as less intrusive
|
||||
as possible.
|
||||
I "patched" the main files to add an option for abc removal, and handle it
|
||||
just like any other option, and then wrote all the relevant code in two
|
||||
separated files (one header for data structures, and a C file for the code).
|
||||
If the patch turns out to be useful also for other pourposes (like a more
|
||||
generic "unreachable code elimination", that detects branches that will never
|
||||
be taken using the analysis of variable values), it will not be difficult
|
||||
to integrate the branch summarizations into the BasicBlock data structures,
|
||||
and so on.
|
||||
|
||||
One last thing... in some places, I knowingly coded in an inefficient way.
|
||||
For instance, "remove_abc_from_block" does something only if the flag
|
||||
"has_array_access_instructions" is true, but I call it anyway, letting it
|
||||
do nothing (calling it conditionally would be better). There are several
|
||||
things like this in the code, but I was in a hurry, and preferred to make
|
||||
the code more readable (it is already difficult to understand as it is).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
WHEN IS ABC REMOVAL POSSIBLE? WHEN IS IT USEFUL?
|
||||
|
||||
Warning! Random ideas ahead!
|
||||
|
||||
In general, managed code should be safe, so abc removal is possible only if
|
||||
there already is some branch in the method that does the check.
|
||||
So, one check on the index is "mandatory", the abc removal can only avoid a
|
||||
second one (which is useless *because* of the first one).
|
||||
If in the code there is not a conditional branch that "avoids" to access
|
||||
an array out of its bounds, in general the abc removal cannot occur.
|
||||
|
||||
It could happen, however, that one method is called from another one, and
|
||||
the check on the index is performed in the caller.
|
||||
|
||||
For instance:
|
||||
|
||||
void
|
||||
caller( int[] a, int n ) {
|
||||
if ( n <= a.Length ) {
|
||||
for ( int i = 0; i < n; i++ ) {
|
||||
callee( a, i );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void callee( int[] a, int i ) {
|
||||
Console.WriteLine( "a [i] = " + a [i] );
|
||||
}
|
||||
|
||||
|
||||
In this case, it should be possible to have two versions of the callee, one
|
||||
without checks, to be called from methods that do the check themselves, and
|
||||
another to be called otherwise.
|
||||
This kind of optimization could be profile driven: if one method is executed
|
||||
several times, wastes CPU time for bound checks, and is mostly called from
|
||||
another one, it could make sense to analyze the situation in detail.
|
||||
|
||||
However, one simple way to perform this optimization would be to inline
|
||||
the callee (so that the abc removal algorithm can see both methods at once).
|
||||
|
||||
The biggest benefits of abc removal can be seen for array accesses that
|
||||
occur "often", like the ones inside inner loops. This is why I tried to
|
||||
handle "recursive" variable definitions, because without them you cannot
|
||||
optimize inside loops, which is also where you need it most.
|
||||
|
||||
Another possible optimization (alwais related to loops) is the following:
|
||||
|
||||
void method( int[] a, int n ) {
|
||||
for ( int i = 0; i < n; i++ ) {
|
||||
Console.WriteLine( "a [i] = " + a [i] );
|
||||
}
|
||||
}
|
||||
|
||||
In this case, the check on n is missing, so the abc could not be removed.
|
||||
However, this would mean that i will be checked twice at each loop iteration,
|
||||
one against n, and the other against a.Length. The code could be transformed
|
||||
like this:
|
||||
|
||||
void method( int[] a, int n ) {
|
||||
if ( n < a.Length ) {
|
||||
for ( int i = 0; i < n; i++ ) {
|
||||
Console.WriteLine( "a [i] = " + a [i] ); // Remove abc
|
||||
}
|
||||
} else {
|
||||
for ( int i = 0; i < n; i++ ) {
|
||||
Console.WriteLine( "a [i] = " + a [i] ); // Leave abc
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
This could result in performance improvements (again, probably this
|
||||
optimization should be profile driven).
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
OPEN ISSUES
|
||||
|
||||
There are several issues that should still be addressed...
|
||||
|
||||
One is related to aliasing. For now, I decided to operate only on local
|
||||
variables, and ignore aliasing problems (and alias analisys has not yet
|
||||
been implemented anyway).
|
||||
Actually, I identified the local arrays with their length, because I
|
||||
totally ignore the contents of arrays (and objects in general).
|
||||
|
||||
Also, in several places in the code I only handle some cases, and ignore
|
||||
other more complex ones, which could anyway work (there are comments where
|
||||
this happens). Anyway, this is not harmful (the code is not as effective
|
||||
as it could be).
|
||||
|
||||
Another possible improvement is the explicit handling of all constants.
|
||||
For now, code like
|
||||
|
||||
void
|
||||
method () {
|
||||
int[] a = new int [16];
|
||||
for ( int i = 0; i < 16; i++ ) {
|
||||
a [i] = i;
|
||||
}
|
||||
}
|
||||
|
||||
is not handled, because the two constants "16" are lost when variable
|
||||
relations are summarized (actually they are not lost, they are stored in the
|
||||
summarized values, but they are not yet used correctly).
|
||||
|
||||
The worst thing, anyway, is that for now I fail completely in distinguishing
|
||||
between signed and unsigned variables/operations/conditions, and between
|
||||
different integer sizes (in bytes). I did this on pourpose, just for lack of
|
||||
time, but this can turn out to be terribly wrong.
|
||||
The problem is caused by the fact that I handle arithmetical operations and
|
||||
conditions as "ideal" operations, but actually they can overflow and/or
|
||||
underflow, giving "surprising" results.
|
||||
|
||||
For instance, look at the following two methods:
|
||||
|
||||
public static void testSignedOverflow()
|
||||
{
|
||||
Console.WriteLine( "Testing signed overflow..." );
|
||||
int[] ia = new int[70000];
|
||||
int i = 1;
|
||||
while ( i <ia.Length )
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine( " i = " + i );
|
||||
ia[i] = i;
|
||||
}
|
||||
catch ( IndexOutOfRangeException e )
|
||||
{
|
||||
Console.WriteLine( "Yes, we had an overflow (i = " + i + ")" );
|
||||
}
|
||||
i *= 60000;
|
||||
}
|
||||
Console.WriteLine( "Testing signed overflow done." );
|
||||
}
|
||||
|
||||
public static void testUnsignedOverflow()
|
||||
{
|
||||
Console.WriteLine( "Testing unsigned overflow..." );
|
||||
int[] ia = new int[70000];
|
||||
uint i = 1;
|
||||
while ( i <ia.Length )
|
||||
{
|
||||
try
|
||||
{
|
||||
Console.WriteLine( " i = " + i );
|
||||
ia[i] = (int) i;
|
||||
}
|
||||
catch ( IndexOutOfRangeException e )
|
||||
{
|
||||
Console.WriteLine( "Yes, we had an overflow (i = " + i + ")" );
|
||||
}
|
||||
i *= 60000;
|
||||
}
|
||||
Console.WriteLine( "Testing unsigned overflow done." );
|
||||
}
|
||||
|
||||
In the "testSignedOverflow" method, the exception will be thrown, while
|
||||
in the "testUnsignedOverflow" everything will go on smoothly.
|
||||
The problem is that the test "i <ia.Length" is a signed comparison in the
|
||||
first case, and will not exit from the loop if the index is negative.
|
||||
Therefore, in the first method, the abc should not be removed.
|
||||
|
||||
In practice, the abc removal code should try to predict if any given
|
||||
expression could over/under-flow, and act accordingly.
|
||||
For now, I made so that the only accepted expressions are plain increments
|
||||
and decrements of variables (which cannot over/under-flow without being
|
||||
trapped by the existing conditions). Anyway, this issue should be analyzed
|
||||
better.
|
||||
By the way, in summarizations there is a field that keeps track of the
|
||||
relation with "1", which I planned to use exactly to summarize products and
|
||||
quotients, but it is never used (as I said, only increment and decrement
|
||||
operations are properly summarized).
|
||||
|
||||
@@ -1,173 +0,0 @@
|
||||
Rules for opening shared files
|
||||
==============================
|
||||
|
||||
File is already open, with share set to none:
|
||||
|
||||
Can not open again
|
||||
|
||||
|
||||
File is already open for reading, with read share:
|
||||
|
||||
Can open for reading only, share must include read (can have write too)
|
||||
|
||||
|
||||
File is already open for reading, with write share:
|
||||
|
||||
Can open for writing only, share must include read (can have write too)
|
||||
|
||||
|
||||
File is already open for reading, with read + write share:
|
||||
|
||||
Can open for read, writing or both, share must include read (can have write too)
|
||||
|
||||
|
||||
File is already open for writing, with read share:
|
||||
|
||||
Can open for reading only, share must include write (can have read too)
|
||||
|
||||
|
||||
File is already open for writing, with write share:
|
||||
|
||||
Can open for writing only, share must include write (can have read too)
|
||||
|
||||
|
||||
File is already open for writing, with read + write share:
|
||||
|
||||
Can open for reading, writing or both, share must include write (can have read too)
|
||||
|
||||
|
||||
File is already open for reading + writing, with read share:
|
||||
|
||||
Can open for reading only, share must be read + write
|
||||
|
||||
|
||||
File is already open for reading + writing, with write share:
|
||||
|
||||
Can open for for writing only, share must be read + write
|
||||
|
||||
|
||||
File is already open for reading + writing, with read + write share:
|
||||
|
||||
Can open for read, writing or both, share must be read + write
|
||||
|
||||
|
||||
|
||||
Executive Summary
|
||||
-----------------
|
||||
|
||||
Second open must have access within first share, must set second share to at least first access
|
||||
|
||||
|
||||
|
||||
|
||||
Documenting code
|
||||
----------------
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
|
||||
int access[] = {
|
||||
GENERIC_READ,
|
||||
GENERIC_WRITE,
|
||||
GENERIC_READ | GENERIC_WRITE
|
||||
};
|
||||
|
||||
char *access_names[] = {
|
||||
"G_READ",
|
||||
"G_WRITE",
|
||||
"G_READ|G_WRITE"
|
||||
};
|
||||
|
||||
int share[] = {
|
||||
FILE_SHARE_READ,
|
||||
FILE_SHARE_WRITE,
|
||||
FILE_SHARE_READ | FILE_SHARE_WRITE
|
||||
};
|
||||
|
||||
char *share_names[] = {
|
||||
"SHARE_READ",
|
||||
"SHARE_WRITE",
|
||||
"SHARE_READ|SHARE_WRITE"
|
||||
};
|
||||
|
||||
void lockfiles(int access1, int share1, int access2, int share2)
|
||||
{
|
||||
HANDLE h1, h2;
|
||||
BOOL ret;
|
||||
|
||||
if (access2 == 0 && share2 == 0) {
|
||||
printf("\n");
|
||||
printf("%22.22s\n%22.22s", access_names[access1], share_names[share1]);
|
||||
}
|
||||
|
||||
h1 = CreateFile("lockedfile",
|
||||
access[access1],
|
||||
share[share1],
|
||||
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (h1 == INVALID_HANDLE_VALUE) {
|
||||
printf("Open1 failed: %d\n", GetLastError());
|
||||
return;
|
||||
}
|
||||
|
||||
h2 = CreateFile("lockedfile",
|
||||
access[access2],
|
||||
share[share2],
|
||||
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (h2 == INVALID_HANDLE_VALUE) {
|
||||
printf(" %4.4s", "");
|
||||
} else {
|
||||
printf(" %4.4s", "OK");
|
||||
CloseHandle(h2);
|
||||
}
|
||||
|
||||
CloseHandle(h1);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int i, j, k, l;
|
||||
|
||||
printf("\t\t\t\t\t\t\tSecond Open\n");
|
||||
printf("%22.22s G_RE G_RE G_RE G_WR G_WR G_WR G_RW G_RW G_RW\n", "");
|
||||
printf("%22.22s S_RE S_WR S_RW S_RE S_WR S_RW S_RE S_WR S_RW", "First open --v ");
|
||||
for (i = 0; i < 3; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (k = 0; k < 3; k++) {
|
||||
for (l = 0; l < 3; l++) {
|
||||
lockfiles(i, j, k, l);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Code output
|
||||
-----------
|
||||
|
||||
Second Open
|
||||
G_RE G_RE G_RE G_WR G_WR G_WR G_RW G_RW G_RW
|
||||
First open --v S_RE S_WR S_RW S_RE S_WR S_RW S_RE S_WR S_RW
|
||||
G_READ
|
||||
SHARE_READ OK OK
|
||||
G_READ
|
||||
SHARE_WRITE OK OK
|
||||
G_READ
|
||||
SHARE_READ|SHARE_WRITE OK OK OK OK OK OK
|
||||
G_WRITE
|
||||
SHARE_READ OK OK
|
||||
G_WRITE
|
||||
SHARE_WRITE OK OK
|
||||
G_WRITE
|
||||
SHARE_READ|SHARE_WRITE OK OK OK OK OK OK
|
||||
G_READ|G_WRITE
|
||||
SHARE_READ OK
|
||||
G_READ|G_WRITE
|
||||
SHARE_WRITE OK
|
||||
G_READ|G_WRITE
|
||||
SHARE_READ|SHARE_WRITE OK OK OK
|
||||
|
||||
+2
-5
@@ -375,8 +375,7 @@
|
||||
variables to registers. The linear scan pass uses the
|
||||
information that was previously gathered by the loop nesting
|
||||
and loop structure computation to favor variables in inner
|
||||
loops. This process updates the basic block `nesting' field
|
||||
which is later used during liveness analysis.
|
||||
loops.
|
||||
|
||||
Stack space is then reserved for the local variables and any
|
||||
temporary variables generated during the various
|
||||
@@ -490,9 +489,7 @@
|
||||
operations if possible.
|
||||
|
||||
The rest of the code generation is fairly simple: a switch
|
||||
statement is used to generate code for each of the MonoInsts,
|
||||
in the mono/mini/mini-ARCH.c files, the method is called
|
||||
"mono_arch_output_basic_block".
|
||||
statement is used to generate code for each of the MonoInsts
|
||||
|
||||
We always try to allocate code in sequence, instead of just using
|
||||
malloc. This way we increase spatial locality which gives a massive
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
<h1>Mono 1.0 Release Notes</h1>
|
||||
|
||||
<h2>What does Mono Include</h2>
|
||||
|
||||
<h2>Missing functionality</h2>
|
||||
|
||||
<p>COM support.
|
||||
|
||||
<p>EnterpriseServices are non-existant.
|
||||
|
||||
<p>Windows.Forms is only available as a preview, it is not
|
||||
completed nor stable.
|
||||
|
||||
<h3>Assembly: System.Drawing</h3>
|
||||
|
||||
<p>System.Drawing.Printing is not supported.
|
||||
@@ -1,3 +0,0 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
@@ -1,16 +0,0 @@
|
||||
2004-05-05 Zoltan Varga <[email protected]>
|
||||
|
||||
* mono-jni.c: Implement some missing JNI functions.
|
||||
|
||||
2004-04-13 Zoltan Varga <[email protected]>
|
||||
|
||||
* mono-jni.c: Use <stdarg.h> instead of <varargs.h>.
|
||||
|
||||
2004-04-12 Zoltan Varga <[email protected]>
|
||||
|
||||
* mono-jni.c: Fix compilation under gcc 2.95 + fix warnings.
|
||||
|
||||
2004-04-07 Zoltan Varga <[email protected]>
|
||||
|
||||
* mono-jni.c Makefile.am: New files.
|
||||
|
||||
@@ -1,15 +0,0 @@
|
||||
|
||||
INCLUDES = \
|
||||
-I$(top_srcdir) \
|
||||
$(IKVM_JNI_CFLAGS) \
|
||||
$(GMODULE_CFLAGS) \
|
||||
$(GLIB_CFLAGS)
|
||||
|
||||
if JIT_SUPPORTED
|
||||
|
||||
lib_LTLIBRARIES = libmono-ikvm-jni.la
|
||||
endif
|
||||
|
||||
libmono_ikvm_jni_la_SOURCES = mono-jni.c
|
||||
libmono_ikvm_jni_la_LIBADD = $(top_builddir)/mono/mini/libmono.la
|
||||
|
||||
-1263
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -1,5 +1,5 @@
|
||||
man_MANS = mcs.1 mono.1 monostyle.1 mono-config.5 sqlsharp.1 oldmono.1 ilasm.1 \
|
||||
cert2spc.1 cilc.1 genxs.1 wsdl.1 disco.1 soapsuds.1 makecert.1 \
|
||||
chktrust.1 setreg.1 sn.1 secutil.1 signcode.1 certmgr.1 monop.1 xsd.1 gacutil.1
|
||||
chktrust.1 setreg.1 sn.1 secutil.1 signcode.1 certmgr.1 monop.1
|
||||
|
||||
EXTRA_DIST = $(man_MANS)
|
||||
@@ -44,25 +44,6 @@ More details displayed on the console.
|
||||
.TP
|
||||
.I "-help", "-h", "-?", "/?"
|
||||
Display help about this tool.
|
||||
.SH FILES
|
||||
.B WARNING: This details the current behavior of Mono and could change between releases.
|
||||
The only safe way to interact with certificate stores is to use the certmgr
|
||||
tool. The current releases of Mono keeps all the user certificate stores in
|
||||
separates directories under
|
||||
.I ~/.mono/certs/
|
||||
.TP
|
||||
For example the trusted root certificates for a user would be kept under
|
||||
.I ~/.mono/certs/Trust/
|
||||
.TP
|
||||
Certificates files are kept in DER (binary) format (extension .cer).
|
||||
.TP
|
||||
The filenames either starts with
|
||||
.I tbp
|
||||
(thumbprint) or
|
||||
.I ski
|
||||
(subject key identifier).
|
||||
.TP
|
||||
The rest of the filename is the base64-encoded value (tbp or ski).
|
||||
.SH AUTHOR
|
||||
Written by Sebastien Pouliot
|
||||
.SH COPYRIGHT
|
||||
|
||||
+5
-14
@@ -1,9 +1,8 @@
|
||||
.\"
|
||||
.\" chktrust manual page.
|
||||
.\" Copyright 2003 Motus Technologies
|
||||
.\" Copyright 2004 Novell
|
||||
.\" Author:
|
||||
.\" Sebastien Pouliot (sebastien@ximian.com)
|
||||
.\" Sebastien Pouliot (spouliot@motus.com)
|
||||
.\"
|
||||
.TH Mono "chktrust"
|
||||
.SH NAME
|
||||
@@ -14,33 +13,25 @@ chktrust \- Check the trust of a PE executable.
|
||||
.SH DESCRIPTION
|
||||
Verify if an PE executable (CLR assembly, Win32 EXE or DLL) has a valid
|
||||
Authenticode(r) signature that can be traced back to a trusted certificate
|
||||
authority (CA). This means that
|
||||
.TP
|
||||
(a) the signature is valid (i.e. file integrity) and,
|
||||
.TP
|
||||
(b) the code-signing certificate can be chained back to one of the
|
||||
certificates in the Trust store.
|
||||
authority (CA).
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.I "-q", "-quiet"
|
||||
Quiet mode. Limited display on console.
|
||||
Limited display on console.
|
||||
.TP
|
||||
.I "-v", "-verbose"
|
||||
Verbose mode. More details displayed on the console.
|
||||
More details displayed on the console.
|
||||
.TP
|
||||
.I "-help", "-h", "-?", "/?"
|
||||
Display help about this tool.
|
||||
.SH KNOWN RESTRICTIONS
|
||||
chktrust cannot validate Authenticode signatures on CAB files.
|
||||
.SH AUTHOR
|
||||
Written by Sebastien Pouliot
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 2003 Motus Technologies.
|
||||
Copyright (C) 2004 Novell.
|
||||
Released under BSD license.
|
||||
.SH MAILING LISTS
|
||||
Visit http://mail.ximian.com/mailman/mono-list for details.
|
||||
.SH WEB SITE
|
||||
Visit: http://www.go-mono.com for details
|
||||
.SH SEE ALSO
|
||||
.BR signcode(1), makecert(1), certmgr(1), setreg(1)
|
||||
.BR signcode(1), makecert(1)
|
||||
@@ -1,87 +0,0 @@
|
||||
..\"
|
||||
.\" gacutil manual page.
|
||||
.\" (C) 2004 Novell, Inc.
|
||||
.\" Author:
|
||||
.\" Miguel de Icaza ([email protected])
|
||||
.\"
|
||||
.de Sp \" Vertical space (when we can't use .PP)
|
||||
.if t .sp .5v
|
||||
.if n .sp
|
||||
..
|
||||
.TH gacutil "Mono 1.0"
|
||||
.SH NAME
|
||||
gacutil \- Global Asssembly Cache management utility.
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
.B gacutil [-user] [command] [options]
|
||||
.SH DESCRIPTION
|
||||
\fIgacutil\fP is a tool used by developers to install assemblies into
|
||||
the system Global Assembly Cache (GAC) to become part of the
|
||||
assemblies that are available for all applications at runtime.
|
||||
.PP
|
||||
Notice that they are not directly available to the compiler, the
|
||||
convention is that assemblies must also be placed in a separate
|
||||
directory for being accessed to the compiler. This is done with the
|
||||
-package directive to gacutil.
|
||||
.PP
|
||||
The tool allows for installationl, removal, and listing of the
|
||||
contents of the assembly cache.
|
||||
.PP
|
||||
The GAC is relative to the Mono installation prefix:
|
||||
mono_prefix/lib/mono.
|
||||
.SH FLAGS
|
||||
The "-user" flag enables you to install/remove the assembly into the
|
||||
user's assembly cache, as opposed to the global one.
|
||||
.PP
|
||||
.SH COMMANDS
|
||||
.I "-i path_to_assembly" [-f] [-root ROOTDIR] [-package NAME]
|
||||
.Sp
|
||||
The above installs the assembly into the GAC, use the -f flag to force
|
||||
an installation an overwrite anything in there.
|
||||
.Sp
|
||||
The -package option can be used to also create a directory in in
|
||||
prefix/lib/mono with the name NAME, and a symlink is created from
|
||||
NAME/assembly_name to the assembly on the GAC. This is used so
|
||||
developers can reference a set of libraries at once.
|
||||
.Sp
|
||||
The -root option is used by developers integrating this with automake
|
||||
tools or packaging tools that require a prefix directory to be
|
||||
specified. The root represents the "libdir" component of a prefix
|
||||
(typically prefix/lib).
|
||||
.fi
|
||||
.PP
|
||||
.I "-l"
|
||||
.Sp
|
||||
Lists the contents of the Global Assembly Cache
|
||||
.PP
|
||||
.I "-u assembly_name [-root]"
|
||||
.Sp
|
||||
The above removes the given assembly name from the Global Assembly
|
||||
Cache. As opposed to the install option that takes a filename, this
|
||||
takes as an argument the assembly name, which looks like this:
|
||||
.nf
|
||||
MyLibrary.Something, version=1.0.0.0, publicKeyToken=xxxx,culture=neutral
|
||||
.fi
|
||||
.Sp
|
||||
Notice that you can have spaces in the command line, there is no need
|
||||
to quote them.
|
||||
.Sp
|
||||
The removal performs a greedy removal, if you only specifiy one
|
||||
component like, "MyLibrary.Something", it will remove all versions of
|
||||
the library.
|
||||
.SH FILES
|
||||
On Unix assemblies are loaded from the installation lib directory. If you set
|
||||
`prefix' to /usr, the assemblies will be located in /usr/lib. On
|
||||
Windows, the assemblies are loaded from the directory where mono and
|
||||
mint live.
|
||||
.PP
|
||||
/etc/mono/config, ~/.mono/config
|
||||
.PP
|
||||
Mono runtime configuration file. See the mono-config(5) manual page
|
||||
for more information.
|
||||
.SH WEB SITE
|
||||
Visit: http://www.go-mono.com for details
|
||||
.SH SEE ALSO
|
||||
.BR mcs(1), mono(1)
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@ CIL byte code that can be executed by any system that implemented a Common
|
||||
Language Infrastructure virtual machine.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \//output:<file_name>
|
||||
.B \//out:<file_name>
|
||||
Specify the output file name.
|
||||
.TP
|
||||
.B \//exe
|
||||
|
||||
+44
-85
@@ -1,16 +1,15 @@
|
||||
.\"
|
||||
.\" makecert manual page.
|
||||
.\" Copyright 2003 Motus Technologies
|
||||
.\" Copyright 2004 Novell
|
||||
.\" Author:
|
||||
.\" Sebastien Pouliot (sebastien@ximian.com)
|
||||
.\" Sebastien Pouliot (spouliot@motus.com)
|
||||
.\"
|
||||
.TH Mono "MakeCert"
|
||||
.SH NAME
|
||||
MakeCert \- Create X.509 certificates for test purposes
|
||||
.SH SYNOPSIS
|
||||
.PP
|
||||
.B makecert [options] certificate
|
||||
.B MakeCert [options] certificate
|
||||
.SH DESCRIPTION
|
||||
Create an X.509 certificate using the provided informations. This
|
||||
is useful for testing Authenticode signatures, SSL and S/MIME
|
||||
@@ -18,108 +17,68 @@ technologies.
|
||||
.SH PARAMETERS
|
||||
.TP
|
||||
.I "-# num"
|
||||
Specify the certificate serial number.
|
||||
Certificate serial number
|
||||
.TP
|
||||
.I "-n dn"
|
||||
Specify the subject Distinguished Name (DN).
|
||||
Subject Distinguished Name
|
||||
.TP
|
||||
.I "-in dn"
|
||||
Specify the issuer Distinguished Name (DN).
|
||||
Issuert Distinguished Name
|
||||
.TP
|
||||
.I "-r"
|
||||
Create a self-signed, also called root, certificate.
|
||||
.TP
|
||||
.I "-iv pvkfile"
|
||||
Specify the private key file (.PVK) for the issuer. The private key in the
|
||||
specified file will be used to sign the new certificate.
|
||||
.TP
|
||||
.I "-ic certfile"
|
||||
Extract the issuer's name from the specified certificate file - i.e. the
|
||||
subject name of the specified certificate becomes the issuer name of the
|
||||
new certificate.
|
||||
.TP
|
||||
.I "-in name"
|
||||
Use the issuer's name from the specified parameter.
|
||||
.TP
|
||||
.I "-ik container"
|
||||
Specify the key container name to be used for the issuer.
|
||||
.TP
|
||||
.I "-iky [signature | exchange | #]"
|
||||
Specify the key number to be used in the provider (when used with -ik).
|
||||
.TP
|
||||
.I "-ip provider"
|
||||
Specify the cryptographic provider to be used for the issuer.
|
||||
.TP
|
||||
.I "-ir [localmachine | currentuser]"
|
||||
Specify the provider will search the user or the machine keys containers for
|
||||
the issuer.
|
||||
.TP
|
||||
.I "-iy number"
|
||||
Specify the provider type to be used for the issuer.
|
||||
Create a self-signed (root) certificate
|
||||
.TP
|
||||
.I "-sv pkvfile"
|
||||
Specify the private key file (.PVK) for the subject. The public part of the
|
||||
key will be inserted into the created certificate. If non-existant the
|
||||
specified file will be created with a new key pair (default to 1024 bits RSA
|
||||
key pair).
|
||||
Private key file (.PVK) for the subject (created if missing)
|
||||
.TP
|
||||
.I "-sk container"
|
||||
Specify the key container name to be used for the subject.
|
||||
.I "-iv pvkfile"
|
||||
Private key file (.PVK) for the issuer
|
||||
.TP
|
||||
.I "-sky [signature | exchange | #]"
|
||||
Specify the key number to be used in the provider (when used with -sk).
|
||||
.TP
|
||||
.I "-sp provider"
|
||||
Specify the cryptographic provider to be used for the subject.
|
||||
.TP
|
||||
.I "-sr [localmachine | currentuser]"
|
||||
Specify the provider will search the user or the machine keys containers for
|
||||
the subject.
|
||||
.TP
|
||||
.I "-sy number"
|
||||
Specify the provider type to be used for the issuer.
|
||||
.TP
|
||||
.I "-a hash"
|
||||
Select hash algorithm. Only MD5 and SHA1 algorithms are supported.
|
||||
.TP
|
||||
.I "-b date"
|
||||
The date since when the certificate is valid (notBefore).
|
||||
.TP
|
||||
.I "-e date"
|
||||
The date until when the certificate is valid (notAfter).
|
||||
.TP
|
||||
.I "-m number"
|
||||
Specify the certificate validity period in months. This is added to the
|
||||
notBefore validity date which can be set with -b or will default to the
|
||||
current date/time.
|
||||
.TP
|
||||
.I "-cy [authority|end]"
|
||||
Basic constraints. Select Authority or End-Entity certificate. Only Authority
|
||||
certificates can be used to sign other certificates (-ic). End-Entity can
|
||||
be used by clients (e.g. Authenticode, S/MIME) or servers (e.g. SSL).
|
||||
.TP
|
||||
.I "-h number"
|
||||
Add a path length restriction to the certificate chain. This is only
|
||||
applicable for certificates that have BasicConstraint set to Authority (-cy
|
||||
authority). This is used to limit the chain of certificates than can be
|
||||
issued under this authority.
|
||||
.TP
|
||||
.I "-eku oid[,oid]"
|
||||
Add some extended key usage OID to the certificate.
|
||||
.I "-ic certfile"
|
||||
Extract the issuer's name from the specified certificate
|
||||
.TP
|
||||
.I "-?"
|
||||
Help (display this help message)
|
||||
.TP
|
||||
.I "-!"
|
||||
Extended help (for advanced options)
|
||||
.SH KNOWN RESTRICTIONS
|
||||
Compared to the Windows version some options aren't supported (-$, -d, -l,
|
||||
-nscp, -is, -sc, -ss). Also PVK files with passwords aren't supported.
|
||||
.TP
|
||||
.I "-a hash"
|
||||
Select hash algorithm. Only MD5 and SHA1 are supported.
|
||||
.TP
|
||||
.I "-b date"
|
||||
The date since when the certificate is valid (notBefore).
|
||||
.TP
|
||||
.I "-cy [authority|end]"
|
||||
Basic constraints. Select Authority or End-Entity certificate.
|
||||
.TP
|
||||
.I "-e date"
|
||||
The date until when the certificate is valid (notAfter).
|
||||
.TP
|
||||
.I "-eku oid[,oid]"
|
||||
Add some extended key usage OID to the certificate.
|
||||
.TP
|
||||
.I "-h number"
|
||||
Add a path length restriction to the certificate chain.
|
||||
.TP
|
||||
.I "-ic cert"
|
||||
Take the issuer's name from the specified certificate.
|
||||
.TP
|
||||
.I "-in name"
|
||||
Take the issuer's name from the specified parameter.
|
||||
.TP
|
||||
.I "-iv pvkfile"
|
||||
Sign the certificate using the private key inside the PVK file.
|
||||
.TP
|
||||
.I "-m number"
|
||||
Certificate validity period (in months).
|
||||
.TP
|
||||
.I "-sv pvkfile"
|
||||
Create a new PVK file if non-existant, otherwise use the PVK file as the subject public key.
|
||||
.SH AUTHOR
|
||||
Written by Sebastien Pouliot
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 2003 Motus Technologies.
|
||||
Copyright (C) 2004 Novell.
|
||||
Released under BSD license.
|
||||
.SH MAILING LISTS
|
||||
Visit http://mail.ximian.com/mailman/mono-list for details.
|
||||
|
||||
@@ -20,5 +20,4 @@
|
||||
<manpage name="soapsuds" page="soapsuds.1" />
|
||||
<manpage name="setreg" page="setreg.1" />
|
||||
<manpage name="certmgr" page="certmgr.1" />
|
||||
<manpage name="xsd" page="xsd.1" />
|
||||
</manpages>
|
||||
@@ -70,21 +70,6 @@ resource.
|
||||
.I \-debug-
|
||||
Do not generate debugging information.
|
||||
.TP
|
||||
.I \-delaysign+
|
||||
Only embed the strongname public key into the assembly. The actual
|
||||
signing must be done in a later stage using the SN tool. This is useful
|
||||
to protect the private key during development. Note that delay signing
|
||||
can only be done using a strongname key file (not a key container). The
|
||||
option is equivalent to including [assembly: AssemblyDelaySign (true)]
|
||||
in your source code. Compiler option takes precedence over the
|
||||
attributes.
|
||||
.TP
|
||||
.I \-delaysign-
|
||||
Default. Strongname (sign) the assembly using the strong name key file
|
||||
(or container). The option is equivalent to including [assembly:
|
||||
AssemblyDelaySign (false)] in your source code. Compiler option takes
|
||||
precedence over the attributes.
|
||||
.TP
|
||||
.I \-\-expect-error X L
|
||||
The compiler will expect the code to generate an error
|
||||
named `X' in line `L'. This is only used by the test suite.
|
||||
@@ -93,20 +78,9 @@ named `X' in line `L'. This is only used by the test suite.
|
||||
This is used for debugging the compiler. This makes the error emission
|
||||
generate an exception that can be caught by a debugger.
|
||||
.TP
|
||||
.I \-keyfile:KEYFILE
|
||||
Strongname (sign) the output assembly using the key pair present in
|
||||
the specified strong name key file (snk). A full key pair is required
|
||||
by default (or when using delaysign-). A file containing only the
|
||||
public key can be used with delaysign+. The option is equivalent to
|
||||
including [assembly: AssemblyKeyFile ("KEYFILE")] in your source code.
|
||||
Compiler option takes precedence over the attributes.
|
||||
.TP
|
||||
.I \-keycontainer:CONTAINER
|
||||
Strongname (sign) the output assembly using the key pair present in
|
||||
the specified container. Note that delaysign+ is ignored when using
|
||||
key containers. The option is equivalent to including [assembly:
|
||||
AssemblyKeyName ("CONTAINER")] in your source code. Compiler option
|
||||
takes precedence over the attributes.
|
||||
.I \-\-stacktrace
|
||||
Generates a stack trace at the time the error is reported, useful for
|
||||
debugging the compiler.
|
||||
.TP
|
||||
.I -lib:PATHLIST
|
||||
Each path specified in the comma-separated list will direct the
|
||||
@@ -116,10 +90,6 @@ compiler to look for libraries in that specified path.
|
||||
Directs the compiler to look for libraries in the specified path.
|
||||
Multiple paths can be provided by using the option multiple times.
|
||||
.TP
|
||||
.I \-main:CLASS
|
||||
Tells the compiler which CLASS contains the entry point. Useful when
|
||||
you are compiling several classes with a Main method.
|
||||
.TP
|
||||
.I \-nostdlib, -nostdlib+
|
||||
Use this flag if you want to compile the core library. This makes the
|
||||
compiler load its internal types from the assembly being compiled.
|
||||
@@ -138,16 +108,6 @@ Names the output file to be generated.
|
||||
.I \-\-parse
|
||||
Used for benchmarking. The compiler will only parse its input files.
|
||||
.TP
|
||||
.I \-pkg:package1[,packageN]
|
||||
The compiler will invoke pkg-config --libs on the set of packages
|
||||
specified on the command line to obtain libraries and directories to
|
||||
compile the code.
|
||||
.PP
|
||||
This is typically used with third party components, like this:
|
||||
.nf
|
||||
$ mcs -pkg:gtk-sharp demo.cs
|
||||
.fi
|
||||
.TP
|
||||
.I -resource:RESOURCE[,ID]
|
||||
Embeds to the given resource file. The optional ID can be used to
|
||||
give a different name to the resource. If not specified, the resource
|
||||
@@ -171,13 +131,9 @@ Does recursive compilation using the specified pattern. In Unix the
|
||||
shell will perform globbing, so you migth want to use it like this:
|
||||
.PP
|
||||
.nf
|
||||
$ mcs -recurse:'*.cs'
|
||||
bash$ mcs -recurse:'*.cs'
|
||||
.fi
|
||||
.TP
|
||||
.I \-\-stacktrace
|
||||
Generates a stack trace at the time the error is reported, useful for
|
||||
debugging the compiler.
|
||||
.TP
|
||||
.I \-target:KIND, \-t:KIND
|
||||
Used to specify the desired target. The possible values are: exe
|
||||
(plain executable), winexe (Windows.Forms executable), library
|
||||
@@ -264,7 +220,7 @@ Please read the accompanying `COPYING' file for details. Alternative
|
||||
licenses are available from Ximian.
|
||||
.PP
|
||||
.SH SEE ALSO
|
||||
mono(1), mint(1), sn(1)
|
||||
mono(1), mint(1)
|
||||
.PP
|
||||
.SH BUGS
|
||||
To report bugs in the compiler, you can use `bug-buddy', or you can
|
||||
|
||||
+2
-22
@@ -46,19 +46,6 @@ This option is used to precompile the CIL code in the specified
|
||||
assembly to native code. The generated code is stored in a file with
|
||||
the extension .so. This file will be automatically picked up by the
|
||||
runtime when the assembly is executed.
|
||||
.Sp
|
||||
Ahead-of-Time compilation is most useful if you use it in combination
|
||||
with the -O=all,-shared flag which enables all of the optimizations in
|
||||
the code generator to be performed. Some of those optimizations are
|
||||
not practical for Just-in-Time compilation since they might be very
|
||||
time consuming.
|
||||
.Sp
|
||||
Unlike the .NET Framework, Ahead-of-Time compilation will not generate
|
||||
domain independent code: it generates the same code that the
|
||||
Just-in-Time compiler would produce. Since most applications use a
|
||||
single domain, this is fine. If you want to optimize the generated
|
||||
code for use in multi-domain applications, consider using the
|
||||
-O=shared flag.
|
||||
.Sp
|
||||
This pre-compiles the methods, but the original assembly is still
|
||||
required to execute as this one contains the metadata and exception
|
||||
@@ -254,10 +241,8 @@ environment variable.
|
||||
.TP
|
||||
.I "MONO_DEBUG"
|
||||
If set, enables some features of the runtime useful for debugging.
|
||||
It makes the runtime display the stack traces for all the threads
|
||||
running and exit when mono is interrupted (Ctrl-C) and print some
|
||||
additional messages on error conditions. It may not exit cleanly. Use at
|
||||
your own risk.
|
||||
Currently it only makes the runtime display the stack traces for all the
|
||||
threads running and exit. It may not exit cleanly. Use at your own risk.
|
||||
.TP
|
||||
.I "MONO_DISABLE_AIO"
|
||||
If set, tells mono NOT to attempt using native asynchronous I/O services. In
|
||||
@@ -306,11 +291,6 @@ managed implementation on error.
|
||||
.I "MONO_CODEDOM_NODELETE"
|
||||
If set to any value, the C# CodeDom compiler will not remove the temporary
|
||||
source files generated.
|
||||
.TP
|
||||
.I "MONO_EGD_SOCKET"
|
||||
For platforms that do not otherwise have a way of obtaining random bytes
|
||||
this can be set to the name of a file system socket on which an egd or
|
||||
prngd daemon is listening.
|
||||
.SH FILES
|
||||
On Unix assemblies are loaded from the installation lib directory. If you set
|
||||
`prefix' to /usr, the assemblies will be located in /usr/lib. On
|
||||
|
||||
+3
-3
@@ -16,16 +16,16 @@ parameters used in Mono.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.I "-q"
|
||||
Quiet mode. Limited display on console.
|
||||
Limited display on console.
|
||||
.TP
|
||||
.I "-help", "-h", "-?", "/?"
|
||||
Display help about this tool.
|
||||
.SH FEATURES
|
||||
.TP
|
||||
.I "1"
|
||||
Trust the test root certificates (both Microsoft and Mono). Depending on the
|
||||
Trust the test root certificates (both Micrsoft and Mono). Depending on the
|
||||
value this will add (TRUE) or remove (FALSE) the two self-signed certificates
|
||||
from the current user Trust store.
|
||||
from the current user Trust store (~/.mono/certs/Trust/).
|
||||
.SH AUTHOR
|
||||
Written by Sebastien Pouliot
|
||||
.SH COPYRIGHT
|
||||
|
||||
+3
-15
@@ -1,9 +1,8 @@
|
||||
.\"
|
||||
.\" signcode manual page.
|
||||
.\" Copyright 2003 Motus Technologies
|
||||
.\" Copyright 2004 Novell
|
||||
.\" Author:
|
||||
.\" Sebastien Pouliot (sebastien@ximian.com)
|
||||
.\" Sebastien Pouliot (spouliot@motus.com)
|
||||
.\"
|
||||
.TH Mono "signcode"
|
||||
.SH NAME
|
||||
@@ -14,8 +13,7 @@ signcode \- Digitally sign an PE executable using an X.509 certificate.
|
||||
.SH DESCRIPTION
|
||||
Digitally sign an PE executable (CLR assembly, Win32 EXE or DLL) using an
|
||||
X.509 certificate and it's associated private key. The signature is compatible
|
||||
with Authenticode(r) and can be validated with chktrust (either on Windows or
|
||||
on any platform supported by Mono).
|
||||
with Authenticode(r) and can be validated with chktrust.
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.I "-spc spcfile"
|
||||
@@ -50,7 +48,7 @@ had a valid (non-expired) certificate when the PE executable was signed.
|
||||
.I "-tr #"
|
||||
Number of retries to get a timestamp for the countersignature.
|
||||
.TP
|
||||
.I "-tw #"
|
||||
.I "-td #"
|
||||
Delay (in seconds) between the retries to get a timestamp for the countersignature.
|
||||
.TP
|
||||
.I "-k name"
|
||||
@@ -70,20 +68,10 @@ CryptoAPI key location (when not using -v).
|
||||
.TP
|
||||
.I "-help", "-h", "-?", "/?"
|
||||
Display help about this tool.
|
||||
.SH OTHER CODE SIGNING TECHNOLOGIES
|
||||
Assemblies are PE files that can also be strongnamed using the sn.exe tool. The
|
||||
order of code signature is important if a file requires both an Authenticode
|
||||
and a strongname signature. Strongname must be applied before the Authenticode
|
||||
signature. Applying a strongname after the Authenticode signature, like
|
||||
re-signing an assembly (e.g. delay-sign), will invalidate the Authenticode
|
||||
signature.
|
||||
.SH KNOWN RESTRICTIONS
|
||||
signcode cannot generate Authenticode signatures for CAB files.
|
||||
.SH AUTHOR
|
||||
Written by Sebastien Pouliot
|
||||
.SH COPYRIGHT
|
||||
Copyright (C) 2003 Motus Technologies.
|
||||
Copyright (C) 2004 Novell.
|
||||
Released under BSD license.
|
||||
.SH MAILING LISTS
|
||||
Visit http://mail.ximian.com/mailman/mono-list for details.
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
.\" xsd manual page.
|
||||
.\" (C) 2004 Novell, Inc.
|
||||
.\" Author:
|
||||
.\" Lluis Sanchez Gual ([email protected])
|
||||
.\"
|
||||
.TH "xsd" "1" "" "" ""
|
||||
.SH "NAME"
|
||||
xsd \- Mono's utility for generating schema or class files
|
||||
.SH "SYNOPSIS"
|
||||
.PP
|
||||
.B xsd
|
||||
<schema.xsd> /classes [options]
|
||||
.PP
|
||||
.B xsd
|
||||
<schema.xsd> /dataset [options]
|
||||
.PP
|
||||
.B xsd
|
||||
<assembly>.dll|<assembly>.exe [options]
|
||||
.PP
|
||||
.B xsd
|
||||
<instance.xml> [<instance.xml> ...] [options]
|
||||
.PP
|
||||
.SH "DESCRIPTION"
|
||||
.I xsd
|
||||
is a tool for intended to complement the XML serialization support of Mono. It can do the following tasks:
|
||||
.TP
|
||||
Generate serializable classes
|
||||
From a given XML schema, generate a class that can be used to read and write xml documents that conform that schema (/classes option).
|
||||
.TP
|
||||
Generate typed datasets
|
||||
From a given XML schema, generate a typed DataSet class that can be used to read and write xml documents that conform that schema (/dataset option).
|
||||
.TP
|
||||
Generate XML schemas
|
||||
From a given assembly and an optional type name, generate an XML schema that can be used to validate the xml documents that can be obtained by serializing objects of that type. If no type is provided, xsd generates a schema for all types in the assembly. When specifying the assembly name do not include the file extension (.dll or .exe). xsd will look for the assembly using the standard assembly loading rules.
|
||||
.TP
|
||||
Infer XML schemas
|
||||
From a given set of XML documents, infer the XML schema that can be used to validate those documents.
|
||||
|
||||
.SH "OPTIONS"
|
||||
The following options are available:
|
||||
.TP
|
||||
.I "/element:name" "/e:name"
|
||||
Specifies the name of the XML schema element for which a class or a dataset has to be generated.
|
||||
.TP
|
||||
.TP
|
||||
.I "/namespace:name" "/n:name"
|
||||
Specifies the namespace of the XML schema element for which a class or a dataset has to be generated.
|
||||
.TP
|
||||
.I "/language:name" "/l:name"
|
||||
Specifies the programming language to use for the generated code. The only supported languages are CS (C#) and VB (Visual Basic.NET).
|
||||
.TP
|
||||
.I "/generator:type,assembly" "/g:type,assembly"
|
||||
Indicates xsd.exe to use custom CodeDomProvider to generate code. Type name must be full name. Assembly name is file name that xsd.exe tries to load.
|
||||
.TP
|
||||
.I "/outputdir:path" "/o:path"
|
||||
Specifies the directory where to generate the code or schemas.
|
||||
.TP
|
||||
.I "/type:name" "/t:name"
|
||||
Specifies the full name of the type (including namespace) for which to generate the XML schema.
|
||||
.TP
|
||||
.I "/help" "/h"
|
||||
Show usage help.
|
||||
.PP
|
||||
.SH "AUTHORS"
|
||||
Lluis Sanchez Gual ([email protected])
|
||||
.br
|
||||
Atsushi Enomoto ([email protected])
|
||||
.PP
|
||||
.SH "LICENSE"
|
||||
xsd is released under the terms of the GNU GPL.
|
||||
.PP
|
||||
.SH "SEE ALSO"
|
||||
disco(1), soapsuds(1), mono(1), mcs(1), wsdl(1)
|
||||
@@ -0,0 +1,3 @@
|
||||
y.output
|
||||
cs-parser.cs
|
||||
*.dll
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: AssemblyVersion("0.94")]
|
||||
[assembly: AssemblyVersion("0.31.99")]
|
||||
[assembly: AssemblyTitle ("Mono C# Compiler")]
|
||||
[assembly: AssemblyDescription ("Mono C# Compiler")]
|
||||
[assembly: AssemblyDescription ("Mono C# Compiler with Generics")]
|
||||
[assembly: AssemblyCopyright ("2001, 2002, 2003 Ximian, Inc.")]
|
||||
[assembly: AssemblyCompany ("Ximian, Inc.")]
|
||||
+1061
-1588
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,121 @@
|
||||
thisdir := gmcs
|
||||
SUBDIRS :=
|
||||
include ../build/rules.make
|
||||
|
||||
COMPILER_SOURCES = \
|
||||
AssemblyInfo.cs \
|
||||
anonymous.cs \
|
||||
assign.cs \
|
||||
attribute.cs \
|
||||
driver.cs \
|
||||
cs-tokenizer.cs \
|
||||
cfold.cs \
|
||||
class.cs \
|
||||
codegen.cs \
|
||||
const.cs \
|
||||
constant.cs \
|
||||
convert.cs \
|
||||
decl.cs \
|
||||
delegate.cs \
|
||||
enum.cs \
|
||||
ecore.cs \
|
||||
expression.cs \
|
||||
flowanalysis.cs \
|
||||
generic.cs \
|
||||
iterators.cs \
|
||||
literal.cs \
|
||||
location.cs \
|
||||
modifiers.cs \
|
||||
namespace.cs \
|
||||
parameter.cs \
|
||||
pending.cs \
|
||||
report.cs \
|
||||
rootcontext.cs \
|
||||
statement.cs \
|
||||
support.cs \
|
||||
typemanager.cs \
|
||||
symbolwriter.cs \
|
||||
tree.cs
|
||||
|
||||
all_sources = $(COMPILER_SOURCES) cs-parser.cs
|
||||
|
||||
DISTFILES = \
|
||||
$(COMPILER_SOURCES) \
|
||||
compiler.csproj \
|
||||
compiler.csproj.user \
|
||||
compiler.doc \
|
||||
compiler.sln \
|
||||
cs-parser.jay \
|
||||
mcs.exe.config \
|
||||
NOTES \
|
||||
TODO
|
||||
|
||||
all-local: gmcs.exe
|
||||
|
||||
install-local: gmcs.exe
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(prefix)/bin
|
||||
$(INSTALL_BIN) gmcs.exe $(DESTDIR)$(prefix)/bin
|
||||
|
||||
uninstall-local:
|
||||
-rm -f $(DESTDIR)$(prefix)/bin/mcs.exe
|
||||
|
||||
test-local run-test-local:
|
||||
|
||||
clean-local:
|
||||
rm -f *.exe *.pdb cs-parser.cs y.output
|
||||
|
||||
dist-local: dist-default
|
||||
|
||||
gmcs.exe: $(all_sources)
|
||||
$(BOOT_COMPILE) /target:exe /out:$@ $^
|
||||
|
||||
cs-parser.cs: cs-parser.jay $(topdir)/jay/skeleton.cs
|
||||
$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $< >$@
|
||||
|
||||
# Testing targets
|
||||
|
||||
TIME =
|
||||
|
||||
# This used to be called test, but that conflicts with the global
|
||||
# recursive target.
|
||||
|
||||
btest: mcs2.exe mcs3.exe
|
||||
ls -l mcs2.exe mcs3.exe
|
||||
|
||||
mcs2.exe: gmcs.exe
|
||||
$(TIME) $(RUNTIME) ./gmcs.exe $(USE_MCS_FLAGS) /target:exe /out:$@ $(all_sources)
|
||||
|
||||
mcs3.exe: mcs2.exe
|
||||
$(TIME) $(RUNTIME) ./mcs2.exe $(USE_MCS_FLAGS) /target:exe /out:$@ $(all_sources)
|
||||
|
||||
wc:
|
||||
wc -l $(all_sources)
|
||||
|
||||
ctest:
|
||||
-rm mcs2.exe mcs3.exe
|
||||
make btest USE_MCS_FLAGS=
|
||||
|
||||
# we need this because bash tries to use its own crappy timer
|
||||
FRIENDLY_TIME = $(shell which time) -f'%U seconds'
|
||||
|
||||
do-time : mcs.exe
|
||||
@ echo -n "Run 1: "
|
||||
$(FRIENDLY_TIME) $(RUNTIME) ./mcs.exe $(USE_MCS_FLAGS) /target:exe /out:mcs2.exe $(all_sources) > /dev/null || (echo FAILED; exit 1)
|
||||
@ echo -n "Run 2: "
|
||||
@ $(FRIENDLY_TIME) $(RUNTIME) ./mcs2.exe $(USE_MCS_FLAGS) /target:exe /out:mcs3.exe $(all_sources) > /dev/null || (echo FAILED; exit 1)
|
||||
@ echo -n "corlib: "
|
||||
@ rm -f ../class/lib/mscorlib.dll
|
||||
@ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
|
||||
|
||||
do-corlib:
|
||||
@ echo -n "corlib: "
|
||||
@ rm -f ../class/lib/mscorlib.dll
|
||||
@ (cd ../class/corlib ; make BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null ) || (echo FAILED; exit 1)
|
||||
|
||||
PROFILER=default
|
||||
|
||||
profile : mcs.exe
|
||||
$(RUNTIME) --profile=$(PROFILER) ./mcs.exe $(USE_MCS_FLAGS) /target:exe /out:mcs2.exe $(all_sources)
|
||||
|
||||
response:
|
||||
echo $(all_sources) > res
|
||||
File renamed without changes.
@@ -267,7 +267,7 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (target_type == source_type)
|
||||
return this;
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -967,19 +967,6 @@ namespace Mono.CSharp {
|
||||
((BoolConstant) right).Value);
|
||||
|
||||
}
|
||||
if (left is NullLiteral){
|
||||
if (right is NullLiteral)
|
||||
return new BoolConstant (true);
|
||||
else if (right is StringConstant)
|
||||
return new BoolConstant (
|
||||
((StringConstant) right).Value == null);
|
||||
} else if (right is NullLiteral){
|
||||
if (left is NullLiteral)
|
||||
return new BoolConstant (true);
|
||||
else if (left is StringConstant)
|
||||
return new BoolConstant (
|
||||
((StringConstant) left).Value == null);
|
||||
}
|
||||
if (left is StringConstant && right is StringConstant){
|
||||
return new BoolConstant (
|
||||
((StringConstant) left).Value ==
|
||||
@@ -1021,19 +1008,6 @@ namespace Mono.CSharp {
|
||||
((BoolConstant) left).Value !=
|
||||
((BoolConstant) right).Value);
|
||||
}
|
||||
if (left is NullLiteral){
|
||||
if (right is NullLiteral)
|
||||
return new BoolConstant (false);
|
||||
else if (right is StringConstant)
|
||||
return new BoolConstant (
|
||||
((StringConstant) right).Value != null);
|
||||
} else if (right is NullLiteral){
|
||||
if (left is NullLiteral)
|
||||
return new BoolConstant (false);
|
||||
else if (left is StringConstant)
|
||||
return new BoolConstant (
|
||||
((StringConstant) left).Value != null);
|
||||
}
|
||||
if (left is StringConstant && right is StringConstant){
|
||||
return new BoolConstant (
|
||||
((StringConstant) left).Value !=
|
||||
+886
-1615
File diff suppressed because it is too large.
Load diff
@@ -12,10 +12,6 @@ using System.IO;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace Mono.CSharp {
|
||||
|
||||
@@ -94,31 +90,15 @@ namespace Mono.CSharp {
|
||||
//
|
||||
static public void Init (string name, string output, bool want_debugging_support)
|
||||
{
|
||||
AssemblyName an;
|
||||
|
||||
FileName = output;
|
||||
AssemblyName an = Assembly.GetAssemblyName (name, output);
|
||||
an = new AssemblyName ();
|
||||
an.Name = Path.GetFileNameWithoutExtension (name);
|
||||
|
||||
current_domain = AppDomain.CurrentDomain;
|
||||
|
||||
try {
|
||||
Assembly.Builder = current_domain.DefineDynamicAssembly (an,
|
||||
AssemblyBuilderAccess.Save, Dirname (name));
|
||||
}
|
||||
catch (ArgumentException) {
|
||||
// specified key may not be exportable outside it's container
|
||||
if (RootContext.StrongNameKeyContainer != null) {
|
||||
Report.Error (1548, "Could not access the key inside the container `" +
|
||||
RootContext.StrongNameKeyContainer + "'.");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
catch (CryptographicException) {
|
||||
if ((RootContext.StrongNameKeyContainer != null) || (RootContext.StrongNameKeyFile != null)) {
|
||||
Report.Error (1548, "Could not use the specified key to strongname the assembly.");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
throw;
|
||||
}
|
||||
Assembly.Builder = current_domain.DefineDynamicAssembly (
|
||||
an, AssemblyBuilderAccess.Save, Dirname (name));
|
||||
|
||||
//
|
||||
// Pass a path-less name to DefineDynamicModule. Wonder how
|
||||
@@ -139,17 +119,7 @@ namespace Mono.CSharp {
|
||||
{
|
||||
try {
|
||||
Assembly.Builder.Save (Basename (name));
|
||||
}
|
||||
catch (COMException) {
|
||||
if ((RootContext.StrongNameKeyFile == null) || (!RootContext.StrongNameDelaySign))
|
||||
throw;
|
||||
|
||||
// FIXME: it seems Microsoft AssemblyBuilder doesn't like to delay sign assemblies
|
||||
Report.Error (1548, "Couldn't delay-sign the assembly with the '" +
|
||||
RootContext.StrongNameKeyFile +
|
||||
"', Use MCS with the Mono runtime or CSC to compile this assembly.");
|
||||
}
|
||||
catch (System.IO.IOException io) {
|
||||
} catch (System.IO.IOException io){
|
||||
Report.Error (16, "Could not write to file `"+name+"', cause: " + io.Message);
|
||||
}
|
||||
}
|
||||
@@ -322,7 +292,7 @@ namespace Mono.CSharp {
|
||||
public bool InIterator;
|
||||
|
||||
public bool IsLastStatement;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Whether remapping of locals, parameters and fields is turned on.
|
||||
/// Used by iterators and anonymous methods.
|
||||
@@ -395,7 +365,7 @@ namespace Mono.CSharp {
|
||||
InUnsafe = (code_flags & Modifiers.UNSAFE) != 0;
|
||||
}
|
||||
loc = l;
|
||||
|
||||
|
||||
if (ReturnType == TypeManager.void_type)
|
||||
ReturnType = null;
|
||||
}
|
||||
@@ -504,7 +474,7 @@ namespace Mono.CSharp {
|
||||
|
||||
FlowBranching.Reachability reachability = current_flow_branching.MergeTopBlock ();
|
||||
current_flow_branching = null;
|
||||
|
||||
|
||||
DoFlowAnalysis = old_do_flow_analysis;
|
||||
|
||||
block.Emit (this);
|
||||
@@ -513,7 +483,8 @@ namespace Mono.CSharp {
|
||||
reachability.AlwaysThrows ||
|
||||
reachability.IsUnreachable)
|
||||
unreachable = true;
|
||||
}
|
||||
}
|
||||
#if FIXME
|
||||
} catch (Exception e) {
|
||||
Console.WriteLine ("Exception caught by the compiler while compiling:");
|
||||
Console.WriteLine (" Block that caused the problem begin at: " + loc);
|
||||
@@ -526,6 +497,9 @@ namespace Mono.CSharp {
|
||||
Console.WriteLine (Report.FriendlyStackTrace (e));
|
||||
|
||||
Environment.Exit (1);
|
||||
#else
|
||||
} finally {
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,17 +705,14 @@ namespace Mono.CSharp {
|
||||
//
|
||||
public void EmitThis ()
|
||||
{
|
||||
if (InIterator){
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
if (!IsStatic){
|
||||
FieldBuilder this_field = IteratorHandler.Current.this_field;
|
||||
if (TypeManager.IsValueType (this_field.FieldType))
|
||||
ig.Emit (OpCodes.Ldflda, this_field);
|
||||
else
|
||||
ig.Emit (OpCodes.Ldfld, this_field);
|
||||
}
|
||||
} else
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
|
||||
if (!IsStatic){
|
||||
if (InIterator)
|
||||
ig.Emit (OpCodes.Ldfld, IteratorHandler.Current.this_field);
|
||||
else
|
||||
throw new Exception ("EmitThis for an unknown state");
|
||||
}
|
||||
}
|
||||
|
||||
public Expression GetThis (Location loc)
|
||||
@@ -760,221 +731,74 @@ namespace Mono.CSharp {
|
||||
}
|
||||
|
||||
|
||||
public abstract class CommonAssemblyModulClass: Attributable {
|
||||
static string[] attribute_targets = new string [] { "assembly", "module" };
|
||||
public abstract class CommonAssemblyModulClass: IAttributeSupport {
|
||||
Hashtable m_attributes;
|
||||
|
||||
protected CommonAssemblyModulClass ():
|
||||
base (null)
|
||||
protected CommonAssemblyModulClass ()
|
||||
{
|
||||
m_attributes = new Hashtable ();
|
||||
}
|
||||
|
||||
public void AddAttributes (ArrayList attrs)
|
||||
//
|
||||
// Adds a global attribute that was declared in `container',
|
||||
// the attribute is in `attr', and it was defined at `loc'
|
||||
//
|
||||
public void AddAttribute (TypeContainer container, AttributeSection attr)
|
||||
{
|
||||
if (OptAttributes == null) {
|
||||
OptAttributes = new Attributes (attrs);
|
||||
NamespaceEntry ns = container.NamespaceEntry;
|
||||
Attributes a = (Attributes) m_attributes [ns];
|
||||
|
||||
if (a == null) {
|
||||
m_attributes [ns] = new Attributes (attr);
|
||||
return;
|
||||
}
|
||||
OptAttributes.AddAttributes (attrs);
|
||||
OptAttributes.CheckTargets (ValidAttributeTargets);
|
||||
|
||||
a.AddAttributeSection (attr);
|
||||
}
|
||||
|
||||
public virtual void Emit (TypeContainer tc)
|
||||
public virtual void Emit ()
|
||||
{
|
||||
if (OptAttributes == null)
|
||||
if (m_attributes.Count < 1)
|
||||
return;
|
||||
|
||||
EmitContext ec = new EmitContext (tc, Mono.CSharp.Location.Null, null, null, 0, false);
|
||||
OptAttributes.Emit (ec, this);
|
||||
TypeContainer dummy = new TypeContainer ();
|
||||
EmitContext temp_ec = new EmitContext (dummy, Mono.CSharp.Location.Null, null, null, 0, false);
|
||||
|
||||
foreach (DictionaryEntry de in m_attributes)
|
||||
{
|
||||
NamespaceEntry ns = (NamespaceEntry) de.Key;
|
||||
Attributes attrs = (Attributes) de.Value;
|
||||
|
||||
dummy.NamespaceEntry = ns;
|
||||
Attribute.ApplyAttributes (temp_ec, null, this, attrs);
|
||||
}
|
||||
}
|
||||
|
||||
protected Attribute GetClsCompliantAttribute ()
|
||||
{
|
||||
if (OptAttributes == null)
|
||||
return null;
|
||||
|
||||
EmitContext temp_ec = new EmitContext (new TypeContainer (), Mono.CSharp.Location.Null, null, null, 0, false);
|
||||
Attribute a = OptAttributes.Search (TypeManager.cls_compliant_attribute_type, temp_ec);
|
||||
if (a != null) {
|
||||
a.Resolve (temp_ec);
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
protected override string[] ValidAttributeTargets {
|
||||
get {
|
||||
return attribute_targets;
|
||||
}
|
||||
}
|
||||
#region IAttributeSupport Members
|
||||
public abstract void SetCustomAttribute(CustomAttributeBuilder customBuilder);
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public class AssemblyClass: CommonAssemblyModulClass {
|
||||
// TODO: make it private and move all builder based methods here
|
||||
public AssemblyBuilder Builder;
|
||||
bool is_cls_compliant;
|
||||
|
||||
bool m_is_cls_compliant;
|
||||
|
||||
public AssemblyClass (): base ()
|
||||
{
|
||||
is_cls_compliant = false;
|
||||
m_is_cls_compliant = false;
|
||||
}
|
||||
|
||||
public bool IsClsCompliant {
|
||||
get {
|
||||
return is_cls_compliant;
|
||||
return m_is_cls_compliant;
|
||||
}
|
||||
}
|
||||
|
||||
public override AttributeTargets AttributeTargets {
|
||||
get {
|
||||
return AttributeTargets.Assembly;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsClsCompliaceRequired(DeclSpace ds)
|
||||
{
|
||||
return is_cls_compliant;
|
||||
}
|
||||
|
||||
public void ResolveClsCompliance ()
|
||||
{
|
||||
Attribute a = GetClsCompliantAttribute ();
|
||||
if (a == null)
|
||||
return;
|
||||
|
||||
is_cls_compliant = a.GetClsCompliantAttributeValue (null);
|
||||
}
|
||||
|
||||
public AssemblyName GetAssemblyName (string name, string output)
|
||||
{
|
||||
if (OptAttributes != null) {
|
||||
foreach (Attribute a in OptAttributes.Attrs) {
|
||||
if (a.Target != "assembly")
|
||||
continue;
|
||||
// TODO: This code is buggy: comparing Attribute name without resolving it is wrong.
|
||||
// However, this is invoked by CodeGen.Init, at which time none of the namespaces
|
||||
// are loaded yet.
|
||||
switch (a.Name) {
|
||||
case "AssemblyKeyFile":
|
||||
case "AssemblyKeyFileAttribute":
|
||||
case "System.Reflection.AssemblyKeyFileAttribute":
|
||||
if (RootContext.StrongNameKeyFile != null) {
|
||||
Report.Warning (1616, "Compiler option -keyfile overrides " +
|
||||
"AssemblyKeyFileAttribute");
|
||||
}
|
||||
else {
|
||||
string value = a.GetString ();
|
||||
if (value != String.Empty)
|
||||
RootContext.StrongNameKeyFile = value;
|
||||
}
|
||||
break;
|
||||
case "AssemblyKeyName":
|
||||
case "AssemblyKeyNameAttribute":
|
||||
case "System.Reflection.AssemblyKeyNameAttribute":
|
||||
if (RootContext.StrongNameKeyContainer != null) {
|
||||
Report.Warning (1616, "Compiler option -keycontainer overrides " +
|
||||
"AssemblyKeyNameAttribute");
|
||||
}
|
||||
else {
|
||||
string value = a.GetString ();
|
||||
if (value != String.Empty)
|
||||
RootContext.StrongNameKeyContainer = value;
|
||||
}
|
||||
break;
|
||||
case "AssemblyDelaySign":
|
||||
case "AssemblyDelaySignAttribute":
|
||||
case "System.Reflection.AssemblyDelaySignAttribute":
|
||||
RootContext.StrongNameDelaySign = a.GetBoolean ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AssemblyName an = new AssemblyName ();
|
||||
an.Name = Path.GetFileNameWithoutExtension (name);
|
||||
|
||||
// note: delay doesn't apply when using a key container
|
||||
if (RootContext.StrongNameKeyContainer != null) {
|
||||
an.KeyPair = new StrongNameKeyPair (RootContext.StrongNameKeyContainer);
|
||||
return an;
|
||||
}
|
||||
|
||||
// strongname is optional
|
||||
if (RootContext.StrongNameKeyFile == null)
|
||||
return an;
|
||||
|
||||
string AssemblyDir = Path.GetDirectoryName (output);
|
||||
|
||||
// the StrongName key file may be relative to (a) the compiled
|
||||
// file or (b) to the output assembly. See bugzilla #55320
|
||||
// http://bugzilla.ximian.com/show_bug.cgi?id=55320
|
||||
|
||||
// (a) relative to the compiled file
|
||||
string filename = Path.GetFullPath (RootContext.StrongNameKeyFile);
|
||||
bool exist = File.Exists (filename);
|
||||
if ((!exist) && (AssemblyDir != null) && (AssemblyDir != String.Empty)) {
|
||||
// (b) relative to the outputed assembly
|
||||
filename = Path.GetFullPath (Path.Combine (AssemblyDir, RootContext.StrongNameKeyFile));
|
||||
exist = File.Exists (filename);
|
||||
}
|
||||
|
||||
if (exist) {
|
||||
using (FileStream fs = new FileStream (filename, FileMode.Open, FileAccess.Read)) {
|
||||
byte[] snkeypair = new byte [fs.Length];
|
||||
fs.Read (snkeypair, 0, snkeypair.Length);
|
||||
|
||||
if (RootContext.StrongNameDelaySign) {
|
||||
// delayed signing - DO NOT include private key
|
||||
try {
|
||||
// check for possible ECMA key
|
||||
if (snkeypair.Length == 16) {
|
||||
// will be rejected if not "the" ECMA key
|
||||
an.KeyPair = new StrongNameKeyPair (snkeypair);
|
||||
}
|
||||
else {
|
||||
// take it, with or without, a private key
|
||||
RSA rsa = CryptoConvert.FromCapiKeyBlob (snkeypair);
|
||||
// and make sure we only feed the public part to Sys.Ref
|
||||
byte[] publickey = CryptoConvert.ToCapiPublicKeyBlob (rsa);
|
||||
an.KeyPair = new StrongNameKeyPair (publickey);
|
||||
}
|
||||
}
|
||||
catch (Exception) {
|
||||
Report.Error (1548, "Could not strongname the assembly. File `" +
|
||||
RootContext.StrongNameKeyFile + "' incorrectly encoded.");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
}
|
||||
else {
|
||||
// no delay so we make sure we have the private key
|
||||
try {
|
||||
CryptoConvert.FromCapiPrivateKeyBlob (snkeypair);
|
||||
an.KeyPair = new StrongNameKeyPair (snkeypair);
|
||||
}
|
||||
catch (CryptographicException) {
|
||||
if (snkeypair.Length == 16) {
|
||||
// error # is different for ECMA key
|
||||
Report.Error (1606, "Could not strongname the assembly. " +
|
||||
"ECMA key can only be used to delay-sign assemblies");
|
||||
}
|
||||
else {
|
||||
Report.Error (1548, "Could not strongname the assembly. File `" +
|
||||
RootContext.StrongNameKeyFile +
|
||||
"' doesn't have a private key.");
|
||||
}
|
||||
Environment.Exit (1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
Report.Error (1548, "Could not strongname the assembly. File `" +
|
||||
RootContext.StrongNameKeyFile + "' not found.");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
return an;
|
||||
}
|
||||
|
||||
public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder customBuilder)
|
||||
public override void SetCustomAttribute(CustomAttributeBuilder customBuilder)
|
||||
{
|
||||
Builder.SetCustomAttribute (customBuilder);
|
||||
}
|
||||
@@ -983,6 +807,7 @@ namespace Mono.CSharp {
|
||||
public class ModuleClass: CommonAssemblyModulClass {
|
||||
// TODO: make it private and move all builder based methods here
|
||||
public ModuleBuilder Builder;
|
||||
|
||||
bool m_module_is_unsafe;
|
||||
|
||||
public ModuleClass (bool is_unsafe)
|
||||
@@ -990,20 +815,9 @@ namespace Mono.CSharp {
|
||||
m_module_is_unsafe = is_unsafe;
|
||||
}
|
||||
|
||||
public override AttributeTargets AttributeTargets {
|
||||
get {
|
||||
return AttributeTargets.Module;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsClsCompliaceRequired(DeclSpace ds)
|
||||
public override void Emit ()
|
||||
{
|
||||
return CodeGen.Assembly.IsClsCompliant;
|
||||
}
|
||||
|
||||
public override void Emit (TypeContainer tc)
|
||||
{
|
||||
base.Emit (tc);
|
||||
base.Emit ();
|
||||
|
||||
if (!m_module_is_unsafe)
|
||||
return;
|
||||
@@ -1013,17 +827,13 @@ namespace Mono.CSharp {
|
||||
return;
|
||||
}
|
||||
|
||||
ApplyAttributeBuilder (null, new CustomAttributeBuilder (TypeManager.unverifiable_code_ctor, new object [0]));
|
||||
SetCustomAttribute (new CustomAttributeBuilder (TypeManager.unverifiable_code_ctor, new object [0]));
|
||||
}
|
||||
|
||||
public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder customBuilder)
|
||||
public override void SetCustomAttribute(CustomAttributeBuilder customBuilder)
|
||||
{
|
||||
if (a != null && a.Type == TypeManager.cls_compliant_attribute_type) {
|
||||
Report.Warning_T (3012, a.Location);
|
||||
return;
|
||||
}
|
||||
|
||||
Builder.SetCustomAttribute (customBuilder);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,7 +28,6 @@ namespace Mono.CSharp {
|
||||
public Expression Expr;
|
||||
EmitContext const_ec;
|
||||
|
||||
bool resolved = false;
|
||||
object ConstantValue = null;
|
||||
Type type;
|
||||
|
||||
@@ -41,9 +40,10 @@ namespace Mono.CSharp {
|
||||
Modifiers.INTERNAL |
|
||||
Modifiers.PRIVATE;
|
||||
|
||||
public Const (Expression constant_type, string name, Expression expr, int mod_flags,
|
||||
Attributes attrs, Location loc)
|
||||
: base (constant_type, mod_flags, AllowedModifiers, name, null, attrs, loc)
|
||||
public Const (Expression constant_type, string name, Expression expr,
|
||||
int mod_flags, Attributes attrs, Location loc)
|
||||
: base (constant_type, mod_flags, AllowedModifiers,
|
||||
new MemberName (name), null, attrs, loc)
|
||||
{
|
||||
Expr = expr;
|
||||
}
|
||||
@@ -78,7 +78,7 @@ namespace Mono.CSharp {
|
||||
return false;
|
||||
|
||||
const_ec = new EmitContext (parent, Location, null, type, ModFlags);
|
||||
|
||||
|
||||
Type ttype = type;
|
||||
while (ttype.IsArray)
|
||||
ttype = TypeManager.GetElementType (ttype);
|
||||
@@ -118,9 +118,6 @@ namespace Mono.CSharp {
|
||||
//
|
||||
public static Constant ChangeType (Location loc, Constant expr, Type type)
|
||||
{
|
||||
if (type == TypeManager.object_type)
|
||||
return expr;
|
||||
|
||||
bool fail;
|
||||
|
||||
// from the null type to any reference-type.
|
||||
@@ -181,19 +178,16 @@ namespace Mono.CSharp {
|
||||
/// Looks up the value of a constant field. Defines it if it hasn't
|
||||
/// already been. Similar to LookupEnumValue in spirit.
|
||||
/// </summary>
|
||||
public bool LookupConstantValue (out object value)
|
||||
public object LookupConstantValue ()
|
||||
{
|
||||
if (resolved) {
|
||||
value = ConstantValue;
|
||||
return true;
|
||||
}
|
||||
if (ConstantValue != null)
|
||||
return ConstantValue;
|
||||
|
||||
if (in_transit) {
|
||||
Report.Error (110, Location,
|
||||
"The evaluation of the constant value for `" +
|
||||
Name + "' involves a circular definition.");
|
||||
value = null;
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
in_transit = true;
|
||||
@@ -202,11 +196,9 @@ namespace Mono.CSharp {
|
||||
//
|
||||
// We might have cleared Expr ourselves in a recursive definition
|
||||
//
|
||||
if (Expr == null){
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Expr == null)
|
||||
return null;
|
||||
|
||||
Expr = Expr.Resolve (const_ec);
|
||||
|
||||
in_transit = false;
|
||||
@@ -214,49 +206,37 @@ namespace Mono.CSharp {
|
||||
if (Expr == null) {
|
||||
if (errors == Report.Errors)
|
||||
Report.Error (150, Location, "A constant value is expected");
|
||||
value = null;
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
Expression real_expr = Expr;
|
||||
|
||||
Constant ce = Expr as Constant;
|
||||
if (ce == null){
|
||||
UnCheckedExpr un_expr = Expr as UnCheckedExpr;
|
||||
CheckedExpr ch_expr = Expr as CheckedExpr;
|
||||
EmptyCast ec_expr = Expr as EmptyCast;
|
||||
|
||||
if ((un_expr != null) && (un_expr.Expr is Constant))
|
||||
Expr = un_expr.Expr;
|
||||
else if ((ch_expr != null) && (ch_expr.Expr is Constant))
|
||||
Expr = ch_expr.Expr;
|
||||
else if ((ec_expr != null) && (ec_expr.Child is Constant))
|
||||
Expr = ec_expr.Child;
|
||||
else if (Expr is ArrayCreation) {
|
||||
ArrayCreation ac = (ArrayCreation) Expr;
|
||||
|
||||
Expr = ac.TurnIntoConstant ();
|
||||
if (Expr == null){
|
||||
Report.Error (150, Location, "A constant value is expected");
|
||||
value = null;
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
if (errors == Report.Errors)
|
||||
Report.Error (150, Location, "A constant value is expected");
|
||||
value = null;
|
||||
return false;
|
||||
return null;
|
||||
}
|
||||
|
||||
ce = Expr as Constant;
|
||||
}
|
||||
|
||||
if (type != real_expr.Type) {
|
||||
if (type != ce.Type) {
|
||||
ce = ChangeType (Location, ce, type);
|
||||
if (ce == null){
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
if (ce == null)
|
||||
return null;
|
||||
Expr = ce;
|
||||
}
|
||||
ConstantValue = ce.GetValue ();
|
||||
@@ -279,27 +259,20 @@ namespace Mono.CSharp {
|
||||
FieldBuilder.SetConstant (ConstantValue);
|
||||
|
||||
if (!TypeManager.RegisterFieldValue (FieldBuilder, ConstantValue))
|
||||
throw new Exception ("Cannot register const value");
|
||||
return null;
|
||||
|
||||
value = ConstantValue;
|
||||
resolved = true;
|
||||
return true;
|
||||
return ConstantValue;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Emits the field value by evaluating the expression
|
||||
/// </summary>
|
||||
public override void Emit (TypeContainer parent)
|
||||
public void Emit (TypeContainer parent)
|
||||
{
|
||||
object value;
|
||||
LookupConstantValue (out value);
|
||||
|
||||
if (OptAttributes != null) {
|
||||
OptAttributes.Emit (const_ec, this);
|
||||
}
|
||||
|
||||
base.Emit (parent);
|
||||
LookupConstantValue ();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -146,14 +146,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
// Returns true iff 1) the stack type of this is one of Object,
|
||||
// int32, int64 and 2) this == 0 or this == null.
|
||||
//
|
||||
public virtual bool IsZeroInteger {
|
||||
get { return false; }
|
||||
}
|
||||
}
|
||||
|
||||
public class BoolConstant : Constant {
|
||||
@@ -185,10 +177,6 @@ namespace Mono.CSharp {
|
||||
else
|
||||
ec.ig.Emit (OpCodes.Ldc_I4_0);
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == false; }
|
||||
}
|
||||
}
|
||||
|
||||
public class ByteConstant : Constant {
|
||||
@@ -245,10 +233,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return new IntConstant (Value);
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == 0; }
|
||||
}
|
||||
}
|
||||
|
||||
public class CharConstant : Constant {
|
||||
@@ -334,10 +318,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return new IntConstant (Value);
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == '\0'; }
|
||||
}
|
||||
}
|
||||
|
||||
public class SByteConstant : Constant {
|
||||
@@ -397,10 +377,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return new IntConstant (Value);
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == 0; }
|
||||
}
|
||||
}
|
||||
|
||||
public class ShortConstant : Constant {
|
||||
@@ -457,10 +433,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return new IntConstant (Value);
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == 0; }
|
||||
}
|
||||
}
|
||||
|
||||
public class UShortConstant : Constant {
|
||||
@@ -517,10 +489,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return new IntConstant (Value);
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == 0; }
|
||||
}
|
||||
}
|
||||
|
||||
public class IntConstant : Constant {
|
||||
@@ -635,10 +603,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == 0; }
|
||||
}
|
||||
}
|
||||
|
||||
public class UIntConstant : Constant {
|
||||
@@ -695,10 +659,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == 0; }
|
||||
}
|
||||
}
|
||||
|
||||
public class LongConstant : Constant {
|
||||
@@ -770,10 +730,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == 0; }
|
||||
}
|
||||
}
|
||||
|
||||
public class ULongConstant : Constant {
|
||||
@@ -832,10 +788,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Value == 0; }
|
||||
}
|
||||
}
|
||||
|
||||
public class FloatConstant : Constant {
|
||||
@@ -1013,10 +965,7 @@ namespace Mono.CSharp {
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
if (Value == null)
|
||||
ec.ig.Emit (OpCodes.Ldnull);
|
||||
else
|
||||
ec.ig.Emit (OpCodes.Ldstr, Value);
|
||||
ec.ig.Emit (OpCodes.Ldstr, Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace Mono.CSharp {
|
||||
|
||||
if (expr_type == TypeManager.void_type)
|
||||
return null;
|
||||
|
||||
|
||||
//
|
||||
// notice that it is possible to write "ValueType v = 1", the ValueType here
|
||||
// is an abstract class, and not really a value type, so we apply the same rules.
|
||||
@@ -51,12 +51,12 @@ namespace Mono.CSharp {
|
||||
if (expr_type.IsPointer)
|
||||
return null;
|
||||
|
||||
if (expr_type.IsValueType)
|
||||
if (TypeManager.IsValueType (expr_type))
|
||||
return new BoxedCast (expr);
|
||||
if (expr_type.IsClass || expr_type.IsInterface || expr_type == TypeManager.enum_type)
|
||||
return new EmptyCast (expr, target_type);
|
||||
} else if (target_type == TypeManager.value_type) {
|
||||
if (expr_type.IsValueType)
|
||||
if (TypeManager.IsValueType (expr_type))
|
||||
return new BoxedCast (expr);
|
||||
if (expr is NullLiteral)
|
||||
return new NullCast (expr, target_type);
|
||||
@@ -88,20 +88,11 @@ namespace Mono.CSharp {
|
||||
|
||||
// from any class-type S to any interface-type T.
|
||||
if (target_type.IsInterface) {
|
||||
if (target_type != TypeManager.iconvertible_type &&
|
||||
expr_type.IsValueType && (expr is Constant) &&
|
||||
!(expr is IntLiteral || expr is BoolLiteral ||
|
||||
expr is FloatLiteral || expr is DoubleLiteral ||
|
||||
expr is LongLiteral || expr is CharLiteral ||
|
||||
expr is StringLiteral || expr is DecimalLiteral ||
|
||||
expr is UIntLiteral || expr is ULongLiteral)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (TypeManager.ImplementsInterface (expr_type, target_type)){
|
||||
if (expr_type.IsClass)
|
||||
return new EmptyCast (expr, target_type);
|
||||
else if (expr_type.IsValueType)
|
||||
else if (TypeManager.IsValueType (expr_type) ||
|
||||
TypeManager.IsEnumType (expr_type))
|
||||
return new BoxedCast (expr, target_type);
|
||||
else
|
||||
return new EmptyCast (expr, target_type);
|
||||
@@ -152,6 +143,10 @@ namespace Mono.CSharp {
|
||||
expr_type.IsSubclassOf (TypeManager.delegate_type))
|
||||
if (target_type == TypeManager.icloneable_type)
|
||||
return new EmptyCast (expr, target_type);
|
||||
|
||||
// from a generic type definition to a generic instance.
|
||||
if (TypeManager.IsEqualGenericType (expr_type, target_type))
|
||||
return new EmptyCast (expr, target_type);
|
||||
|
||||
return null;
|
||||
|
||||
@@ -172,7 +167,7 @@ namespace Mono.CSharp {
|
||||
// This is the boxed case.
|
||||
//
|
||||
if (target_type == TypeManager.object_type) {
|
||||
if (expr_type.IsClass || expr_type.IsValueType ||
|
||||
if (expr_type.IsClass || TypeManager.IsValueType (expr_type) ||
|
||||
expr_type.IsInterface || expr_type == TypeManager.enum_type)
|
||||
return true;
|
||||
} else if (expr_type.IsSubclassOf (target_type))
|
||||
@@ -233,7 +228,10 @@ namespace Mono.CSharp {
|
||||
if (expr is NullLiteral && !target_type.IsValueType &&
|
||||
!TypeManager.IsEnumType (target_type))
|
||||
return true;
|
||||
|
||||
|
||||
// from a generic type definition to a generic instance.
|
||||
if (TypeManager.IsEqualGenericType (expr_type, target_type))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -253,6 +251,7 @@ namespace Mono.CSharp {
|
||||
// Attempt to do the implicit constant expression conversions
|
||||
|
||||
if (expr is Constant){
|
||||
|
||||
if (expr is IntConstant){
|
||||
Expression e;
|
||||
|
||||
@@ -267,7 +266,7 @@ namespace Mono.CSharp {
|
||||
// we just inline it
|
||||
//
|
||||
long v = ((LongConstant) expr).Value;
|
||||
if (v >= 0)
|
||||
if (v > 0)
|
||||
return new ULongConstant ((ulong) v);
|
||||
}
|
||||
}
|
||||
@@ -440,7 +439,9 @@ namespace Mono.CSharp {
|
||||
if (expr_type == TypeManager.void_type)
|
||||
return false;
|
||||
|
||||
if (expr_type == target_type)
|
||||
//Console.WriteLine ("Expr is {0}", expr);
|
||||
//Console.WriteLine ("{0} -> {1} ?", expr_type, target_type);
|
||||
if (expr_type.Equals (target_type))
|
||||
return true;
|
||||
|
||||
// First numeric conversions
|
||||
@@ -856,8 +857,6 @@ namespace Mono.CSharp {
|
||||
return UserDefinedConversion (ec, source, target, loc, true);
|
||||
}
|
||||
|
||||
static DoubleHash explicit_conv = new DoubleHash (100);
|
||||
static DoubleHash implicit_conv = new DoubleHash (100);
|
||||
/// <summary>
|
||||
/// Computes the MethodGroup for the user-defined conversion
|
||||
/// operators from source_type to target_type. `look_for_explicit'
|
||||
@@ -875,10 +874,7 @@ namespace Mono.CSharp {
|
||||
op_name = "op_Implicit";
|
||||
|
||||
MethodGroupExpr union3;
|
||||
object r;
|
||||
if ((look_for_explicit ? explicit_conv : implicit_conv).Lookup (source_type, target_type, out r))
|
||||
return (MethodGroupExpr) r;
|
||||
|
||||
|
||||
mg1 = Expression.MethodLookup (ec, source_type, op_name, loc);
|
||||
if (source_type.BaseType != null)
|
||||
mg2 = Expression.MethodLookup (ec, source_type.BaseType, op_name, loc);
|
||||
@@ -927,9 +923,7 @@ namespace Mono.CSharp {
|
||||
union4 = Invocation.MakeUnionSet (union5, union6, loc);
|
||||
}
|
||||
|
||||
MethodGroupExpr ret = Invocation.MakeUnionSet (union3, union4, loc);
|
||||
(look_for_explicit ? explicit_conv : implicit_conv).Insert (source_type, target_type, ret);
|
||||
return ret;
|
||||
return Invocation.MakeUnionSet (union3, union4, loc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1053,8 +1047,8 @@ namespace Mono.CSharp {
|
||||
|
||||
return ImplicitDelegateCreation.Create (ec, (MethodGroupExpr) expr, target_type, loc);
|
||||
}
|
||||
|
||||
if (expr_type == target_type && !(expr is NullLiteral))
|
||||
|
||||
if (expr_type.Equals (target_type) && !(expr is NullLiteral))
|
||||
return expr;
|
||||
|
||||
e = ImplicitNumericConversion (ec, expr, target_type, loc);
|
||||
@@ -1174,7 +1168,7 @@ namespace Mono.CSharp {
|
||||
Type target_type, Location loc)
|
||||
{
|
||||
Expression e;
|
||||
|
||||
|
||||
e = ImplicitConversion (ec, source, target_type, loc);
|
||||
if (e != null)
|
||||
return e;
|
||||
@@ -1621,7 +1615,7 @@ namespace Mono.CSharp {
|
||||
/// type is expr.Type to `target_type'.
|
||||
/// </summary>
|
||||
static public Expression ExplicitConversion (EmitContext ec, Expression expr,
|
||||
Type target_type, Location loc)
|
||||
Type target_type, Location loc)
|
||||
{
|
||||
Type expr_type = expr.Type;
|
||||
Type original_expr_type = expr_type;
|
||||
@@ -1734,7 +1728,7 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ne = ExplicitUserConversion (ec, expr, target_type, loc);
|
||||
if (ne != null)
|
||||
return ne;
|
||||
File diff suppressed because it is too large.
Load diff
@@ -40,6 +40,7 @@ namespace Mono.CSharp
|
||||
bool handle_get_set = false;
|
||||
bool handle_remove_add = false;
|
||||
bool handle_assembly = false;
|
||||
bool handle_constraints = false;
|
||||
|
||||
//
|
||||
// Whether tokens have been seen on this line
|
||||
@@ -132,6 +133,16 @@ namespace Mono.CSharp
|
||||
handle_remove_add = value;
|
||||
}
|
||||
}
|
||||
|
||||
public bool ConstraintsParsing {
|
||||
get {
|
||||
return handle_constraints;
|
||||
}
|
||||
|
||||
set {
|
||||
handle_constraints = value;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Class variables
|
||||
@@ -288,6 +299,7 @@ namespace Mono.CSharp
|
||||
AddKeyword ("virtual", Token.VIRTUAL);
|
||||
AddKeyword ("void", Token.VOID);
|
||||
AddKeyword ("volatile", Token.VOLATILE);
|
||||
AddKeyword ("where", Token.WHERE);
|
||||
AddKeyword ("while", Token.WHILE);
|
||||
}
|
||||
|
||||
@@ -325,6 +337,8 @@ namespace Mono.CSharp
|
||||
return -1;
|
||||
if (handle_assembly == false && res == Token.ASSEMBLY)
|
||||
return -1;
|
||||
if (handle_constraints == false && res == Token.WHERE)
|
||||
return -1;
|
||||
return res;
|
||||
|
||||
}
|
||||
@@ -370,31 +384,62 @@ namespace Mono.CSharp
|
||||
identifiers = null;
|
||||
}
|
||||
|
||||
static bool is_identifier_start_character (char c)
|
||||
bool is_identifier_start_character (char c)
|
||||
{
|
||||
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_' || Char.IsLetter (c);
|
||||
}
|
||||
|
||||
static bool is_identifier_part_character (char c)
|
||||
bool is_identifier_part_character (char c)
|
||||
{
|
||||
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '_' || (c >= '0' && c <= '9') || Char.IsLetter (c);
|
||||
}
|
||||
|
||||
public static bool IsValidIdentifier (string s)
|
||||
{
|
||||
if (s == null || s.Length == 0)
|
||||
return false;
|
||||
|
||||
if (!is_identifier_start_character (s [0]))
|
||||
return false;
|
||||
|
||||
for (int i = 1; i < s.Length; i ++)
|
||||
if (! is_identifier_part_character (s [i]))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parse_less_than ()
|
||||
{
|
||||
start:
|
||||
int the_token = token ();
|
||||
switch (the_token) {
|
||||
case Token.IDENTIFIER:
|
||||
case Token.OBJECT:
|
||||
case Token.STRING:
|
||||
case Token.BOOL:
|
||||
case Token.DECIMAL:
|
||||
case Token.FLOAT:
|
||||
case Token.DOUBLE:
|
||||
case Token.SBYTE:
|
||||
case Token.BYTE:
|
||||
case Token.SHORT:
|
||||
case Token.USHORT:
|
||||
case Token.INT:
|
||||
case Token.UINT:
|
||||
case Token.LONG:
|
||||
case Token.ULONG:
|
||||
case Token.CHAR:
|
||||
case Token.VOID:
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
again:
|
||||
the_token = token ();
|
||||
|
||||
if (the_token == Token.OP_GENERICS_GT)
|
||||
return true;
|
||||
else if (the_token == Token.COMMA)
|
||||
goto start;
|
||||
else if (the_token == Token.OP_GENERICS_LT) {
|
||||
if (!parse_less_than ())
|
||||
return false;
|
||||
goto again;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool parsing_less_than = false;
|
||||
int parsing_generic_less_than = 0;
|
||||
|
||||
int is_punct (char c, ref bool doread)
|
||||
{
|
||||
int d;
|
||||
@@ -447,6 +492,60 @@ namespace Mono.CSharp
|
||||
return Token.INTERR;
|
||||
}
|
||||
|
||||
if (c == '<') {
|
||||
if (parsing_generic_less_than++ > 0)
|
||||
return Token.OP_GENERICS_LT;
|
||||
|
||||
// Save current position and parse next token.
|
||||
int old = reader.Position;
|
||||
bool is_generic_lt = parse_less_than ();
|
||||
reader.Position = old;
|
||||
putback_char = -1;
|
||||
|
||||
if (is_generic_lt) {
|
||||
parsing_generic_less_than++;
|
||||
return Token.OP_GENERICS_LT;
|
||||
} else
|
||||
parsing_generic_less_than = 0;
|
||||
|
||||
d = peekChar ();
|
||||
if (d == '<'){
|
||||
getChar ();
|
||||
d = peekChar ();
|
||||
|
||||
if (d == '='){
|
||||
doread = true;
|
||||
return Token.OP_SHIFT_LEFT_ASSIGN;
|
||||
}
|
||||
return Token.OP_SHIFT_LEFT;
|
||||
} else if (d == '='){
|
||||
doread = true;
|
||||
return Token.OP_LE;
|
||||
}
|
||||
return Token.OP_LT;
|
||||
} else if (c == '>') {
|
||||
if (parsing_generic_less_than > 0) {
|
||||
parsing_generic_less_than--;
|
||||
return Token.OP_GENERICS_GT;
|
||||
}
|
||||
|
||||
d = peekChar ();
|
||||
if (d == '>'){
|
||||
getChar ();
|
||||
d = peekChar ();
|
||||
|
||||
if (d == '='){
|
||||
doread = true;
|
||||
return Token.OP_SHIFT_RIGHT_ASSIGN;
|
||||
}
|
||||
return Token.OP_SHIFT_RIGHT;
|
||||
} else if (d == '='){
|
||||
doread = true;
|
||||
return Token.OP_GE;
|
||||
}
|
||||
return Token.OP_GT;
|
||||
}
|
||||
|
||||
d = peekChar ();
|
||||
if (c == '+'){
|
||||
|
||||
@@ -542,39 +641,6 @@ namespace Mono.CSharp
|
||||
return Token.CARRET;
|
||||
}
|
||||
|
||||
if (c == '<'){
|
||||
if (d == '<'){
|
||||
getChar ();
|
||||
d = peekChar ();
|
||||
|
||||
if (d == '='){
|
||||
doread = true;
|
||||
return Token.OP_SHIFT_LEFT_ASSIGN;
|
||||
}
|
||||
return Token.OP_SHIFT_LEFT;
|
||||
} else if (d == '='){
|
||||
doread = true;
|
||||
return Token.OP_LE;
|
||||
}
|
||||
return Token.OP_LT;
|
||||
}
|
||||
|
||||
if (c == '>'){
|
||||
if (d == '>'){
|
||||
getChar ();
|
||||
d = peekChar ();
|
||||
|
||||
if (d == '='){
|
||||
doread = true;
|
||||
return Token.OP_SHIFT_RIGHT_ASSIGN;
|
||||
}
|
||||
return Token.OP_SHIFT_RIGHT;
|
||||
} else if (d == '='){
|
||||
doread = true;
|
||||
return Token.OP_GE;
|
||||
}
|
||||
return Token.OP_GT;
|
||||
}
|
||||
return Token.ERROR;
|
||||
}
|
||||
|
||||
@@ -1108,7 +1174,19 @@ namespace Mono.CSharp
|
||||
public int token ()
|
||||
{
|
||||
current_token = xtoken ();
|
||||
return current_token;
|
||||
|
||||
if (current_token != Token.DEFAULT)
|
||||
return current_token;
|
||||
|
||||
int c = consume_whitespace ();
|
||||
if (c == -1)
|
||||
current_token = Token.ERROR;
|
||||
else if (c == '(')
|
||||
current_token = Token.DEFAULT_OPEN_PARENS;
|
||||
else
|
||||
putback (c);
|
||||
|
||||
return current_token;
|
||||
}
|
||||
|
||||
static StringBuilder static_cmd_arg = new System.Text.StringBuilder ();
|
||||
@@ -1124,16 +1202,10 @@ namespace Mono.CSharp
|
||||
// skip over white space
|
||||
while ((c = getChar ()) != -1 && (c != '\n') && ((c == '\r') || (c == ' ') || (c == '\t')))
|
||||
;
|
||||
|
||||
|
||||
|
||||
while ((c != -1) && (c != '\n') && (c != ' ') && (c != '\t') && (c != '\r')){
|
||||
if (is_identifier_part_character ((char) c)){
|
||||
static_cmd_arg.Append ((char) c);
|
||||
c = getChar ();
|
||||
} else {
|
||||
putback (c);
|
||||
break;
|
||||
}
|
||||
static_cmd_arg.Append ((char) c);
|
||||
c = getChar ();
|
||||
}
|
||||
|
||||
cmd = static_cmd_arg.ToString ();
|
||||
@@ -1192,7 +1264,7 @@ namespace Mono.CSharp
|
||||
//
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
int pos;
|
||||
|
||||
@@ -1704,7 +1776,7 @@ namespace Mono.CSharp
|
||||
if (s >= 'a'){
|
||||
int keyword = GetKeyword (id_builder, pos);
|
||||
if (keyword != -1 && !quoted)
|
||||
return keyword;
|
||||
return keyword;
|
||||
}
|
||||
|
||||
//
|
||||
@@ -1730,8 +1802,8 @@ namespace Mono.CSharp
|
||||
|
||||
return Token.IDENTIFIER;
|
||||
}
|
||||
|
||||
public int xtoken ()
|
||||
|
||||
int consume_whitespace ()
|
||||
{
|
||||
int t;
|
||||
bool doread = false;
|
||||
@@ -1801,22 +1873,7 @@ namespace Mono.CSharp
|
||||
goto is_punct_label;
|
||||
}
|
||||
|
||||
|
||||
if (is_identifier_start_character ((char)c)){
|
||||
tokens_seen = true;
|
||||
return consume_identifier (c, false);
|
||||
}
|
||||
|
||||
is_punct_label:
|
||||
if ((t = is_punct ((char)c, ref doread)) != Token.ERROR){
|
||||
tokens_seen = true;
|
||||
if (doread){
|
||||
getChar ();
|
||||
col++;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
// white space
|
||||
if (c == '\n'){
|
||||
line++;
|
||||
@@ -1827,19 +1884,6 @@ namespace Mono.CSharp
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c >= '0' && c <= '9'){
|
||||
tokens_seen = true;
|
||||
return is_number (c);
|
||||
}
|
||||
|
||||
if (c == '.'){
|
||||
tokens_seen = true;
|
||||
int peek = peekChar ();
|
||||
if (peek >= '0' && peek <= '9')
|
||||
return is_number (c);
|
||||
return Token.DOT;
|
||||
}
|
||||
|
||||
/* For now, ignore pre-processor commands */
|
||||
// FIXME: In C# the '#' is not limited to appear
|
||||
// on the first column.
|
||||
@@ -1876,72 +1920,115 @@ namespace Mono.CSharp
|
||||
Report.Error (1027, Location, "#endif/#endregion expected");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (c == '"')
|
||||
return consume_string (false);
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int xtoken ()
|
||||
{
|
||||
int t;
|
||||
bool doread = false;
|
||||
int c;
|
||||
|
||||
val = null;
|
||||
// optimization: eliminate col and implement #directive semantic correctly.
|
||||
|
||||
c = consume_whitespace ();
|
||||
if (c == -1)
|
||||
return Token.EOF;
|
||||
|
||||
if (is_identifier_start_character ((char)c)){
|
||||
tokens_seen = true;
|
||||
return consume_identifier (c, false);
|
||||
}
|
||||
|
||||
is_punct_label:
|
||||
if ((t = is_punct ((char)c, ref doread)) != Token.ERROR){
|
||||
tokens_seen = true;
|
||||
if (doread){
|
||||
getChar ();
|
||||
col++;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
if (c >= '0' && c <= '9'){
|
||||
tokens_seen = true;
|
||||
return is_number (c);
|
||||
}
|
||||
|
||||
if (c == '.'){
|
||||
tokens_seen = true;
|
||||
int peek = peekChar ();
|
||||
if (peek >= '0' && peek <= '9')
|
||||
return is_number (c);
|
||||
return Token.DOT;
|
||||
}
|
||||
|
||||
if (c == '"')
|
||||
return consume_string (false);
|
||||
|
||||
if (c == '\''){
|
||||
c = getChar ();
|
||||
tokens_seen = true;
|
||||
if (c == '\''){
|
||||
c = getChar ();
|
||||
tokens_seen = true;
|
||||
if (c == '\''){
|
||||
error_details = "Empty character literal";
|
||||
Report.Error (1011, Location, error_details);
|
||||
return Token.ERROR;
|
||||
}
|
||||
c = escape (c);
|
||||
if (c == -1)
|
||||
return Token.ERROR;
|
||||
val = new System.Char ();
|
||||
val = (char) c;
|
||||
c = getChar ();
|
||||
|
||||
if (c != '\''){
|
||||
error_details = "Too many characters in character literal";
|
||||
Report.Error (1012, Location, error_details);
|
||||
|
||||
// Try to recover, read until newline or next "'"
|
||||
while ((c = getChar ()) != -1){
|
||||
if (c == '\n' || c == '\''){
|
||||
line++;
|
||||
ref_line++;
|
||||
col = 0;
|
||||
break;
|
||||
} else
|
||||
col++;
|
||||
|
||||
}
|
||||
return Token.ERROR;
|
||||
}
|
||||
return Token.LITERAL_CHARACTER;
|
||||
}
|
||||
|
||||
if (c == '@') {
|
||||
c = getChar ();
|
||||
if (c == '"') {
|
||||
tokens_seen = true;
|
||||
return consume_string (true);
|
||||
} else if (is_identifier_start_character ((char) c)){
|
||||
return consume_identifier (c, true);
|
||||
} else {
|
||||
Report.Error (1033, Location, "'@' must be followed by string constant or identifier");
|
||||
}
|
||||
}
|
||||
|
||||
if (c == '#') {
|
||||
error_details = "Preprocessor directives must appear as the first non-whitespace " +
|
||||
"character on a line.";
|
||||
|
||||
Report.Error (1040, Location, error_details);
|
||||
|
||||
error_details = "Empty character literal";
|
||||
Report.Error (1011, Location, error_details);
|
||||
return Token.ERROR;
|
||||
}
|
||||
c = escape (c);
|
||||
if (c == -1)
|
||||
return Token.ERROR;
|
||||
val = new System.Char ();
|
||||
val = (char) c;
|
||||
c = getChar ();
|
||||
|
||||
error_details = ((char)c).ToString ();
|
||||
if (c != '\''){
|
||||
error_details = "Too many characters in character literal";
|
||||
Report.Error (1012, Location, error_details);
|
||||
|
||||
// Try to recover, read until newline or next "'"
|
||||
while ((c = getChar ()) != -1){
|
||||
if (c == '\n' || c == '\''){
|
||||
line++;
|
||||
ref_line++;
|
||||
col = 0;
|
||||
break;
|
||||
} else
|
||||
col++;
|
||||
}
|
||||
return Token.ERROR;
|
||||
}
|
||||
return Token.LITERAL_CHARACTER;
|
||||
}
|
||||
|
||||
if (c == '@') {
|
||||
c = getChar ();
|
||||
if (c == '"') {
|
||||
tokens_seen = true;
|
||||
return consume_string (true);
|
||||
} else if (is_identifier_start_character ((char) c)){
|
||||
return consume_identifier (c, true);
|
||||
} else {
|
||||
Report.Error (1033, Location, "'@' must be followed by string constant or identifier");
|
||||
}
|
||||
}
|
||||
|
||||
if (c == '#') {
|
||||
error_details = "Preprocessor directives must appear as the first non-whitespace " +
|
||||
"character on a line.";
|
||||
|
||||
Report.Error (1040, Location, error_details);
|
||||
|
||||
return Token.ERROR;
|
||||
}
|
||||
|
||||
return Token.EOF;
|
||||
error_details = ((char)c).ToString ();
|
||||
|
||||
return Token.ERROR;
|
||||
}
|
||||
|
||||
public void cleanup ()
|
||||
+474
-486
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -17,8 +17,6 @@ namespace Mono.CSharp
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.Diagnostics;
|
||||
using Mono.Languages;
|
||||
|
||||
public enum Target {
|
||||
Library, Exe, Module, WinExe
|
||||
@@ -80,7 +78,7 @@ namespace Mono.CSharp
|
||||
static ArrayList embedded_resources;
|
||||
static string win32ResourceFile;
|
||||
static string win32IconFile;
|
||||
|
||||
|
||||
//
|
||||
// An array of the defines from the command line
|
||||
//
|
||||
@@ -105,12 +103,6 @@ namespace Mono.CSharp
|
||||
// Whether the user has specified a different encoder manually
|
||||
//
|
||||
static bool using_default_encoder = true;
|
||||
|
||||
//
|
||||
// The system version we are using, if not specified on the commandline we
|
||||
// will use the same version as corlib for looking for libraries in the GAC.
|
||||
//
|
||||
static string sys_version;
|
||||
|
||||
public static void ShowTime (string msg)
|
||||
{
|
||||
@@ -183,7 +175,7 @@ namespace Mono.CSharp
|
||||
SeekableStreamReader reader = new SeekableStreamReader (input, encoding, using_default_encoder);
|
||||
|
||||
parser = new CSharpParser (reader, file, defines);
|
||||
parser.yacc_verbose = yacc_verbose;
|
||||
parser.yacc_verbose_flag = yacc_verbose;
|
||||
try {
|
||||
parser.parse ();
|
||||
} catch (Exception ex) {
|
||||
@@ -192,19 +184,6 @@ namespace Mono.CSharp
|
||||
input.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
static void OtherFlags ()
|
||||
{
|
||||
Console.WriteLine (
|
||||
"Other flags in the compiler\n" +
|
||||
" --fatal Makes errors fatal\n" +
|
||||
" --parse Only parses the source file\n" +
|
||||
" --stacktrace Shows stack trace at error location\n" +
|
||||
" --timestamp Displays time stamps of various compiler events\n" +
|
||||
" -2 Enables experimental C# features\n" +
|
||||
" -v Verbose parsing (for debugging the parser)\n" +
|
||||
" --mcs-debug X Sets MCS debugging level to X\n");
|
||||
}
|
||||
|
||||
static void Usage ()
|
||||
{
|
||||
@@ -215,37 +194,38 @@ namespace Mono.CSharp
|
||||
" -checked[+|-] Set default context to checked\n" +
|
||||
" -codepage:ID Sets code page to the one in ID\n" +
|
||||
" (number, `utf8' or `reset')\n" +
|
||||
" -clscheck[+|-] Disables CLS Compliance verifications" + Environment.NewLine +
|
||||
" -define:S1[;S2] Defines one or more symbols (short: /d:)\n" +
|
||||
" -debug[+|-] Generate debugging information\n" +
|
||||
" -delaysign[+|-] Only insert the public key into the assembly (no signing)\n" +
|
||||
" -debug[+-] Generate debugging information\n" +
|
||||
" -doc:FILE XML Documentation file to generate\n" +
|
||||
" -g Generate debugging information\n" +
|
||||
" -keycontainer:NAME The key pair container used to strongname the assembly\n" +
|
||||
" -keyfile:FILE The strongname key file used to strongname the assembly\n" +
|
||||
" --fatal Makes errors fatal\n" +
|
||||
" -lib:PATH1,PATH2 Adds the paths to the assembly link path\n" +
|
||||
" -main:class Specified the class that contains the entry point\n" +
|
||||
" -noconfig[+|-] Disables implicit references to assemblies\n" +
|
||||
" -nostdlib[+|-] Does not load core libraries\n" +
|
||||
" -nowarn:W1[,W2] Disables one or more warnings\n" +
|
||||
" -out:FNAME Specifies output file\n" +
|
||||
" -pkg:P1[,Pn] References packages P1..Pn\n" +
|
||||
" --parse Only parses the source file\n" +
|
||||
" --expect-error X Expect that error X will be encountered\n" +
|
||||
" -recurse:SPEC Recursively compiles the files in SPEC ([dir]/file)\n" +
|
||||
" -reference:ASS References the specified assembly (-r:ASS)\n" +
|
||||
" --stacktrace Shows stack trace at error location\n" +
|
||||
" -target:KIND Specifies the target (KIND is one of: exe, winexe,\n" +
|
||||
" library, module), (short: /t:)\n" +
|
||||
" --timestamp Displays time stamps of various compiler events\n" +
|
||||
" -unsafe[+|-] Allows unsafe code\n" +
|
||||
" -warnaserror[+|-] Treat warnings as errors\n" +
|
||||
" -warn:LEVEL Sets warning level (the highest is 4, the default is 2)\n" +
|
||||
" -help2 Show other help flags\n" +
|
||||
" -v Verbose parsing (for debugging the parser)\n" +
|
||||
" -2 Enables experimental C# features\n" +
|
||||
"\n" +
|
||||
"Resources:\n" +
|
||||
" -linkresource:FILE[,ID] Links FILE as a resource\n" +
|
||||
" -resource:FILE[,ID] Embed FILE as a resource\n" +
|
||||
" -win32res:FILE Specifies Win32 resource file (.res)\n" +
|
||||
" -win32icon:FILE Use this icon for the output\n" +
|
||||
" @file Read response file for more options\n\n" +
|
||||
" --mcs-debug X Sets MCS debugging level to X\n" +
|
||||
" @file Read response file for more options\n\n" +
|
||||
"Options can be of the form -option or /option");
|
||||
}
|
||||
|
||||
@@ -271,6 +251,7 @@ namespace Mono.CSharp
|
||||
|
||||
public static int Main (string[] args)
|
||||
{
|
||||
RootContext.V2 = true;
|
||||
bool ok = MainDriver (args);
|
||||
|
||||
if (ok && Report.Errors == 0) {
|
||||
@@ -299,15 +280,12 @@ namespace Mono.CSharp
|
||||
string total_log = "";
|
||||
|
||||
try {
|
||||
char[] path_chars = { '/', '\\' };
|
||||
char[] path_chars = { '/', '\\', '.' };
|
||||
|
||||
if (assembly.IndexOfAny (path_chars) != -1) {
|
||||
a = Assembly.LoadFrom (assembly);
|
||||
} else {
|
||||
string ass = assembly;
|
||||
if (ass.EndsWith (".dll"))
|
||||
ass = assembly.Substring (0, assembly.Length - 4);
|
||||
a = Assembly.Load (ass);
|
||||
a = Assembly.Load (assembly);
|
||||
}
|
||||
TypeManager.AddAssembly (a);
|
||||
|
||||
@@ -694,7 +672,7 @@ namespace Mono.CSharp
|
||||
Usage ();
|
||||
Environment.Exit (0);
|
||||
return true;
|
||||
|
||||
|
||||
case "--define":
|
||||
if ((i + 1) >= args.Length){
|
||||
Usage ();
|
||||
@@ -997,49 +975,6 @@ namespace Mono.CSharp
|
||||
|
||||
resources.Add (value);
|
||||
return true;
|
||||
|
||||
case "/pkg": {
|
||||
string packages;
|
||||
|
||||
if (value == ""){
|
||||
Usage ();
|
||||
Environment.Exit (1);
|
||||
}
|
||||
packages = String.Join (" ", value.Split (new Char [] { ';', ',', '\n', '\r'}));
|
||||
|
||||
ProcessStartInfo pi = new ProcessStartInfo ();
|
||||
pi.FileName = "pkg-config";
|
||||
pi.RedirectStandardOutput = true;
|
||||
pi.UseShellExecute = false;
|
||||
pi.Arguments = "--libs " + packages;
|
||||
Process p = null;
|
||||
try {
|
||||
p = Process.Start (pi);
|
||||
} catch (Exception e) {
|
||||
Report.Error (-27, "Couldn't run pkg-config: " + e.Message);
|
||||
Environment.Exit (1);
|
||||
}
|
||||
|
||||
if (p.StandardOutput == null){
|
||||
Report.Warning (-27, "Specified package did not return any information");
|
||||
return true;
|
||||
}
|
||||
string pkgout = p.StandardOutput.ReadToEnd ();
|
||||
p.WaitForExit ();
|
||||
if (p.ExitCode != 0) {
|
||||
Report.Error (-27, "Error running pkg-config. Check the above output.");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
|
||||
if (pkgout != null){
|
||||
string [] xargs = pkgout.Trim (new Char [] {' ', '\n', '\r', '\t'}).
|
||||
Split (new Char [] { ' ', '\t'});
|
||||
args = AddArgs (args, xargs);
|
||||
}
|
||||
|
||||
p.Close ();
|
||||
return true;
|
||||
}
|
||||
|
||||
case "/res":
|
||||
case "/resource":
|
||||
@@ -1125,10 +1060,6 @@ namespace Mono.CSharp
|
||||
link_paths.Add (dir);
|
||||
return true;
|
||||
}
|
||||
|
||||
case "/debug-":
|
||||
want_debugging_support = false;
|
||||
return true;
|
||||
|
||||
case "/debug":
|
||||
case "/debug+":
|
||||
@@ -1144,14 +1075,6 @@ namespace Mono.CSharp
|
||||
RootContext.Checked = false;
|
||||
return true;
|
||||
|
||||
case "/clscheck":
|
||||
case "/clscheck+":
|
||||
return true;
|
||||
|
||||
case "/clscheck-":
|
||||
RootContext.VerifyClsCompliance = false;
|
||||
return true;
|
||||
|
||||
case "/unsafe":
|
||||
case "/unsafe+":
|
||||
RootContext.Unsafe = true;
|
||||
@@ -1208,11 +1131,6 @@ namespace Mono.CSharp
|
||||
load_default_config = false;
|
||||
return true;
|
||||
|
||||
case "/help2":
|
||||
OtherFlags ();
|
||||
Environment.Exit(0);
|
||||
return true;
|
||||
|
||||
case "/help":
|
||||
case "/?":
|
||||
Usage ();
|
||||
@@ -1240,27 +1158,6 @@ namespace Mono.CSharp
|
||||
case "/fullpaths":
|
||||
return true;
|
||||
|
||||
case "/keyfile":
|
||||
if (value == String.Empty) {
|
||||
Report.Error (5, arg + " requires an argument");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
RootContext.StrongNameKeyFile = value;
|
||||
return true;
|
||||
case "/keycontainer":
|
||||
if (value == String.Empty) {
|
||||
Report.Error (5, arg + " requires an argument");
|
||||
Environment.Exit (1);
|
||||
}
|
||||
RootContext.StrongNameKeyContainer = value;
|
||||
return true;
|
||||
case "/delaysign+":
|
||||
RootContext.StrongNameDelaySign = true;
|
||||
return true;
|
||||
case "/delaysign-":
|
||||
RootContext.StrongNameDelaySign = false;
|
||||
return true;
|
||||
|
||||
case "/v2":
|
||||
case "/2":
|
||||
SetupV2 ();
|
||||
@@ -1296,17 +1193,6 @@ namespace Mono.CSharp
|
||||
//Environment.Exit (1);
|
||||
return false;
|
||||
}
|
||||
|
||||
static string [] AddArgs (string [] args, string [] extra_args)
|
||||
{
|
||||
string [] new_args;
|
||||
|
||||
new_args = new string [extra_args.Length + args.Length];
|
||||
args.CopyTo (new_args, 0);
|
||||
extra_args.CopyTo (new_args, args.Length);
|
||||
|
||||
return new_args;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parses the arguments, and drives the compilation
|
||||
@@ -1323,6 +1209,8 @@ namespace Mono.CSharp
|
||||
int i;
|
||||
bool parsing_options = true;
|
||||
|
||||
Console.WriteLine ("Mono C# Compiler {0} for Generics",
|
||||
Assembly.GetExecutingAssembly ().GetName ().Version.ToString ());
|
||||
try {
|
||||
encoding = Encoding.GetEncoding (28591);
|
||||
} catch {
|
||||
@@ -1344,13 +1232,12 @@ namespace Mono.CSharp
|
||||
// path.
|
||||
//
|
||||
|
||||
for (i = 0; i < args.Length; i++){
|
||||
int argc = args.Length;
|
||||
for (i = 0; i < argc; i++){
|
||||
string arg = args [i];
|
||||
if (arg == "")
|
||||
continue;
|
||||
|
||||
|
||||
if (arg.StartsWith ("@")){
|
||||
string [] extra_args;
|
||||
string [] new_args, extra_args;
|
||||
string response_file = arg.Substring (1);
|
||||
|
||||
if (response_file_list == null)
|
||||
@@ -1372,7 +1259,11 @@ namespace Mono.CSharp
|
||||
return false;
|
||||
}
|
||||
|
||||
args = AddArgs (args, extra_args);
|
||||
new_args = new string [extra_args.Length + argc];
|
||||
args.CopyTo (new_args, 0);
|
||||
extra_args.CopyTo (new_args, argc);
|
||||
args = new_args;
|
||||
argc = new_args.Length;
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1405,15 +1296,15 @@ namespace Mono.CSharp
|
||||
|
||||
if (tokenize)
|
||||
return true;
|
||||
|
||||
|
||||
//
|
||||
// If we are an exe, require a source file for the entry point
|
||||
//
|
||||
if (RootContext.Target == Target.Exe || RootContext.Target == Target.WinExe){
|
||||
if (first_source == null){
|
||||
Report.Error (2008, "No files to compile were specified");
|
||||
return false;
|
||||
}
|
||||
if (first_source == null){
|
||||
Report.Error (2008, "No files to compile were specified");
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1421,8 +1312,8 @@ namespace Mono.CSharp
|
||||
// If there is nothing to put in the assembly, and we are not a library
|
||||
//
|
||||
if (first_source == null && embedded_resources == null && resources == null){
|
||||
Report.Error (2008, "No files to compile were specified");
|
||||
return false;
|
||||
Report.Error (2008, "No files to compile were specified");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Report.Errors > 0)
|
||||
@@ -1430,7 +1321,7 @@ namespace Mono.CSharp
|
||||
|
||||
if (parse_only)
|
||||
return true;
|
||||
|
||||
|
||||
Tokenizer.Cleanup ();
|
||||
|
||||
//
|
||||
@@ -1452,7 +1343,6 @@ namespace Mono.CSharp
|
||||
if (timestamps)
|
||||
ShowTime ("Loading references");
|
||||
link_paths.Add (GetSystemDir ());
|
||||
link_paths.Add (Directory.GetCurrentDirectory ());
|
||||
LoadReferences ();
|
||||
|
||||
if (timestamps)
|
||||
@@ -1483,8 +1373,7 @@ namespace Mono.CSharp
|
||||
Environment.Exit (1);
|
||||
}
|
||||
|
||||
MethodInfo set_method = module_only.GetSetMethod (true);
|
||||
set_method.Invoke (CodeGen.Assembly.Builder, BindingFlags.Default, null, new object[]{true}, null);
|
||||
module_only.SetValue (CodeGen.Assembly.Builder, true, null);
|
||||
}
|
||||
|
||||
TypeManager.AddModule (CodeGen.Module.Builder);
|
||||
@@ -1531,7 +1420,6 @@ namespace Mono.CSharp
|
||||
ShowTime ("Populate tree");
|
||||
if (!RootContext.StdLib)
|
||||
RootContext.BootCorlib_PopulateCoreTypes ();
|
||||
|
||||
RootContext.PopulateTypes ();
|
||||
RootContext.DefineTypes ();
|
||||
|
||||
@@ -1546,12 +1434,6 @@ namespace Mono.CSharp
|
||||
return false;
|
||||
}
|
||||
|
||||
if (RootContext.VerifyClsCompliance) {
|
||||
CodeGen.Assembly.ResolveClsCompliance ();
|
||||
AttributeTester.VerifyModulesClsCompliance ();
|
||||
TypeManager.LoadAllImportedTypes ();
|
||||
}
|
||||
|
||||
//
|
||||
// The code generator
|
||||
//
|
||||
@@ -1572,7 +1454,7 @@ namespace Mono.CSharp
|
||||
RootContext.CloseTypes ();
|
||||
|
||||
PEFileKinds k = PEFileKinds.ConsoleApplication;
|
||||
|
||||
|
||||
switch (RootContext.Target) {
|
||||
case Target.Library:
|
||||
case Target.Module:
|
||||
@@ -1592,7 +1474,7 @@ namespace Mono.CSharp
|
||||
" does not have an entry point defined");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
CodeGen.Assembly.Builder.SetEntryPoint (ep, k);
|
||||
} else if (RootContext.MainClass != null) {
|
||||
Report.Error (2017, "Can not specify -main: when building module or library");
|
||||
@@ -1685,20 +1567,9 @@ namespace Mono.CSharp
|
||||
|
||||
Timer.ShowTimers ();
|
||||
|
||||
if (Report.ExpectedError != 0) {
|
||||
if (Report.Errors == 0) {
|
||||
Console.WriteLine ("Failed to report expected error " + Report.ExpectedError + ".\n" +
|
||||
"No other errors reported.");
|
||||
|
||||
Environment.Exit (2);
|
||||
} else {
|
||||
Console.WriteLine ("Failed to report expected error " + Report.ExpectedError + ".\n" +
|
||||
"However, other errors were reported.");
|
||||
|
||||
Environment.Exit (1);
|
||||
}
|
||||
|
||||
|
||||
if (Report.ExpectedError != 0){
|
||||
Console.WriteLine("Failed to report expected error " + Report.ExpectedError);
|
||||
Environment.Exit (1);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ namespace Mono.CSharp {
|
||||
|
||||
if ((flags & ResolveFlags.SimpleName) == 0) {
|
||||
MemberLookupFailed (ec, null, ec.ContainerType, s.Name,
|
||||
ec.DeclSpace.Name, loc);
|
||||
0, ec.DeclSpace.Name, loc);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -315,10 +315,10 @@ namespace Mono.CSharp {
|
||||
|
||||
case ExprClass.MethodGroup:
|
||||
if (!RootContext.V2){
|
||||
if ((flags & ResolveFlags.MethodGroup) == 0) {
|
||||
((MethodGroupExpr) e).ReportUsageError ();
|
||||
return null;
|
||||
}
|
||||
if ((flags & ResolveFlags.MethodGroup) == 0) {
|
||||
((MethodGroupExpr) e).ReportUsageError ();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -376,7 +376,7 @@ namespace Mono.CSharp {
|
||||
if (e is SimpleName){
|
||||
SimpleName s = (SimpleName) e;
|
||||
MemberLookupFailed (ec, null, ec.ContainerType, s.Name,
|
||||
ec.DeclSpace.Name, loc);
|
||||
0, ec.DeclSpace.Name, loc);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -389,7 +389,7 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (e.type == null)
|
||||
if ((e.type == null) && !(e is ConstructedType))
|
||||
throw new Exception ("Expression " + e +
|
||||
" did not set its type after Resolve");
|
||||
}
|
||||
@@ -466,11 +466,7 @@ namespace Mono.CSharp {
|
||||
else if (t == TypeManager.bool_type)
|
||||
return new BoolConstant ((bool) v);
|
||||
else if (TypeManager.IsEnumType (t)){
|
||||
Type real_type = TypeManager.TypeToCoreType (v.GetType ());
|
||||
if (real_type == t)
|
||||
real_type = real_type.UnderlyingSystemType;
|
||||
|
||||
Constant e = Constantify (v, real_type);
|
||||
Constant e = Constantify (v, TypeManager.TypeToCoreType (v.GetType ()));
|
||||
|
||||
return new EnumConstant (e, t);
|
||||
} else
|
||||
@@ -527,7 +523,7 @@ namespace Mono.CSharp {
|
||||
public static Expression MemberLookup (EmitContext ec, Type queried_type, string name,
|
||||
MemberTypes mt, BindingFlags bf, Location loc)
|
||||
{
|
||||
return MemberLookup (ec, ec.ContainerType, null, queried_type, name, mt, bf, loc);
|
||||
return MemberLookup (ec, ec.ContainerType, null, queried_type, name, 0, mt, bf, loc);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -537,11 +533,13 @@ namespace Mono.CSharp {
|
||||
|
||||
public static Expression MemberLookup (EmitContext ec, Type container_type,
|
||||
Type qualifier_type, Type queried_type,
|
||||
string name, MemberTypes mt,
|
||||
BindingFlags bf, Location loc)
|
||||
string name, int num_type_arguments,
|
||||
MemberTypes mt, BindingFlags bf,
|
||||
Location loc)
|
||||
{
|
||||
MemberInfo [] mi = TypeManager.MemberLookup (container_type, qualifier_type,
|
||||
queried_type, mt, bf, name);
|
||||
queried_type, num_type_arguments,
|
||||
mt, bf, name);
|
||||
|
||||
if (mi == null)
|
||||
return null;
|
||||
@@ -570,25 +568,34 @@ namespace Mono.CSharp {
|
||||
BindingFlags.Static |
|
||||
BindingFlags.Instance;
|
||||
|
||||
public static Expression MemberLookup (EmitContext ec, Type queried_type,
|
||||
string name, int num_type_arguments,
|
||||
Location loc)
|
||||
{
|
||||
return MemberLookup (ec, ec.ContainerType, null, queried_type, name,
|
||||
num_type_arguments, AllMemberTypes, AllBindingFlags,
|
||||
loc);
|
||||
}
|
||||
|
||||
public static Expression MemberLookup (EmitContext ec, Type queried_type,
|
||||
string name, Location loc)
|
||||
{
|
||||
return MemberLookup (ec, ec.ContainerType, null, queried_type, name,
|
||||
AllMemberTypes, AllBindingFlags, loc);
|
||||
0, AllMemberTypes, AllBindingFlags, loc);
|
||||
}
|
||||
|
||||
public static Expression MemberLookup (EmitContext ec, Type qualifier_type,
|
||||
Type queried_type, string name, Location loc)
|
||||
{
|
||||
return MemberLookup (ec, ec.ContainerType, qualifier_type, queried_type,
|
||||
name, AllMemberTypes, AllBindingFlags, loc);
|
||||
name, 0, AllMemberTypes, AllBindingFlags, loc);
|
||||
}
|
||||
|
||||
public static Expression MethodLookup (EmitContext ec, Type queried_type,
|
||||
string name, Location loc)
|
||||
{
|
||||
return MemberLookup (ec, ec.ContainerType, null, queried_type, name,
|
||||
MemberTypes.Method, AllBindingFlags, loc);
|
||||
0, MemberTypes.Method, AllBindingFlags, loc);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -598,23 +605,25 @@ namespace Mono.CSharp {
|
||||
/// find it.
|
||||
/// </summary>
|
||||
public static Expression MemberLookupFinal (EmitContext ec, Type qualifier_type,
|
||||
Type queried_type, string name, Location loc)
|
||||
Type queried_type, string name,
|
||||
int num_type_arguments, Location loc)
|
||||
{
|
||||
return MemberLookupFinal (ec, qualifier_type, queried_type, name,
|
||||
AllMemberTypes, AllBindingFlags, loc);
|
||||
num_type_arguments, AllMemberTypes,
|
||||
AllBindingFlags, loc);
|
||||
}
|
||||
|
||||
public static Expression MemberLookupFinal (EmitContext ec, Type qualifier_type,
|
||||
Type queried_type, string name,
|
||||
MemberTypes mt, BindingFlags bf,
|
||||
Location loc)
|
||||
int num_type_arguments, MemberTypes mt,
|
||||
BindingFlags bf, Location loc)
|
||||
{
|
||||
Expression e;
|
||||
|
||||
int errors = Report.Errors;
|
||||
|
||||
e = MemberLookup (ec, ec.ContainerType, qualifier_type, queried_type,
|
||||
name, mt, bf, loc);
|
||||
name, num_type_arguments, mt, bf, loc);
|
||||
|
||||
if (e != null)
|
||||
return e;
|
||||
@@ -623,19 +632,21 @@ namespace Mono.CSharp {
|
||||
if (errors < Report.Errors)
|
||||
return null;
|
||||
|
||||
MemberLookupFailed (ec, qualifier_type, queried_type, name, null, loc);
|
||||
MemberLookupFailed (ec, qualifier_type, queried_type, name,
|
||||
num_type_arguments, null, loc);
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void MemberLookupFailed (EmitContext ec, Type qualifier_type,
|
||||
Type queried_type, string name,
|
||||
string class_name, Location loc)
|
||||
int num_type_arguments, string class_name,
|
||||
Location loc)
|
||||
{
|
||||
object lookup = TypeManager.MemberLookup (queried_type, null, queried_type,
|
||||
AllMemberTypes, AllBindingFlags |
|
||||
BindingFlags.NonPublic, name);
|
||||
MemberInfo[] mi = TypeManager.MemberLookup (queried_type, null, queried_type,
|
||||
-1, AllMemberTypes, AllBindingFlags |
|
||||
BindingFlags.NonPublic, name);
|
||||
|
||||
if (lookup == null) {
|
||||
if (mi == null) {
|
||||
if (class_name != null)
|
||||
Report.Error (103, loc, "The name `" + name + "' could not be " +
|
||||
"found in `" + class_name + "'");
|
||||
@@ -646,6 +657,21 @@ namespace Mono.CSharp {
|
||||
return;
|
||||
}
|
||||
|
||||
if (TypeManager.MemberLookup (queried_type, null, queried_type,
|
||||
0, AllMemberTypes, AllBindingFlags |
|
||||
BindingFlags.NonPublic, name) == null) {
|
||||
if ((mi.Length == 1) && (mi [0] is Type)) {
|
||||
Type t = (Type) mi [0];
|
||||
|
||||
Report.Error (305, loc,
|
||||
"Using the generic type `{0}' " +
|
||||
"requires {1} type arguments",
|
||||
TypeManager.GetFullName (t),
|
||||
TypeManager.GetNumberOfTypeArguments (t));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((qualifier_type != null) && (qualifier_type != ec.ContainerType) &&
|
||||
ec.ContainerType.IsSubclassOf (qualifier_type)) {
|
||||
// Although a derived class can access protected members of
|
||||
@@ -654,11 +680,11 @@ namespace Mono.CSharp {
|
||||
// ec.ContainerType and the lookup succeeds with the latter one,
|
||||
// then we are in this situation.
|
||||
|
||||
lookup = TypeManager.MemberLookup (
|
||||
mi = TypeManager.MemberLookup (
|
||||
ec.ContainerType, ec.ContainerType, ec.ContainerType,
|
||||
AllMemberTypes, AllBindingFlags, name);
|
||||
0, AllMemberTypes, AllBindingFlags, name);
|
||||
|
||||
if (lookup != null) {
|
||||
if (mi != null) {
|
||||
Report.Error (
|
||||
1540, loc, "Cannot access protected member `" +
|
||||
TypeManager.CSharpName (qualifier_type) + "." +
|
||||
@@ -672,13 +698,17 @@ namespace Mono.CSharp {
|
||||
}
|
||||
|
||||
if (qualifier_type != null)
|
||||
Report.Error_T (122, loc, TypeManager.CSharpName (qualifier_type) + "." + name);
|
||||
Report.Error (
|
||||
122, loc, "`" + TypeManager.CSharpName (qualifier_type) + "." +
|
||||
name + "' is inaccessible due to its protection level");
|
||||
else if (name == ".ctor") {
|
||||
Report.Error (143, loc, String.Format ("The type {0} has no constructors defined",
|
||||
TypeManager.CSharpName (queried_type)));
|
||||
} else {
|
||||
Report.Error_T (122, loc, name);
|
||||
}
|
||||
Report.Error (
|
||||
122, loc, "`" + name + "' is inaccessible due to its " +
|
||||
"protection level");
|
||||
}
|
||||
}
|
||||
|
||||
static public MemberInfo GetFieldFromEvent (EventExpr event_expr)
|
||||
@@ -717,7 +747,8 @@ namespace Mono.CSharp {
|
||||
|
||||
ArrayList arguments = new ArrayList ();
|
||||
arguments.Add (new Argument (e, Argument.AType.Expression));
|
||||
method = Invocation.OverloadResolve (ec, (MethodGroupExpr) operator_group, arguments, loc);
|
||||
method = Invocation.OverloadResolve (
|
||||
ec, (MethodGroupExpr) operator_group, arguments, false, loc);
|
||||
|
||||
if (method == null)
|
||||
return null;
|
||||
@@ -1221,7 +1252,7 @@ namespace Mono.CSharp {
|
||||
//
|
||||
// Default implementation of IAssignMethod.CacheTemporaries
|
||||
//
|
||||
public virtual void CacheTemporaries (EmitContext ec)
|
||||
public void CacheTemporaries (EmitContext ec)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1325,7 +1356,7 @@ namespace Mono.CSharp {
|
||||
/// </summary>
|
||||
public class EmptyCast : Expression {
|
||||
protected Expression child;
|
||||
|
||||
|
||||
public Expression Child {
|
||||
get {
|
||||
return child;
|
||||
@@ -1515,10 +1546,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
return Child.ConvertToInt ();
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return Child.IsZeroInteger; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -1532,13 +1559,11 @@ namespace Mono.CSharp {
|
||||
public BoxedCast (Expression expr)
|
||||
: base (expr, TypeManager.object_type)
|
||||
{
|
||||
eclass = ExprClass.Value;
|
||||
}
|
||||
|
||||
public BoxedCast (Expression expr, Type target_type)
|
||||
: base (expr, target_type)
|
||||
{
|
||||
eclass = ExprClass.Value;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
@@ -1897,6 +1922,7 @@ namespace Mono.CSharp {
|
||||
/// </remarks>
|
||||
public class SimpleName : Expression {
|
||||
public string Name;
|
||||
public int NumTypeArguments;
|
||||
|
||||
//
|
||||
// If true, then we are a simple name, not composed with a ".
|
||||
@@ -1917,6 +1943,14 @@ namespace Mono.CSharp {
|
||||
is_base = true;
|
||||
}
|
||||
|
||||
public SimpleName (string name, int num_type_arguments, Location l)
|
||||
{
|
||||
Name = name;
|
||||
NumTypeArguments = num_type_arguments;
|
||||
loc = l;
|
||||
is_base = true;
|
||||
}
|
||||
|
||||
public static void Error_ObjectRefRequired (EmitContext ec, Location l, string name)
|
||||
{
|
||||
if (ec.IsFieldInitializer)
|
||||
@@ -1981,10 +2015,14 @@ namespace Mono.CSharp {
|
||||
else
|
||||
alias_value = null;
|
||||
|
||||
TypeParameterExpr generic_type = ds.LookupGeneric (Name, loc);
|
||||
if (generic_type != null)
|
||||
return generic_type.ResolveAsTypeTerminal (ec);
|
||||
|
||||
if (ec.ResolvingTypeTree){
|
||||
int errors = Report.Errors;
|
||||
Type dt = ds.FindType (loc, Name);
|
||||
|
||||
Type dt = ds.FindType (loc, Name, NumTypeArguments);
|
||||
|
||||
if (Report.Errors != errors)
|
||||
return null;
|
||||
|
||||
@@ -1992,7 +2030,7 @@ namespace Mono.CSharp {
|
||||
return new TypeExpression (dt, loc);
|
||||
|
||||
if (alias_value != null){
|
||||
if ((t = RootContext.LookupType (ds, alias_value, true, loc)) != null)
|
||||
if ((t = RootContext.LookupType (ds, alias_value, true, NumTypeArguments, loc)) != null)
|
||||
return new TypeExpression (t, loc);
|
||||
}
|
||||
}
|
||||
@@ -2007,13 +2045,13 @@ namespace Mono.CSharp {
|
||||
// we have alias value, but it isn't Type, so try if it's namespace
|
||||
return new SimpleName (alias_value, loc);
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Stage 2: Lookup up if we are an alias to a type
|
||||
// or a namespace.
|
||||
//
|
||||
|
||||
if ((t = RootContext.LookupType (ds, Name, true, loc)) != null)
|
||||
if ((t = RootContext.LookupType (ds, Name, true, NumTypeArguments, loc)) != null)
|
||||
return new TypeExpression (t, loc);
|
||||
|
||||
// No match, maybe our parent can compose us
|
||||
@@ -2021,28 +2059,6 @@ namespace Mono.CSharp {
|
||||
return this;
|
||||
}
|
||||
|
||||
Expression SimpleNameResolve (EmitContext ec, Expression right_side,
|
||||
bool allow_static)
|
||||
{
|
||||
Expression e = DoSimpleNameResolve (ec, right_side, allow_static);
|
||||
if (e == null)
|
||||
return null;
|
||||
|
||||
Block current_block = ec.CurrentBlock;
|
||||
if (current_block != null){
|
||||
LocalInfo vi = current_block.GetLocalInfo (Name);
|
||||
if (is_base &&
|
||||
current_block.IsVariableNameUsedInChildBlock(Name)) {
|
||||
Report.Error (135, Location,
|
||||
"'{0}' has a different meaning in a " +
|
||||
"child block", Name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// 7.5.2: Simple Names.
|
||||
///
|
||||
@@ -2060,7 +2076,7 @@ namespace Mono.CSharp {
|
||||
/// Type is both an instance variable and a Type; Type.GetType
|
||||
/// is the static method not an instance method of type.
|
||||
/// </remarks>
|
||||
Expression DoSimpleNameResolve (EmitContext ec, Expression right_side, bool allow_static)
|
||||
Expression SimpleNameResolve (EmitContext ec, Expression right_side, bool allow_static)
|
||||
{
|
||||
Expression e = null;
|
||||
|
||||
@@ -2108,15 +2124,17 @@ namespace Mono.CSharp {
|
||||
if (lookup_ds.TypeBuilder == null)
|
||||
break;
|
||||
|
||||
e = MemberLookup (ec, lookup_ds.TypeBuilder, Name, loc);
|
||||
e = MemberLookup (ec, lookup_ds.TypeBuilder,
|
||||
Name, NumTypeArguments, loc);
|
||||
if (e != null)
|
||||
break;
|
||||
|
||||
lookup_ds =lookup_ds.Parent;
|
||||
} while (lookup_ds != null);
|
||||
|
||||
|
||||
if (e == null && ec.ContainerType != null)
|
||||
e = MemberLookup (ec, ec.ContainerType, Name, loc);
|
||||
e = MemberLookup (ec, ec.ContainerType,
|
||||
Name, NumTypeArguments, loc);
|
||||
|
||||
if (e == null) {
|
||||
//
|
||||
@@ -2259,7 +2277,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
if (Type == TypeManager.enum_type ||
|
||||
(Type == TypeManager.value_type && RootContext.StdLib) ||
|
||||
Type == TypeManager.multicast_delegate_type ||
|
||||
Type == TypeManager.delegate_type ||
|
||||
Type == TypeManager.array_type)
|
||||
return false;
|
||||
@@ -2303,11 +2320,6 @@ namespace Mono.CSharp {
|
||||
return Type == tobj.Type;
|
||||
}
|
||||
|
||||
public override int GetHashCode ()
|
||||
{
|
||||
return Type.GetHashCode ();
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return Name;
|
||||
@@ -2370,7 +2382,7 @@ namespace Mono.CSharp {
|
||||
public MethodBase [] Methods;
|
||||
Expression instance_expression = null;
|
||||
bool is_explicit_impl = false;
|
||||
bool identical_type_name = false;
|
||||
bool has_type_arguments = false;
|
||||
|
||||
public MethodGroupExpr (MemberInfo [] mi, Location l)
|
||||
{
|
||||
@@ -2405,10 +2417,10 @@ namespace Mono.CSharp {
|
||||
public Type DeclaringType {
|
||||
get {
|
||||
//
|
||||
// The methods are arranged in this order:
|
||||
// derived type -> base type
|
||||
// We assume that the top-level type is in the end
|
||||
//
|
||||
return Methods [0].DeclaringType;
|
||||
return Methods [Methods.Length - 1].DeclaringType;
|
||||
//return Methods [0].DeclaringType;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2435,19 +2447,20 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
public bool IdenticalTypeName {
|
||||
public bool HasTypeArguments {
|
||||
get {
|
||||
return identical_type_name;
|
||||
return has_type_arguments;
|
||||
}
|
||||
|
||||
set {
|
||||
identical_type_name = value;
|
||||
has_type_arguments = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get {
|
||||
return Methods [0].Name;
|
||||
return TypeManager.CSharpSignature (
|
||||
Methods [Methods.Length - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2540,16 +2553,12 @@ namespace Mono.CSharp {
|
||||
public readonly FieldInfo FieldInfo;
|
||||
Expression instance_expr;
|
||||
VariableInfo variable_info;
|
||||
|
||||
LocalTemporary temporary;
|
||||
IMemoryLocation instance_ml;
|
||||
bool have_temporary;
|
||||
|
||||
public FieldExpr (FieldInfo fi, Location l)
|
||||
{
|
||||
FieldInfo = fi;
|
||||
eclass = ExprClass.Variable;
|
||||
type = fi.FieldType;
|
||||
type = TypeManager.TypeToCoreType (fi.FieldType);
|
||||
loc = l;
|
||||
}
|
||||
|
||||
@@ -2673,7 +2682,13 @@ namespace Mono.CSharp {
|
||||
if (IsStatic && !ec.IsStatic)
|
||||
Report_AssignToReadonly (false);
|
||||
|
||||
if (ec.ContainerType == FieldInfo.DeclaringType)
|
||||
Type ctype;
|
||||
if (ec.TypeContainer.CurrentType != null)
|
||||
ctype = ec.TypeContainer.CurrentType.ResolveType (ec);
|
||||
else
|
||||
ctype = ec.ContainerType;
|
||||
|
||||
if (TypeManager.IsEqual (ctype, FieldInfo.DeclaringType))
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -2691,35 +2706,6 @@ namespace Mono.CSharp {
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void CacheTemporaries (EmitContext ec)
|
||||
{
|
||||
if (!FieldInfo.IsStatic && (temporary == null))
|
||||
temporary = new LocalTemporary (ec, instance_expr.Type);
|
||||
}
|
||||
|
||||
void EmitInstance (EmitContext ec)
|
||||
{
|
||||
if (instance_expr.Type.IsValueType)
|
||||
CacheTemporaries (ec);
|
||||
|
||||
if ((temporary == null) || have_temporary)
|
||||
return;
|
||||
|
||||
if (instance_expr.Type.IsValueType) {
|
||||
instance_ml = instance_expr as IMemoryLocation;
|
||||
if (instance_ml == null) {
|
||||
instance_expr.Emit (ec);
|
||||
temporary.Store (ec);
|
||||
instance_ml = temporary;
|
||||
}
|
||||
} else {
|
||||
instance_expr.Emit (ec);
|
||||
temporary.Store (ec);
|
||||
}
|
||||
|
||||
have_temporary = true;
|
||||
}
|
||||
|
||||
override public void Emit (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
@@ -2742,15 +2728,30 @@ namespace Mono.CSharp {
|
||||
ig.Emit (OpCodes.Ldsfld, FieldInfo);
|
||||
return;
|
||||
}
|
||||
|
||||
EmitInstance (ec);
|
||||
if (instance_ml != null)
|
||||
instance_ml.AddressOf (ec, AddressOp.Load);
|
||||
else if (temporary != null)
|
||||
temporary.Emit (ec);
|
||||
else
|
||||
instance_expr.Emit (ec);
|
||||
|
||||
|
||||
if (instance_expr.Type.IsValueType){
|
||||
IMemoryLocation ml;
|
||||
LocalTemporary tempo = null;
|
||||
|
||||
if (!(instance_expr is IMemoryLocation)){
|
||||
tempo = new LocalTemporary (ec, instance_expr.Type);
|
||||
|
||||
if (ec.RemapToProxy)
|
||||
ec.EmitThis ();
|
||||
|
||||
InstanceExpression.Emit (ec);
|
||||
tempo.Store (ec);
|
||||
ml = tempo;
|
||||
} else
|
||||
ml = (IMemoryLocation) instance_expr;
|
||||
|
||||
ml.AddressOf (ec, AddressOp.Load);
|
||||
} else {
|
||||
if (ec.RemapToProxy)
|
||||
ec.EmitThis ();
|
||||
else
|
||||
instance_expr.Emit (ec);
|
||||
}
|
||||
if (is_volatile)
|
||||
ig.Emit (OpCodes.Volatile);
|
||||
|
||||
@@ -2770,13 +2771,18 @@ namespace Mono.CSharp {
|
||||
}
|
||||
|
||||
if (!is_static){
|
||||
EmitInstance (ec);
|
||||
if (instance_ml != null)
|
||||
instance_ml.AddressOf (ec, AddressOp.Store);
|
||||
else if (temporary != null)
|
||||
temporary.Emit (ec);
|
||||
else
|
||||
instance_expr.Emit (ec);
|
||||
Expression instance = instance_expr;
|
||||
|
||||
if (instance.Type.IsValueType){
|
||||
IMemoryLocation ml = (IMemoryLocation) instance;
|
||||
|
||||
ml.AddressOf (ec, AddressOp.Store);
|
||||
} else {
|
||||
if (ec.RemapToProxy)
|
||||
ec.EmitThis ();
|
||||
else
|
||||
instance.Emit (ec);
|
||||
}
|
||||
}
|
||||
|
||||
source.Emit (ec);
|
||||
@@ -2851,14 +2857,13 @@ namespace Mono.CSharp {
|
||||
// only load the pointer, and not perform an Ldobj immediately after
|
||||
// the value has been loaded into the stack.
|
||||
//
|
||||
EmitInstance (ec);
|
||||
if (instance_ml != null)
|
||||
instance_ml.AddressOf (ec, AddressOp.LoadStore);
|
||||
else if (temporary != null)
|
||||
temporary.Emit (ec);
|
||||
else if (instance_expr is This)
|
||||
if (instance_expr is This)
|
||||
((This)instance_expr).AddressOf (ec, AddressOp.LoadStore);
|
||||
else
|
||||
else if (instance_expr.Type.IsValueType && instance_expr is IMemoryLocation){
|
||||
IMemoryLocation ml = (IMemoryLocation) instance_expr;
|
||||
|
||||
ml.AddressOf (ec, AddressOp.LoadStore);
|
||||
} else
|
||||
instance_expr.Emit (ec);
|
||||
ig.Emit (OpCodes.Ldflda, FieldInfo);
|
||||
}
|
||||
@@ -2898,8 +2903,6 @@ namespace Mono.CSharp {
|
||||
bool must_do_cs1540_check;
|
||||
|
||||
Expression instance_expr;
|
||||
LocalTemporary temporary;
|
||||
bool have_temporary;
|
||||
|
||||
public PropertyExpr (EmitContext ec, PropertyInfo pi, Location l)
|
||||
{
|
||||
@@ -2962,122 +2965,95 @@ namespace Mono.CSharp {
|
||||
return true;
|
||||
}
|
||||
|
||||
MethodInfo FindAccessor (Type invocation_type, bool is_set)
|
||||
MethodInfo GetAccessor (Type invocation_type, string accessor_name)
|
||||
{
|
||||
BindingFlags flags = BindingFlags.Public | BindingFlags.NonPublic |
|
||||
BindingFlags.Static | BindingFlags.Instance |
|
||||
BindingFlags.DeclaredOnly;
|
||||
BindingFlags.Static | BindingFlags.Instance;
|
||||
MemberInfo[] group;
|
||||
|
||||
Type current = PropertyInfo.DeclaringType;
|
||||
for (; current != null; current = current.BaseType) {
|
||||
MemberInfo[] group = TypeManager.MemberLookup (
|
||||
invocation_type, invocation_type, current,
|
||||
MemberTypes.Property, flags, PropertyInfo.Name);
|
||||
group = TypeManager.MemberLookup (
|
||||
invocation_type, invocation_type, PropertyInfo.DeclaringType,
|
||||
0, MemberTypes.Method, flags, accessor_name + "_" + PropertyInfo.Name);
|
||||
|
||||
if (group == null)
|
||||
continue;
|
||||
//
|
||||
// The first method is the closest to us
|
||||
//
|
||||
if (group == null)
|
||||
return null;
|
||||
|
||||
if (group.Length != 1)
|
||||
// Oooops, can this ever happen ?
|
||||
return null;
|
||||
foreach (MethodInfo mi in group) {
|
||||
MethodAttributes ma = mi.Attributes & MethodAttributes.MemberAccessMask;
|
||||
|
||||
PropertyInfo pi = (PropertyInfo) group [0];
|
||||
|
||||
MethodInfo get = pi.GetGetMethod (true);
|
||||
MethodInfo set = pi.GetSetMethod (true);
|
||||
|
||||
if (is_set) {
|
||||
if (set != null)
|
||||
return set;
|
||||
} else {
|
||||
if (get != null)
|
||||
return get;
|
||||
//
|
||||
// If only accessible to the current class or children
|
||||
//
|
||||
if (ma == MethodAttributes.Private) {
|
||||
Type declaring_type = mi.DeclaringType;
|
||||
|
||||
if (invocation_type != declaring_type){
|
||||
if (TypeManager.IsSubclassOrNestedChildOf (invocation_type, mi.DeclaringType))
|
||||
return mi;
|
||||
else
|
||||
continue;
|
||||
} else
|
||||
return mi;
|
||||
}
|
||||
//
|
||||
// FamAndAssem requires that we not only derivate, but we are on the
|
||||
// same assembly.
|
||||
//
|
||||
if (ma == MethodAttributes.FamANDAssem){
|
||||
if (mi.DeclaringType.Assembly != invocation_type.Assembly)
|
||||
continue;
|
||||
else
|
||||
return mi;
|
||||
}
|
||||
|
||||
MethodInfo accessor = get != null ? get : set;
|
||||
if (accessor == null)
|
||||
// Assembly and FamORAssem succeed if we're in the same assembly.
|
||||
if ((ma == MethodAttributes.Assembly) || (ma == MethodAttributes.FamORAssem)){
|
||||
if (mi.DeclaringType.Assembly == invocation_type.Assembly)
|
||||
return mi;
|
||||
}
|
||||
|
||||
// We already know that we aren't in the same assembly.
|
||||
if (ma == MethodAttributes.Assembly)
|
||||
continue;
|
||||
if ((accessor.Attributes & MethodAttributes.NewSlot) != 0)
|
||||
break;
|
||||
|
||||
// Family and FamANDAssem require that we derive.
|
||||
if ((ma == MethodAttributes.Family) || (ma == MethodAttributes.FamANDAssem) || (ma == MethodAttributes.FamORAssem)){
|
||||
if (!TypeManager.IsSubclassOrNestedChildOf (invocation_type, mi.DeclaringType))
|
||||
continue;
|
||||
else {
|
||||
must_do_cs1540_check = true;
|
||||
|
||||
return mi;
|
||||
}
|
||||
}
|
||||
|
||||
return mi;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
MethodInfo GetAccessor (Type invocation_type, bool is_set)
|
||||
{
|
||||
MethodInfo mi = FindAccessor (invocation_type, is_set);
|
||||
if (mi == null)
|
||||
return null;
|
||||
|
||||
MethodAttributes ma = mi.Attributes & MethodAttributes.MemberAccessMask;
|
||||
|
||||
//
|
||||
// If only accessible to the current class or children
|
||||
//
|
||||
if (ma == MethodAttributes.Private) {
|
||||
Type declaring_type = mi.DeclaringType;
|
||||
|
||||
if (invocation_type != declaring_type){
|
||||
if (TypeManager.IsSubclassOrNestedChildOf (invocation_type, mi.DeclaringType))
|
||||
return mi;
|
||||
else
|
||||
return null;
|
||||
} else
|
||||
return mi;
|
||||
}
|
||||
//
|
||||
// FamAndAssem requires that we not only derivate, but we are on the
|
||||
// same assembly.
|
||||
//
|
||||
if (ma == MethodAttributes.FamANDAssem){
|
||||
if (mi.DeclaringType.Assembly != invocation_type.Assembly)
|
||||
return null;
|
||||
else
|
||||
return mi;
|
||||
}
|
||||
|
||||
// Assembly and FamORAssem succeed if we're in the same assembly.
|
||||
if ((ma == MethodAttributes.Assembly) || (ma == MethodAttributes.FamORAssem)){
|
||||
if (mi.DeclaringType.Assembly == invocation_type.Assembly)
|
||||
return mi;
|
||||
}
|
||||
|
||||
// We already know that we aren't in the same assembly.
|
||||
if (ma == MethodAttributes.Assembly)
|
||||
return null;
|
||||
|
||||
// Family and FamANDAssem require that we derive.
|
||||
if ((ma == MethodAttributes.Family) || (ma == MethodAttributes.FamANDAssem) || (ma == MethodAttributes.FamORAssem)){
|
||||
if (!TypeManager.IsSubclassOrNestedChildOf (invocation_type, mi.DeclaringType))
|
||||
return null;
|
||||
else {
|
||||
if (!TypeManager.IsNestedChildOf (invocation_type, mi.DeclaringType))
|
||||
must_do_cs1540_check = true;
|
||||
|
||||
return mi;
|
||||
}
|
||||
}
|
||||
|
||||
return mi;
|
||||
}
|
||||
|
||||
//
|
||||
// We also perform the permission checking here, as the PropertyInfo does not
|
||||
// hold the information for the accessibility of its setter/getter
|
||||
//
|
||||
void ResolveAccessors (EmitContext ec)
|
||||
{
|
||||
getter = GetAccessor (ec.ContainerType, false);
|
||||
getter = GetAccessor (ec.ContainerType, "get");
|
||||
if ((getter != null) && getter.IsStatic)
|
||||
is_static = true;
|
||||
|
||||
setter = GetAccessor (ec.ContainerType, true);
|
||||
setter = GetAccessor (ec.ContainerType, "set");
|
||||
if ((setter != null) && setter.IsStatic)
|
||||
is_static = true;
|
||||
|
||||
if (setter == null && getter == null){
|
||||
Report.Error_T (122, loc, PropertyInfo.Name);
|
||||
Error (122, "`" + PropertyInfo.Name + "' " +
|
||||
"is inaccessible because of its protection level");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3113,16 +3089,6 @@ namespace Mono.CSharp {
|
||||
|
||||
override public Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
if (getter != null){
|
||||
if (TypeManager.GetArgumentTypes (getter).Length != 0){
|
||||
Report.Error (
|
||||
117, loc, "`{0}' does not contain a " +
|
||||
"definition for `{1}'.", getter.DeclaringType,
|
||||
Name);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
if (getter == null){
|
||||
//
|
||||
// The following condition happens if the PropertyExpr was
|
||||
@@ -3174,14 +3140,6 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (TypeManager.GetArgumentTypes (setter).Length != 1){
|
||||
Report.Error (
|
||||
117, loc, "`{0}' does not contain a " +
|
||||
"definition for `{1}'.", getter.DeclaringType,
|
||||
Name);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!InstanceResolve (ec))
|
||||
return null;
|
||||
|
||||
@@ -3196,29 +3154,8 @@ namespace Mono.CSharp {
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void CacheTemporaries (EmitContext ec)
|
||||
{
|
||||
if (!is_static)
|
||||
temporary = new LocalTemporary (ec, instance_expr.Type);
|
||||
}
|
||||
|
||||
Expression EmitInstance (EmitContext ec)
|
||||
{
|
||||
if (temporary != null){
|
||||
if (!have_temporary){
|
||||
instance_expr.Emit (ec);
|
||||
temporary.Store (ec);
|
||||
have_temporary = true;
|
||||
}
|
||||
return temporary;
|
||||
} else
|
||||
return instance_expr;
|
||||
}
|
||||
|
||||
override public void Emit (EmitContext ec)
|
||||
{
|
||||
Expression expr = EmitInstance (ec);
|
||||
|
||||
//
|
||||
// Special case: length of single dimension array property is turned into ldlen
|
||||
//
|
||||
@@ -3231,14 +3168,14 @@ namespace Mono.CSharp {
|
||||
// support invoking GetArrayRank, so test for that case first
|
||||
//
|
||||
if (iet != TypeManager.array_type && (iet.GetArrayRank () == 1)){
|
||||
expr.Emit (ec);
|
||||
instance_expr.Emit (ec);
|
||||
ec.ig.Emit (OpCodes.Ldlen);
|
||||
ec.ig.Emit (OpCodes.Conv_I4);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Invocation.EmitCall (ec, IsBase, IsStatic, expr, getter, null, loc);
|
||||
Invocation.EmitCall (ec, IsBase, IsStatic, instance_expr, getter, null, loc);
|
||||
|
||||
}
|
||||
|
||||
@@ -3247,13 +3184,11 @@ namespace Mono.CSharp {
|
||||
//
|
||||
public void EmitAssign (EmitContext ec, Expression source)
|
||||
{
|
||||
Expression expr = EmitInstance (ec);
|
||||
|
||||
Argument arg = new Argument (source, Argument.AType.Expression);
|
||||
ArrayList args = new ArrayList ();
|
||||
|
||||
args.Add (arg);
|
||||
Invocation.EmitCall (ec, IsBase, IsStatic, expr, setter, args, loc);
|
||||
Invocation.EmitCall (ec, IsBase, IsStatic, instance_expr, setter, args, loc);
|
||||
}
|
||||
|
||||
override public void EmitStatement (EmitContext ec)
|
||||
@@ -3268,7 +3203,7 @@ namespace Mono.CSharp {
|
||||
/// </summary>
|
||||
public class EventExpr : Expression, IMemberExpr {
|
||||
public readonly EventInfo EventInfo;
|
||||
Expression instance_expr;
|
||||
public Expression instance_expr;
|
||||
|
||||
bool is_static;
|
||||
MethodInfo add_accessor, remove_accessor;
|
||||
@@ -13,74 +13,9 @@ using System;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Mono.CSharp {
|
||||
|
||||
class EnumMember: Attributable {
|
||||
string name;
|
||||
Enum parent;
|
||||
Location loc;
|
||||
|
||||
static string[] attribute_targets = new string [] { "field" };
|
||||
|
||||
public FieldBuilder builder;
|
||||
|
||||
public EnumMember (string name, Enum parent, Location loc, Attributes attrs):
|
||||
base (attrs)
|
||||
{
|
||||
this.name = name;
|
||||
this.parent = parent;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
|
||||
{
|
||||
if (a.Type == TypeManager.marshal_as_attr_type) {
|
||||
UnmanagedMarshal marshal = a.GetMarshal ();
|
||||
if (marshal != null) {
|
||||
builder.SetMarshal (marshal);
|
||||
return;
|
||||
}
|
||||
Report.Warning_T (-24, a.Location);
|
||||
return;
|
||||
}
|
||||
|
||||
builder.SetCustomAttribute (cb);
|
||||
}
|
||||
|
||||
public override AttributeTargets AttributeTargets {
|
||||
get {
|
||||
return AttributeTargets.Field;
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsClsCompliaceRequired(DeclSpace ds)
|
||||
{
|
||||
return parent.IsClsCompliaceRequired (ds);
|
||||
}
|
||||
|
||||
public void DefineMember (TypeBuilder tb)
|
||||
{
|
||||
FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static
|
||||
| FieldAttributes.Literal;
|
||||
|
||||
builder = tb.DefineField (name, tb, attr);
|
||||
}
|
||||
|
||||
public void Emit (EmitContext ec)
|
||||
{
|
||||
if (OptAttributes != null)
|
||||
OptAttributes.Emit (ec, this);
|
||||
}
|
||||
|
||||
protected override string[] ValidAttributeTargets {
|
||||
get {
|
||||
return attribute_targets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enumeration container
|
||||
/// </summary>
|
||||
@@ -105,9 +40,6 @@ namespace Mono.CSharp {
|
||||
Hashtable in_transit;
|
||||
|
||||
ArrayList field_builders;
|
||||
|
||||
|
||||
Hashtable name_to_member;
|
||||
|
||||
public const int AllowedModifiers =
|
||||
Modifiers.NEW |
|
||||
@@ -129,8 +61,6 @@ namespace Mono.CSharp {
|
||||
member_to_value = new Hashtable ();
|
||||
in_transit = new Hashtable ();
|
||||
field_builders = new ArrayList ();
|
||||
|
||||
name_to_member = new Hashtable ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,8 +87,6 @@ namespace Mono.CSharp {
|
||||
member_to_attributes = new Hashtable ();
|
||||
|
||||
member_to_attributes.Add (name, opt_attrs);
|
||||
|
||||
name_to_member.Add (name, new EnumMember (name, this, loc, opt_attrs));
|
||||
|
||||
return AdditionResult.Success;
|
||||
}
|
||||
@@ -204,13 +132,6 @@ namespace Mono.CSharp {
|
||||
|
||||
attr |= TypeAttributes.Class | TypeAttributes.Sealed;
|
||||
|
||||
if (!(BaseType is TypeLookupExpression)) {
|
||||
Report.Error (1008, Location,
|
||||
"Type byte, sbyte, short, ushort, int, uint, " +
|
||||
"long, or ulong expected (got: `{0}')", BaseType);
|
||||
return null;
|
||||
}
|
||||
|
||||
UnderlyingType = ResolveType (BaseType, false, Location);
|
||||
|
||||
if (UnderlyingType != TypeManager.int32_type &&
|
||||
@@ -220,9 +141,10 @@ namespace Mono.CSharp {
|
||||
UnderlyingType != TypeManager.short_type &&
|
||||
UnderlyingType != TypeManager.ushort_type &&
|
||||
UnderlyingType != TypeManager.byte_type &&
|
||||
UnderlyingType != TypeManager.char_type &&
|
||||
UnderlyingType != TypeManager.sbyte_type) {
|
||||
Report.Error (1008, Location,
|
||||
"Type byte, sbyte, short, ushort, int, uint, " +
|
||||
"Type byte, sbyte, short, char, ushort, int, uint, " +
|
||||
"long, or ulong expected (got: " +
|
||||
TypeManager.CSharpName (UnderlyingType) + ")");
|
||||
return null;
|
||||
@@ -579,8 +501,10 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
EnumMember em = name_to_member [name] as EnumMember;
|
||||
em.DefineMember (TypeBuilder);
|
||||
FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static
|
||||
| FieldAttributes.Literal;
|
||||
|
||||
FieldBuilder fb = TypeBuilder.DefineField (name, TypeBuilder, attr);
|
||||
|
||||
bool fail;
|
||||
default_value = TypeManager.ChangeType (default_value, UnderlyingType, out fail);
|
||||
@@ -589,13 +513,18 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
|
||||
em.builder.SetConstant (default_value);
|
||||
field_builders.Add (em.builder);
|
||||
fb.SetConstant (default_value);
|
||||
field_builders.Add (fb);
|
||||
member_to_value [name] = default_value;
|
||||
|
||||
if (!TypeManager.RegisterFieldValue (em.builder, default_value))
|
||||
if (!TypeManager.RegisterFieldValue (fb, default_value))
|
||||
return null;
|
||||
|
||||
//
|
||||
// Now apply attributes
|
||||
//
|
||||
Attribute.ApplyAttributes (ec, fb, fb, (Attributes) member_to_attributes [name]);
|
||||
|
||||
return default_value;
|
||||
}
|
||||
|
||||
@@ -611,14 +540,17 @@ namespace Mono.CSharp {
|
||||
//
|
||||
if (TypeBuilder == null)
|
||||
return false;
|
||||
|
||||
|
||||
EmitContext ec = new EmitContext (this, this, Location, null,
|
||||
UnderlyingType, ModFlags, false);
|
||||
|
||||
|
||||
object default_value = 0;
|
||||
|
||||
|
||||
FieldAttributes attr = FieldAttributes.Public | FieldAttributes.Static
|
||||
| FieldAttributes.Literal;
|
||||
|
||||
|
||||
foreach (string name in ordered_enums) {
|
||||
//
|
||||
// Have we already been defined, thanks to some cross-referencing ?
|
||||
@@ -639,10 +571,8 @@ namespace Mono.CSharp {
|
||||
return false;
|
||||
}
|
||||
|
||||
EnumMember em = name_to_member [name] as EnumMember;
|
||||
|
||||
em.DefineMember (TypeBuilder);
|
||||
FieldBuilder fb = em.builder;
|
||||
FieldBuilder fb = TypeBuilder.DefineField (
|
||||
name, TypeBuilder, attr);
|
||||
|
||||
if (default_value == null) {
|
||||
Report.Error (543, loc, "Enumerator value for '" + name + "' is too large to " +
|
||||
@@ -663,70 +593,21 @@ namespace Mono.CSharp {
|
||||
|
||||
if (!TypeManager.RegisterFieldValue (fb, default_value))
|
||||
return false;
|
||||
|
||||
//
|
||||
// Apply attributes on the enum member
|
||||
//
|
||||
Attribute.ApplyAttributes (ec, fb, fb, (Attributes) member_to_attributes [name]);
|
||||
}
|
||||
|
||||
default_value = GetNextDefaultValue (default_value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Emit (TypeContainer tc)
|
||||
{
|
||||
EmitContext ec = new EmitContext (tc, this, Location, null, null, ModFlags, false);
|
||||
|
||||
if (OptAttributes != null) {
|
||||
OptAttributes.Emit (ec, this);
|
||||
}
|
||||
|
||||
foreach (EnumMember em in name_to_member.Values) {
|
||||
em.Emit (ec);
|
||||
}
|
||||
|
||||
base.Emit (tc);
|
||||
}
|
||||
|
||||
protected override bool IsIdentifierClsCompliant (DeclSpace ds)
|
||||
{
|
||||
if (!base.IsIdentifierClsCompliant (ds))
|
||||
return false;
|
||||
|
||||
for (int i = 1; i < ordered_enums.Count; ++i) {
|
||||
string checked_name = ordered_enums [i] as string;
|
||||
for (int ii = 0; ii < ordered_enums.Count; ++ii) {
|
||||
if (ii == i)
|
||||
continue;
|
||||
|
||||
string enumerator_name = ordered_enums [ii] as string;
|
||||
if (String.Compare (checked_name, enumerator_name, true, CultureInfo.InvariantCulture) == 0) {
|
||||
Report.SymbolRelatedToPreviousError ((Location)member_to_location [enumerator_name], enumerator_name);
|
||||
Report.Error_T (3005, (Location)member_to_location [checked_name], GetEnumeratorName (checked_name));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected override bool VerifyClsCompliance (DeclSpace ds)
|
||||
{
|
||||
if (!base.VerifyClsCompliance (ds))
|
||||
return false;
|
||||
|
||||
if (!AttributeTester.IsClsCompliant (UnderlyingType)) {
|
||||
Report.Error_T (3009, Location, GetSignatureForError (), TypeManager.CSharpName (UnderlyingType));
|
||||
}
|
||||
|
||||
Attribute.ApplyAttributes (ec, TypeBuilder, this, OptAttributes);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns full enum name.
|
||||
/// </summary>
|
||||
string GetEnumeratorName (string valueName)
|
||||
{
|
||||
return String.Concat (Name, ".", valueName);
|
||||
}
|
||||
|
||||
//
|
||||
// IMemberFinder
|
||||
//
|
||||
@@ -768,12 +649,5 @@ namespace Mono.CSharp {
|
||||
return (Expression) defined_names [name];
|
||||
}
|
||||
}
|
||||
|
||||
public override AttributeTargets AttributeTargets {
|
||||
get {
|
||||
return AttributeTargets.Enum;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File diff suppressed because it is too large.
Load diff
@@ -79,7 +79,7 @@ namespace Mono.CSharp
|
||||
|
||||
public sealed class Reachability
|
||||
{
|
||||
FlowReturns returns, breaks, throws, barrier;
|
||||
FlowReturns returns, breaks, throws, barrier, reachable;
|
||||
|
||||
public FlowReturns Returns {
|
||||
get { return returns; }
|
||||
@@ -93,6 +93,10 @@ namespace Mono.CSharp
|
||||
public FlowReturns Barrier {
|
||||
get { return barrier; }
|
||||
}
|
||||
public FlowReturns Reachable {
|
||||
get { return reachable; }
|
||||
}
|
||||
|
||||
public Reachability (FlowReturns returns, FlowReturns breaks,
|
||||
FlowReturns throws, FlowReturns barrier)
|
||||
{
|
||||
@@ -100,11 +104,15 @@ namespace Mono.CSharp
|
||||
this.breaks = breaks;
|
||||
this.throws = throws;
|
||||
this.barrier = barrier;
|
||||
|
||||
update ();
|
||||
}
|
||||
|
||||
public Reachability Clone ()
|
||||
{
|
||||
return new Reachability (returns, breaks, throws, barrier);
|
||||
Reachability cloned = new Reachability (returns, breaks, throws, barrier);
|
||||
cloned.reachable = reachable;
|
||||
return cloned;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
@@ -223,12 +231,7 @@ namespace Mono.CSharp
|
||||
a.throws = AndFlowReturns (a.throws, b.throws);
|
||||
a.barrier = AndFlowReturns (a.barrier, b.barrier);
|
||||
|
||||
if (a_unreachable && b_unreachable)
|
||||
a.barrier = FlowReturns.Always;
|
||||
else if (a_unreachable || b_unreachable)
|
||||
a.barrier = FlowReturns.Sometimes;
|
||||
else
|
||||
a.barrier = FlowReturns.Never;
|
||||
a.reachable = AndFlowReturns (a.reachable, b.reachable);
|
||||
}
|
||||
|
||||
public void Or (Reachability b)
|
||||
@@ -237,6 +240,8 @@ namespace Mono.CSharp
|
||||
breaks = OrFlowReturns (breaks, b.breaks);
|
||||
throws = OrFlowReturns (throws, b.throws);
|
||||
barrier = OrFlowReturns (barrier, b.barrier);
|
||||
|
||||
update ();
|
||||
}
|
||||
|
||||
public static Reachability Never ()
|
||||
@@ -246,21 +251,16 @@ namespace Mono.CSharp
|
||||
FlowReturns.Never, FlowReturns.Never);
|
||||
}
|
||||
|
||||
public FlowReturns Reachable {
|
||||
get {
|
||||
if ((returns == FlowReturns.Always) ||
|
||||
(breaks == FlowReturns.Always) ||
|
||||
(throws == FlowReturns.Always) ||
|
||||
(barrier == FlowReturns.Always))
|
||||
return FlowReturns.Never;
|
||||
else if ((returns == FlowReturns.Never) &&
|
||||
(breaks == FlowReturns.Never) &&
|
||||
(throws == FlowReturns.Never) &&
|
||||
(barrier == FlowReturns.Never))
|
||||
return FlowReturns.Always;
|
||||
else
|
||||
return FlowReturns.Sometimes;
|
||||
}
|
||||
void update ()
|
||||
{
|
||||
if ((returns == FlowReturns.Always) || (breaks == FlowReturns.Always) ||
|
||||
(throws == FlowReturns.Always) || (barrier == FlowReturns.Always))
|
||||
reachable = FlowReturns.Never;
|
||||
else if ((returns == FlowReturns.Never) && (breaks == FlowReturns.Never) &&
|
||||
(throws == FlowReturns.Never) && (barrier == FlowReturns.Never))
|
||||
reachable = FlowReturns.Always;
|
||||
else
|
||||
reachable = FlowReturns.Sometimes;
|
||||
}
|
||||
|
||||
public bool AlwaysBreaks {
|
||||
@@ -296,42 +296,43 @@ namespace Mono.CSharp
|
||||
}
|
||||
|
||||
public bool IsUnreachable {
|
||||
get { return Reachable == FlowReturns.Never; }
|
||||
get { return reachable == FlowReturns.Never; }
|
||||
}
|
||||
|
||||
public void SetReturns ()
|
||||
{
|
||||
returns = FlowReturns.Always;
|
||||
update ();
|
||||
}
|
||||
|
||||
public void SetReturnsSometimes ()
|
||||
{
|
||||
returns = FlowReturns.Sometimes;
|
||||
update ();
|
||||
}
|
||||
|
||||
public void SetBreaks ()
|
||||
{
|
||||
breaks = FlowReturns.Always;
|
||||
update ();
|
||||
}
|
||||
|
||||
public void ResetBreaks ()
|
||||
{
|
||||
breaks = FlowReturns.Never;
|
||||
update ();
|
||||
}
|
||||
|
||||
public void SetThrows ()
|
||||
{
|
||||
throws = FlowReturns.Always;
|
||||
}
|
||||
|
||||
public void SetThrowsSometimes ()
|
||||
{
|
||||
throws = FlowReturns.Sometimes;
|
||||
update ();
|
||||
}
|
||||
|
||||
public void SetBarrier ()
|
||||
{
|
||||
barrier = FlowReturns.Always;
|
||||
update ();
|
||||
}
|
||||
|
||||
static string ShortName (FlowReturns returns)
|
||||
@@ -351,7 +352,7 @@ namespace Mono.CSharp
|
||||
return String.Format ("[{0}:{1}:{2}:{3}:{4}]",
|
||||
ShortName (returns), ShortName (breaks),
|
||||
ShortName (throws), ShortName (barrier),
|
||||
ShortName (Reachable));
|
||||
ShortName (reachable));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -370,9 +371,6 @@ namespace Mono.CSharp
|
||||
case BranchingType.Block:
|
||||
return new FlowBranchingBlock (parent, type, SiblingType.Block, block, loc);
|
||||
|
||||
case BranchingType.Loop:
|
||||
return new FlowBranchingLoop (parent, block, loc);
|
||||
|
||||
default:
|
||||
return new FlowBranchingBlock (parent, type, SiblingType.Conditional, block, loc);
|
||||
}
|
||||
@@ -427,11 +425,6 @@ namespace Mono.CSharp
|
||||
// </summary>
|
||||
public readonly Location Location;
|
||||
|
||||
// <summary>
|
||||
// This is only valid for SwitchSection, Try, Catch and Finally.
|
||||
// </summary>
|
||||
public readonly Block Block;
|
||||
|
||||
// <summary>
|
||||
// If this is true, then the usage vector has been modified and must be
|
||||
// merged when we're done with this branching.
|
||||
@@ -472,12 +465,9 @@ namespace Mono.CSharp
|
||||
//
|
||||
// Normally, you should not use any of these constructors.
|
||||
//
|
||||
public UsageVector (SiblingType type, UsageVector parent,
|
||||
Block block, Location loc,
|
||||
int num_params, int num_locals)
|
||||
public UsageVector (SiblingType type, UsageVector parent, Location loc, int num_params, int num_locals)
|
||||
{
|
||||
this.Type = type;
|
||||
this.Block = block;
|
||||
this.Location = loc;
|
||||
this.InheritsFrom = parent;
|
||||
this.CountParameters = num_params;
|
||||
@@ -485,7 +475,7 @@ namespace Mono.CSharp
|
||||
|
||||
if (parent != null) {
|
||||
if (num_locals > 0)
|
||||
locals = new MyBitVector (parent.locals, CountLocals);
|
||||
locals = new MyBitVector (parent.locals, CountLocals);
|
||||
|
||||
if (num_params > 0)
|
||||
parameters = new MyBitVector (parent.parameters, num_params);
|
||||
@@ -493,7 +483,7 @@ namespace Mono.CSharp
|
||||
reachability = parent.Reachability.Clone ();
|
||||
} else {
|
||||
if (num_locals > 0)
|
||||
locals = new MyBitVector (null, CountLocals);
|
||||
locals = new MyBitVector (null, CountLocals);
|
||||
|
||||
if (num_params > 0)
|
||||
parameters = new MyBitVector (null, num_params);
|
||||
@@ -504,19 +494,15 @@ namespace Mono.CSharp
|
||||
id = ++next_id;
|
||||
}
|
||||
|
||||
public UsageVector (SiblingType type, UsageVector parent,
|
||||
Block block, Location loc)
|
||||
: this (type, parent, block, loc,
|
||||
parent.CountParameters, parent.CountLocals)
|
||||
public UsageVector (SiblingType type, UsageVector parent, Location loc)
|
||||
: this (type, parent, loc, parent.CountParameters, parent.CountLocals)
|
||||
{ }
|
||||
|
||||
public UsageVector (MyBitVector parameters, MyBitVector locals,
|
||||
Reachability reachability, Block block,
|
||||
Location loc)
|
||||
Reachability reachability, Location loc)
|
||||
{
|
||||
this.Type = SiblingType.Block;
|
||||
this.Location = loc;
|
||||
this.Block = block;
|
||||
|
||||
this.reachability = reachability;
|
||||
this.parameters = parameters;
|
||||
@@ -530,12 +516,10 @@ namespace Mono.CSharp
|
||||
// </summary>
|
||||
public UsageVector Clone ()
|
||||
{
|
||||
UsageVector retval = new UsageVector (
|
||||
Type, null, Block, Location,
|
||||
CountParameters, CountLocals);
|
||||
UsageVector retval = new UsageVector (Type, null, Location, CountParameters, CountLocals);
|
||||
|
||||
if (retval.locals != null)
|
||||
retval.locals = locals.Clone ();
|
||||
retval.locals = locals.Clone ();
|
||||
|
||||
if (parameters != null)
|
||||
retval.parameters = parameters.Clone ();
|
||||
@@ -547,7 +531,7 @@ namespace Mono.CSharp
|
||||
|
||||
public bool IsAssigned (VariableInfo var)
|
||||
{
|
||||
if (!var.IsParameter && Reachability.IsUnreachable)
|
||||
if (!var.IsParameter && Reachability.AlwaysBreaks)
|
||||
return true;
|
||||
|
||||
return var.IsAssigned (var.IsParameter ? parameters : locals);
|
||||
@@ -555,7 +539,7 @@ namespace Mono.CSharp
|
||||
|
||||
public void SetAssigned (VariableInfo var)
|
||||
{
|
||||
if (!var.IsParameter && Reachability.IsUnreachable)
|
||||
if (!var.IsParameter && Reachability.AlwaysBreaks)
|
||||
return;
|
||||
|
||||
IsDirty = true;
|
||||
@@ -564,7 +548,7 @@ namespace Mono.CSharp
|
||||
|
||||
public bool IsFieldAssigned (VariableInfo var, string name)
|
||||
{
|
||||
if (!var.IsParameter && Reachability.IsUnreachable)
|
||||
if (!var.IsParameter && Reachability.AlwaysBreaks)
|
||||
return true;
|
||||
|
||||
return var.IsFieldAssigned (var.IsParameter ? parameters : locals, name);
|
||||
@@ -572,7 +556,7 @@ namespace Mono.CSharp
|
||||
|
||||
public void SetFieldAssigned (VariableInfo var, string name)
|
||||
{
|
||||
if (!var.IsParameter && Reachability.IsUnreachable)
|
||||
if (!var.IsParameter && Reachability.AlwaysBreaks)
|
||||
return;
|
||||
|
||||
IsDirty = true;
|
||||
@@ -642,19 +626,15 @@ namespace Mono.CSharp
|
||||
// then we do always return (or stay in the
|
||||
// loop forever).
|
||||
new_r.SetReturns ();
|
||||
}
|
||||
}
|
||||
|
||||
new_r.SetBarrier ();
|
||||
} else {
|
||||
if (new_r.Returns == FlowReturns.Always) {
|
||||
// We're either finite or we may leave the loop.
|
||||
new_r.SetReturnsSometimes ();
|
||||
}
|
||||
if (new_r.Throws == FlowReturns.Always) {
|
||||
// We're either finite or we may leave the loop.
|
||||
new_r.SetThrowsSometimes ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (branching.Type == BranchingType.Switch)
|
||||
new_r.ResetBreaks ();
|
||||
|
||||
@@ -670,9 +650,9 @@ namespace Mono.CSharp
|
||||
if ((Type == SiblingType.SwitchSection) && !new_r.IsUnreachable) {
|
||||
Report.Error (163, Location,
|
||||
"Control cannot fall through from one " +
|
||||
"case label to another");
|
||||
"case label to another");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
if (locals != null && result.LocalVector != null)
|
||||
locals.Or (result.LocalVector);
|
||||
@@ -688,7 +668,7 @@ namespace Mono.CSharp
|
||||
IsDirty = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
protected void MergeFinally (FlowBranching branching, UsageVector f_origins,
|
||||
MyBitVector f_params)
|
||||
@@ -734,35 +714,34 @@ namespace Mono.CSharp
|
||||
// 8 Console.WriteLine (a);
|
||||
//
|
||||
// </summary>
|
||||
public void MergeJumpOrigins (UsageVector o_vectors)
|
||||
public void MergeJumpOrigins (ICollection origin_vectors)
|
||||
{
|
||||
Report.Debug (1, " MERGING JUMP ORIGINS", this);
|
||||
|
||||
reachability = Reachability.Never ();
|
||||
|
||||
if (o_vectors == null)
|
||||
if (origin_vectors == null)
|
||||
return;
|
||||
|
||||
bool first = true;
|
||||
|
||||
for (UsageVector vector = o_vectors; vector != null;
|
||||
vector = vector.Next) {
|
||||
Report.Debug (1, " MERGING JUMP ORIGIN", vector);
|
||||
foreach (UsageVector vector in origin_vectors) {
|
||||
Report.Debug (1, " MERGING JUMP ORIGIN", vector);
|
||||
|
||||
if (first) {
|
||||
if (locals != null && vector.Locals != null)
|
||||
locals.Or (vector.locals);
|
||||
locals.Or (vector.locals);
|
||||
|
||||
if (parameters != null)
|
||||
parameters.Or (vector.parameters);
|
||||
first = false;
|
||||
} else {
|
||||
if (locals != null && vector.Locals != null)
|
||||
locals.And (vector.locals);
|
||||
if (parameters != null)
|
||||
parameters.And (vector.parameters);
|
||||
}
|
||||
|
||||
locals.And (vector.locals);
|
||||
if (parameters != null)
|
||||
parameters.And (vector.parameters);
|
||||
}
|
||||
|
||||
Reachability.And (ref reachability, vector.Reachability, true);
|
||||
}
|
||||
|
||||
@@ -780,7 +759,7 @@ namespace Mono.CSharp
|
||||
reachability = Reachability.Never ();
|
||||
|
||||
for (UsageVector vector = f_origins; vector != null; vector = vector.Next) {
|
||||
Report.Debug (1, " MERGING FINALLY ORIGIN", vector);
|
||||
Report.Debug (1, " MERGING FINALLY ORIGIN", vector);
|
||||
|
||||
if (parameters != null)
|
||||
parameters.And (vector.parameters);
|
||||
@@ -791,37 +770,6 @@ namespace Mono.CSharp
|
||||
Report.Debug (1, " MERGING FINALLY ORIGIN DONE", this);
|
||||
}
|
||||
|
||||
public void MergeBreakOrigins (UsageVector o_vectors)
|
||||
{
|
||||
Report.Debug (1, " MERGING BREAK ORIGINS", this);
|
||||
|
||||
if (o_vectors == null)
|
||||
return;
|
||||
|
||||
bool first = true;
|
||||
|
||||
for (UsageVector vector = o_vectors; vector != null;
|
||||
vector = vector.Next) {
|
||||
Report.Debug (1, " MERGING BREAK ORIGIN", vector);
|
||||
|
||||
if (first) {
|
||||
if (locals != null && vector.Locals != null)
|
||||
locals.Or (vector.locals);
|
||||
|
||||
if (parameters != null)
|
||||
parameters.Or (vector.parameters);
|
||||
first = false;
|
||||
} else {
|
||||
if (locals != null && vector.Locals != null)
|
||||
locals.And (vector.locals);
|
||||
if (parameters != null)
|
||||
parameters.And (vector.parameters);
|
||||
}
|
||||
}
|
||||
|
||||
Report.Debug (1, " MERGING BREAK ORIGINS DONE", this);
|
||||
}
|
||||
|
||||
public void CheckOutParameters (FlowBranching branching)
|
||||
{
|
||||
if (parameters != null)
|
||||
@@ -878,7 +826,7 @@ namespace Mono.CSharp
|
||||
public MyBitVector Locals {
|
||||
get {
|
||||
if (locals != null)
|
||||
return locals.Clone ();
|
||||
return locals.Clone ();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
@@ -945,14 +893,13 @@ namespace Mono.CSharp
|
||||
local_map = Block.LocalMap;
|
||||
|
||||
UsageVector parent_vector = parent != null ? parent.CurrentUsageVector : null;
|
||||
vector = new UsageVector (
|
||||
stype, parent_vector, Block, loc,
|
||||
param_map.Length, local_map.Length);
|
||||
vector = new UsageVector (stype, parent_vector, loc, param_map.Length, local_map.Length);
|
||||
|
||||
|
||||
} else {
|
||||
param_map = Parent.param_map;
|
||||
local_map = Parent.local_map;
|
||||
vector = new UsageVector (
|
||||
stype, Parent.CurrentUsageVector, null, loc);
|
||||
vector = new UsageVector (stype, Parent.CurrentUsageVector, loc);
|
||||
}
|
||||
|
||||
AddSibling (vector);
|
||||
@@ -965,34 +912,16 @@ namespace Mono.CSharp
|
||||
// <summary>
|
||||
// Creates a sibling of the current usage vector.
|
||||
// </summary>
|
||||
public virtual void CreateSibling (Block block, SiblingType type)
|
||||
public virtual void CreateSibling (SiblingType type)
|
||||
{
|
||||
UsageVector vector = new UsageVector (
|
||||
type, Parent.CurrentUsageVector, block, Location);
|
||||
AddSibling (vector);
|
||||
AddSibling (new UsageVector (type, Parent.CurrentUsageVector, Location));
|
||||
|
||||
Report.Debug (1, " CREATED SIBLING", CurrentUsageVector);
|
||||
}
|
||||
|
||||
public void CreateSibling ()
|
||||
{
|
||||
CreateSibling (null, SiblingType.Conditional);
|
||||
}
|
||||
|
||||
protected abstract void AddSibling (UsageVector uv);
|
||||
|
||||
public virtual LabeledStatement LookupLabel (string name, Location loc)
|
||||
{
|
||||
if (Parent != null)
|
||||
return Parent.LookupLabel (name, loc);
|
||||
|
||||
Report.Error (
|
||||
159, loc,
|
||||
"No such label `" + name + "' in this scope");
|
||||
return null;
|
||||
}
|
||||
|
||||
public abstract void Label (UsageVector origin_vectors);
|
||||
public abstract void Label (ArrayList origin_vectors);
|
||||
|
||||
// <summary>
|
||||
// Check whether all `out' parameters have been assigned.
|
||||
@@ -1010,12 +939,12 @@ namespace Mono.CSharp
|
||||
|
||||
Report.Error (177, loc, "The out parameter `" +
|
||||
var.Name + "' must be " +
|
||||
"assigned before control leaves the current method.");
|
||||
"assigned before control leave the current method.");
|
||||
}
|
||||
}
|
||||
|
||||
protected UsageVector Merge (UsageVector sibling_list)
|
||||
{
|
||||
{
|
||||
if (sibling_list.Next == null)
|
||||
return sibling_list;
|
||||
|
||||
@@ -1029,13 +958,13 @@ namespace Mono.CSharp
|
||||
for (UsageVector child = sibling_list; child != null; child = child.Next) {
|
||||
bool do_break = (Type != BranchingType.Switch) &&
|
||||
(Type != BranchingType.Loop);
|
||||
|
||||
|
||||
Report.Debug (2, " MERGING SIBLING ", child,
|
||||
child.ParameterVector, child.LocalVector,
|
||||
reachability, child.Reachability, do_break);
|
||||
|
||||
Reachability.And (ref reachability, child.Reachability, do_break);
|
||||
|
||||
|
||||
// A local variable is initialized after a flow branching if it
|
||||
// has been initialized in all its branches which do neither
|
||||
// always return or always throw an exception.
|
||||
@@ -1101,8 +1030,7 @@ namespace Mono.CSharp
|
||||
Report.Debug (2, " MERGING SIBLINGS DONE", parameters, locals,
|
||||
reachability, Infinite);
|
||||
|
||||
return new UsageVector (
|
||||
parameters, locals, reachability, null, Location);
|
||||
return new UsageVector (parameters, locals, reachability, Location);
|
||||
}
|
||||
|
||||
protected abstract UsageVector Merge ();
|
||||
@@ -1124,15 +1052,13 @@ namespace Mono.CSharp
|
||||
throw new NotSupportedException ();
|
||||
|
||||
UsageVector vector = new UsageVector (
|
||||
SiblingType.Conditional, null, Block, Location,
|
||||
param_map.Length, local_map.Length);
|
||||
SiblingType.Conditional, null, Location, param_map.Length, local_map.Length);
|
||||
|
||||
UsageVector result = vector.MergeChild (this);
|
||||
|
||||
Report.Debug (4, "MERGE TOP BLOCK", Location, vector, result.Reachability);
|
||||
|
||||
if ((vector.Reachability.Throws != FlowReturns.Always) &&
|
||||
(vector.Reachability.Barrier != FlowReturns.Always))
|
||||
if (vector.Reachability.Throws != FlowReturns.Always)
|
||||
CheckOutParameters (vector.Parameters, Location);
|
||||
|
||||
return result.Reachability;
|
||||
@@ -1217,14 +1143,6 @@ namespace Mono.CSharp
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
|
||||
public virtual void AddBreakVector (UsageVector vector)
|
||||
{
|
||||
if (Parent != null)
|
||||
Parent.AddBreakVector (vector);
|
||||
else if ((Block == null) || !Block.IsDestructor)
|
||||
throw new NotSupportedException ();
|
||||
}
|
||||
|
||||
public bool IsAssigned (VariableInfo vi)
|
||||
{
|
||||
return CurrentUsageVector.IsAssigned (vi);
|
||||
@@ -1298,25 +1216,13 @@ namespace Mono.CSharp
|
||||
sibling_list = sibling;
|
||||
}
|
||||
|
||||
public override LabeledStatement LookupLabel (string name, Location loc)
|
||||
{
|
||||
if (Block == null)
|
||||
return base.LookupLabel (name, loc);
|
||||
|
||||
LabeledStatement s = Block.LookupLabel (name);
|
||||
if (s != null)
|
||||
return s;
|
||||
|
||||
return base.LookupLabel (name, loc);
|
||||
}
|
||||
|
||||
public override void Label (UsageVector origin_vectors)
|
||||
public override void Label (ArrayList origin_vectors)
|
||||
{
|
||||
if (!CurrentUsageVector.Reachability.IsUnreachable) {
|
||||
UsageVector vector = CurrentUsageVector.Clone ();
|
||||
vector.Next = origin_vectors;
|
||||
origin_vectors = vector;
|
||||
}
|
||||
if (origin_vectors == null)
|
||||
origin_vectors = new ArrayList (1);
|
||||
origin_vectors.Add (CurrentUsageVector.Clone ());
|
||||
}
|
||||
|
||||
CurrentUsageVector.MergeJumpOrigins (origin_vectors);
|
||||
}
|
||||
@@ -1327,31 +1233,6 @@ namespace Mono.CSharp
|
||||
}
|
||||
}
|
||||
|
||||
public class FlowBranchingLoop : FlowBranchingBlock
|
||||
{
|
||||
UsageVector break_origins;
|
||||
|
||||
public FlowBranchingLoop (FlowBranching parent, Block block, Location loc)
|
||||
: base (parent, BranchingType.Loop, SiblingType.Conditional, block, loc)
|
||||
{ }
|
||||
|
||||
public override void AddBreakVector (UsageVector vector)
|
||||
{
|
||||
vector = vector.Clone ();
|
||||
vector.Next = break_origins;
|
||||
break_origins = vector;
|
||||
}
|
||||
|
||||
protected override UsageVector Merge ()
|
||||
{
|
||||
UsageVector vector = base.Merge ();
|
||||
|
||||
vector.MergeBreakOrigins (break_origins);
|
||||
|
||||
return vector;
|
||||
}
|
||||
}
|
||||
|
||||
public class FlowBranchingException : FlowBranching
|
||||
{
|
||||
UsageVector current_vector;
|
||||
@@ -1415,26 +1296,7 @@ namespace Mono.CSharp
|
||||
finally_origins = vector;
|
||||
}
|
||||
|
||||
public override LabeledStatement LookupLabel (string name, Location loc)
|
||||
{
|
||||
if (current_vector.Block == null)
|
||||
return base.LookupLabel (name, loc);
|
||||
|
||||
LabeledStatement s = current_vector.Block.LookupLabel (name);
|
||||
if (s != null)
|
||||
return s;
|
||||
|
||||
if (finally_vector != null) {
|
||||
Report.Error (
|
||||
157, loc, "Control can not leave the body " +
|
||||
"of the finally block");
|
||||
return null;
|
||||
}
|
||||
|
||||
return base.LookupLabel (name, loc);
|
||||
}
|
||||
|
||||
public override void Label (UsageVector origin_vectors)
|
||||
public override void Label (ArrayList origin_vectors)
|
||||
{
|
||||
CurrentUsageVector.MergeJumpOrigins (origin_vectors);
|
||||
}
|
||||
@@ -1990,14 +1852,14 @@ namespace Mono.CSharp
|
||||
|
||||
if ((mod & Parameter.Modifier.OUT) == 0)
|
||||
continue;
|
||||
|
||||
|
||||
// Dont allocate till we find an out var.
|
||||
if (map == null)
|
||||
map = new VariableInfo [Count];
|
||||
|
||||
map [i] = new VariableInfo (ip.ParameterName (i),
|
||||
TypeManager.GetElementType (ip.ParameterType (i)), i, Length);
|
||||
|
||||
|
||||
Length += map [i].Length;
|
||||
}
|
||||
}
|
||||
@@ -2240,7 +2102,7 @@ namespace Mono.CSharp
|
||||
{
|
||||
if (vector != null)
|
||||
return;
|
||||
|
||||
|
||||
vector = new BitArray (Count, false);
|
||||
if (InheritsFrom != null)
|
||||
Vector = InheritsFrom.Vector;
|
||||
@@ -0,0 +1,13 @@
|
||||
class Stack<T> {
|
||||
}
|
||||
|
||||
class Test {
|
||||
}
|
||||
|
||||
class T {
|
||||
Stack<Test> a;
|
||||
|
||||
static void Main()
|
||||
{
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,795 @@
|
||||
//
|
||||
// generic.cs: Support classes for generics
|
||||
//
|
||||
// Author:
|
||||
// Miguel de Icaza ([email protected])
|
||||
//
|
||||
// (C) 2003 Ximian, Inc.
|
||||
//
|
||||
using System;
|
||||
using System.Reflection;
|
||||
using System.Reflection.Emit;
|
||||
using System.Globalization;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
|
||||
namespace Mono.CSharp {
|
||||
|
||||
//
|
||||
// Tracks the constraints for a type parameter
|
||||
//
|
||||
public class Constraints {
|
||||
string type_parameter;
|
||||
ArrayList constraints;
|
||||
Location loc;
|
||||
|
||||
//
|
||||
// type_parameter is the identifier, constraints is an arraylist of
|
||||
// Expressions (with types) or `true' for the constructor constraint.
|
||||
//
|
||||
public Constraints (string type_parameter, ArrayList constraints,
|
||||
Location loc)
|
||||
{
|
||||
this.type_parameter = type_parameter;
|
||||
this.constraints = constraints;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public string TypeParameter {
|
||||
get {
|
||||
return type_parameter;
|
||||
}
|
||||
}
|
||||
|
||||
protected void Error (string message)
|
||||
{
|
||||
Report.Error (-218, "Invalid constraints clause for type " +
|
||||
"parameter `{0}': {1}", type_parameter, message);
|
||||
}
|
||||
|
||||
bool has_ctor_constraint;
|
||||
TypeExpr class_constraint;
|
||||
ArrayList iface_constraints;
|
||||
TypeExpr[] constraint_types;
|
||||
int num_constraints;
|
||||
|
||||
public bool HasConstructorConstraint {
|
||||
get { return has_ctor_constraint; }
|
||||
}
|
||||
|
||||
public bool Resolve (DeclSpace ds)
|
||||
{
|
||||
iface_constraints = new ArrayList ();
|
||||
|
||||
foreach (object obj in constraints) {
|
||||
if (has_ctor_constraint) {
|
||||
Error ("can only use one constructor constraint and " +
|
||||
"it must be the last constraint in the list.");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (obj is bool) {
|
||||
has_ctor_constraint = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
TypeExpr expr = ds.ResolveTypeExpr ((Expression) obj, false, loc);
|
||||
if (expr == null)
|
||||
return false;
|
||||
|
||||
if (expr.IsInterface)
|
||||
iface_constraints.Add (expr);
|
||||
else if (class_constraint != null) {
|
||||
Error ("can have at most one class constraint.");
|
||||
return false;
|
||||
} else
|
||||
class_constraint = expr;
|
||||
|
||||
num_constraints++;
|
||||
}
|
||||
|
||||
constraint_types = new TypeExpr [num_constraints];
|
||||
int pos = 0;
|
||||
if (class_constraint != null)
|
||||
constraint_types [pos++] = class_constraint;
|
||||
iface_constraints.CopyTo (constraint_types, pos);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Type[] ResolveTypes (EmitContext ec)
|
||||
{
|
||||
Type [] types = new Type [constraint_types.Length];
|
||||
|
||||
for (int i = 0; i < constraint_types.Length; i++)
|
||||
types [i] = constraint_types [i].ResolveType (ec);
|
||||
|
||||
return types;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This type represents a generic type parameter
|
||||
//
|
||||
public class TypeParameter {
|
||||
string name;
|
||||
Constraints constraints;
|
||||
Location loc;
|
||||
Type type;
|
||||
|
||||
public TypeParameter (string name, Constraints constraints, Location loc)
|
||||
{
|
||||
this.name = name;
|
||||
this.constraints = constraints;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public Location Location {
|
||||
get {
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
|
||||
public Constraints Constraints {
|
||||
get {
|
||||
return constraints;
|
||||
}
|
||||
}
|
||||
|
||||
public Type Type {
|
||||
get {
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
public bool Resolve (DeclSpace ds)
|
||||
{
|
||||
if (constraints != null)
|
||||
return constraints.Resolve (ds);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public Type Define (TypeBuilder tb)
|
||||
{
|
||||
type = tb.DefineGenericParameter (name);
|
||||
return type;
|
||||
}
|
||||
|
||||
public Type DefineMethod (MethodBuilder mb)
|
||||
{
|
||||
type = mb.DefineGenericParameter (name);
|
||||
return type;
|
||||
}
|
||||
|
||||
public void DefineType (EmitContext ec, TypeBuilder tb)
|
||||
{
|
||||
int index = type.GenericParameterPosition;
|
||||
if (constraints == null)
|
||||
tb.SetGenericParameterConstraints (index, new Type [0]);
|
||||
else
|
||||
tb.SetGenericParameterConstraints (index, constraints.ResolveTypes (ec));
|
||||
}
|
||||
|
||||
public void DefineType (EmitContext ec, MethodBuilder mb)
|
||||
{
|
||||
int index = type.GenericParameterPosition;
|
||||
if (constraints == null)
|
||||
mb.SetGenericParameterConstraints (index, new Type [0]);
|
||||
else
|
||||
mb.SetGenericParameterConstraints (index, constraints.ResolveTypes (ec));
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return "TypeParameter[" + name + "]";
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This type represents a generic type parameter reference.
|
||||
//
|
||||
// These expressions are born in a fully resolved state.
|
||||
//
|
||||
public class TypeParameterExpr : TypeExpr {
|
||||
TypeParameter type_parameter;
|
||||
|
||||
public override string Name {
|
||||
get {
|
||||
return type_parameter.Name;
|
||||
}
|
||||
}
|
||||
|
||||
public TypeParameter TypeParameter {
|
||||
get {
|
||||
return type_parameter;
|
||||
}
|
||||
}
|
||||
|
||||
public TypeParameterExpr (TypeParameter type_parameter, Location loc)
|
||||
{
|
||||
this.type_parameter = type_parameter;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public override TypeExpr DoResolveAsTypeStep (EmitContext ec)
|
||||
{
|
||||
type = type_parameter.Type;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public void Error_CannotUseAsUnmanagedType (Location loc)
|
||||
{
|
||||
Report.Error (-203, loc, "Can not use type parameter as unamanged type");
|
||||
}
|
||||
}
|
||||
|
||||
public class TypeArguments {
|
||||
public readonly Location Location;
|
||||
ArrayList args;
|
||||
Type[] atypes;
|
||||
bool has_type_args;
|
||||
bool created;
|
||||
|
||||
public TypeArguments (Location loc)
|
||||
{
|
||||
args = new ArrayList ();
|
||||
this.Location = loc;
|
||||
}
|
||||
|
||||
public void Add (Expression type)
|
||||
{
|
||||
if (created)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
args.Add (type);
|
||||
}
|
||||
|
||||
public void Add (TypeArguments new_args)
|
||||
{
|
||||
if (created)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
args.AddRange (new_args.args);
|
||||
}
|
||||
|
||||
public string[] GetDeclarations ()
|
||||
{
|
||||
string[] ret = new string [args.Count];
|
||||
for (int i = 0; i < args.Count; i++) {
|
||||
SimpleName sn = args [i] as SimpleName;
|
||||
if (sn != null) {
|
||||
ret [i] = sn.Name;
|
||||
continue;
|
||||
}
|
||||
|
||||
Report.Error (81, Location, "Type parameter declaration " +
|
||||
"must be an identifier not a type");
|
||||
return null;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public Type[] Arguments {
|
||||
get {
|
||||
return atypes;
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasTypeArguments {
|
||||
get {
|
||||
return has_type_args;
|
||||
}
|
||||
}
|
||||
|
||||
public int Count {
|
||||
get {
|
||||
return args.Count;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
StringBuilder s = new StringBuilder ();
|
||||
|
||||
int count = args.Count;
|
||||
for (int i = 0; i < count; i++){
|
||||
//
|
||||
// FIXME: Use TypeManager.CSharpname once we have the type
|
||||
//
|
||||
s.Append (args [i].ToString ());
|
||||
if (i+1 < count)
|
||||
s.Append (",");
|
||||
}
|
||||
return s.ToString ();
|
||||
}
|
||||
|
||||
public bool Resolve (EmitContext ec)
|
||||
{
|
||||
DeclSpace ds = ec.DeclSpace;
|
||||
int count = args.Count;
|
||||
bool ok = true;
|
||||
|
||||
atypes = new Type [count];
|
||||
|
||||
for (int i = 0; i < count; i++){
|
||||
TypeExpr te = ds.ResolveTypeExpr (
|
||||
(Expression) args [i], false, Location);
|
||||
if (te == null) {
|
||||
ok = false;
|
||||
continue;
|
||||
}
|
||||
if (te is TypeParameterExpr)
|
||||
has_type_args = true;
|
||||
atypes [i] = te.ResolveType (ec);
|
||||
|
||||
if (atypes [i] == null) {
|
||||
Report.Error (246, Location, "Cannot find type `{0}'",
|
||||
te.Name);
|
||||
ok = false;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
}
|
||||
|
||||
public class ConstructedType : TypeExpr {
|
||||
string name, full_name;
|
||||
TypeArguments args;
|
||||
Type[] gen_params, atypes;
|
||||
Type gt;
|
||||
|
||||
public ConstructedType (string name, TypeArguments args, Location l)
|
||||
{
|
||||
loc = l;
|
||||
this.name = name;
|
||||
this.args = args;
|
||||
|
||||
eclass = ExprClass.Type;
|
||||
full_name = name + "<" + args.ToString () + ">";
|
||||
}
|
||||
|
||||
public ConstructedType (string name, TypeParameter[] type_params, Location l)
|
||||
: this (type_params, l)
|
||||
{
|
||||
loc = l;
|
||||
|
||||
this.name = name;
|
||||
full_name = name + "<" + args.ToString () + ">";
|
||||
}
|
||||
|
||||
protected ConstructedType (TypeArguments args, Location l)
|
||||
{
|
||||
loc = l;
|
||||
this.args = args;
|
||||
|
||||
eclass = ExprClass.Type;
|
||||
}
|
||||
|
||||
protected ConstructedType (TypeParameter[] type_params, Location l)
|
||||
{
|
||||
loc = l;
|
||||
|
||||
args = new TypeArguments (l);
|
||||
foreach (TypeParameter type_param in type_params)
|
||||
args.Add (new TypeParameterExpr (type_param, l));
|
||||
|
||||
eclass = ExprClass.Type;
|
||||
}
|
||||
|
||||
public ConstructedType (Type t, TypeParameter[] type_params, Location l)
|
||||
: this (type_params, l)
|
||||
{
|
||||
gt = t.GetGenericTypeDefinition ();
|
||||
|
||||
this.name = gt.FullName;
|
||||
full_name = gt.FullName + "<" + args.ToString () + ">";
|
||||
}
|
||||
|
||||
public ConstructedType (Type t, TypeArguments args, Location l)
|
||||
: this (args, l)
|
||||
{
|
||||
gt = t.GetGenericTypeDefinition ();
|
||||
|
||||
this.name = gt.FullName;
|
||||
full_name = gt.FullName + "<" + args.ToString () + ">";
|
||||
}
|
||||
|
||||
public TypeArguments TypeArguments {
|
||||
get { return args; }
|
||||
}
|
||||
|
||||
protected bool CheckConstraints (int index)
|
||||
{
|
||||
Type atype = atypes [index];
|
||||
Type ptype = gen_params [index];
|
||||
|
||||
//// FIXME
|
||||
return true;
|
||||
|
||||
//
|
||||
// First, check parent class.
|
||||
//
|
||||
if ((ptype.BaseType != atype.BaseType) &&
|
||||
!atype.BaseType.IsSubclassOf (ptype.BaseType)) {
|
||||
Report.Error (-219, loc, "Cannot create constructed type `{0}': " +
|
||||
"type argument `{1}' must derive from `{2}'.",
|
||||
full_name, atype, ptype.BaseType);
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// Now, check the interfaces.
|
||||
//
|
||||
foreach (Type itype in ptype.GetInterfaces ()) {
|
||||
if (TypeManager.ImplementsInterface (atype, itype))
|
||||
continue;
|
||||
|
||||
Report.Error (-219, loc, "Cannot create constructed type `{0}: " +
|
||||
"type argument `{1}' must implement interface `{2}'.",
|
||||
full_name, atype, itype);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override TypeExpr DoResolveAsTypeStep (EmitContext ec)
|
||||
{
|
||||
if (gt != null)
|
||||
return this;
|
||||
|
||||
//
|
||||
// First, resolve the generic type.
|
||||
//
|
||||
DeclSpace ds;
|
||||
Type nested = ec.DeclSpace.FindNestedType (loc, name, out ds);
|
||||
if (nested != null) {
|
||||
gt = nested.GetGenericTypeDefinition ();
|
||||
|
||||
TypeArguments new_args = new TypeArguments (loc);
|
||||
foreach (TypeParameter param in ds.TypeParameters)
|
||||
new_args.Add (new TypeParameterExpr (param, loc));
|
||||
new_args.Add (args);
|
||||
|
||||
args = new_args;
|
||||
return this;
|
||||
}
|
||||
|
||||
SimpleName sn = new SimpleName (name, args.Count, loc);
|
||||
TypeExpr resolved = sn.ResolveAsTypeTerminal (ec);
|
||||
if (resolved == null) {
|
||||
sn = new SimpleName (name, -1, loc);
|
||||
resolved = sn.ResolveAsTypeTerminal (ec);
|
||||
if ((resolved == null) || (resolved.Type == null)) {
|
||||
Report.Error (246, loc,
|
||||
"The type or namespace name `{0}<...>' "+
|
||||
"could not be found", name);
|
||||
return null;
|
||||
}
|
||||
|
||||
Type t = resolved.Type;
|
||||
int num_args = TypeManager.GetNumberOfTypeArguments (t);
|
||||
|
||||
if (num_args == 0) {
|
||||
Report.Error (308, loc,
|
||||
"The non-generic type `{0}' cannot " +
|
||||
"be used with type arguments.",
|
||||
TypeManager.CSharpName (t));
|
||||
return null;
|
||||
}
|
||||
|
||||
Report.Error (305, loc,
|
||||
"Using the generic type `{0}' " +
|
||||
"requires {1} type arguments",
|
||||
TypeManager.GetFullName (t), num_args);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (resolved.Type == null)
|
||||
throw new InternalErrorException (
|
||||
"Failed to resolve constructed type `{0}'",
|
||||
full_name);
|
||||
|
||||
gt = resolved.Type.GetGenericTypeDefinition ();
|
||||
return this;
|
||||
}
|
||||
|
||||
public override Type ResolveType (EmitContext ec)
|
||||
{
|
||||
if (type != null)
|
||||
return type;
|
||||
if (DoResolveAsTypeStep (ec) == null)
|
||||
return null;
|
||||
|
||||
//
|
||||
// Resolve the arguments.
|
||||
//
|
||||
if (args.Resolve (ec) == false)
|
||||
return null;
|
||||
|
||||
gen_params = gt.GetGenericArguments ();
|
||||
atypes = args.Arguments;
|
||||
|
||||
if (atypes.Length != gen_params.Length) {
|
||||
Report.Error (-217, loc, "Generic type `{0}' takes {1} " +
|
||||
"type parameters, but specified {2}.", gt.Name,
|
||||
gen_params.Length, atypes.Length);
|
||||
return null;
|
||||
}
|
||||
|
||||
for (int i = 0; i < gen_params.Length; i++) {
|
||||
if (!CheckConstraints (i))
|
||||
return null;
|
||||
}
|
||||
|
||||
//
|
||||
// Now bind the parameters.
|
||||
//
|
||||
type = gt.BindGenericParameters (atypes);
|
||||
return type;
|
||||
}
|
||||
|
||||
public Expression GetMemberAccess (EmitContext ec)
|
||||
{
|
||||
TypeExpr current;
|
||||
if (ec.TypeContainer.CurrentType != null)
|
||||
current = ec.TypeContainer.CurrentType;
|
||||
else
|
||||
current = new TypeExpression (ec.ContainerType, loc);
|
||||
|
||||
return new GenericMemberAccess (current, name, args, loc);
|
||||
}
|
||||
|
||||
public override bool CheckAccessLevel (DeclSpace ds)
|
||||
{
|
||||
return ds.CheckAccessLevel (gt);
|
||||
}
|
||||
|
||||
public override bool AsAccessible (DeclSpace ds, int flags)
|
||||
{
|
||||
return ds.AsAccessible (gt, flags);
|
||||
}
|
||||
|
||||
public override bool IsClass {
|
||||
get { return gt.IsClass; }
|
||||
}
|
||||
|
||||
public override bool IsValueType {
|
||||
get { return gt.IsValueType; }
|
||||
}
|
||||
|
||||
public override bool IsInterface {
|
||||
get { return gt.IsInterface; }
|
||||
}
|
||||
|
||||
public override bool IsSealed {
|
||||
get { return gt.IsSealed; }
|
||||
}
|
||||
|
||||
public override bool IsAttribute {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
public override TypeExpr[] GetInterfaces ()
|
||||
{
|
||||
TypeExpr[] ifaces = TypeManager.GetInterfaces (gt);
|
||||
return ifaces;
|
||||
}
|
||||
|
||||
public override bool Equals (object obj)
|
||||
{
|
||||
ConstructedType cobj = obj as ConstructedType;
|
||||
if (cobj == null)
|
||||
return false;
|
||||
|
||||
if ((type == null) || (cobj.type == null))
|
||||
return false;
|
||||
|
||||
return type == cobj.type;
|
||||
}
|
||||
|
||||
public override string Name {
|
||||
get {
|
||||
return full_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GenericMethod : DeclSpace
|
||||
{
|
||||
public GenericMethod (NamespaceEntry ns, TypeContainer parent, string name,
|
||||
Attributes attrs, Location l)
|
||||
: base (ns, parent, name, attrs, l)
|
||||
{ }
|
||||
|
||||
public override TypeBuilder DefineType ()
|
||||
{
|
||||
throw new Exception ();
|
||||
}
|
||||
|
||||
public override bool Define (TypeContainer parent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Define (MethodBuilder mb)
|
||||
{
|
||||
Type[] gen_params = new Type [TypeParameters.Length];
|
||||
for (int i = 0; i < TypeParameters.Length; i++)
|
||||
gen_params [i] = TypeParameters [i].DefineMethod (mb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DefineType (EmitContext ec, MethodBuilder mb)
|
||||
{
|
||||
for (int i = 0; i < TypeParameters.Length; i++)
|
||||
TypeParameters [i].DefineType (ec, mb);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override bool DefineMembers (TypeContainer parent)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public override MemberList FindMembers (MemberTypes mt, BindingFlags bf,
|
||||
MemberFilter filter, object criteria)
|
||||
{
|
||||
throw new Exception ();
|
||||
}
|
||||
|
||||
public override MemberCache MemberCache {
|
||||
get {
|
||||
throw new Exception ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class GenericMemberAccess : MemberAccess
|
||||
{
|
||||
TypeArguments args;
|
||||
|
||||
public GenericMemberAccess (Expression expr, string id, TypeArguments args, Location loc)
|
||||
: base (expr, id, args.Count, loc)
|
||||
{
|
||||
this.args = args;
|
||||
}
|
||||
|
||||
private bool DoResolveBase (EmitContext ec)
|
||||
{
|
||||
ConstructedType cexpr = expr as ConstructedType;
|
||||
if (cexpr != null) {
|
||||
TypeArguments new_args = new TypeArguments (loc);
|
||||
new_args.Add (cexpr.TypeArguments);
|
||||
new_args.Add (args);
|
||||
|
||||
args = new_args;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec, Expression right_side,
|
||||
ResolveFlags flags)
|
||||
{
|
||||
if (!DoResolveBase (ec))
|
||||
return null;
|
||||
|
||||
Expression expr = base.DoResolve (ec, right_side, flags);
|
||||
if (expr == null)
|
||||
return null;
|
||||
|
||||
TypeExpr texpr = expr as TypeExpr;
|
||||
if (texpr != null) {
|
||||
Type t = texpr.ResolveType (ec);
|
||||
if (t == null)
|
||||
return null;
|
||||
|
||||
ConstructedType ctype = new ConstructedType (t, args, loc);
|
||||
return ctype.DoResolve (ec);
|
||||
}
|
||||
|
||||
MethodGroupExpr mg = expr as MethodGroupExpr;
|
||||
if (mg == null) {
|
||||
return expr;
|
||||
Report.Error (-220, loc, "Member `{0}' has type arguments, but did " +
|
||||
"not resolve as a method group.", Identifier);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.Resolve (ec) == false)
|
||||
return null;
|
||||
|
||||
Type[] atypes = args.Arguments;
|
||||
|
||||
ArrayList list = new ArrayList ();
|
||||
|
||||
foreach (MethodBase method in mg.Methods) {
|
||||
MethodInfo mi = method as MethodInfo;
|
||||
if (mi == null)
|
||||
continue;
|
||||
|
||||
Type[] gen_params = mi.GetGenericArguments ();
|
||||
|
||||
if (atypes.Length != gen_params.Length) {
|
||||
Report.Error (-217, loc, "Generic method `{0}' takes {1} " +
|
||||
"type parameters, but specified {2}.", mi.Name,
|
||||
gen_params.Length, atypes.Length);
|
||||
continue;
|
||||
}
|
||||
|
||||
list.Add (mi.BindGenericParameters (args.Arguments));
|
||||
}
|
||||
|
||||
MethodInfo[] methods = new MethodInfo [list.Count];
|
||||
list.CopyTo (methods, 0);
|
||||
|
||||
MethodGroupExpr new_mg = new MethodGroupExpr (methods, mg.Location);
|
||||
new_mg.InstanceExpression = mg.InstanceExpression;
|
||||
new_mg.HasTypeArguments = true;
|
||||
return new_mg;
|
||||
}
|
||||
|
||||
public override Expression ResolveAsTypeStep (EmitContext ec)
|
||||
{
|
||||
if (!DoResolveBase (ec))
|
||||
return null;
|
||||
|
||||
expr = base.ResolveAsTypeStep (ec);
|
||||
if (expr == null)
|
||||
return null;
|
||||
|
||||
Type t = ((TypeExpr) expr).ResolveType (ec);
|
||||
if (t == null)
|
||||
return null;
|
||||
|
||||
ConstructedType ctype = new ConstructedType (t, args, loc);
|
||||
return ctype.ResolveAsTypeStep (ec);
|
||||
}
|
||||
}
|
||||
|
||||
public class DefaultValueExpression : Expression
|
||||
{
|
||||
Expression expr;
|
||||
LocalTemporary temp_storage;
|
||||
|
||||
public DefaultValueExpression (Expression expr, Location loc)
|
||||
{
|
||||
this.expr = expr;
|
||||
this.loc = loc;
|
||||
}
|
||||
|
||||
public override Expression DoResolve (EmitContext ec)
|
||||
{
|
||||
type = ec.DeclSpace.ResolveType (expr, false, loc);
|
||||
if (type == null)
|
||||
return null;
|
||||
|
||||
if (type.IsGenericParameter || TypeManager.IsValueType (type))
|
||||
temp_storage = new LocalTemporary (ec, type);
|
||||
|
||||
eclass = ExprClass.Variable;
|
||||
return this;
|
||||
}
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
if (temp_storage != null) {
|
||||
temp_storage.AddressOf (ec, AddressOp.LoadStore);
|
||||
ec.ig.Emit (OpCodes.Initobj, type);
|
||||
temp_storage.Emit (ec);
|
||||
} else
|
||||
ec.ig.Emit (OpCodes.Ldnull);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,8 +25,6 @@ namespace Mono.Languages
|
||||
// Input stream to parse from.
|
||||
public System.IO.Stream input;
|
||||
|
||||
public abstract void parse ();
|
||||
|
||||
public virtual string[] extensions()
|
||||
{
|
||||
string [] list = { ".cs" };
|
||||
Executable
+1231
File diff suppressed because it is too large.
Load diff
@@ -31,8 +31,7 @@ namespace Mono.CSharp {
|
||||
|
||||
public class Yield : Statement {
|
||||
public Expression expr;
|
||||
bool in_exc;
|
||||
|
||||
|
||||
public Yield (Expression expr, Location l)
|
||||
{
|
||||
this.expr = expr;
|
||||
@@ -68,7 +67,7 @@ namespace Mono.CSharp {
|
||||
if (!CheckContext (ec, loc))
|
||||
return false;
|
||||
|
||||
in_exc = ec.CurrentBranching.InTryOrCatch (false);
|
||||
|
||||
Type iterator_type = IteratorHandler.Current.IteratorType;
|
||||
if (expr.Type != iterator_type){
|
||||
expr = Convert.ImplicitConversionRequired (ec, expr, iterator_type, loc);
|
||||
@@ -80,7 +79,7 @@ namespace Mono.CSharp {
|
||||
|
||||
protected override void DoEmit (EmitContext ec)
|
||||
{
|
||||
IteratorHandler.Current.MarkYield (ec, expr, in_exc);
|
||||
IteratorHandler.Current.MarkYield (ec, expr);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,6 +177,10 @@ namespace Mono.CSharp {
|
||||
int modifiers;
|
||||
|
||||
static int proxy_count;
|
||||
string MakeProxyName ()
|
||||
{
|
||||
return String.Format ("__Proxy_{0}", proxy_count++);
|
||||
}
|
||||
|
||||
public void EmitYieldBreak (ILGenerator ig, bool add_return)
|
||||
{
|
||||
@@ -326,33 +329,32 @@ namespace Mono.CSharp {
|
||||
enumerable_proxy_class.DefineMethodOverride (getenumerator_method, TypeManager.ienumerable_getenumerator_void);
|
||||
ILGenerator ig = getenumerator_method.GetILGenerator ();
|
||||
|
||||
ig.Emit (OpCodes.Newobj, (ConstructorInfo) enumerator_proxy_constructor);
|
||||
if (enumerable_this_field != null || parameters.Count > 0){
|
||||
LocalBuilder obj = ig.DeclareLocal (enumerator_proxy_class);
|
||||
ig.Emit (OpCodes.Stloc, obj);
|
||||
if (enumerable_this_field != null){
|
||||
ig.Emit (OpCodes.Ldloc, obj);
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ig.Emit (OpCodes.Ldfld, enumerable_this_field);
|
||||
ig.Emit (OpCodes.Stfld, this_field);
|
||||
}
|
||||
|
||||
for (int i = 0; i < parameters.Count; i++){
|
||||
ig.Emit (OpCodes.Ldloc, obj);
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ig.Emit (OpCodes.Ldfld, enumerable_parameter_fields [i]);
|
||||
ig.Emit (OpCodes.Stfld, parameter_fields [i]);
|
||||
}
|
||||
ig.Emit (OpCodes.Ldloc, obj);
|
||||
if (enumerable_this_field != null){
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ig.Emit (OpCodes.Ldfld, enumerable_this_field);
|
||||
}
|
||||
|
||||
for (int i = 0; i < parameters.Count; i++){
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ig.Emit (OpCodes.Ldfld, enumerable_parameter_fields [i]);
|
||||
}
|
||||
ig.Emit (OpCodes.Newobj, (ConstructorInfo) enumerator_proxy_constructor);
|
||||
ig.Emit (OpCodes.Ret);
|
||||
}
|
||||
|
||||
void LoadArgs (ILGenerator ig)
|
||||
{
|
||||
int count = parameters.Count;
|
||||
if ((modifiers & Modifiers.STATIC) == 0)
|
||||
count++;
|
||||
|
||||
for (int i = 0; i < count; i++)
|
||||
ParameterReference.EmitLdArg (ig, i);
|
||||
}
|
||||
|
||||
//
|
||||
// Called back from Yield
|
||||
//
|
||||
public void MarkYield (EmitContext ec, Expression expr, bool in_exc)
|
||||
public void MarkYield (EmitContext ec, Expression expr)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
|
||||
@@ -366,33 +368,51 @@ namespace Mono.CSharp {
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
IntConstant.EmitInt (ig, pc);
|
||||
ig.Emit (OpCodes.Stfld, pc_field);
|
||||
|
||||
// Return ok
|
||||
ig.Emit (OpCodes.Ldc_I4_1);
|
||||
|
||||
// Find out how to "leave"
|
||||
if (in_exc || !ec.IsLastStatement){
|
||||
Type old = ec.ReturnType;
|
||||
ec.ReturnType = TypeManager.int32_type;
|
||||
ig.Emit (OpCodes.Stloc, ec.TemporaryReturn ());
|
||||
ec.ReturnType = old;
|
||||
}
|
||||
|
||||
if (in_exc){
|
||||
ec.NeedReturnLabel ();
|
||||
ig.Emit (OpCodes.Leave, ec.ReturnLabel);
|
||||
} else if (ec.IsLastStatement){
|
||||
ig.Emit (OpCodes.Ret);
|
||||
} else {
|
||||
ec.NeedReturnLabel ();
|
||||
ig.Emit (OpCodes.Br, ec.ReturnLabel);
|
||||
}
|
||||
// Return ok.
|
||||
ig.Emit (OpCodes.Ldc_I4_1);
|
||||
ig.Emit (OpCodes.Ret);
|
||||
|
||||
Label resume_point = ig.DefineLabel ();
|
||||
ig.MarkLabel (resume_point);
|
||||
resume_labels.Add (resume_point);
|
||||
}
|
||||
|
||||
void ComputeConstructorTypes (out Type [] constructor_types, out Parameters constructor_parameters)
|
||||
{
|
||||
bool is_static = (modifiers & Modifiers.STATIC) != 0;
|
||||
|
||||
if (is_static && parameters.Count == 0){
|
||||
constructor_types = TypeManager.NoTypes;
|
||||
constructor_parameters = Parameters.EmptyReadOnlyParameters;
|
||||
return;
|
||||
}
|
||||
|
||||
int count = (is_static ? 0 : 1) + parameters.Count;
|
||||
constructor_types = new Type [count];
|
||||
Parameter [] pars = new Parameter [count];
|
||||
constructor_parameters = new Parameters (pars, null, loc);
|
||||
|
||||
int i = 0;
|
||||
if (!is_static){
|
||||
constructor_types [0] = container.TypeBuilder;
|
||||
|
||||
Parameter THIS = new Parameter (
|
||||
new TypeExpression (container.TypeBuilder, loc), "this", Parameter.Modifier.NONE, null);
|
||||
pars [0] = THIS;
|
||||
i++;
|
||||
}
|
||||
|
||||
for (int j = 0; j < parameters.Count; j++, i++){
|
||||
Type partype = parameters.ParameterType (j);
|
||||
|
||||
pars [i] = new Parameter (new TypeExpression (partype, loc),
|
||||
parameters.ParameterName (j),
|
||||
Parameter.Modifier.NONE, null);
|
||||
constructor_types [i] = partype;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Creates the IEnumerator Proxy class
|
||||
//
|
||||
@@ -410,8 +430,7 @@ namespace Mono.CSharp {
|
||||
// Create the class
|
||||
//
|
||||
enumerator_proxy_class = container_builder.DefineNestedType (
|
||||
"<Enumerator:" + name + ":" + (proxy_count++) + ">",
|
||||
TypeAttributes.AutoLayout | TypeAttributes.Class |TypeAttributes.NestedPrivate,
|
||||
MakeProxyName (), TypeAttributes.AutoLayout | TypeAttributes.Class |TypeAttributes.NestedPublic,
|
||||
TypeManager.object_type, proxy_base_itypes);
|
||||
|
||||
TypeManager.RegisterBuilder (enumerator_proxy_class, proxy_base_interfaces);
|
||||
@@ -419,29 +438,33 @@ namespace Mono.CSharp {
|
||||
//
|
||||
// Define our fields
|
||||
//
|
||||
pc_field = enumerator_proxy_class.DefineField ("PC", TypeManager.int32_type, FieldAttributes.Assembly);
|
||||
current_field = enumerator_proxy_class.DefineField ("current", IteratorType, FieldAttributes.Assembly);
|
||||
pc_field = enumerator_proxy_class.DefineField ("PC", TypeManager.int32_type, FieldAttributes.Private);
|
||||
current_field = enumerator_proxy_class.DefineField ("current", IteratorType, FieldAttributes.Private);
|
||||
if ((modifiers & Modifiers.STATIC) == 0)
|
||||
this_field = enumerator_proxy_class.DefineField ("THIS", container.TypeBuilder, FieldAttributes.Assembly);
|
||||
this_field = enumerator_proxy_class.DefineField ("THIS", container.TypeBuilder, FieldAttributes.Private);
|
||||
|
||||
parameter_fields = new FieldBuilder [parameters.Count];
|
||||
for (int i = 0; i < parameters.Count; i++){
|
||||
parameter_fields [i] = enumerator_proxy_class.DefineField (
|
||||
String.Format ("tor{0}_{1}", i, parameters.ParameterName (i)),
|
||||
parameters.ParameterType (i), FieldAttributes.Assembly);
|
||||
String.Format ("p{0}_{1}", i, parameters.ParameterName (i)),
|
||||
parameters.ParameterType (i), FieldAttributes.Private);
|
||||
}
|
||||
|
||||
//
|
||||
// Define a constructor
|
||||
//
|
||||
// FIXME: currently its parameterless
|
||||
Type [] constructor_types;
|
||||
Parameters constructor_parameters;
|
||||
|
||||
ComputeConstructorTypes (out constructor_types, out constructor_parameters);
|
||||
|
||||
enumerator_proxy_constructor = enumerator_proxy_class.DefineConstructor (
|
||||
MethodAttributes.Public | MethodAttributes.HideBySig |
|
||||
MethodAttributes.SpecialName | MethodAttributes.RTSpecialName,
|
||||
CallingConventions.HasThis, TypeManager.NoTypes);
|
||||
InternalParameters parameter_info = new InternalParameters (
|
||||
TypeManager.NoTypes, Parameters.EmptyReadOnlyParameters);
|
||||
TypeManager.RegisterMethod (enumerator_proxy_constructor, parameter_info, TypeManager.NoTypes);
|
||||
CallingConventions.HasThis, constructor_types);
|
||||
InternalParameters parameter_info = new InternalParameters (constructor_types, constructor_parameters);
|
||||
TypeManager.RegisterMethod (enumerator_proxy_constructor, parameter_info, constructor_types);
|
||||
|
||||
//
|
||||
// Our constructor
|
||||
@@ -450,6 +473,20 @@ namespace Mono.CSharp {
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ig.Emit (OpCodes.Call, TypeManager.object_ctor);
|
||||
|
||||
int arg_start;
|
||||
if (this_field != null){
|
||||
arg_start = 2;
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ig.Emit (OpCodes.Ldarg_1);
|
||||
ig.Emit (OpCodes.Stfld, this_field);
|
||||
} else {
|
||||
arg_start = 1;
|
||||
}
|
||||
for (int i = 0; i < parameters.Count; i++){
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ParameterReference.EmitLdArg (ig, i + arg_start);
|
||||
ig.Emit (OpCodes.Stfld, parameter_fields [i]);
|
||||
}
|
||||
ig.Emit (OpCodes.Ret);
|
||||
}
|
||||
|
||||
@@ -466,36 +503,52 @@ namespace Mono.CSharp {
|
||||
// Creates the Enumerable proxy class.
|
||||
//
|
||||
enumerable_proxy_class = container_builder.DefineNestedType (
|
||||
"<Enumerable:" + name + ":" + (proxy_count++)+ ">",
|
||||
TypeAttributes.AutoLayout | TypeAttributes.Class |TypeAttributes.NestedPublic,
|
||||
MakeProxyName (), TypeAttributes.AutoLayout | TypeAttributes.Class |TypeAttributes.NestedPublic,
|
||||
TypeManager.object_type, proxy_base_interfaces);
|
||||
|
||||
//
|
||||
// Constructor
|
||||
//
|
||||
Type [] constructor_types;
|
||||
Parameters constructor_parameters;
|
||||
|
||||
ComputeConstructorTypes (out constructor_types, out constructor_parameters);
|
||||
if ((modifiers & Modifiers.STATIC) == 0){
|
||||
enumerable_this_field = enumerable_proxy_class.DefineField (
|
||||
"THIS", container.TypeBuilder, FieldAttributes.Assembly);
|
||||
"THIS", container.TypeBuilder, FieldAttributes.Private);
|
||||
}
|
||||
enumerable_parameter_fields = new FieldBuilder [parameters.Count];
|
||||
for (int i = 0; i < parameters.Count; i++){
|
||||
enumerable_parameter_fields [i] = enumerable_proxy_class.DefineField (
|
||||
String.Format ("able{0}_{1}", i, parameters.ParameterName (i)),
|
||||
parameters.ParameterType (i), FieldAttributes.Assembly);
|
||||
String.Format ("p{0}_{1}", i, parameters.ParameterName (i)),
|
||||
parameters.ParameterType (i), FieldAttributes.Private);
|
||||
}
|
||||
|
||||
enumerable_proxy_constructor = enumerable_proxy_class.DefineConstructor (
|
||||
MethodAttributes.Public | MethodAttributes.HideBySig |
|
||||
MethodAttributes.SpecialName | MethodAttributes.RTSpecialName,
|
||||
CallingConventions.HasThis, TypeManager.NoTypes);
|
||||
InternalParameters parameter_info = new InternalParameters (
|
||||
TypeManager.NoTypes, Parameters.EmptyReadOnlyParameters);
|
||||
TypeManager.RegisterMethod (enumerable_proxy_constructor, parameter_info, TypeManager.NoTypes);
|
||||
CallingConventions.HasThis, constructor_types);
|
||||
InternalParameters parameter_info = new InternalParameters (constructor_types, constructor_parameters);
|
||||
TypeManager.RegisterMethod (enumerable_proxy_constructor, parameter_info, constructor_types);
|
||||
|
||||
ILGenerator ig = enumerable_proxy_constructor.GetILGenerator ();
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ig.Emit (OpCodes.Call, TypeManager.object_ctor);
|
||||
|
||||
int first_arg;
|
||||
if (enumerable_this_field != null){
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ig.Emit (OpCodes.Ldarg_1);
|
||||
ig.Emit (OpCodes.Stfld, enumerable_this_field);
|
||||
first_arg = 2;
|
||||
} else
|
||||
first_arg = 1;
|
||||
|
||||
for (int i = 0; i < parameters.Count; i++){
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
ParameterReference.EmitLdArg (ig, i + first_arg);
|
||||
ig.Emit (OpCodes.Stfld, enumerable_parameter_fields [i]);
|
||||
}
|
||||
ig.Emit (OpCodes.Ret);
|
||||
}
|
||||
|
||||
@@ -579,54 +632,12 @@ namespace Mono.CSharp {
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
FieldBuilder this_field = null;
|
||||
bool is_ienumerable = IsIEnumerable (handler.return_type);
|
||||
Type temp_type;
|
||||
handler.LoadArgs (ec.ig);
|
||||
|
||||
if (is_ienumerable){
|
||||
temp_type = handler.enumerable_proxy_class;
|
||||
ig.Emit (OpCodes.Newobj, (ConstructorInfo) handler.enumerable_proxy_constructor);
|
||||
this_field = handler.enumerable_this_field;
|
||||
} else {
|
||||
temp_type = handler.enumerator_proxy_class;
|
||||
ig.Emit (OpCodes.Newobj, (ConstructorInfo) handler.enumerator_proxy_constructor);
|
||||
this_field = handler.this_field;
|
||||
}
|
||||
|
||||
if (this_field == null && handler.parameters.Count == 0)
|
||||
return;
|
||||
|
||||
LocalBuilder temp = ec.GetTemporaryLocal (temp_type);
|
||||
|
||||
ig.Emit (OpCodes.Stloc, temp);
|
||||
//
|
||||
// Initialize This
|
||||
//
|
||||
int first = 0;
|
||||
if (this_field != null){
|
||||
ig.Emit (OpCodes.Ldloc, temp);
|
||||
ig.Emit (OpCodes.Ldarg_0);
|
||||
if (handler.container is Struct)
|
||||
ig.Emit (OpCodes.Ldobj, handler.container.TypeBuilder);
|
||||
ig.Emit (OpCodes.Stfld, this_field);
|
||||
first = 1;
|
||||
}
|
||||
|
||||
for (int i = 0; i < handler.parameters.Count; i++){
|
||||
ig.Emit (OpCodes.Ldloc, temp);
|
||||
ParameterReference.EmitLdArg (ig, i + first);
|
||||
if (is_ienumerable)
|
||||
ig.Emit (OpCodes.Stfld, handler.enumerable_parameter_fields [i]);
|
||||
else
|
||||
ig.Emit (OpCodes.Stfld, handler.parameter_fields [i]);
|
||||
}
|
||||
|
||||
//
|
||||
// Initialize fields
|
||||
//
|
||||
ig.Emit (OpCodes.Ldloc, temp);
|
||||
ec.FreeTemporaryLocal (temp, handler.container.TypeBuilder);
|
||||
if (IsIEnumerable (handler.return_type))
|
||||
ec.ig.Emit (OpCodes.Newobj, (ConstructorInfo) handler.enumerable_proxy_constructor);
|
||||
else
|
||||
ec.ig.Emit (OpCodes.Newobj, (ConstructorInfo) handler.enumerator_proxy_constructor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,10 +57,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
ec.ig.Emit (OpCodes.Ldnull);
|
||||
}
|
||||
|
||||
public override bool IsZeroInteger {
|
||||
get { return true; }
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -73,12 +69,7 @@ namespace Mono.CSharp {
|
||||
{
|
||||
Null = new NullPointer ();
|
||||
}
|
||||
|
||||
private NullPointer ()
|
||||
{
|
||||
type = TypeManager.object_type;
|
||||
}
|
||||
|
||||
|
||||
public override void Emit (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
@@ -74,10 +74,10 @@ namespace Mono.CSharp {
|
||||
string path = Path.GetFullPath (name);
|
||||
|
||||
if (source_files.Contains (path)){
|
||||
Report.Warning (
|
||||
2002,
|
||||
Report.Error (
|
||||
1516,
|
||||
"Source file `" + name + "' specified multiple times");
|
||||
return;
|
||||
Environment.Exit (1);
|
||||
}
|
||||
|
||||
source_files.Add (path, ++source_count);
|
||||
@@ -120,7 +120,7 @@ namespace Mono.CSharp {
|
||||
// </remarks>
|
||||
static public SourceFile LookupFile (string name)
|
||||
{
|
||||
string path = name == "" ? "" : Path.GetFullPath (name);
|
||||
string path = Path.GetFullPath (name);
|
||||
|
||||
if (!source_files.Contains (path)) {
|
||||
if (source_count >= (1 << source_bits))
|
||||
File renamed without changes.
@@ -31,6 +31,7 @@ namespace Mono.CSharp {
|
||||
// We use this internally to flag that the method contains an iterator
|
||||
//
|
||||
public const int METHOD_YIELDS = 0x8000;
|
||||
public const int METHOD_GENERIC = 0x10000;
|
||||
|
||||
public const int Accessibility =
|
||||
PUBLIC | PROTECTED | INTERNAL | PRIVATE;
|
||||
@@ -68,8 +69,6 @@ namespace Mono.CSharp {
|
||||
s = "extern"; break;
|
||||
case Modifiers.VOLATILE:
|
||||
s = "volatile"; break;
|
||||
case Modifiers.UNSAFE:
|
||||
s = "unsafe"; break;
|
||||
}
|
||||
|
||||
return s;
|
||||
@@ -199,7 +198,7 @@ namespace Mono.CSharp {
|
||||
if ((mod & Modifiers.UNSAFE) != 0){
|
||||
if (!RootContext.Unsafe){
|
||||
Report.Error (227, l,
|
||||
"Unsafe code requires the -unsafe command " +
|
||||
"Unsafe code requires the --unsafe command " +
|
||||
"line option to be specified");
|
||||
}
|
||||
}
|
||||
@@ -105,10 +105,7 @@ namespace Mono.CSharp {
|
||||
if (ns != null)
|
||||
return ns;
|
||||
|
||||
//
|
||||
// The type is not a nested type here
|
||||
//
|
||||
t = TypeManager.LookupTypeDirect (DeclSpace.MakeFQN (fullname, name));
|
||||
t = TypeManager.LookupType (DeclSpace.MakeFQN (fullname, name));
|
||||
if ((t == null) || ((ds != null) && !ds.CheckAccessLevel (t)))
|
||||
return null;
|
||||
|
||||
@@ -255,9 +252,14 @@ namespace Mono.CSharp {
|
||||
|
||||
NamespaceEntry curr_ns = NamespaceEntry;
|
||||
|
||||
//
|
||||
// GENERICS: Cope with the expression and not with the string
|
||||
// this will fail with `using A = Stack<int>'
|
||||
//
|
||||
|
||||
string alias = Alias.ToString ();
|
||||
while ((curr_ns != null) && (resolved == null)) {
|
||||
resolved = curr_ns.Lookup (null, alias, false, Location);
|
||||
resolved = curr_ns.Lookup (null, alias, Location);
|
||||
|
||||
if (resolved == null)
|
||||
curr_ns = curr_ns.Parent;
|
||||
@@ -392,7 +394,7 @@ namespace Mono.CSharp {
|
||||
return ((Type) resolved).FullName;
|
||||
}
|
||||
|
||||
public object Lookup (DeclSpace ds, string name, bool silent, Location loc)
|
||||
public object Lookup (DeclSpace ds, string name, Location loc)
|
||||
{
|
||||
object o;
|
||||
Namespace ns;
|
||||
@@ -405,7 +407,7 @@ namespace Mono.CSharp {
|
||||
string first = name.Substring (0, pos);
|
||||
string last = name.Substring (pos + 1);
|
||||
|
||||
o = Lookup (ds, first, silent, loc);
|
||||
o = Lookup (ds, first, loc);
|
||||
if (o == null)
|
||||
return null;
|
||||
|
||||
@@ -437,9 +439,6 @@ namespace Mono.CSharp {
|
||||
return o;
|
||||
}
|
||||
|
||||
if (name.IndexOf ('.') > 0)
|
||||
return null;
|
||||
|
||||
//
|
||||
// Check using entries.
|
||||
//
|
||||
@@ -448,8 +447,7 @@ namespace Mono.CSharp {
|
||||
match = using_ns.Lookup (ds, name) as Type;
|
||||
if (match != null){
|
||||
if (t != null) {
|
||||
if (!silent)
|
||||
DeclSpace.Error_AmbiguousTypeReference (loc, name, t, match);
|
||||
DeclSpace.Error_AmbiguousTypeReference (loc, name, t, match);
|
||||
return null;
|
||||
} else {
|
||||
t = match;
|
||||
File renamed without changes.
@@ -16,113 +16,11 @@ using System.Collections;
|
||||
|
||||
namespace Mono.CSharp {
|
||||
|
||||
/// <summary>
|
||||
/// Abstract Base class for parameters of a method.
|
||||
/// </summary>
|
||||
public abstract class ParameterBase : Attributable {
|
||||
|
||||
protected ParameterBuilder builder;
|
||||
|
||||
public ParameterBase (Attributes attrs)
|
||||
: base (attrs)
|
||||
{
|
||||
}
|
||||
|
||||
public override void ApplyAttributeBuilder (Attribute a, CustomAttributeBuilder cb)
|
||||
{
|
||||
if (a.Type == TypeManager.marshal_as_attr_type) {
|
||||
UnmanagedMarshal marshal = a.GetMarshal ();
|
||||
if (marshal != null) {
|
||||
builder.SetMarshal (marshal);
|
||||
return;
|
||||
}
|
||||
Report.Warning_T (-24, a.Location);
|
||||
return;
|
||||
}
|
||||
|
||||
builder.SetCustomAttribute (cb);
|
||||
}
|
||||
|
||||
public override bool IsClsCompliaceRequired(DeclSpace ds)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class for applying custom attributes on the return type
|
||||
/// </summary>
|
||||
public class ReturnParameter: ParameterBase {
|
||||
public ReturnParameter (MethodBuilder mb, Location location):
|
||||
base (null)
|
||||
{
|
||||
try {
|
||||
builder = mb.DefineParameter (0, ParameterAttributes.None, "");
|
||||
}
|
||||
catch (ArgumentOutOfRangeException) {
|
||||
Report.Warning_T (-28, location);
|
||||
}
|
||||
}
|
||||
|
||||
public override void ApplyAttributeBuilder(Attribute a, CustomAttributeBuilder cb)
|
||||
{
|
||||
// This occurs after Warning -28
|
||||
if (builder == null)
|
||||
return;
|
||||
|
||||
base.ApplyAttributeBuilder (a, cb);
|
||||
}
|
||||
|
||||
public override AttributeTargets AttributeTargets {
|
||||
get {
|
||||
return AttributeTargets.ReturnValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is never called
|
||||
/// </summary>
|
||||
protected override string[] ValidAttributeTargets {
|
||||
get {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Class for applying custom attributes on the implicit parameter type
|
||||
/// of the 'set' method in properties, and the 'add' and 'remove' methods in events.
|
||||
/// </summary>
|
||||
public class ImplicitParameter: ParameterBase {
|
||||
public ImplicitParameter (MethodBuilder mb):
|
||||
base (null)
|
||||
{
|
||||
builder = mb.DefineParameter (1, ParameterAttributes.None, "");
|
||||
}
|
||||
|
||||
public override AttributeTargets AttributeTargets {
|
||||
get {
|
||||
return AttributeTargets.Parameter;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Is never called
|
||||
/// </summary>
|
||||
protected override string[] ValidAttributeTargets {
|
||||
get {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Represents a single method parameter
|
||||
/// </summary>
|
||||
|
||||
//TODO: Add location member to this or base class for better error location and all methods simplification.
|
||||
public class Parameter : ParameterBase {
|
||||
public class Parameter {
|
||||
[Flags]
|
||||
public enum Modifier : byte {
|
||||
NONE = 0,
|
||||
@@ -133,19 +31,18 @@ namespace Mono.CSharp {
|
||||
ISBYREF = 8
|
||||
}
|
||||
|
||||
static string[] attribute_targets = new string [] { "param" };
|
||||
|
||||
public readonly Expression TypeName;
|
||||
public readonly Modifier ModFlags;
|
||||
public Attributes OptAttributes;
|
||||
public readonly string Name;
|
||||
Type parameter_type;
|
||||
|
||||
public Parameter (Expression type, string name, Modifier mod, Attributes attrs)
|
||||
: base (attrs)
|
||||
{
|
||||
Name = name;
|
||||
ModFlags = mod;
|
||||
TypeName = type;
|
||||
OptAttributes = attrs;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
@@ -160,15 +57,6 @@ namespace Mono.CSharp {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((ModFlags & Parameter.Modifier.ISBYREF) != 0){
|
||||
if (parameter_type == TypeManager.typed_reference_type ||
|
||||
parameter_type == TypeManager.arg_iterator_type){
|
||||
Report.Error (1601, l,
|
||||
"out or ref parameter can not be of type TypedReference or ArgIterator");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return parameter_type != null;
|
||||
}
|
||||
|
||||
@@ -204,12 +92,6 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
public override AttributeTargets AttributeTargets {
|
||||
get {
|
||||
return AttributeTargets.Parameter;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the signature for this parameter evaluating it on the
|
||||
/// @tc context
|
||||
@@ -223,45 +105,6 @@ namespace Mono.CSharp {
|
||||
|
||||
return ExternalType ().FullName;
|
||||
}
|
||||
|
||||
public string GetSignatureForError ()
|
||||
{
|
||||
string typeName = TypeManager.CSharpName (parameter_type);
|
||||
switch (ModFlags & ~Modifier.ISBYREF) {
|
||||
case Modifier.OUT:
|
||||
return "out " + typeName;
|
||||
case Modifier.PARAMS:
|
||||
return "params " + typeName;
|
||||
case Modifier.REF:
|
||||
return "ref " + typeName;
|
||||
}
|
||||
return typeName;
|
||||
}
|
||||
|
||||
public void DefineParameter (EmitContext ec, MethodBuilder mb, ConstructorBuilder cb, int index, Location loc)
|
||||
{
|
||||
ParameterAttributes par_attr = Attributes;
|
||||
|
||||
if (mb == null)
|
||||
builder = cb.DefineParameter (index, par_attr, Name);
|
||||
else
|
||||
builder = mb.DefineParameter (index, par_attr, Name);
|
||||
|
||||
if (OptAttributes != null) {
|
||||
OptAttributes.Emit (ec, this);
|
||||
|
||||
if (par_attr == ParameterAttributes.Out){
|
||||
if (OptAttributes.Contains (TypeManager.in_attribute_type, ec))
|
||||
Report.Error (36, loc, "Can not use [In] attribute on out parameter");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override string[] ValidAttributeTargets {
|
||||
get {
|
||||
return attribute_targets;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -565,47 +408,8 @@ namespace Mono.CSharp {
|
||||
// For now this is the only correc thing to do
|
||||
return CallingConventions.Standard;
|
||||
}
|
||||
|
||||
//
|
||||
// The method's attributes are passed in because we need to extract
|
||||
// the "return:" attribute from there to apply on the return type
|
||||
//
|
||||
public void LabelParameters (EmitContext ec,
|
||||
MethodBase builder,
|
||||
Location loc) {
|
||||
//
|
||||
// Define each type attribute (in/out/ref) and
|
||||
// the argument names.
|
||||
//
|
||||
int i = 0;
|
||||
|
||||
MethodBuilder mb = builder as MethodBuilder;
|
||||
ConstructorBuilder cb = builder as ConstructorBuilder;
|
||||
|
||||
if (FixedParameters != null) {
|
||||
for (i = 0; i < FixedParameters.Length; i++) {
|
||||
FixedParameters [i].DefineParameter (ec, mb, cb, i + 1, loc);
|
||||
}
|
||||
}
|
||||
|
||||
if (ArrayParameter != null){
|
||||
ParameterBuilder pb;
|
||||
Parameter array_param = ArrayParameter;
|
||||
|
||||
if (mb == null)
|
||||
pb = cb.DefineParameter (
|
||||
i + 1, array_param.Attributes,
|
||||
array_param.Name);
|
||||
else
|
||||
pb = mb.DefineParameter (
|
||||
i + 1, array_param.Attributes,
|
||||
array_param.Name);
|
||||
|
||||
CustomAttributeBuilder a = new CustomAttributeBuilder (
|
||||
TypeManager.cons_param_array_attribute, new object [0]);
|
||||
|
||||
pb.SetCustomAttribute (a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -157,7 +157,7 @@ namespace Mono.CSharp {
|
||||
mi = iface.GetMethods ();
|
||||
} else
|
||||
mi = t.GetMethods ();
|
||||
|
||||
|
||||
int count = mi.Length;
|
||||
pending_implementations [i].type = t;
|
||||
pending_implementations [i].optional = missing.Optional;
|
||||
@@ -238,7 +238,7 @@ namespace Mono.CSharp {
|
||||
|
||||
for (int i = 0; i < impl.Length; i++)
|
||||
ret [i] = new MissingInterfacesInfo (impl [i].Type);
|
||||
|
||||
|
||||
// we really should not get here because Object doesnt implement any
|
||||
// interfaces. But it could implement something internal, so we have
|
||||
// to handle that case.
|
||||
@@ -249,7 +249,7 @@ namespace Mono.CSharp {
|
||||
|
||||
foreach (TypeExpr te in parent_impls) {
|
||||
Type t = te.Type;
|
||||
|
||||
|
||||
for (int i = 0; i < ret.Length; i ++) {
|
||||
if (t == ret [i].Type) {
|
||||
ret [i].Optional = true;
|
||||
@@ -384,7 +384,7 @@ namespace Mono.CSharp {
|
||||
} else if ((need_proxy == null) && (name != m.Name))
|
||||
continue;
|
||||
|
||||
if (ret_type != m.ReturnType){
|
||||
if (!TypeManager.IsEqual (ret_type, m.ReturnType)){
|
||||
if (!((ret_type == null && m.ReturnType == TypeManager.void_type) ||
|
||||
(m.ReturnType == null && ret_type == TypeManager.void_type)))
|
||||
continue;
|
||||
@@ -400,7 +400,7 @@ namespace Mono.CSharp {
|
||||
bool fail = false;
|
||||
|
||||
for (j = 0; j < top; j++){
|
||||
if (tm.args [i][j] != args[j]){
|
||||
if (!TypeManager.IsEqual (tm.args [i][j], args[j])){
|
||||
fail = true;
|
||||
break;
|
||||
}
|
||||
@@ -12,7 +12,6 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Reflection;
|
||||
|
||||
@@ -59,69 +58,6 @@ namespace Mono.CSharp {
|
||||
// Keeps track of the warnings that we are ignoring
|
||||
//
|
||||
static Hashtable warning_ignore_table;
|
||||
|
||||
/// <summary>
|
||||
/// List of symbols related to reported error/warning. You have to fill it before error/warning is reported.
|
||||
/// </summary>
|
||||
static StringCollection related_symbols = new StringCollection ();
|
||||
|
||||
struct WarningData {
|
||||
public WarningData (int level, string text) {
|
||||
Level = level;
|
||||
Message = text;
|
||||
}
|
||||
|
||||
public bool IsEnabled ()
|
||||
{
|
||||
return RootContext.WarningLevel >= Level;
|
||||
}
|
||||
|
||||
public string Format (params object[] args)
|
||||
{
|
||||
return String.Format (Message, args);
|
||||
}
|
||||
|
||||
readonly string Message;
|
||||
readonly int Level;
|
||||
}
|
||||
|
||||
static string GetErrorMsg (int error_no)
|
||||
{
|
||||
switch (error_no) {
|
||||
case 0122: return "'{0}' is inaccessible due to its protection level";
|
||||
case 0619: return "'{0}' is obsolete: '{1}'";
|
||||
case 0657: return "'{0}' is not a valid attribute location for this declaration. Valid attribute locations for this declaration are '{1}'";
|
||||
case 3001: return "Argument type '{0}' is not CLS-compliant";
|
||||
case 3002: return "Return type of '{0}' is not CLS-compliant";
|
||||
case 3003: return "Type of '{0}' is not CLS-compliant";
|
||||
case 3005: return "Identifier '{0}' differing only in case is not CLS-compliant";
|
||||
case 3006: return "Overloaded method '{0}' differing only in ref or out, or in array rank, is not CLS-compliant";
|
||||
case 3008: return "Identifier '{0}' is not CLS-compliant";
|
||||
case 3009: return "'{0}': base type '{1}' is not CLS-compliant";
|
||||
case 3010: return "'{0}': CLS-compliant interfaces must have only CLS-compliant members";
|
||||
case 3011: return "'{0}': only CLS-compliant members can be abstract";
|
||||
case 3013: return "Added modules must be marked with the CLSCompliant attribute to match the assembly";
|
||||
case 3014: return "'{0}' cannot be marked as CLS-compliant because the assembly does not have a CLSCompliant attribute";
|
||||
case 3015: return "'{0}' has no accessible constructors which use only CLS-compliant types";
|
||||
case 3016: return "Arrays as attribute arguments are not CLS-compliant";
|
||||
}
|
||||
throw new InternalErrorException (String.Format ("Missing error '{0}' text", error_no));
|
||||
}
|
||||
|
||||
static WarningData GetWarningMsg (int warn_no)
|
||||
{
|
||||
switch (warn_no) {
|
||||
case -24: return new WarningData (1, "The Microsoft Runtime cannot set this marshal info. Please use the Mono runtime instead.");
|
||||
case -28: return new WarningData (1, "The Microsoft .NET Runtime 1.x does not permit setting custom attributes on the return type");
|
||||
case 0612: return new WarningData (1, "'{0}' is obsolete");
|
||||
case 0618: return new WarningData (2, "'{0}' is obsolete: '{1}'");
|
||||
case 0672: return new WarningData (1, "Member '{0}' overrides obsolete member. Add the Obsolete attribute to '{0}'");
|
||||
case 3012: return new WarningData (1, "You must specify the CLSCompliant attribute on the assembly, not the module, to enable CLS compliance checking");
|
||||
case 3019: return new WarningData (2, "CLS compliance checking will not be performed on '{0}' because it is private or internal");
|
||||
}
|
||||
|
||||
throw new InternalErrorException (String.Format ("Wrong warning number '{0}'", warn_no));
|
||||
}
|
||||
|
||||
static void Check (int code)
|
||||
{
|
||||
@@ -174,52 +110,11 @@ namespace Mono.CSharp {
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
[Obsolete ("Use SymbolRelatedToPreviousError for better error description")]
|
||||
static public void LocationOfPreviousError (Location loc)
|
||||
{
|
||||
Console.WriteLine (String.Format ("{0}({1}) (Location of symbol related to previous error)", loc.Name, loc.Row));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// In most error cases is very useful to have information about symbol that caused the error.
|
||||
/// Call this method before you call Report.Error when it makes sense.
|
||||
/// </summary>
|
||||
static public void SymbolRelatedToPreviousError (Location loc, string symbol)
|
||||
{
|
||||
SymbolRelatedToPreviousError (String.Format ("{0}({1})", loc.Name, loc.Row), symbol);
|
||||
}
|
||||
|
||||
static public void SymbolRelatedToPreviousError (MemberInfo mi)
|
||||
{
|
||||
DeclSpace temp_ds = TypeManager.LookupDeclSpace (mi.DeclaringType);
|
||||
if (temp_ds == null) {
|
||||
SymbolRelatedToPreviousError (mi.DeclaringType.Assembly.Location, TypeManager.GetFullNameSignature (mi));
|
||||
} else {
|
||||
string name = String.Concat (temp_ds.Name, ".", mi.Name);
|
||||
MemberCore mc = temp_ds.GetDefinition (name) as MemberCore;
|
||||
SymbolRelatedToPreviousError (mc.Location, mc.GetSignatureForError ());
|
||||
}
|
||||
}
|
||||
|
||||
static public void SymbolRelatedToPreviousError (Type type)
|
||||
{
|
||||
SymbolRelatedToPreviousError (type.Assembly.Location, TypeManager.CSharpName (type));
|
||||
}
|
||||
|
||||
static void SymbolRelatedToPreviousError (string loc, string symbol)
|
||||
{
|
||||
related_symbols.Add (String.Format ("{0}: ('{1}' name of symbol related to previous error)", loc, symbol));
|
||||
}
|
||||
|
||||
static public void RealError (string msg)
|
||||
{
|
||||
Errors++;
|
||||
Console.WriteLine (msg);
|
||||
|
||||
foreach (string s in related_symbols)
|
||||
Console.WriteLine (s);
|
||||
related_symbols.Clear ();
|
||||
|
||||
if (Stacktrace)
|
||||
Console.WriteLine (FriendlyStackTrace (new StackTrace (true)));
|
||||
|
||||
@@ -227,43 +122,6 @@ namespace Mono.CSharp {
|
||||
throw new Exception (msg);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Method reports warning message. Only one reason why exist Warning and Report methods is beter code readability.
|
||||
/// </summary>
|
||||
static public void Warning_T (int code, Location loc, params object[] args)
|
||||
{
|
||||
WarningData warning = GetWarningMsg (code);
|
||||
if (warning.IsEnabled ())
|
||||
Warning (code, loc, warning.Format (args));
|
||||
|
||||
related_symbols.Clear ();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reports error message.
|
||||
/// </summary>
|
||||
static public void Error_T (int code, Location loc, params object[] args)
|
||||
{
|
||||
Error_T (code, String.Format ("{0}({1})", loc.Name, loc.Row), args);
|
||||
}
|
||||
|
||||
static public void Error_T (int code, string location, params object[] args)
|
||||
{
|
||||
string errorText = String.Format (GetErrorMsg (code), args);
|
||||
PrintError (code, location, errorText);
|
||||
}
|
||||
|
||||
static void PrintError (int code, string l, string text)
|
||||
{
|
||||
if (code < 0)
|
||||
code = 8000-code;
|
||||
|
||||
string msg = String.Format ("{0} error CS{1:0000}: {2}", l, code, text);
|
||||
RealError (msg);
|
||||
Check (code);
|
||||
}
|
||||
|
||||
static public void Error (int code, Location l, string text)
|
||||
{
|
||||
if (code < 0)
|
||||
@@ -283,10 +141,8 @@ namespace Mono.CSharp {
|
||||
code = 8000-code;
|
||||
|
||||
if (warning_ignore_table != null){
|
||||
if (warning_ignore_table.Contains (code)) {
|
||||
related_symbols.Clear ();
|
||||
if (warning_ignore_table.Contains (code))
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (WarningsAreErrors)
|
||||
@@ -304,11 +160,6 @@ namespace Mono.CSharp {
|
||||
// "{0}({1}) warning CS{2}: {3}",
|
||||
l.Name, row, code, text));
|
||||
Warnings++;
|
||||
|
||||
foreach (string s in related_symbols)
|
||||
Console.WriteLine (s);
|
||||
related_symbols.Clear ();
|
||||
|
||||
Check (code);
|
||||
|
||||
if (Stacktrace)
|
||||
@@ -350,6 +201,11 @@ namespace Mono.CSharp {
|
||||
Error (code, loc, String.Format (format, args));
|
||||
}
|
||||
|
||||
static public void Error (int code, string format, params object[] args)
|
||||
{
|
||||
Error (code, String.Format (format, args));
|
||||
}
|
||||
|
||||
static public void Warning (int code, Location loc, string format, params object[] args)
|
||||
{
|
||||
Warning (code, loc, String.Format (format, args));
|
||||
@@ -414,6 +270,8 @@ namespace Mono.CSharp {
|
||||
sb.Append ("null");
|
||||
else if (arg is ICollection)
|
||||
sb.Append (PrintCollection ((ICollection) arg));
|
||||
else if (arg is IntPtr)
|
||||
sb.Append (String.Format ("IntPtr(0x{0:x})", ((IntPtr) arg).ToInt32 ()));
|
||||
else
|
||||
sb.Append (arg);
|
||||
}
|
||||
@@ -571,5 +429,9 @@ namespace Mono.CSharp {
|
||||
: base (message)
|
||||
{
|
||||
}
|
||||
|
||||
public InternalErrorException (string format, params object[] args)
|
||||
: this (String.Format (format, args))
|
||||
{ }
|
||||
}
|
||||
}
|
||||
@@ -58,25 +58,14 @@ namespace Mono.CSharp {
|
||||
static TypeBuilder impl_details_class;
|
||||
|
||||
public static int WarningLevel = 2;
|
||||
|
||||
|
||||
public static Target Target = Target.Exe;
|
||||
public static string TargetExt = ".exe";
|
||||
|
||||
public static bool VerifyClsCompliance = true;
|
||||
|
||||
//
|
||||
// If set, enable C# version 2 features
|
||||
//
|
||||
public static bool V2 = true;
|
||||
|
||||
//
|
||||
// We keep strongname related info here because
|
||||
// it's also used as complier options from CSC 8.x
|
||||
//
|
||||
public static string StrongNameKeyFile;
|
||||
public static string StrongNameKeyContainer;
|
||||
public static bool StrongNameDelaySign = false;
|
||||
|
||||
//
|
||||
// Constructor
|
||||
//
|
||||
@@ -86,7 +75,7 @@ namespace Mono.CSharp {
|
||||
interface_resolve_order = new ArrayList ();
|
||||
type_container_resolve_order = new ArrayList ();
|
||||
}
|
||||
|
||||
|
||||
public static bool NeedsEntryPoint {
|
||||
get {
|
||||
return RootContext.Target == Target.Exe || RootContext.Target == Target.WinExe;
|
||||
@@ -273,7 +262,7 @@ namespace Mono.CSharp {
|
||||
object o = root.GetDefinition (name);
|
||||
if (o == null){
|
||||
Report.Error (518, "The predefined type `" + name + "' is not defined");
|
||||
Environment.Exit (1);
|
||||
Environment.Exit (0);
|
||||
}
|
||||
|
||||
if (!(o is Delegate)){
|
||||
@@ -341,9 +330,7 @@ namespace Mono.CSharp {
|
||||
"System.Decimal", "System.Void",
|
||||
"System.RuntimeFieldHandle",
|
||||
"System.RuntimeTypeHandle",
|
||||
"System.IntPtr",
|
||||
"System.TypedReference",
|
||||
"System.ArgIterator"
|
||||
"System.IntPtr"
|
||||
};
|
||||
|
||||
foreach (string cname in structs_second_stage)
|
||||
@@ -372,14 +359,11 @@ namespace Mono.CSharp {
|
||||
"System.Diagnostics.ConditionalAttribute",
|
||||
"System.ObsoleteAttribute",
|
||||
"System.ParamArrayAttribute",
|
||||
"System.CLSCompliantAttribute",
|
||||
"System.Security.UnverifiableCodeAttribute",
|
||||
"System.Runtime.CompilerServices.IndexerNameAttribute",
|
||||
"System.Runtime.InteropServices.InAttribute",
|
||||
"System.Runtime.InteropServices.StructLayoutAttribute",
|
||||
"System.Runtime.InteropServices.FieldOffsetAttribute",
|
||||
"System.InvalidOperationException",
|
||||
"System.MarshalByRefObject"
|
||||
"System.InvalidOperationException"
|
||||
|
||||
};
|
||||
|
||||
// We must store them here before calling BootstrapCorlib_ResolveDelegate.
|
||||
@@ -484,19 +468,24 @@ namespace Mono.CSharp {
|
||||
return ns.Substring (0, i);
|
||||
}
|
||||
|
||||
static Type NamespaceLookup (DeclSpace ds, string name, bool silent,
|
||||
Location loc)
|
||||
static Type NamespaceLookup (DeclSpace ds, string name,
|
||||
int num_type_args, Location loc)
|
||||
{
|
||||
//
|
||||
// Try in the current namespace and all its implicit parents
|
||||
//
|
||||
for (NamespaceEntry ns = ds.NamespaceEntry; ns != null; ns = ns.ImplicitParent) {
|
||||
object result = ns.Lookup (ds, name, silent, loc);
|
||||
object result = ns.Lookup (ds, name, loc);
|
||||
if (result == null)
|
||||
continue;
|
||||
|
||||
if (result is Type)
|
||||
return (Type) result;
|
||||
Type t = result as Type;
|
||||
if (t != null) {
|
||||
if (TypeManager.CheckGeneric (t, num_type_args))
|
||||
return t;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -504,6 +493,12 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
|
||||
static public Type LookupType (DeclSpace ds, string name, bool silent,
|
||||
Location loc)
|
||||
{
|
||||
return LookupType (ds, name, silent, 0, loc);
|
||||
}
|
||||
|
||||
//
|
||||
// Public function used to locate types, this can only
|
||||
// be used after the ResolveTree function has been invoked.
|
||||
@@ -512,12 +507,15 @@ namespace Mono.CSharp {
|
||||
//
|
||||
// Come to think of it, this should be a DeclSpace
|
||||
//
|
||||
static public Type LookupType (DeclSpace ds, string name, bool silent, Location loc)
|
||||
static public Type LookupType (DeclSpace ds, string name, bool silent,
|
||||
int num_type_params, Location loc)
|
||||
{
|
||||
Type t;
|
||||
|
||||
if (ds.Cache.Contains (name)) {
|
||||
if (ds.Cache.Contains (name)){
|
||||
t = (Type) ds.Cache [name];
|
||||
if (t != null)
|
||||
return t;
|
||||
} else {
|
||||
//
|
||||
// For the case the type we are looking for is nested within this one
|
||||
@@ -525,25 +523,9 @@ namespace Mono.CSharp {
|
||||
//
|
||||
DeclSpace containing_ds = ds;
|
||||
while (containing_ds != null){
|
||||
|
||||
// if the member cache has been created, lets use it.
|
||||
// the member cache is MUCH faster.
|
||||
if (containing_ds.MemberCache != null) {
|
||||
t = containing_ds.MemberCache.FindNestedType (name);
|
||||
if (t == null) {
|
||||
containing_ds = containing_ds.Parent;
|
||||
continue;
|
||||
}
|
||||
|
||||
ds.Cache [name] = t;
|
||||
return t;
|
||||
}
|
||||
|
||||
// no member cache. Do it the hard way -- reflection
|
||||
Type current_type = containing_ds.TypeBuilder;
|
||||
|
||||
while (current_type != null &&
|
||||
current_type != TypeManager.object_type) {
|
||||
while (current_type != null) {
|
||||
//
|
||||
// nested class
|
||||
//
|
||||
@@ -559,15 +541,17 @@ namespace Mono.CSharp {
|
||||
containing_ds = containing_ds.Parent;
|
||||
}
|
||||
|
||||
t = NamespaceLookup (ds, name, silent, loc);
|
||||
if (!silent)
|
||||
t = NamespaceLookup (ds, name, num_type_params, loc);
|
||||
if (t != null){
|
||||
ds.Cache [name] = t;
|
||||
return t;
|
||||
}
|
||||
}
|
||||
|
||||
if (t == null && !silent)
|
||||
if (!silent)
|
||||
Report.Error (246, loc, "Cannot find type `"+name+"'");
|
||||
|
||||
return t;
|
||||
return null;
|
||||
}
|
||||
|
||||
// <summary>
|
||||
@@ -673,15 +657,6 @@ namespace Mono.CSharp {
|
||||
else
|
||||
Report1530 (en.Location);
|
||||
}
|
||||
|
||||
//
|
||||
// Check for cycles in the struct layout
|
||||
//
|
||||
if (type_container_resolve_order != null){
|
||||
Hashtable seen = new Hashtable ();
|
||||
foreach (TypeContainer tc in type_container_resolve_order)
|
||||
TypeManager.CheckStructCycles (tc, seen);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@@ -744,21 +719,20 @@ namespace Mono.CSharp {
|
||||
|
||||
static public void EmitCode ()
|
||||
{
|
||||
//
|
||||
// Because of the strange way in which we do things, global
|
||||
// attributes must be processed first.
|
||||
//
|
||||
CodeGen.Assembly.Emit ();
|
||||
CodeGen.Module.Emit ();
|
||||
|
||||
if (attribute_types != null)
|
||||
foreach (TypeContainer tc in attribute_types)
|
||||
tc.Emit ();
|
||||
|
||||
CodeGen.Assembly.Emit (Tree.Types);
|
||||
CodeGen.Module.Emit (Tree.Types);
|
||||
|
||||
if (Tree.Types.Enums != null) {
|
||||
foreach (Enum e in Tree.Types.Enums)
|
||||
e.Emit (Tree.Types);
|
||||
}
|
||||
|
||||
if (interface_resolve_order != null) {
|
||||
if (interface_resolve_order != null){
|
||||
foreach (Interface iface in interface_resolve_order)
|
||||
iface.Emit (Tree.Types);
|
||||
iface.Emit ();
|
||||
}
|
||||
|
||||
if (type_container_resolve_order != null) {
|
||||
@@ -769,10 +743,6 @@ namespace Mono.CSharp {
|
||||
tc.Emit ();
|
||||
}
|
||||
|
||||
if (Tree.Types.Delegates != null) {
|
||||
foreach (Delegate d in Tree.Types.Delegates)
|
||||
d.Emit (Tree.Types);
|
||||
}
|
||||
//
|
||||
// Run any hooks after all the types have been defined.
|
||||
// This is used to create nested auxiliary classes for example
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using Generics;
|
||||
|
||||
namespace Test
|
||||
{
|
||||
public class Bar : Foo
|
||||
{
|
||||
public void Hello (Stack<int> stack)
|
||||
{
|
||||
Console.WriteLine ("Hello Generic World!");
|
||||
Console.WriteLine (stack);
|
||||
Console.WriteLine (stack.GetType ());
|
||||
}
|
||||
|
||||
public Stack<int> Test ()
|
||||
{
|
||||
return Driver.int_stack;
|
||||
}
|
||||
|
||||
public static void Main ()
|
||||
{
|
||||
Foo foo = new Bar ();
|
||||
Driver.Init (foo);
|
||||
Stack<int> a = Driver.int_stack;
|
||||
Console.WriteLine ("STACK: {0}", a);
|
||||
foo.Hello (a);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
.assembly sample-stack {}
|
||||
|
||||
.namespace Generics
|
||||
{
|
||||
.class interface public abstract Foo
|
||||
{
|
||||
.method public virtual hidebysig newslot abstract instance default void Hello(class Generics.Stack<int32> stack)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
.class public beforefieldinit Driver extends [mscorlib]System.Object
|
||||
{
|
||||
.field static public class Generics.Stack<int32> int_stack
|
||||
.field static public class Generics.Stack<string> string_stack
|
||||
|
||||
.method public hidebysig specialname rtspecialname instance default void .ctor()
|
||||
{
|
||||
ldarg.0
|
||||
call instance void valuetype [corlib]System.Object::.ctor()
|
||||
ret
|
||||
}
|
||||
|
||||
.method public static void Init (class Generics.Foo foo)
|
||||
{
|
||||
newobj instance void class Generics.Stack<int32>::.ctor ()
|
||||
stsfld class Generics.Stack<int32> Generics.Driver::int_stack
|
||||
|
||||
newobj instance void class Generics.Stack<string>::.ctor ()
|
||||
stsfld class Generics.Stack<string> Generics.Driver::string_stack
|
||||
|
||||
ldarg.0
|
||||
ldsfld class Generics.Stack<int32> Generics.Driver::int_stack
|
||||
callvirt instance void class Generics.Foo::Hello(class Generics.Stack<int32>)
|
||||
|
||||
ret
|
||||
}
|
||||
}
|
||||
|
||||
.class public Stack<T> extends [mscorlib]System.Object
|
||||
{
|
||||
.field private int32 size
|
||||
.field private !0[] data
|
||||
|
||||
.method public instance void .ctor ()
|
||||
{
|
||||
ldarg.0
|
||||
call instance void [mscorlib]System.Object::.ctor ()
|
||||
ldarg.0
|
||||
ldc.i4.s 100
|
||||
newarr !0
|
||||
stfld !0[] class Generics.Stack<!0>::data
|
||||
ldarg.0
|
||||
ldc.i4.m1
|
||||
stfld int32 class Generics.Stack<!0>::size
|
||||
ret
|
||||
}
|
||||
|
||||
.method public instance void Push (!0 item)
|
||||
{
|
||||
.locals init (int32 temp)
|
||||
|
||||
ldarg.0
|
||||
ldfld !0[] class Generics.Stack<!0>::data
|
||||
ldarg.0
|
||||
dup
|
||||
|
||||
ldfld int32 class Generics.Stack<!0>::size
|
||||
ldc.i4.1
|
||||
add
|
||||
dup
|
||||
stloc.0
|
||||
stfld int32 class Generics.Stack<!0>::size
|
||||
ldloc.0
|
||||
ldarg.1
|
||||
stelem !0
|
||||
ret
|
||||
}
|
||||
|
||||
.method public instance !0 Pop ()
|
||||
{
|
||||
.locals init (!0, int32)
|
||||
|
||||
ldarg.0
|
||||
ldfld !0[] class Generics.Stack<!0>::data
|
||||
ldarg.0
|
||||
dup
|
||||
|
||||
ldfld int32 class Generics.Stack<!0>::size
|
||||
dup
|
||||
stloc.1
|
||||
ldc.i4.1
|
||||
sub
|
||||
stfld int32 class Generics.Stack<!0>::size
|
||||
ldloc.1
|
||||
ldelem !0
|
||||
stloc.0
|
||||
ldloc.0
|
||||
|
||||
ret
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -22,14 +22,14 @@ namespace Mono.CSharp {
|
||||
public Location loc;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the statement, true means that all sub-statements
|
||||
/// did resolve ok.
|
||||
/// Resolves the statement, true means that all sub-statements
|
||||
/// did resolve ok.
|
||||
// </summary>
|
||||
public virtual bool Resolve (EmitContext ec)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// We already know that the statement is unreachable, but we still
|
||||
/// need to resolve it to catch errors.
|
||||
@@ -69,12 +69,12 @@ namespace Mono.CSharp {
|
||||
{
|
||||
Error (error, String.Format (format, args));
|
||||
}
|
||||
|
||||
|
||||
public void Error (int error, string s)
|
||||
{
|
||||
if (!Location.IsNull (loc))
|
||||
Report.Error (error, loc, s);
|
||||
else
|
||||
else
|
||||
Report.Error (error, s);
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Mono.CSharp {
|
||||
{
|
||||
ec.Mark (loc, true);
|
||||
DoEmit (ec);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class EmptyStatement : Statement {
|
||||
@@ -108,7 +108,7 @@ namespace Mono.CSharp {
|
||||
Expression expr;
|
||||
public Statement TrueStatement;
|
||||
public Statement FalseStatement;
|
||||
|
||||
|
||||
bool is_true_ret;
|
||||
|
||||
public If (Expression expr, Statement trueStatement, Location l)
|
||||
@@ -137,7 +137,7 @@ namespace Mono.CSharp {
|
||||
if (expr == null){
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Dead code elimination
|
||||
//
|
||||
@@ -156,11 +156,11 @@ namespace Mono.CSharp {
|
||||
if (!TrueStatement.ResolveUnreachable (ec, true))
|
||||
return false;
|
||||
TrueStatement = null;
|
||||
|
||||
|
||||
if ((FalseStatement != null) &&
|
||||
!FalseStatement.Resolve (ec))
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -171,7 +171,7 @@ namespace Mono.CSharp {
|
||||
|
||||
is_true_ret = ec.CurrentBranching.CurrentUsageVector.Reachability.IsUnreachable;
|
||||
|
||||
ec.CurrentBranching.CreateSibling ();
|
||||
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
|
||||
|
||||
if ((FalseStatement != null) && !FalseStatement.Resolve (ec))
|
||||
ok = false;
|
||||
@@ -199,13 +199,13 @@ namespace Mono.CSharp {
|
||||
if (take)
|
||||
TrueStatement.Emit (ec);
|
||||
else if (FalseStatement != null)
|
||||
FalseStatement.Emit (ec);
|
||||
FalseStatement.Emit (ec);
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
expr.EmitBranchable (ec, false_target, false);
|
||||
|
||||
|
||||
TrueStatement.Emit (ec);
|
||||
|
||||
if (FalseStatement != null){
|
||||
@@ -337,8 +337,8 @@ namespace Mono.CSharp {
|
||||
if (!Statement.Resolve (ec))
|
||||
ok = false;
|
||||
|
||||
ec.CurrentBranching.Infinite = infinite;
|
||||
ec.EndFlowBranching ();
|
||||
ec.CurrentBranching.Infinite = infinite;
|
||||
ec.EndFlowBranching ();
|
||||
|
||||
return ok;
|
||||
}
|
||||
@@ -440,7 +440,7 @@ namespace Mono.CSharp {
|
||||
|
||||
ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
|
||||
if (!infinite)
|
||||
ec.CurrentBranching.CreateSibling ();
|
||||
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
|
||||
|
||||
if (!Statement.Resolve (ec))
|
||||
ok = false;
|
||||
@@ -450,8 +450,8 @@ namespace Mono.CSharp {
|
||||
ok = false;
|
||||
}
|
||||
|
||||
ec.CurrentBranching.Infinite = infinite;
|
||||
ec.EndFlowBranching ();
|
||||
ec.CurrentBranching.Infinite = infinite;
|
||||
ec.EndFlowBranching ();
|
||||
|
||||
return ok;
|
||||
}
|
||||
@@ -468,7 +468,7 @@ namespace Mono.CSharp {
|
||||
Label test = ig.DefineLabel ();
|
||||
|
||||
if (InitStatement != null && InitStatement != EmptyStatement.Value)
|
||||
InitStatement.Emit (ec);
|
||||
InitStatement.Emit (ec);
|
||||
|
||||
ec.LoopBegin = ig.DefineLabel ();
|
||||
ec.LoopEnd = ig.DefineLabel ();
|
||||
@@ -549,7 +549,7 @@ namespace Mono.CSharp {
|
||||
public override bool Resolve (EmitContext ec)
|
||||
{
|
||||
if (ec.ReturnType == null){
|
||||
if (Expr != null){
|
||||
if (Expr != null){
|
||||
Error (127, "Return with a value not allowed here");
|
||||
return false;
|
||||
}
|
||||
@@ -598,15 +598,22 @@ namespace Mono.CSharp {
|
||||
if (Expr != null) {
|
||||
Expr.Emit (ec);
|
||||
|
||||
if (in_exc)
|
||||
if (in_exc || !ec.IsLastStatement)
|
||||
ec.ig.Emit (OpCodes.Stloc, ec.TemporaryReturn ());
|
||||
}
|
||||
|
||||
if (in_exc) {
|
||||
ec.NeedReturnLabel ();
|
||||
ec.ig.Emit (OpCodes.Leave, ec.ReturnLabel);
|
||||
} else {
|
||||
} else if (ec.IsLastStatement) {
|
||||
// If we are the last statement in a top-level block, simply
|
||||
// emit a `ret'.
|
||||
ec.ig.Emit (OpCodes.Ret);
|
||||
} else {
|
||||
// Otherwise, we always create a return label and jump to
|
||||
// it.
|
||||
ec.NeedReturnLabel ();
|
||||
ec.ig.Emit (OpCodes.Br, ec.ReturnLabel);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -618,9 +625,13 @@ namespace Mono.CSharp {
|
||||
|
||||
public override bool Resolve (EmitContext ec)
|
||||
{
|
||||
label = ec.CurrentBranching.LookupLabel (target, loc);
|
||||
if (label == null)
|
||||
label = block.LookupLabel (target);
|
||||
if (label == null){
|
||||
Report.Error (
|
||||
159, loc,
|
||||
"No such label `" + target + "' in this scope");
|
||||
return false;
|
||||
}
|
||||
|
||||
// If this is a forward goto.
|
||||
if (!label.IsDefined)
|
||||
@@ -657,7 +668,7 @@ namespace Mono.CSharp {
|
||||
bool referenced;
|
||||
Label label;
|
||||
|
||||
FlowBranching.UsageVector vectors;
|
||||
ArrayList vectors;
|
||||
|
||||
public LabeledStatement (string label_name, Location l)
|
||||
{
|
||||
@@ -688,9 +699,10 @@ namespace Mono.CSharp {
|
||||
|
||||
public void AddUsageVector (FlowBranching.UsageVector vector)
|
||||
{
|
||||
vector = vector.Clone ();
|
||||
vector.Next = vectors;
|
||||
vectors = vector;
|
||||
if (vectors == null)
|
||||
vectors = new ArrayList ();
|
||||
|
||||
vectors.Add (vector.Clone ());
|
||||
}
|
||||
|
||||
public override bool Resolve (EmitContext ec)
|
||||
@@ -830,8 +842,8 @@ namespace Mono.CSharp {
|
||||
!t.IsSubclassOf (TypeManager.exception_type) &&
|
||||
!(expr is NullLiteral)) {
|
||||
Error (155,
|
||||
"The type caught or thrown must be derived " +
|
||||
"from System.Exception");
|
||||
"The type caught or thrown must be derived " +
|
||||
"from System.Exception");
|
||||
return false;
|
||||
}
|
||||
} else if (!in_catch) {
|
||||
@@ -847,14 +859,14 @@ namespace Mono.CSharp {
|
||||
protected override void DoEmit (EmitContext ec)
|
||||
{
|
||||
if (expr == null)
|
||||
ec.ig.Emit (OpCodes.Rethrow);
|
||||
else {
|
||||
expr.Emit (ec);
|
||||
ec.ig.Emit (OpCodes.Rethrow);
|
||||
else {
|
||||
expr.Emit (ec);
|
||||
|
||||
ec.ig.Emit (OpCodes.Throw);
|
||||
}
|
||||
ec.ig.Emit (OpCodes.Throw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Break : Statement {
|
||||
|
||||
@@ -874,11 +886,7 @@ namespace Mono.CSharp {
|
||||
Error (157, "Control can not leave the body of the finally block");
|
||||
return false;
|
||||
} else if (ec.CurrentBranching.InTryOrCatch (false))
|
||||
ec.CurrentBranching.AddFinallyVector (
|
||||
ec.CurrentBranching.CurrentUsageVector);
|
||||
else if (ec.CurrentBranching.InLoop ())
|
||||
ec.CurrentBranching.AddBreakVector (
|
||||
ec.CurrentBranching.CurrentUsageVector);
|
||||
ec.CurrentBranching.AddFinallyVector (ec.CurrentBranching.CurrentUsageVector);
|
||||
|
||||
crossing_exc = ec.CurrentBranching.BreakCrossesTryCatchBoundary ();
|
||||
|
||||
@@ -895,9 +903,9 @@ namespace Mono.CSharp {
|
||||
else {
|
||||
ec.NeedReturnLabel ();
|
||||
ig.Emit (OpCodes.Br, ec.LoopEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class Continue : Statement {
|
||||
|
||||
@@ -956,14 +964,14 @@ namespace Mono.CSharp {
|
||||
|
||||
public VariableInfo VariableInfo;
|
||||
|
||||
enum Flags : byte {
|
||||
Used = 1,
|
||||
enum Flags : byte {
|
||||
Used = 1,
|
||||
ReadOnly = 2,
|
||||
Fixed = 4
|
||||
}
|
||||
|
||||
Flags flags;
|
||||
|
||||
|
||||
public LocalInfo (Expression type, string name, Block block, Location l)
|
||||
{
|
||||
Type = type;
|
||||
@@ -998,42 +1006,32 @@ namespace Mono.CSharp {
|
||||
return !ec.DoFlowAnalysis || ec.CurrentBranching.IsAssigned (VariableInfo);
|
||||
}
|
||||
|
||||
public bool Resolve (EmitContext ec)
|
||||
public bool Resolve (DeclSpace decl)
|
||||
{
|
||||
if (VariableType == null)
|
||||
VariableType = ec.DeclSpace.ResolveType (Type, false, Location);
|
||||
|
||||
if (VariableType == TypeManager.void_type) {
|
||||
Report.Error (1547, Location,
|
||||
"Keyword 'void' cannot be used in this context");
|
||||
return false;
|
||||
}
|
||||
VariableType = decl.ResolveType (Type, false, Location);
|
||||
|
||||
if (VariableType == null)
|
||||
return false;
|
||||
|
||||
// TODO: breaks the build
|
||||
// if (VariableType.IsPointer && !ec.InUnsafe)
|
||||
// Expression.UnsafeError (Location);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void MakePinned ()
|
||||
{
|
||||
TypeManager.MakePinned (LocalBuilder);
|
||||
flags |= Flags.Fixed;
|
||||
flags |= Flags.Fixed;
|
||||
}
|
||||
|
||||
public bool IsFixed {
|
||||
get {
|
||||
if (((flags & Flags.Fixed) != 0) || TypeManager.IsValueType (VariableType))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
if (((flags & Flags.Fixed) != 0) || TypeManager.IsValueType (VariableType))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return String.Format ("LocalInfo ({0},{1},{2},{3})",
|
||||
@@ -1183,14 +1181,6 @@ namespace Mono.CSharp {
|
||||
this.loc = start;
|
||||
this_id = id++;
|
||||
statements = new ArrayList ();
|
||||
|
||||
if (parent != null && Implicit) {
|
||||
if (parent.child_variable_names == null)
|
||||
parent.child_variable_names = new Hashtable();
|
||||
// share with parent
|
||||
child_variable_names = parent.child_variable_names;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Block CreateSwitchBlock (Location start)
|
||||
@@ -1228,93 +1218,56 @@ namespace Mono.CSharp {
|
||||
/// otherwise.
|
||||
/// </returns>
|
||||
///
|
||||
public bool AddLabel (string name, LabeledStatement target, Location loc)
|
||||
public bool AddLabel (string name, LabeledStatement target)
|
||||
{
|
||||
if (switch_block != null)
|
||||
return switch_block.AddLabel (name, target, loc);
|
||||
|
||||
Block cur = this;
|
||||
while (cur != null) {
|
||||
if (cur.DoLookupLabel (name) != null) {
|
||||
Report.Error (
|
||||
140, loc, "The label '{0}' is a duplicate",
|
||||
name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Implicit)
|
||||
break;
|
||||
|
||||
cur = cur.Parent;
|
||||
}
|
||||
|
||||
while (cur != null) {
|
||||
if (cur.DoLookupLabel (name) != null) {
|
||||
Report.Error (
|
||||
158, loc,
|
||||
"The label '{0}' shadows another label " +
|
||||
"by the same name in a containing scope.",
|
||||
name);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (children != null) {
|
||||
foreach (Block b in children) {
|
||||
LabeledStatement s = b.DoLookupLabel (name);
|
||||
if (s == null)
|
||||
continue;
|
||||
|
||||
Report.Error (
|
||||
158, s.Location,
|
||||
"The label '{0}' shadows another " +
|
||||
"label by the same name in a " +
|
||||
"containing scope.",
|
||||
name);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur = cur.Parent;
|
||||
}
|
||||
return switch_block.AddLabel (name, target);
|
||||
|
||||
if (labels == null)
|
||||
labels = new Hashtable ();
|
||||
|
||||
if (labels.Contains (name))
|
||||
return false;
|
||||
|
||||
labels.Add (name, target);
|
||||
return true;
|
||||
}
|
||||
|
||||
public LabeledStatement LookupLabel (string name)
|
||||
{
|
||||
LabeledStatement s = DoLookupLabel (name);
|
||||
if (s != null)
|
||||
return s;
|
||||
|
||||
if (children == null)
|
||||
return null;
|
||||
|
||||
foreach (Block child in children) {
|
||||
if (!child.Implicit)
|
||||
continue;
|
||||
|
||||
s = child.LookupLabel (name);
|
||||
if (s != null)
|
||||
return s;
|
||||
}
|
||||
|
||||
return null;
|
||||
Hashtable l = new Hashtable ();
|
||||
|
||||
return LookupLabel (name, l);
|
||||
}
|
||||
|
||||
LabeledStatement DoLookupLabel (string name)
|
||||
//
|
||||
// Lookups a label in the current block, parents and children.
|
||||
// It skips during child recurssion on `source'
|
||||
//
|
||||
LabeledStatement LookupLabel (string name, Hashtable seen)
|
||||
{
|
||||
if (switch_block != null)
|
||||
return switch_block.LookupLabel (name);
|
||||
return switch_block.LookupLabel (name, seen);
|
||||
|
||||
if (seen [this] != null)
|
||||
return null;
|
||||
|
||||
seen [this] = this;
|
||||
|
||||
if (labels != null)
|
||||
if (labels.Contains (name))
|
||||
return ((LabeledStatement) labels [name]);
|
||||
|
||||
if (children != null){
|
||||
foreach (Block b in children){
|
||||
LabeledStatement s = b.LookupLabel (name, seen);
|
||||
if (s != null)
|
||||
return s;
|
||||
}
|
||||
}
|
||||
|
||||
if (Parent != null)
|
||||
return Parent.LookupLabel (name, seen);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1351,6 +1304,28 @@ namespace Mono.CSharp {
|
||||
child_variable_names.Add (name, true);
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// Marks all variables from block @block and all its children as being
|
||||
// used in a child block.
|
||||
// </summary>
|
||||
public void AddChildVariableNames (Block block)
|
||||
{
|
||||
if (block.Variables != null) {
|
||||
foreach (string name in block.Variables.Keys)
|
||||
AddChildVariableName (name);
|
||||
}
|
||||
|
||||
if (block.children != null) {
|
||||
foreach (Block child in block.children)
|
||||
AddChildVariableNames (child);
|
||||
}
|
||||
|
||||
if (block.child_variable_names != null) {
|
||||
foreach (string name in block.child_variable_names.Keys)
|
||||
AddChildVariableName (name);
|
||||
}
|
||||
}
|
||||
|
||||
// <summary>
|
||||
// Checks whether a variable name has already been used in a child block.
|
||||
// </summary>
|
||||
@@ -1425,19 +1400,11 @@ namespace Mono.CSharp {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
vi = new LocalInfo (type, name, this, l);
|
||||
|
||||
variables.Add (name, vi);
|
||||
|
||||
// Mark 'name' as "used by a child block" in every surrounding block
|
||||
Block cur = this;
|
||||
while (cur != null && cur.Implicit)
|
||||
cur = cur.Parent;
|
||||
if (cur != null)
|
||||
for (Block par = cur.Parent; par != null; par = par.Parent)
|
||||
par.AddChildVariableName (name);
|
||||
|
||||
if ((flags & Flags.VariablesInitialized) != 0)
|
||||
throw new Exception ();
|
||||
|
||||
@@ -1509,6 +1476,15 @@ namespace Mono.CSharp {
|
||||
return e != null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use to fetch the statement associated with this label
|
||||
/// </summary>
|
||||
public Statement this [string name] {
|
||||
get {
|
||||
return (Statement) labels [name];
|
||||
}
|
||||
}
|
||||
|
||||
Parameters parameters = null;
|
||||
public Parameters Parameters {
|
||||
get {
|
||||
@@ -1608,7 +1584,7 @@ namespace Mono.CSharp {
|
||||
LocalInfo[] locals;
|
||||
if (variables != null) {
|
||||
foreach (LocalInfo li in variables.Values)
|
||||
li.Resolve (ec);
|
||||
li.Resolve (ec.DeclSpace);
|
||||
|
||||
locals = new LocalInfo [variables.Count];
|
||||
variables.Values.CopyTo (locals, 0);
|
||||
@@ -1700,7 +1676,7 @@ namespace Mono.CSharp {
|
||||
void UsageWarning (FlowBranching.UsageVector vector)
|
||||
{
|
||||
string name;
|
||||
|
||||
|
||||
if (variables != null){
|
||||
foreach (DictionaryEntry de in variables){
|
||||
LocalInfo vi = (LocalInfo) de.Value;
|
||||
@@ -1709,7 +1685,7 @@ namespace Mono.CSharp {
|
||||
continue;
|
||||
|
||||
name = (string) de.Key;
|
||||
|
||||
|
||||
if (vector.IsAssigned (vi.VariableInfo)){
|
||||
Report.Warning (
|
||||
219, vi.Location, "The variable `" + name +
|
||||
@@ -1741,18 +1717,13 @@ namespace Mono.CSharp {
|
||||
int statement_count = statements.Count;
|
||||
for (int ix = 0; ix < statement_count; ix++){
|
||||
Statement s = (Statement) statements [ix];
|
||||
|
||||
|
||||
if (unreachable && !(s is LabeledStatement)) {
|
||||
if (s == EmptyStatement.Value)
|
||||
s.loc = EndLocation;
|
||||
|
||||
if (!s.ResolveUnreachable (ec, !warning_shown))
|
||||
ok = false;
|
||||
|
||||
if (s != EmptyStatement.Value)
|
||||
warning_shown = true;
|
||||
else
|
||||
s.loc = Location.Null;
|
||||
|
||||
statements [ix] = EmptyStatement.Value;
|
||||
continue;
|
||||
@@ -2215,7 +2186,7 @@ namespace Mono.CSharp {
|
||||
}
|
||||
if (error)
|
||||
return false;
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2276,8 +2247,6 @@ namespace Mono.CSharp {
|
||||
public long nFirst;
|
||||
public long nLast;
|
||||
public ArrayList rgKeys = null;
|
||||
// how many items are in the bucket
|
||||
public int Size = 1;
|
||||
public int Length
|
||||
{
|
||||
get { return (int) (nLast - nFirst + 1); }
|
||||
@@ -2329,11 +2298,10 @@ namespace Mono.CSharp {
|
||||
for (int ikb = 1; ikb < rgKeyBlocks.Count; ikb++)
|
||||
{
|
||||
KeyBlock kb = (KeyBlock) rgKeyBlocks [ikb];
|
||||
if ((kbCurr.Size + kb.Size) * 2 >= KeyBlock.TotalLength (kbCurr, kb))
|
||||
if ((kbCurr.Length + kb.Length) * 2 >= KeyBlock.TotalLength (kbCurr, kb))
|
||||
{
|
||||
// merge blocks
|
||||
kbCurr.nLast = kb.nLast;
|
||||
kbCurr.Size += kb.Size;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2626,8 +2594,7 @@ namespace Mono.CSharp {
|
||||
bool first = true;
|
||||
foreach (SwitchSection ss in Sections){
|
||||
if (!first)
|
||||
ec.CurrentBranching.CreateSibling (
|
||||
null, FlowBranching.SiblingType.SwitchSection);
|
||||
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.SwitchSection);
|
||||
else
|
||||
first = false;
|
||||
|
||||
@@ -2637,8 +2604,7 @@ namespace Mono.CSharp {
|
||||
|
||||
|
||||
if (!got_default)
|
||||
ec.CurrentBranching.CreateSibling (
|
||||
null, FlowBranching.SiblingType.SwitchSection);
|
||||
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.SwitchSection);
|
||||
|
||||
FlowBranching.Reachability reachability = ec.EndFlowBranching ();
|
||||
ec.Switch = old_switch;
|
||||
@@ -3202,9 +3168,7 @@ namespace Mono.CSharp {
|
||||
Report.Debug (1, "START OF CATCH BLOCKS", vector);
|
||||
|
||||
foreach (Catch c in Specific){
|
||||
ec.CurrentBranching.CreateSibling (
|
||||
c.Block, FlowBranching.SiblingType.Catch);
|
||||
|
||||
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Catch);
|
||||
Report.Debug (1, "STARTED SIBLING FOR CATCH", ec.CurrentBranching);
|
||||
|
||||
if (c.Name != null) {
|
||||
@@ -3222,9 +3186,7 @@ namespace Mono.CSharp {
|
||||
Report.Debug (1, "END OF CATCH BLOCKS", ec.CurrentBranching);
|
||||
|
||||
if (General != null){
|
||||
ec.CurrentBranching.CreateSibling (
|
||||
General.Block, FlowBranching.SiblingType.Catch);
|
||||
|
||||
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Catch);
|
||||
Report.Debug (1, "STARTED SIBLING FOR GENERAL", ec.CurrentBranching);
|
||||
|
||||
if (!General.Resolve (ec))
|
||||
@@ -3235,9 +3197,7 @@ namespace Mono.CSharp {
|
||||
|
||||
if (Fini != null) {
|
||||
if (ok)
|
||||
ec.CurrentBranching.CreateSibling (
|
||||
Fini, FlowBranching.SiblingType.Finally);
|
||||
|
||||
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Finally);
|
||||
Report.Debug (1, "STARTED SIBLING FOR FINALLY", ec.CurrentBranching, vector);
|
||||
|
||||
if (!Fini.Resolve (ec))
|
||||
@@ -3414,14 +3374,14 @@ namespace Mono.CSharp {
|
||||
i--;
|
||||
|
||||
ig.BeginFinallyBlock ();
|
||||
|
||||
|
||||
if (!var.Type.IsValueType) {
|
||||
var.Emit (ec);
|
||||
ig.Emit (OpCodes.Brfalse, skip);
|
||||
converted_vars [i].Emit (ec);
|
||||
ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
|
||||
var.Emit (ec);
|
||||
ig.Emit (OpCodes.Brfalse, skip);
|
||||
converted_vars [i].Emit (ec);
|
||||
ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
|
||||
} else {
|
||||
Expression ml = Expression.MemberLookup(ec, TypeManager.idisposable_type, var.Type, "Dispose", Mono.CSharp.Location.Null);
|
||||
Expression ml = Expression.MemberLookup(ec, typeof(IDisposable), var.Type, "Dispose", Mono.CSharp.Location.Null);
|
||||
|
||||
if (!(ml is MethodGroupExpr)) {
|
||||
var.Emit (ec);
|
||||
@@ -3602,7 +3562,7 @@ namespace Mono.CSharp {
|
||||
bool ok = true;
|
||||
|
||||
ec.StartFlowBranching (FlowBranching.BranchingType.Loop, loc);
|
||||
ec.CurrentBranching.CreateSibling ();
|
||||
ec.CurrentBranching.CreateSibling (FlowBranching.SiblingType.Conditional);
|
||||
|
||||
//
|
||||
//
|
||||
@@ -3908,9 +3868,14 @@ namespace Mono.CSharp {
|
||||
bool EmitCollectionForeach (EmitContext ec)
|
||||
{
|
||||
ILGenerator ig = ec.ig;
|
||||
VariableStorage enumerator;
|
||||
VariableStorage enumerator, disposable;
|
||||
|
||||
enumerator = new VariableStorage (ec, hm.enumerator_type);
|
||||
if (hm.is_disposable)
|
||||
disposable = new VariableStorage (ec, TypeManager.idisposable_type);
|
||||
else
|
||||
disposable = null;
|
||||
|
||||
enumerator.EmitThis ();
|
||||
//
|
||||
// Instantiate the enumerator
|
||||
@@ -3919,18 +3884,11 @@ namespace Mono.CSharp {
|
||||
if (expr is IMemoryLocation){
|
||||
IMemoryLocation ml = (IMemoryLocation) expr;
|
||||
|
||||
Expression ml1 = Expression.MemberLookup(ec, TypeManager.ienumerator_type, expr.Type, "GetEnumerator", Mono.CSharp.Location.Null);
|
||||
|
||||
if (!(ml1 is MethodGroupExpr)) {
|
||||
expr.Emit(ec);
|
||||
ec.ig.Emit(OpCodes.Box, expr.Type);
|
||||
} else {
|
||||
ml.AddressOf (ec, AddressOp.Load);
|
||||
}
|
||||
ml.AddressOf (ec, AddressOp.Load);
|
||||
} else
|
||||
throw new Exception ("Expr " + expr + " of type " + expr.Type +
|
||||
" does not implement IMemoryLocation");
|
||||
ig.Emit (OpCodes.Callvirt, hm.get_enumerator);
|
||||
ig.Emit (OpCodes.Call, hm.get_enumerator);
|
||||
} else {
|
||||
expr.Emit (ec);
|
||||
ig.Emit (OpCodes.Callvirt, hm.get_enumerator);
|
||||
@@ -3973,20 +3931,20 @@ namespace Mono.CSharp {
|
||||
// Now the finally block
|
||||
//
|
||||
if (hm.is_disposable) {
|
||||
Label call_dispose = ig.DefineLabel ();
|
||||
Label end_finally = ig.DefineLabel ();
|
||||
ig.BeginFinallyBlock ();
|
||||
|
||||
|
||||
disposable.EmitThis ();
|
||||
enumerator.EmitThis ();
|
||||
enumerator.EmitLoad ();
|
||||
ig.Emit (OpCodes.Isinst, TypeManager.idisposable_type);
|
||||
ig.Emit (OpCodes.Dup);
|
||||
ig.Emit (OpCodes.Brtrue_S, call_dispose);
|
||||
ig.Emit (OpCodes.Pop);
|
||||
ig.Emit (OpCodes.Endfinally);
|
||||
|
||||
ig.MarkLabel (call_dispose);
|
||||
disposable.EmitStore ();
|
||||
disposable.EmitLoad ();
|
||||
ig.Emit (OpCodes.Brfalse, end_finally);
|
||||
disposable.EmitThis ();
|
||||
disposable.EmitLoad ();
|
||||
ig.Emit (OpCodes.Callvirt, TypeManager.void_dispose_void);
|
||||
|
||||
ig.MarkLabel (end_finally);
|
||||
|
||||
// The runtime generates this anyways.
|
||||
// ig.Emit (OpCodes.Endfinally);
|
||||
File renamed without changes.
@@ -20,6 +20,7 @@ namespace Mono.CSharp {
|
||||
|
||||
public interface ParameterData {
|
||||
Type ParameterType (int pos);
|
||||
bool HasArrayParameter { get; }
|
||||
int Count { get; }
|
||||
string ParameterName (int pos);
|
||||
string ParameterDesc (int pos);
|
||||
@@ -30,16 +31,23 @@ namespace Mono.CSharp {
|
||||
ParameterInfo [] pi;
|
||||
bool last_arg_is_params = false;
|
||||
|
||||
public ReflectionParameters (ParameterInfo [] pi)
|
||||
public ReflectionParameters (MethodBase method)
|
||||
{
|
||||
object [] attrs;
|
||||
|
||||
this.pi = pi;
|
||||
this.pi = method.GetParameters ();
|
||||
int count = pi.Length-1;
|
||||
|
||||
if (count >= 0) {
|
||||
attrs = pi [count].GetCustomAttributes (TypeManager.param_array_type, true);
|
||||
if (count < 0)
|
||||
return;
|
||||
|
||||
if (method.HasGenericParameters) {
|
||||
MethodInfo generic = method.GetGenericMethodDefinition ();
|
||||
ParameterData gpd = Invocation.GetParameterData (generic);
|
||||
|
||||
last_arg_is_params = gpd.HasArrayParameter;
|
||||
} else {
|
||||
attrs = pi [count].GetCustomAttributes (TypeManager.param_array_type, true);
|
||||
if (attrs == null)
|
||||
return;
|
||||
|
||||
@@ -49,7 +57,11 @@ namespace Mono.CSharp {
|
||||
last_arg_is_params = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool HasArrayParameter {
|
||||
get { return last_arg_is_params; }
|
||||
}
|
||||
|
||||
public Type ParameterType (int pos)
|
||||
{
|
||||
if (last_arg_is_params && pos >= pi.Length - 1)
|
||||
@@ -146,6 +158,10 @@ namespace Mono.CSharp {
|
||||
}
|
||||
}
|
||||
|
||||
public bool HasArrayParameter {
|
||||
get { return Parameters.ArrayParameter != null; }
|
||||
}
|
||||
|
||||
Parameter GetParameter (int pos)
|
||||
{
|
||||
Parameter [] fixed_pars = Parameters.FixedParameters;
|
||||
@@ -312,42 +328,6 @@ namespace Mono.CSharp {
|
||||
{
|
||||
this.reader = reader;
|
||||
this.buffer = new char [DefaultCacheSize];
|
||||
|
||||
// Compute the preamble size
|
||||
|
||||
// Let the StreamWriter autodetect the encoder
|
||||
reader.Peek ();
|
||||
|
||||
reader.BaseStream.Position = 0;
|
||||
Encoding enc = reader.CurrentEncoding;
|
||||
// First of all, get at least a char
|
||||
|
||||
byte[] auxb = new byte [50];
|
||||
int num_bytes = 0;
|
||||
int num_chars = 0;
|
||||
int br = 0;
|
||||
do {
|
||||
br = reader.BaseStream.Read (auxb, num_bytes, auxb.Length - num_bytes);
|
||||
num_bytes += br;
|
||||
num_chars = enc.GetCharCount (auxb, 0, num_bytes);
|
||||
}
|
||||
while (num_chars == 0 && br > 0);
|
||||
|
||||
if (num_chars != 0)
|
||||
{
|
||||
// Now, check which bytes at the beginning have no effect in the
|
||||
// char count
|
||||
|
||||
int p = 0;
|
||||
while (enc.GetCharCount (auxb, p, num_bytes-p) >= num_chars)
|
||||
p++;
|
||||
|
||||
preamble_size = p - 1;
|
||||
reader.BaseStream.Position = 0;
|
||||
reader.DiscardBufferedData ();
|
||||
|
||||
buffer_start = preamble_size;
|
||||
}
|
||||
}
|
||||
|
||||
public SeekableStreamReader (Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks)
|
||||
@@ -363,7 +343,6 @@ namespace Mono.CSharp {
|
||||
int buffer_size; // in bytes
|
||||
int char_count; // count buffer[] valid characters
|
||||
int pos; // index into buffer[]
|
||||
int preamble_size;
|
||||
|
||||
/// <remarks>
|
||||
/// The difference to the StreamReader's BaseStream.Position is that this one is reliable; ie. it
|
||||
@@ -386,9 +365,6 @@ namespace Mono.CSharp {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (value == 0) // Skip preamble
|
||||
value = preamble_size;
|
||||
|
||||
// Ok, now we need to seek.
|
||||
reader.DiscardBufferedData ();
|
||||
File renamed without changes.
@@ -56,12 +56,12 @@ namespace Mono.CSharp
|
||||
public void RecordDecl (string name, DeclSpace ds)
|
||||
{
|
||||
if (decls.Contains (name)){
|
||||
DeclSpace other = (DeclSpace) decls [name];
|
||||
Report.SymbolRelatedToPreviousError (other.Location, other.GetSignatureForError ());
|
||||
|
||||
Report.Error (
|
||||
101, ds.Location,
|
||||
"There is already a definition for `" + name + "'");
|
||||
DeclSpace other = (DeclSpace) decls [name];
|
||||
Report.Error (0,
|
||||
other.Location, "(Location of symbol related to previous error)");
|
||||
return;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,14 +0,0 @@
|
||||
compiler.pdb
|
||||
compiler.exe
|
||||
compiler.suo
|
||||
compiler.csproj
|
||||
compiler.csproj.user
|
||||
cs-parser.cs
|
||||
y.output
|
||||
*.pdb
|
||||
mcs
|
||||
Web References
|
||||
bin
|
||||
obj
|
||||
Web References
|
||||
Web References
|
||||
@@ -1,406 +0,0 @@
|
||||
//
|
||||
// CryptoConvert.cs - Crypto Convertion Routines
|
||||
//
|
||||
// Author:
|
||||
// Sebastien Pouliot <[email protected]>
|
||||
//
|
||||
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
|
||||
// (C) 2004 Novell (http://www.novell.com)
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace Mono.Security.Cryptography {
|
||||
|
||||
#if INSIDE_CORLIB
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class CryptoConvert {
|
||||
|
||||
private CryptoConvert ()
|
||||
{
|
||||
}
|
||||
|
||||
static private int ToInt32LE (byte [] bytes, int offset)
|
||||
{
|
||||
return (bytes [offset+3] << 24) | (bytes [offset+2] << 16) | (bytes [offset+1] << 8) | bytes [offset];
|
||||
}
|
||||
|
||||
static private uint ToUInt32LE (byte [] bytes, int offset)
|
||||
{
|
||||
return (uint)((bytes [offset+3] << 24) | (bytes [offset+2] << 16) | (bytes [offset+1] << 8) | bytes [offset]);
|
||||
}
|
||||
|
||||
static private byte [] GetBytesLE (int val)
|
||||
{
|
||||
return new byte [] {
|
||||
(byte) (val & 0xff),
|
||||
(byte) ((val >> 8) & 0xff),
|
||||
(byte) ((val >> 16) & 0xff),
|
||||
(byte) ((val >> 24) & 0xff)
|
||||
};
|
||||
}
|
||||
|
||||
static private byte[] Trim (byte[] array)
|
||||
{
|
||||
for (int i=0; i < array.Length; i++) {
|
||||
if (array [i] != 0x00) {
|
||||
byte[] result = new byte [array.Length - i];
|
||||
Buffer.BlockCopy (array, i, result, 0, result.Length);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// convert the key from PRIVATEKEYBLOB to RSA
|
||||
// http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/Security/private_key_blobs.asp
|
||||
// e.g. SNK files, PVK files
|
||||
static public RSA FromCapiPrivateKeyBlob (byte[] blob)
|
||||
{
|
||||
return FromCapiPrivateKeyBlob (blob, 0);
|
||||
}
|
||||
|
||||
static public RSA FromCapiPrivateKeyBlob (byte[] blob, int offset)
|
||||
{
|
||||
if (blob == null)
|
||||
throw new ArgumentNullException ("blob");
|
||||
if (offset >= blob.Length)
|
||||
throw new ArgumentException ("blob is too small.");
|
||||
|
||||
try {
|
||||
if ((blob [offset] != 0x07) || // PRIVATEKEYBLOB (0x07)
|
||||
(blob [offset+1] != 0x02) || // Version (0x02)
|
||||
(blob [offset+2] != 0x00) || // Reserved (word)
|
||||
(blob [offset+3] != 0x00) ||
|
||||
(ToUInt32LE (blob, offset+8) != 0x32415352)) // DWORD magic = RSA2
|
||||
throw new CryptographicException ("Invalid blob header");
|
||||
|
||||
// ALGID (CALG_RSA_SIGN, CALG_RSA_KEYX, ...)
|
||||
int algId = ToInt32LE (blob, offset+4);
|
||||
|
||||
// DWORD bitlen
|
||||
int bitLen = ToInt32LE (blob, offset+12);
|
||||
|
||||
// DWORD public exponent
|
||||
RSAParameters rsap = new RSAParameters ();
|
||||
byte[] exp = new byte [4];
|
||||
Buffer.BlockCopy (blob, offset+16, exp, 0, 4);
|
||||
Array.Reverse (exp);
|
||||
rsap.Exponent = Trim (exp);
|
||||
|
||||
int pos = offset+20;
|
||||
// BYTE modulus[rsapubkey.bitlen/8];
|
||||
int byteLen = (bitLen >> 3);
|
||||
rsap.Modulus = new byte [byteLen];
|
||||
Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
|
||||
Array.Reverse (rsap.Modulus);
|
||||
pos += byteLen;
|
||||
|
||||
// BYTE prime1[rsapubkey.bitlen/16];
|
||||
int byteHalfLen = (byteLen >> 1);
|
||||
rsap.P = new byte [byteHalfLen];
|
||||
Buffer.BlockCopy (blob, pos, rsap.P, 0, byteHalfLen);
|
||||
Array.Reverse (rsap.P);
|
||||
pos += byteHalfLen;
|
||||
|
||||
// BYTE prime2[rsapubkey.bitlen/16];
|
||||
rsap.Q = new byte [byteHalfLen];
|
||||
Buffer.BlockCopy (blob, pos, rsap.Q, 0, byteHalfLen);
|
||||
Array.Reverse (rsap.Q);
|
||||
pos += byteHalfLen;
|
||||
|
||||
// BYTE exponent1[rsapubkey.bitlen/16];
|
||||
rsap.DP = new byte [byteHalfLen];
|
||||
Buffer.BlockCopy (blob, pos, rsap.DP, 0, byteHalfLen);
|
||||
Array.Reverse (rsap.DP);
|
||||
pos += byteHalfLen;
|
||||
|
||||
// BYTE exponent2[rsapubkey.bitlen/16];
|
||||
rsap.DQ = new byte [byteHalfLen];
|
||||
Buffer.BlockCopy (blob, pos, rsap.DQ, 0, byteHalfLen);
|
||||
Array.Reverse (rsap.DQ);
|
||||
pos += byteHalfLen;
|
||||
|
||||
// BYTE coefficient[rsapubkey.bitlen/16];
|
||||
rsap.InverseQ = new byte [byteHalfLen];
|
||||
Buffer.BlockCopy (blob, pos, rsap.InverseQ, 0, byteHalfLen);
|
||||
Array.Reverse (rsap.InverseQ);
|
||||
pos += byteHalfLen;
|
||||
|
||||
// ok, this is hackish but CryptoAPI support it so...
|
||||
// note: only works because CRT is used by default
|
||||
// http://bugzilla.ximian.com/show_bug.cgi?id=57941
|
||||
rsap.D = new byte [byteLen]; // must be allocated
|
||||
if (pos + byteLen + offset <= blob.Length) {
|
||||
// BYTE privateExponent[rsapubkey.bitlen/8];
|
||||
Buffer.BlockCopy (blob, pos, rsap.D, 0, byteLen);
|
||||
Array.Reverse (rsap.D);
|
||||
}
|
||||
|
||||
RSA rsa = (RSA)RSA.Create ();
|
||||
rsa.ImportParameters (rsap);
|
||||
return rsa;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new CryptographicException ("Invalid blob.", e);
|
||||
}
|
||||
}
|
||||
|
||||
static public byte[] ToCapiPrivateKeyBlob (RSA rsa)
|
||||
{
|
||||
RSAParameters p = rsa.ExportParameters (true);
|
||||
int keyLength = p.Modulus.Length; // in bytes
|
||||
byte[] blob = new byte [20 + (keyLength << 2) + (keyLength >> 1)];
|
||||
|
||||
blob [0] = 0x07; // Type - PRIVATEKEYBLOB (0x07)
|
||||
blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
|
||||
// [2], [3] // RESERVED - Always 0
|
||||
blob [5] = 0x24; // ALGID - Always 00 24 00 00 (for CALG_RSA_SIGN)
|
||||
blob [8] = 0x52; // Magic - RSA2 (ASCII in hex)
|
||||
blob [9] = 0x53;
|
||||
blob [10] = 0x41;
|
||||
blob [11] = 0x32;
|
||||
|
||||
byte[] bitlen = GetBytesLE (keyLength << 3);
|
||||
blob [12] = bitlen [0]; // bitlen
|
||||
blob [13] = bitlen [1];
|
||||
blob [14] = bitlen [2];
|
||||
blob [15] = bitlen [3];
|
||||
|
||||
// public exponent (DWORD)
|
||||
int pos = 16;
|
||||
int n = p.Exponent.Length;
|
||||
while (n > 0)
|
||||
blob [pos++] = p.Exponent [--n];
|
||||
// modulus
|
||||
pos = 20;
|
||||
byte[] part = p.Modulus;
|
||||
int len = part.Length;
|
||||
Array.Reverse (part, 0, len);
|
||||
Buffer.BlockCopy (part, 0, blob, pos, len);
|
||||
pos += len;
|
||||
// private key
|
||||
part = p.P;
|
||||
len = part.Length;
|
||||
Array.Reverse (part, 0, len);
|
||||
Buffer.BlockCopy (part, 0, blob, pos, len);
|
||||
pos += len;
|
||||
|
||||
part = p.Q;
|
||||
len = part.Length;
|
||||
Array.Reverse (part, 0, len);
|
||||
Buffer.BlockCopy (part, 0, blob, pos, len);
|
||||
pos += len;
|
||||
|
||||
part = p.DP;
|
||||
len = part.Length;
|
||||
Array.Reverse (part, 0, len);
|
||||
Buffer.BlockCopy (part, 0, blob, pos, len);
|
||||
pos += len;
|
||||
|
||||
part = p.DQ;
|
||||
len = part.Length;
|
||||
Array.Reverse (part, 0, len);
|
||||
Buffer.BlockCopy (part, 0, blob, pos, len);
|
||||
pos += len;
|
||||
|
||||
part = p.InverseQ;
|
||||
len = part.Length;
|
||||
Array.Reverse (part, 0, len);
|
||||
Buffer.BlockCopy (part, 0, blob, pos, len);
|
||||
pos += len;
|
||||
|
||||
part = p.D;
|
||||
len = part.Length;
|
||||
Array.Reverse (part, 0, len);
|
||||
Buffer.BlockCopy (part, 0, blob, pos, len);
|
||||
|
||||
return blob;
|
||||
}
|
||||
|
||||
static public RSA FromCapiPublicKeyBlob (byte[] blob)
|
||||
{
|
||||
return FromCapiPublicKeyBlob (blob, 0);
|
||||
}
|
||||
|
||||
static public RSA FromCapiPublicKeyBlob (byte[] blob, int offset)
|
||||
{
|
||||
if (blob == null)
|
||||
throw new ArgumentNullException ("blob");
|
||||
if (offset >= blob.Length)
|
||||
throw new ArgumentException ("blob is too small.");
|
||||
|
||||
try {
|
||||
if ((blob [offset] != 0x06) || // PUBLICKEYBLOB (0x06)
|
||||
(blob [offset+1] != 0x02) || // Version (0x02)
|
||||
(blob [offset+2] != 0x00) || // Reserved (word)
|
||||
(blob [offset+3] != 0x00) ||
|
||||
(ToUInt32LE (blob, offset+8) != 0x31415352)) // DWORD magic = RSA1
|
||||
throw new CryptographicException ("Invalid blob header");
|
||||
|
||||
// ALGID (CALG_RSA_SIGN, CALG_RSA_KEYX, ...)
|
||||
int algId = ToInt32LE (blob, offset+4);
|
||||
|
||||
// DWORD bitlen
|
||||
int bitLen = ToInt32LE (blob, offset+12);
|
||||
|
||||
// DWORD public exponent
|
||||
RSAParameters rsap = new RSAParameters ();
|
||||
rsap.Exponent = new byte [3];
|
||||
rsap.Exponent [0] = blob [offset+18];
|
||||
rsap.Exponent [1] = blob [offset+17];
|
||||
rsap.Exponent [2] = blob [offset+16];
|
||||
|
||||
int pos = offset+20;
|
||||
// BYTE modulus[rsapubkey.bitlen/8];
|
||||
int byteLen = (bitLen >> 3);
|
||||
rsap.Modulus = new byte [byteLen];
|
||||
Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
|
||||
Array.Reverse (rsap.Modulus);
|
||||
|
||||
RSA rsa = (RSA)RSA.Create ();
|
||||
rsa.ImportParameters (rsap);
|
||||
return rsa;
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new CryptographicException ("Invalid blob.", e);
|
||||
}
|
||||
}
|
||||
|
||||
static public byte[] ToCapiPublicKeyBlob (RSA rsa)
|
||||
{
|
||||
RSAParameters p = rsa.ExportParameters (false);
|
||||
int keyLength = p.Modulus.Length; // in bytes
|
||||
byte[] blob = new byte [20 + keyLength];
|
||||
|
||||
blob [0] = 0x06; // Type - PUBLICKEYBLOB (0x06)
|
||||
blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
|
||||
// [2], [3] // RESERVED - Always 0
|
||||
blob [5] = 0x24; // ALGID - Always 00 24 00 00 (for CALG_RSA_SIGN)
|
||||
blob [8] = 0x52; // Magic - RSA1 (ASCII in hex)
|
||||
blob [9] = 0x53;
|
||||
blob [10] = 0x41;
|
||||
blob [11] = 0x31;
|
||||
|
||||
byte[] bitlen = GetBytesLE (keyLength << 3);
|
||||
blob [12] = bitlen [0]; // bitlen
|
||||
blob [13] = bitlen [1];
|
||||
blob [14] = bitlen [2];
|
||||
blob [15] = bitlen [3];
|
||||
|
||||
// public exponent (DWORD)
|
||||
int pos = 16;
|
||||
int n = p.Exponent.Length;
|
||||
while (n > 0)
|
||||
blob [pos++] = p.Exponent [--n];
|
||||
// modulus
|
||||
pos = 20;
|
||||
byte[] part = p.Modulus;
|
||||
int len = part.Length;
|
||||
Array.Reverse (part, 0, len);
|
||||
Buffer.BlockCopy (part, 0, blob, pos, len);
|
||||
pos += len;
|
||||
return blob;
|
||||
}
|
||||
|
||||
// PRIVATEKEYBLOB
|
||||
// PUBLICKEYBLOB
|
||||
static public RSA FromCapiKeyBlob (byte[] blob)
|
||||
{
|
||||
return FromCapiKeyBlob (blob, 0);
|
||||
}
|
||||
|
||||
static public RSA FromCapiKeyBlob (byte[] blob, int offset)
|
||||
{
|
||||
if (blob == null)
|
||||
throw new ArgumentNullException ("blob");
|
||||
if (offset >= blob.Length)
|
||||
throw new ArgumentException ("blob is too small.");
|
||||
|
||||
switch (blob [offset]) {
|
||||
case 0x00:
|
||||
// this could be a public key inside an header
|
||||
// like "sn -e" would produce
|
||||
if (blob [offset + 12] == 0x06) {
|
||||
return FromCapiPublicKeyBlob (blob, offset + 12);
|
||||
}
|
||||
break;
|
||||
case 0x06:
|
||||
return FromCapiPublicKeyBlob (blob, offset);
|
||||
case 0x07:
|
||||
return FromCapiPrivateKeyBlob (blob, offset);
|
||||
}
|
||||
throw new CryptographicException ("Unknown blob format.");
|
||||
}
|
||||
|
||||
static public byte[] ToCapiKeyBlob (AsymmetricAlgorithm keypair, bool includePrivateKey)
|
||||
{
|
||||
if (keypair == null)
|
||||
throw new ArgumentNullException ("keypair");
|
||||
|
||||
// check between RSA and DSA (and potentially others like DH)
|
||||
if (keypair is RSA)
|
||||
return ToCapiKeyBlob ((RSA)keypair, includePrivateKey);
|
||||
else
|
||||
return null; // TODO
|
||||
}
|
||||
|
||||
static public byte[] ToCapiKeyBlob (RSA rsa, bool includePrivateKey)
|
||||
{
|
||||
if (rsa == null)
|
||||
throw new ArgumentNullException ("rsa");
|
||||
|
||||
RSAParameters p = rsa.ExportParameters (includePrivateKey);
|
||||
if (includePrivateKey)
|
||||
return ToCapiPrivateKeyBlob (rsa);
|
||||
else
|
||||
return ToCapiPublicKeyBlob (rsa);
|
||||
}
|
||||
|
||||
static public string ToHex (byte[] input)
|
||||
{
|
||||
if (input == null)
|
||||
return null;
|
||||
|
||||
StringBuilder sb = new StringBuilder (input.Length * 2);
|
||||
foreach (byte b in input) {
|
||||
sb.Append (b.ToString ("X2", CultureInfo.InvariantCulture));
|
||||
}
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
static private byte FromHexChar (char c)
|
||||
{
|
||||
if ((c >= 'a') && (c <= 'f'))
|
||||
return (byte) (c - 'a' + 10);
|
||||
if ((c >= 'A') && (c <= 'F'))
|
||||
return (byte) (c - 'A' + 10);
|
||||
if ((c >= '0') && (c <= '9'))
|
||||
return (byte) (c - '0');
|
||||
throw new ArgumentException ("invalid hex char");
|
||||
}
|
||||
|
||||
static public byte[] FromHex (string hex)
|
||||
{
|
||||
if (hex == null)
|
||||
return null;
|
||||
if ((hex.Length & 0x1) == 0x1)
|
||||
throw new ArgumentException ("Length must be a multiple of 2");
|
||||
|
||||
byte[] result = new byte [hex.Length >> 1];
|
||||
int n = 0;
|
||||
int i = 0;
|
||||
while (n < result.Length) {
|
||||
result [n] = (byte) (FromHexChar (hex [i++]) << 4);
|
||||
result [n++] += FromHexChar (hex [i++]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
thisdir := mcs
|
||||
SUBDIRS :=
|
||||
include ../build/rules.make
|
||||
|
||||
BUILT_SOURCES = cs-parser.cs
|
||||
|
||||
EXTRA_DISTFILES = \
|
||||
compiler.csproj \
|
||||
compiler.doc \
|
||||
compiler.sln \
|
||||
cs-parser.jay \
|
||||
mcs.exe.config \
|
||||
NOTES \
|
||||
TODO
|
||||
|
||||
PROGRAM = mcs.exe
|
||||
PROGRAM_COMPILE = $(BOOT_COMPILE)
|
||||
PROGRAM_INSTALL_DIR = $(prefix)/lib/mono/1.0
|
||||
|
||||
CLEAN_FILES = y.output
|
||||
|
||||
cs-parser.cs: cs-parser.jay $(topdir)/jay/skeleton.cs
|
||||
$(topdir)/jay/jay -ctv < $(topdir)/jay/skeleton.cs $< > jay-tmp.out && mv jay-tmp.out $@
|
||||
|
||||
include ../build/executable.make
|
||||
|
||||
# Testing targets
|
||||
|
||||
TIME = time
|
||||
|
||||
# This used to be called test, but that conflicts with the global
|
||||
# recursive target.
|
||||
|
||||
btest: mcs2.exe mcs3.exe
|
||||
ls -l mcs2.exe mcs3.exe
|
||||
|
||||
mcs2.exe: mcs.exe
|
||||
$(TIME) $(RUNTIME) ./mcs.exe $(USE_MCS_FLAGS) /target:exe /out:$@ $(BUILT_SOURCES) @$(response)
|
||||
|
||||
mcs3.exe: mcs2.exe
|
||||
$(TIME) $(RUNTIME) ./mcs2.exe $(USE_MCS_FLAGS) /target:exe /out:$@ $(BUILT_SOURCES) @$(response)
|
||||
|
||||
wc:
|
||||
wc -l $(BUILT_SOURCES) `cat $(sourcefile)`
|
||||
|
||||
ctest:
|
||||
rm -f mcs2.exe mcs3.exe
|
||||
$(MAKE) USE_MCS_FLAGS= btest
|
||||
|
||||
# we need this because bash tries to use its own crappy timer
|
||||
FRIENDLY_TIME = $(shell which time) -f'%U seconds'
|
||||
|
||||
do-time : mcs.exe
|
||||
@ echo -n "Run 1: "
|
||||
@ rm -f mcs2.exe
|
||||
@ $(MAKE) TIME="$(FRIENDLY_TIME)" mcs2.exe > /dev/null || (echo FAILED; exit 1)
|
||||
@ echo -n "Run 2: "
|
||||
@ rm -f mcs3.exe
|
||||
@ $(MAKE) TIME="$(FRIENDLY_TIME)" mcs3.exe > /dev/null || (echo FAILED; exit 1)
|
||||
@ $(MAKE) do-corlib
|
||||
|
||||
do-corlib:
|
||||
@ echo -n "corlib: "
|
||||
@ rm -f ../class/lib/mscorlib.dll
|
||||
@ cd ../class/corlib ; $(MAKE) BOOTSTRAP_MCS="$(FRIENDLY_TIME) mono ../../mcs/mcs.exe" > /dev/null || (echo FAILED; exit 1)
|
||||
|
||||
PROFILER=default
|
||||
|
||||
profile : mcs.exe
|
||||
$(RUNTIME) --profile=$(PROFILER) ./mcs.exe $(USE_MCS_FLAGS) /target:exe /out:mcs2.exe $(BUILT_SOURCES) @$(response)
|
||||
@@ -1,38 +0,0 @@
|
||||
* Notes on improving error handling in MCS
|
||||
(from Axel Schreiner <[email protected]>)
|
||||
|
||||
|
||||
I included the 'recover' example with C# as well. Currently the package
|
||||
is at <http://www.cs.rit.edu/~ats/projects/jay/>. I did change some
|
||||
names and the embedding that the user does somewhat, i.e., it is not
|
||||
directly compatible with what you did.
|
||||
|
||||
Here is the important part about error recovery. To make the typical
|
||||
iterations bullet-proof, code them as follows:
|
||||
|
||||
opt : // null
|
||||
| opt WORD { yyErrorFlag = 0; }
|
||||
| opt error
|
||||
|
||||
seq : WORD
|
||||
| seq WORD { yyErrorFlag = 0; }
|
||||
| error
|
||||
| seq error
|
||||
|
||||
list : WORD
|
||||
| list ',' WORD { yyErrorFlag = 0; }
|
||||
| error
|
||||
| list error
|
||||
| list error WORD { yyErrorFlag = 0; }
|
||||
| list ',' error
|
||||
|
||||
i.e., throw in 'error' wherever a token can be. 'yyErrorFlag' need not
|
||||
be set to zero, but if it is done this way, second errors are caught
|
||||
earlier. This may introduce s/r conflicts, but they tend to be harmless.
|
||||
|
||||
In your case -- the comment concerning error recovery at the beginning
|
||||
of your compiler jay file -- just adding 'error' to the different
|
||||
global things won't work. Your example will already have started to
|
||||
advance in one of the rules and 'error' is then not in the lookahead of
|
||||
wherever the parse then is. You need to put 'error' into the iteration
|
||||
above those global things.
|
||||
@@ -1,58 +0,0 @@
|
||||
|
||||
These are the sources to the Mono C# compiler
|
||||
---------------------------------------------
|
||||
|
||||
Read the mcs/docs/compiler.txt for an overview of the compiler.
|
||||
|
||||
Testing the Compiler
|
||||
--------------------
|
||||
|
||||
You might want to use the `make btest' in this directory to
|
||||
have the compiler bootstrap itself, this is the basic regression
|
||||
test.
|
||||
|
||||
Before commiting changes to MCS, make sure that all the tests
|
||||
in `mcs/tests' pass, type:
|
||||
|
||||
cd mcs/tests
|
||||
make run-test-local
|
||||
|
||||
There is a new set of negative tests (errors that the compiler
|
||||
should flag), but not all of them pass currently:
|
||||
|
||||
cd mcs/errors
|
||||
make run-test-local
|
||||
|
||||
Full Bootstrap
|
||||
==============
|
||||
|
||||
To finally ensure the state of the compiler, it is ideal to do
|
||||
a full bootstrap, to do this, do:
|
||||
|
||||
cd mcs
|
||||
make clean;
|
||||
make
|
||||
make install
|
||||
|
||||
That installs the compiler and assemblies compiled by the new compiler.
|
||||
|
||||
Then, repeat that step again:
|
||||
|
||||
make clean
|
||||
make
|
||||
|
||||
If things work, the compiler has not added a new regression
|
||||
while building the mscorlib and the compiler itself.
|
||||
|
||||
Tests
|
||||
=====
|
||||
|
||||
When bugs are fixed, new tests must be added to the
|
||||
`mcs/tests' directory to excercise the problem and to guarantee
|
||||
that we keep the compiler in a good state.
|
||||
|
||||
When an error is reported, it should be added to mcs/errors.
|
||||
|
||||
We try to make the errors numbers be the same as the ones in
|
||||
Microsoft C#, if this is not possible, allocate a negative error
|
||||
number, and list it in mcs/errors/errors.txt
|
||||
-433
@@ -1,433 +0,0 @@
|
||||
Error Reporting:
|
||||
----------------
|
||||
|
||||
* Make yyerror show a nice syntax error, instead of the current mess.
|
||||
|
||||
Iterators
|
||||
---------
|
||||
* `yield' is no longer a keyword, it only has special
|
||||
meaning before a return or break keywords.
|
||||
|
||||
* Study side effects with assign
|
||||
* Study TemporaryStorage/LocalStorage -> Merge/rename
|
||||
|
||||
* Reset should throw not implemented now.
|
||||
|
||||
Instance idea
|
||||
-------------
|
||||
|
||||
It would be nice to have things that can be "instances" to have an
|
||||
EmitInstance method (this would default to nothing).
|
||||
|
||||
The idea is to be able to use efficiently the instance data on stack
|
||||
manipulations, as opposed to the current scheme, where we basically have
|
||||
a few special cases.
|
||||
|
||||
Optimization ideas
|
||||
------------------
|
||||
|
||||
Currently when we build a type cache, it contains private members,
|
||||
internal members, and internal protected members; We should trim
|
||||
these out, as it shows up on the profile.
|
||||
|
||||
We create too many Arraylists; When we know the size, we should create
|
||||
an array;
|
||||
|
||||
During parsing we use arraylists to accumulate data, like this:
|
||||
|
||||
thing:
|
||||
|
||||
thing_list
|
||||
: thing { $$ =new ArrayList (); $$.Add ($1); }
|
||||
| thing_list thing { ArrayList a = $1; a.Add ($2); $$ = a; }
|
||||
|
||||
We probably could start using "Pairs" there:
|
||||
|
||||
thing_list
|
||||
: thing { $$ = new Pair ($1, null); }
|
||||
| thing_list thing { Pair p = $1; $$ = new Pair ($2, $1); }
|
||||
|
||||
|
||||
Anonymous Methods
|
||||
-----------------
|
||||
|
||||
Plan:
|
||||
|
||||
* Resolve anonymous methods before.
|
||||
* Each time a Local matches, if the mode is `InAnonymous', flag
|
||||
the VariableInfo for `proxying'.
|
||||
* During Resolve track the depth required for local variables.
|
||||
* Before Emit, create proxy classes with proper depth.
|
||||
* Emit.
|
||||
|
||||
Open question:
|
||||
Create a toplevel block for anonymous methods?
|
||||
|
||||
EmitContext.ResolveTypeTree
|
||||
---------------------------
|
||||
|
||||
We should investigate its usage. The problem is that by default
|
||||
this will be set when calling FindType, that triggers a more expensive
|
||||
lookup.
|
||||
|
||||
I believe we should pass the current EmitContext (which has this turned off
|
||||
by default) to ResolveType/REsolveTypeExpr and then have the routines that
|
||||
need ResolveType to pass null as the emit context.
|
||||
|
||||
DeclareLocal audit
|
||||
------------------
|
||||
|
||||
DeclareLocal is used in various statements. The audit should be done
|
||||
in two steps:
|
||||
|
||||
* Identify all the declare locals.
|
||||
|
||||
* Identify its uses.
|
||||
|
||||
* Find if we can make wrapper functions for all of them.
|
||||
|
||||
Then we can move DeclareLocal into a helper class.
|
||||
|
||||
This is required to fix foreach in iterators.
|
||||
|
||||
Large project:
|
||||
--------------
|
||||
|
||||
Drop FindMembers as our API and instead extract all the data
|
||||
out of a type the first time into our own datastructures, and
|
||||
use that to navigate and search the type instead of the
|
||||
callback based FindMembers.
|
||||
|
||||
Martin has some some of this work with his TypeHandle code
|
||||
that we could use for this.
|
||||
|
||||
Notes on memory allocation
|
||||
--------------------------
|
||||
|
||||
Outdated:
|
||||
|
||||
A run of the AllocationProfile shows that the compiler allocates roughly
|
||||
30 megabytes of strings. From those, 20 megabytes come from
|
||||
LookupType.
|
||||
|
||||
See the notes on current_container problems below on memory usage.
|
||||
|
||||
LookupTypeReflection:
|
||||
---------------------
|
||||
|
||||
With something like `System.Object', LookupTypeReflection will be called
|
||||
twice: once to find out that `System' is not a type and once
|
||||
for System.Object.
|
||||
|
||||
This is required because System.Reflection requires that the type/nested types are
|
||||
not separated by a dot but by a plus sign.
|
||||
|
||||
A nested class would be My+Class (My being the toplevel, Class the nested one).
|
||||
|
||||
It is interesting to look at the most called lookups when bootstrapping MCS:
|
||||
|
||||
647 LTR: ArrayList
|
||||
713 LTR: System.Globalization
|
||||
822 LTR: System.Object+Expression
|
||||
904 LTR: Mono.CSharp.ArrayList
|
||||
976 LTR: System.Runtime.CompilerServices
|
||||
999 LTR: Type
|
||||
1118 LTR: System.Runtime
|
||||
1208 LTR: Mono.CSharp.Type
|
||||
1373 LTR: Mono.Languages
|
||||
1599 LTR: System.Diagnostics
|
||||
2036 LTR: System.Text
|
||||
2302 LTR: System.Reflection.Emit
|
||||
2515 LTR: System.Collections
|
||||
4527 LTR: System.Reflection
|
||||
22273 LTR: Mono.CSharp
|
||||
24245 LTR: System
|
||||
27005 LTR: Mono
|
||||
|
||||
Analysis:
|
||||
The top 9 lookups are done for things which are not types.
|
||||
|
||||
Mono.CSharp.Type happens to be a common lookup: the class Type
|
||||
used heavily in the compiler in the default namespace.
|
||||
|
||||
RED FLAG:
|
||||
|
||||
Then `Type' is looked up alone a lot of the time, this happens
|
||||
in parameter declarations and am not entirely sure that this is
|
||||
correct (FindType will pass to LookupInterfaceOrClass a the current_type.FullName,
|
||||
which for some reason is null!). This seems to be a problem with a lost
|
||||
piece of context during FindType.
|
||||
|
||||
System.Object is also used a lot as a toplevel class, and we assume it will
|
||||
have children, we should just shortcut this.
|
||||
|
||||
A cache:
|
||||
|
||||
Adding a cache and adding a catch for `System.Object' to flag that it wont be the
|
||||
root of a hierarchy reduced the MCS bootstrap time from 10.22 seconds to 8.90 seconds.
|
||||
|
||||
This cache is currently enabled with SIMPLE_SPEEDUP in typemanager.cs. Memory consumption
|
||||
went down from 74 megs to 65 megs with this change.
|
||||
|
||||
Ideas:
|
||||
------
|
||||
|
||||
Instead of the hack that *knows* about System.Object not having any children classes,
|
||||
we should just make it simple for a probe to know that there is no need for it.
|
||||
|
||||
The use of DottedName
|
||||
---------------------
|
||||
|
||||
We could probably use a different system to represent names, like this:
|
||||
|
||||
class Name {
|
||||
string simplename;
|
||||
Name parent;
|
||||
}
|
||||
|
||||
So `System.ComponentModel' becomes:
|
||||
|
||||
x: (System, null)
|
||||
y: (ComponentModel, x)
|
||||
|
||||
The problem is that we would still need to construct the name to pass to
|
||||
GetType.
|
||||
|
||||
This has been now implemented, its called "QualifiedIdentifier"
|
||||
|
||||
current_container/current_namespace and the DeclSpace
|
||||
-----------------------------------------------------
|
||||
|
||||
We are storing fully qualified names in the DeclSpace instead of the node,
|
||||
this is because `current_namespace' (Namepsace) is not a DeclSpace like
|
||||
`current_container'.
|
||||
|
||||
The reason for storing the full names today is this:
|
||||
|
||||
namespace X {
|
||||
class Y {
|
||||
}
|
||||
}
|
||||
|
||||
namespace A {
|
||||
class Y {
|
||||
}
|
||||
}
|
||||
|
||||
The problem is that we only use the namespace stack to track the "prefix"
|
||||
for typecontainers, but they are not typecontainers themselves, so we have
|
||||
to use fully qualified names, because both A.X and A.Y would be entered
|
||||
in the toplevel type container. If we use the short names, there would be
|
||||
a name clash.
|
||||
|
||||
To fix this problem, we have to make namespaces DeclSpaces.
|
||||
|
||||
The full size, contrasted with the size that could be stored is:
|
||||
corlib:
|
||||
Size of strings held: 368901
|
||||
Size of strings short: 147863
|
||||
|
||||
System:
|
||||
Size of strings held: 212677
|
||||
Size of strings short: 97521
|
||||
|
||||
System.XML:
|
||||
Size of strings held: 128055
|
||||
Size of strings short: 35782
|
||||
|
||||
System.Data:
|
||||
Size of strings held: 117896
|
||||
Size of strings short: 36153
|
||||
|
||||
System.Web:
|
||||
Size of strings held: 194527
|
||||
Size of strings short: 58064
|
||||
|
||||
System.Windows.Forms:
|
||||
Size of strings held: 220495
|
||||
Size of strings short: 64923
|
||||
|
||||
|
||||
TODO:
|
||||
|
||||
1. Create a "partial" emit context for each TypeContainer..
|
||||
|
||||
2. EmitContext should be partially constructed. No IL Generator.
|
||||
|
||||
interface_type review.
|
||||
|
||||
parameter_array, line 952: `note: must be a single dimension array type'. Validate this
|
||||
|
||||
Dead Code Elimination bugs:
|
||||
---------------------------
|
||||
|
||||
I should also resolve all the children expressions in Switch, Fixed, Using.
|
||||
|
||||
Major tasks:
|
||||
------------
|
||||
|
||||
Pinned and volatile require type modifiers that can not be encoded
|
||||
with Reflection.Emit.
|
||||
|
||||
Properties and 17.6.3: Finish it.
|
||||
|
||||
Implement base indexer access.
|
||||
|
||||
readonly variables and ref/out
|
||||
|
||||
BUGS
|
||||
----
|
||||
|
||||
* Check for Final when overriding, if the parent is Final, then we cant
|
||||
allow an override.
|
||||
|
||||
* Interface indexers
|
||||
|
||||
I have not figured out why the Microsoft version puts an
|
||||
`instance' attribute, and I am not generating this `instance' attribute.
|
||||
|
||||
Explanation: The reason for the `instance' attribute on
|
||||
indexers is that indexers only apply to instances
|
||||
|
||||
* Break/Continue statements
|
||||
|
||||
A finally block should reset the InLoop/LoopBegin/LoopEnd, as
|
||||
they are logically outside the scope of the loop.
|
||||
|
||||
* Break/continue part 2.
|
||||
|
||||
They should transfer control to the finally block if inside a try/catch
|
||||
block.
|
||||
|
||||
* Method Registration and error CS111
|
||||
|
||||
The way we use the method registration to signal 111 is wrong.
|
||||
|
||||
Method registration should only be used to register methodbuilders,
|
||||
we need an alternate method of checking for duplicates.
|
||||
|
||||
*
|
||||
> // CSC sets beforefieldinit
|
||||
> class X {
|
||||
> // .cctor will be generated by compiler
|
||||
> public static readonly object O = new System.Object ();
|
||||
> public static void Main () {}
|
||||
> }
|
||||
>
|
||||
|
||||
PENDING TASKS
|
||||
-------------
|
||||
|
||||
* Merge test 89 and test-34
|
||||
|
||||
* Revisit
|
||||
|
||||
Primary-expression, as it has now been split into
|
||||
non-array-creation-expression and array-creation-expression.
|
||||
|
||||
* Code cleanup
|
||||
|
||||
The information when registering a method in InternalParameters
|
||||
is duplicated, you can always get the types from the InternalParameters
|
||||
|
||||
* Emit modreq for volatiles
|
||||
|
||||
Handle modreq from public apis.
|
||||
|
||||
* Emit `pinned' for pinned local variables.
|
||||
|
||||
Both `modreq' and pinned will require special hacks in the compiler.
|
||||
|
||||
* Make sure that we are pinning the right variable
|
||||
|
||||
* Merge tree.cs, rootcontext.cs
|
||||
|
||||
OPTIMIZATIONS
|
||||
-------------
|
||||
|
||||
* User Defined Conversions is doing way too many calls to do union sets that are not needed
|
||||
|
||||
* Add test case for destructors
|
||||
|
||||
* Places that use `Ldelema' are basically places where I will be
|
||||
initializing a value type. I could apply an optimization to
|
||||
disable the implicit local temporary from being created (by using
|
||||
the method in New).
|
||||
|
||||
* Dropping TypeContainer as an argument to EmitContext
|
||||
|
||||
My theory is that I can get rid of the TypeBuilder completely from
|
||||
the EmitContext, and have typecasts where it is used (from
|
||||
DeclSpace to where it matters).
|
||||
|
||||
The only pending problem is that the code that implements Aliases
|
||||
is on TypeContainer, and probably should go in DeclSpace.
|
||||
|
||||
* Use of local temporary in UnaryMutator
|
||||
|
||||
We should get rid of the Localtemporary there for some cases
|
||||
|
||||
This turns out to be very complex, at least for the post-version,
|
||||
because this case:
|
||||
|
||||
a = i++
|
||||
|
||||
To produce optimal code, it is necessary for UnaryMutator to know
|
||||
that it is being assigned to a variable (the way the stack is laid
|
||||
out using dup requires the store to happen inside UnaryMutator).
|
||||
|
||||
* Tests
|
||||
|
||||
Write tests for the various reference conversions. We have
|
||||
test for all the numeric conversions.
|
||||
|
||||
* Optimizations
|
||||
|
||||
In Indexers and Properties, probably support an EmitWithDup
|
||||
That emits the code to call Get and then leaves a this pointer
|
||||
in the stack, so that later a Store can be emitted using that
|
||||
this pointer (consider Property++ or Indexer++)
|
||||
|
||||
* Optimizations: variable allocation.
|
||||
|
||||
When local variables of a type are required, we should request
|
||||
the variable and later release it when we are done, so that
|
||||
the same local variable slot can be reused later on.
|
||||
|
||||
* Add a cache for the various GetArrayMethod operations.
|
||||
|
||||
* MakeUnionSet Callers
|
||||
|
||||
If the types are the same, there is no need to compute the unionset,
|
||||
we can just use the list from one of the types.
|
||||
|
||||
* Factor the lookup code for class declarations an interfaces
|
||||
(interface.cs:GetInterfaceByName)
|
||||
|
||||
RECOMMENDATIONS
|
||||
---------------
|
||||
|
||||
* Use of lexer.Location in the parser
|
||||
|
||||
Currently we do:
|
||||
|
||||
TOKEN nt TERMINAL nt TERMINAL nt3 {
|
||||
$$ = new Blah ($2, $4, $6, lexer.Location);
|
||||
}
|
||||
|
||||
This is bad, because the lexer.Location is for the last item in `nt3'
|
||||
|
||||
We need to change that to use this pattern:
|
||||
|
||||
TOKEN { oob_stack.Push (lexer.Location) } nt TERMINAL nt TERMINAL nt3 {
|
||||
$$ = new Blah ($3, $5, $7, (Location) oob_stack.Pop ());
|
||||
}
|
||||
|
||||
Notice how numbering of the arguments changes as the
|
||||
{ oob_stack.Push (lexer.Location) } takes a "slot" in the productions.
|
||||
|
||||
* local_variable_declaration
|
||||
|
||||
Not sure that this grammar is correct, we might have to
|
||||
resolve this during semantic analysis.
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,258 +0,0 @@
|
||||
<VisualStudioProject>
|
||||
<CSHARP
|
||||
ProjectType = "Local"
|
||||
ProductVersion = "7.10.3077"
|
||||
SchemaVersion = "2.0"
|
||||
ProjectGuid = "{896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}"
|
||||
>
|
||||
<Build>
|
||||
<Settings
|
||||
ApplicationIcon = ""
|
||||
AssemblyKeyContainerName = ""
|
||||
AssemblyName = "mcs"
|
||||
AssemblyOriginatorKeyFile = ""
|
||||
DefaultClientScript = "JScript"
|
||||
DefaultHTMLPageLayout = "Grid"
|
||||
DefaultTargetSchema = "IE50"
|
||||
DelaySign = "false"
|
||||
OutputType = "Exe"
|
||||
PreBuildEvent = ""
|
||||
PostBuildEvent = ""
|
||||
RootNamespace = "CIR"
|
||||
RunPostBuildEvent = "OnBuildSuccess"
|
||||
StartupObject = ""
|
||||
>
|
||||
<Config
|
||||
Name = "Debug"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "DEBUG;TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "true"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "false"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "false"
|
||||
OutputPath = ".\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
<Config
|
||||
Name = "Release"
|
||||
AllowUnsafeBlocks = "false"
|
||||
BaseAddress = "285212672"
|
||||
CheckForOverflowUnderflow = "false"
|
||||
ConfigurationOverrideFile = ""
|
||||
DefineConstants = "TRACE"
|
||||
DocumentationFile = ""
|
||||
DebugSymbols = "false"
|
||||
FileAlignment = "4096"
|
||||
IncrementalBuild = "true"
|
||||
NoStdLib = "false"
|
||||
NoWarn = ""
|
||||
Optimize = "true"
|
||||
OutputPath = "bin\Release\"
|
||||
RegisterForComInterop = "false"
|
||||
RemoveIntegerChecks = "false"
|
||||
TreatWarningsAsErrors = "false"
|
||||
WarningLevel = "4"
|
||||
/>
|
||||
</Settings>
|
||||
<References>
|
||||
<Reference
|
||||
Name = "System"
|
||||
AssemblyName = "System"
|
||||
/>
|
||||
</References>
|
||||
</Build>
|
||||
<Files>
|
||||
<Include>
|
||||
<File
|
||||
RelPath = "anonymous.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "AssemblyInfo.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "assign.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "attribute.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "cfold.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "class.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "codegen.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "const.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "constant.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "convert.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "CryptoConvert.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "cs-parser.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "cs-tokenizer.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "decl.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "delegate.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "driver.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "ecore.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "enum.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "expression.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "flowanalysis.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "genericparser.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "iterators.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "literal.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "location.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "modifiers.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "namespace.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "parameter.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "pending.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "report.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "rootcontext.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "statement.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "support.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "symbolwriter.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "tree.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<File
|
||||
RelPath = "typemanager.cs"
|
||||
SubType = "Code"
|
||||
BuildAction = "Compile"
|
||||
/>
|
||||
<Folder
|
||||
RelPath = "Web References\"
|
||||
WebReferences = "TRUE"
|
||||
/>
|
||||
</Include>
|
||||
</Files>
|
||||
</CSHARP>
|
||||
</VisualStudioProject>
|
||||
|
||||
@@ -1,114 +0,0 @@
|
||||
Compiler operation
|
||||
|
||||
The compiler has a number of phases:
|
||||
|
||||
* Parsing.
|
||||
|
||||
Initially the compiler parses all the source files and keeps a
|
||||
parsed representation in memory. Very syntax error checking
|
||||
is performed at this point.
|
||||
|
||||
The compiler stores the information in classes whose names
|
||||
represent the language construct, for example, the "if"
|
||||
construct is stored in an `If' class. A class is stored in a
|
||||
`Class'.
|
||||
|
||||
* The TypeManager
|
||||
|
||||
The TypeManager loads all the assemblies that were referenced
|
||||
by the programmer. The CLR type system is used as our
|
||||
repository for types defined as well.
|
||||
|
||||
So the same interface that is used to query the types,
|
||||
properties and flags about system types is the same interface
|
||||
that we use for our types.
|
||||
|
||||
As we work our way through the code generation and semantic
|
||||
analysis, new types are entered into the Type system through
|
||||
the use of System.Reflection.Emit. The TypeManager will
|
||||
lookup types on both the user defined types and on the system
|
||||
defined ones.
|
||||
|
||||
So special care has to be used. The order in which we
|
||||
proceeed from here is important.
|
||||
|
||||
* Base class resolution and type definition.
|
||||
|
||||
Once the parsing has happened, the compiler resolves the
|
||||
inheritance tree for interfaces. This is done recursively
|
||||
and we catch recursive interface definitions here.
|
||||
|
||||
After this is done, we continue on with classes. Classes have
|
||||
can have an optional "parent" inherit from or the implicit
|
||||
System.Object class (for normal builds, builds with /nostdlib
|
||||
will allow you to compile class System.Object with no parent).
|
||||
|
||||
At this point we do some error checking and verify that the
|
||||
inherits/implements section of a class is correct (since we
|
||||
have previously built the interface inheritance).
|
||||
|
||||
By the time we are done, all classes, structs and interfaces
|
||||
have been created using System.Reflection.Emit and registered
|
||||
with the Type Manager.
|
||||
|
||||
This allows us to define fields and resolve argument names for
|
||||
methods, properties, indexers and events.
|
||||
|
||||
* Field generation
|
||||
|
||||
Fields are generated next, we go through all the type
|
||||
containers (classes and structs) and enter the fields into
|
||||
their types.
|
||||
|
||||
* Method, Properties, Indexers and events definitions
|
||||
|
||||
Now all the methods, constructors, properties, indexers and
|
||||
events are entered. They are only `defined' using
|
||||
System.Reflection.Emit. No code generation will happen until
|
||||
everything has been entered into System.Reflection.Emit.
|
||||
|
||||
This is important because to actually generate code we need to
|
||||
know everything about the environment in which the code is
|
||||
being generated.
|
||||
|
||||
* Code Generation
|
||||
|
||||
At this point all the definitions have been entered into the
|
||||
type manager through System.Reflection.Emit. We can now use
|
||||
System.Reflection to query all the information about the
|
||||
types.
|
||||
|
||||
Your normal semantic analysis and code generation phase lives
|
||||
here.
|
||||
|
||||
* Statements
|
||||
|
||||
Most of the statements are handled in the codegen.cs file.
|
||||
|
||||
* Expressions
|
||||
|
||||
* Error reporting
|
||||
|
||||
We should try to use the `Report.Error' and `Report.Warning'
|
||||
classes which are part of the RootContext (there is even a
|
||||
property to access it).
|
||||
|
||||
Error reporting should try to use the same codes that the
|
||||
Microsoft compiler uses (if only so we can track which errors
|
||||
we handle and which ones we dont).
|
||||
|
||||
If there is an error which is specific to MSC, use negative
|
||||
numbers, and register the number in mcs/errors/errors.txt
|
||||
|
||||
Try to write a test case for any error that you run into the
|
||||
code of the compiler if there is none already.
|
||||
|
||||
Put your test case in a file called csNNNN.cs in the
|
||||
mcs/errors directory, and have the first two lines be:
|
||||
|
||||
// csNNNN.cs: This is the description.
|
||||
// Line: XXX
|
||||
|
||||
Where `XXX' is the line where the error ocurrs. We will later
|
||||
use this as a regression test suite for catching errors in the
|
||||
compiler.
|
||||
@@ -1,21 +0,0 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "compiler", "compiler.csproj", "{896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}.Debug.ActiveCfg = Debug|.NET
|
||||
{896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}.Debug.Build.0 = Debug|.NET
|
||||
{896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}.Release.ActiveCfg = Release|.NET
|
||||
{896D1461-B76B-41C0-ABE6-ACA2BB4F7B5A}.Release.Build.0 = Release|.NET
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -1,56 +0,0 @@
|
||||
//
|
||||
// generic.cs: Support classes for generics
|
||||
//
|
||||
// Author:
|
||||
// Miguel de Icaza ([email protected])
|
||||
//
|
||||
// (C) 2003 Ximian, Inc.
|
||||
//
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace Mono.CSharp {
|
||||
|
||||
//
|
||||
// Tracks the constraints for a type parameter
|
||||
//
|
||||
class Constraints {
|
||||
string type_parameter;
|
||||
ArrayList constraints;
|
||||
|
||||
//
|
||||
// type_parameter is the identifier, constraints is an arraylist of
|
||||
// Expressions (with types) or `true' for the constructor constraint.
|
||||
//
|
||||
public Constraints (string type_parameter, ArrayList constraints)
|
||||
{
|
||||
this.type_parameter = type_parameter;
|
||||
this.constraints = constraints;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This type represents a generic type parameter reference.
|
||||
//
|
||||
// These expressions are born in a fully resolved state.
|
||||
//
|
||||
public class TypeParameterExpr : TypeExpr {
|
||||
string type_parameter;
|
||||
|
||||
public TypeParameterExpr (string type_parameter, Location l)
|
||||
: base (typeof (object), l)
|
||||
{
|
||||
this.type_parameter = type_parameter;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return "TypeParameter[" + type_parameter + "]";
|
||||
}
|
||||
|
||||
public void Error_CannotUseAsUnmanagedType (Location loc)
|
||||
{
|
||||
Report.Error (-203, loc, "Can not use type parameter as unamanged type");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
AssemblyInfo.cs
|
||||
anonymous.cs
|
||||
assign.cs
|
||||
attribute.cs
|
||||
driver.cs
|
||||
cs-tokenizer.cs
|
||||
cfold.cs
|
||||
class.cs
|
||||
codegen.cs
|
||||
const.cs
|
||||
constant.cs
|
||||
convert.cs
|
||||
decl.cs
|
||||
delegate.cs
|
||||
enum.cs
|
||||
ecore.cs
|
||||
expression.cs
|
||||
flowanalysis.cs
|
||||
genericparser.cs
|
||||
iterators.cs
|
||||
literal.cs
|
||||
location.cs
|
||||
modifiers.cs
|
||||
namespace.cs
|
||||
parameter.cs
|
||||
pending.cs
|
||||
report.cs
|
||||
rootcontext.cs
|
||||
statement.cs
|
||||
support.cs
|
||||
typemanager.cs
|
||||
symbolwriter.cs
|
||||
tree.cs
|
||||
CryptoConvert.cs
|
||||
@@ -1,31 +1,3 @@
|
||||
2004-05-07 Bernie Solomon <[email protected]>
|
||||
|
||||
* ppc/ppc-codegen.h: remove GCC-ism in ppc_emit32
|
||||
|
||||
2004-04-29 Bernie Solomon <[email protected]>
|
||||
|
||||
* ppc/tramp.c: use sizeof (stackval), fix
|
||||
delegate tramp frame layout for Apple
|
||||
|
||||
2004-04-26 David Waite <[email protected]>
|
||||
|
||||
* unknown.c: modify to have content for defined platforms (to
|
||||
avoid ISO C warning)
|
||||
|
||||
2004-03-29 Bernie Solomon <[email protected]>
|
||||
|
||||
* amd64/tramp.c:
|
||||
* arm/tramp.c:
|
||||
* hppa/tramp.c:
|
||||
* ppc/tramp.c:
|
||||
* s390/tramp.c:
|
||||
* sparc/tramp.c:
|
||||
* x86/tramp.c:
|
||||
remove child from MonoInvocation as it isn't used.
|
||||
|
||||
* hppa/hppa-codegen.h:
|
||||
fix displacements in FP instrs
|
||||
|
||||
2004-03-23 Bernie Solomon <[email protected]>
|
||||
|
||||
* hppa/hppa-codegen.h: created
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
Makefile.in
|
||||
Makefile
|
||||
.deps
|
||||
@@ -885,6 +885,7 @@ enum_calc_size:
|
||||
amd64_alu_reg_reg (p, X86_XOR, AMD64_RAX, AMD64_RAX);
|
||||
amd64_mov_membase_reg (p, AMD64_RBP, (mono_invocation_pos + G_STRUCT_OFFSET (MonoInvocation, ex)), AMD64_RAX, 8);
|
||||
amd64_mov_membase_reg (p, AMD64_RBP, (mono_invocation_pos + G_STRUCT_OFFSET (MonoInvocation, ex_handler)), AMD64_RAX, 8);
|
||||
amd64_mov_membase_reg (p, AMD64_RBP, (mono_invocation_pos + G_STRUCT_OFFSET (MonoInvocation, child)), AMD64_RAX, 8);
|
||||
amd64_mov_membase_reg (p, AMD64_RBP, (mono_invocation_pos + G_STRUCT_OFFSET (MonoInvocation, parent)), AMD64_RAX, 8);
|
||||
/*
|
||||
* Set the method pointer.
|
||||
|
||||
@@ -487,6 +487,7 @@ void* mono_arch_create_method_pointer (MonoMethod* method)
|
||||
ARM_MOV_REG_IMM8(p, ARMREG_R4, 0);
|
||||
ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(ex));
|
||||
ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(ex_handler));
|
||||
ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(child));
|
||||
ARM_STR_IMM(p, ARMREG_R4, ARMREG_SP, MINV_OFFS(parent));
|
||||
|
||||
/* Set the method pointer. */
|
||||
|
||||
@@ -127,7 +127,7 @@ typedef enum {
|
||||
#define hppa_fldd_with_flags(p, disp, base, dest, m, a) \
|
||||
do { \
|
||||
int neg = (disp) < 0; \
|
||||
int im10a = (disp) >> 3; \
|
||||
int im10a = (disp) >> 2; \
|
||||
*(p) = (0x50000002 | (((im10a) & 0x3ff) << 4) | ((base) << 21) | ((dest) << 16) | neg | (m ? 0x8 : 0) | (a ? 0x4 : 0)); \
|
||||
p++; \
|
||||
} while (0)
|
||||
@@ -138,7 +138,7 @@ typedef enum {
|
||||
#define hppa_fstd_with_flags(p, src, disp, base, m, a) \
|
||||
do { \
|
||||
int neg = (disp) < 0; \
|
||||
int im10a = (disp) >> 3; \
|
||||
int im10a = (disp) >> 2; \
|
||||
*(p) = (0x70000002 | (((im10a) & 0x3ff) << 4) | ((base) << 21) | ((src) << 16) | neg | (m ? 0x8 : 0) | (a ? 0x4 : 0)); \
|
||||
p++; \
|
||||
} while (0)
|
||||
|
||||
@@ -566,6 +566,7 @@ generate:
|
||||
ADD_INST(code, pc, hppa_std(code, 19, -8, 29)); // STD %r19,-8(%r29)
|
||||
|
||||
ADD_INST(code, pc, hppa_std(code, 0, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, parent), 30));
|
||||
ADD_INST(code, pc, hppa_std(code, 0, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, child), 30));
|
||||
ADD_INST(code, pc, hppa_std(code, 0, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, ex), 30));
|
||||
ADD_INST(code, pc, hppa_std(code, 0, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, ex_handler), 30));
|
||||
ADD_INST(code, pc, hppa_std(code, 0, invoke_rec_offset + G_STRUCT_OFFSET (MonoInvocation, ip), 30));
|
||||
|
||||
Loaded 100 of 515 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user