[sgen] Set ARCH_MIN_MS_BLOCK_SIZE to 64k on both ppc32 and ppc64.
This fixes a problem that was happening on Debian ppc32 build machines. Since
they are set up as a 32-bit userland on a 64-bit kernel, Mono would be compiled
with an ARCH_MIN_MS_BLOCK_SIZE value of 16k. However, at runtime, the system
page size would be 64k (due to the 64-bit kernel with PPC_64K_PAGES set).
Signed-off-by: `Alex Rønne Petersen <alexrp@xamarin.com>`
need_link_unlink=yes
libmono_cflags="-D_REENTRANT"
libgc_threads=pthreads
- # This doesn't seem to work on solaris/x86, but the configure test runs
- with_tls=pthread
has_dtrace=yes
use_sigposix=yes
enable_solaris_tar_check=yes
// for each argument, the conversion to 'ct' should be no worse than
// the conversion to 'bt'.
- if (result == 2)
- return false;
+ if (result == 2) {
+ better_at_least_one = false;
+
+ ++j;
+ while (j < args_count && !args [j++].IsDefaultArgument) ;
+
+ break;
+ }
// for at least one argument, the conversion to 'ct' should be better than
// the conversion to 'bt'.
return true;
//
- // Tie-breaking rules are applied only for equivalent parameter types
+ // LAMESPEC: Tie-breaking rules for not equivalent parameter types
//
if (!are_equivalent) {
//
- // LAMESPEC: A candidate with less default parameters is still better when there
+ // A candidate with no default parameters is still better when there
// is no better expression conversion
//
- if (candidate_pd.Count < best_pd.Count && !candidate_params && best_pd.FixedParameters [j].HasDefaultValue) {
- return true;
+ if (candidate_pd.Count < best_pd.Count) {
+ if (!candidate_params && !candidate_pd.FixedParameters [j - j].HasDefaultValue) {
+ return true;
+ }
+ } else if (candidate_pd.Count == best_pd.Count) {
+ if (candidate_params)
+ return false;
+
+ if (!candidate_pd.FixedParameters [j - 1].HasDefaultValue && best_pd.FixedParameters [j - 1].HasDefaultValue)
+ return true;
+
+ if (candidate_pd.FixedParameters [j - 1].HasDefaultValue && best_pd.HasParams)
+ return true;
}
return false;
var cand_param = candidate_pd.FixedParameters [j];
var best_param = best_pd.FixedParameters [j];
- if (cand_param.HasDefaultValue != best_param.HasDefaultValue)
+ if (cand_param.HasDefaultValue != best_param.HasDefaultValue && (!candidate_pd.HasParams || !best_pd.HasParams))
return cand_param.HasDefaultValue;
defaults_ambiguity = true;
public override void Emit (EmitContext ec)
{
+ if (EmitOptimizedEmpty (ec))
+ return;
+
var await_field = EmitToFieldSource (ec);
if (await_field != null)
await_field.Emit (ec);
}
+ bool EmitOptimizedEmpty (EmitContext ec)
+ {
+ if (arguments.Count != 1 || dimensions != 1)
+ return false;
+
+ var c = arguments [0] as Constant;
+ if (c == null || !c.IsZeroInteger)
+ return false;
+
+ var m = ec.Module.PredefinedMembers.ArrayEmpty.Get ();
+ if (m == null || ec.CurrentType.MemberDefinition.DeclaringAssembly == m.DeclaringType.MemberDefinition.DeclaringAssembly)
+ return false;
+
+ m = m.MakeGenericMethod (ec.MemberContext, array_element_type);
+ ec.Emit (OpCodes.Call, m);
+ return true;
+ }
+
protected sealed override FieldExpr EmitToFieldSource (EmitContext ec)
{
if (first_emit != null) {
public readonly PredefinedType SecurityAction;
public readonly PredefinedType Dictionary;
public readonly PredefinedType Hashtable;
+ public readonly PredefinedType Array;
+
public readonly TypeSpec[] SwitchUserTypes;
//
SecurityAction = new PredefinedType (module, MemberKind.Enum, "System.Security.Permissions", "SecurityAction");
Dictionary = new PredefinedType (module, MemberKind.Class, "System.Collections.Generic", "Dictionary", 2);
Hashtable = new PredefinedType (module, MemberKind.Class, "System.Collections", "Hashtable");
+ Array = new PredefinedType (module, MemberKind.Class, "System", "Array");
Expression = new PredefinedType (module, MemberKind.Class, "System.Linq.Expressions", "Expression");
ExpressionGeneric = new PredefinedType (module, MemberKind.Class, "System.Linq.Expressions", "Expression", 1);
class PredefinedMembers
{
public readonly PredefinedMember<MethodSpec> ActivatorCreateInstance;
+ public readonly PredefinedMember<MethodSpec> ArrayEmpty;
public readonly PredefinedMember<MethodSpec> AsyncTaskMethodBuilderCreate;
public readonly PredefinedMember<MethodSpec> AsyncTaskMethodBuilderStart;
public readonly PredefinedMember<MethodSpec> AsyncTaskMethodBuilderSetResult;
ActivatorCreateInstance = new PredefinedMember<MethodSpec> (module, types.Activator,
MemberFilter.Method ("CreateInstance", 1, ParametersCompiled.EmptyReadOnlyParameters, null));
+ ArrayEmpty = new PredefinedMember<MethodSpec> (module, types.Array,
+ MemberFilter.Method ("Empty", 1, ParametersCompiled.EmptyReadOnlyParameters, null));
+
AsyncTaskMethodBuilderCreate = new PredefinedMember<MethodSpec> (module, types.AsyncTaskMethodBuilder,
MemberFilter.Method ("Create", 0, ParametersCompiled.EmptyReadOnlyParameters, types.AsyncTaskMethodBuilder.TypeSpec));
if (Test_5 () != 0)
return 5;
- if (Test_6 () != 0)
+ if (Test_6 () != 1)
return 6;
- if (Test_7 (false) != 0)
+ if (Test_7 (false) != 1)
return 7;
if (Test_8 (typeof (bool)) != 0)
--- /dev/null
+using System;
+
+public class Program
+{
+ static int Arg (uint a, long b)
+ {
+ return 2;
+ }
+
+ static int Arg (int a, ulong b, int c = 9)
+ {
+ return 3;
+ }
+
+ static int Arg_2 (uint a, long b, params int[] arg)
+ {
+ return 2;
+ }
+
+ static int Arg_2 (int a, ulong b, int c = 0)
+ {
+ return 3;
+ }
+
+ static int Arg_3 (int a, long b, params int[] arg)
+ {
+ return 2;
+ }
+
+ static int Arg_3 (uint a, ulong b, int c = 0, int d = 1, params int[] oo)
+ {
+ return 3;
+ }
+
+ public static int Main ()
+ {
+ if (Arg (0, 0) != 2)
+ return 1;
+
+ if (Arg (0, 0, 0) != 3)
+ return 2;
+
+ if (Arg_2 (0, 0) != 3)
+ return 3;
+
+ if (Arg_2 (0, 0, 0, 0) != 2)
+ return 4;
+
+ if (Arg_3 (0, 0) != 2)
+ return 5;
+
+ if (Arg_3 (0, 0, 0) != 2)
+ return 6;
+
+ if (Arg_3 (0, 0, 0, 0) != 2)
+ return 7;
+
+ if (Arg_3 (0, 0, 0, 0, 0) != 2)
+ return 8;
+
+ if (Arg_3 (0, 0, 0, 0, 0) != 2)
+ return 9;
+
+ return 0;
+ }
+}
--- /dev/null
+using System;
+
+class X
+{
+ static int Foo (params X[] p)
+ {
+ return 1;
+ }
+
+ static int Foo (object p)
+ {
+ return 0;
+ }
+
+ static int Main ()
+ {
+ if (Foo ((X[]) null) != 1)
+ return 1;
+
+ return 0;
+ }
+}
\ No newline at end of file
<entry il="0x0" row="20" col="2" file_ref="1" hidden="false" />
<entry il="0x1" row="21" col="3" file_ref="1" hidden="false" />
<entry il="0x11" row="21" col="59" file_ref="1" hidden="false" />
- <entry il="0x1c" row="21" col="53" file_ref="1" hidden="false" />
- <entry il="0x2c" row="21" col="47" file_ref="1" hidden="false" />
- <entry il="0x32" row="22" col="2" file_ref="1" hidden="false" />
+ <entry il="0x1b" row="21" col="53" file_ref="1" hidden="false" />
+ <entry il="0x2a" row="21" col="47" file_ref="1" hidden="false" />
+ <entry il="0x30" row="22" col="2" file_ref="1" hidden="false" />
</sequencepoints>
<locals>
<entry name="e" il_index="0" scope_ref="0" />
<test name="dtest-003.cs">
<type name="AssertDynamicObject">
<method name="System.Dynamic.DynamicMetaObject GetFakeMetaObject(System.Object)" attrs="129">
- <size>130</size>
+ <size>129</size>
</method>
<method name="System.Dynamic.DynamicMetaObject BindBinaryOperation(System.Dynamic.BinaryOperationBinder, System.Dynamic.DynamicMetaObject)" attrs="198">
<size>70</size>
</type>
<type name="Tester+<GetIndex_3>c__AnonStorey1">
<method name="Void <>m__0(System.Dynamic.GetIndexBinder, System.Object[])" attrs="131">
- <size>93</size>
+ <size>92</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="Tester+<InvokeMember_2>c__AnonStorey2">
<method name="Void <>m__0(System.Dynamic.InvokeMemberBinder, System.Object[])" attrs="131">
- <size>110</size>
+ <size>109</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="Tester+<InvokeMember_6>c__AnonStorey3">
<method name="Void <>m__0(System.Dynamic.InvokeMemberBinder, System.Object[])" attrs="131">
- <size>120</size>
+ <size>119</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="Tester+<SetIndex_3>c__AnonStorey4">
<method name="Void <>m__0(System.Dynamic.SetIndexBinder, System.Object[], System.Object)" attrs="131">
- <size>120</size>
+ <size>119</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>67</size>
</method>
<method name="Void <GetIndex_1>m__25(System.Dynamic.GetIndexBinder, System.Object[])" attrs="145">
- <size>93</size>
+ <size>92</size>
</method>
<method name="Void <GetIndex_2>m__26(System.Dynamic.GetIndexBinder, System.Object[])" attrs="145">
- <size>112</size>
+ <size>111</size>
</method>
<method name="System.Object <GetMember_1>m__27(System.Dynamic.GetMemberBinder)" attrs="145">
<size>75</size>
</method>
<method name="Void <Invoke_1>m__28(System.Dynamic.InvokeBinder, System.Object[])" attrs="145">
- <size>102</size>
+ <size>101</size>
</method>
<method name="Void <Invoke_2>m__29(System.Dynamic.InvokeBinder, System.Object[])" attrs="145">
- <size>74</size>
+ <size>72</size>
</method>
<method name="Void <Invoke_4>m__2A(System.Dynamic.InvokeBinder, System.Object[])" attrs="145">
<size>128</size>
</method>
<method name="Void <Invoke_5>m__2B(System.Dynamic.InvokeBinder, System.Object[])" attrs="145">
- <size>92</size>
+ <size>91</size>
</method>
<method name="Void <Invoke_5>m__2C(System.Object)" attrs="145">
<size>94</size>
</method>
<method name="Void <Invoke_6>m__2D(System.Dynamic.InvokeBinder, System.Object[])" attrs="145">
- <size>93</size>
+ <size>92</size>
</method>
<method name="Void <InvokeMember_1>m__2E(System.Dynamic.InvokeMemberBinder, System.Object[])" attrs="145">
- <size>111</size>
+ <size>110</size>
</method>
<method name="Void <InvokeMember_3>m__2F(System.Dynamic.InvokeMemberBinder, System.Object[])" attrs="145">
- <size>112</size>
+ <size>111</size>
</method>
<method name="Void <InvokeMember_4>m__30(System.Dynamic.InvokeMemberBinder, System.Object[])" attrs="145">
- <size>111</size>
+ <size>110</size>
</method>
<method name="Void <InvokeMember_7>m__31(System.Dynamic.InvokeMemberBinder, System.Object[])" attrs="145">
- <size>91</size>
+ <size>89</size>
</method>
<method name="Void <InvokeMember_8>m__32(System.Dynamic.InvokeMemberBinder, System.Object[])" attrs="145">
- <size>112</size>
+ <size>111</size>
</method>
<method name="Void <SetIndex_1>m__33(System.Dynamic.SetIndexBinder, System.Object[], System.Object)" attrs="145">
- <size>125</size>
+ <size>124</size>
</method>
<method name="Void <SetIndex_2>m__34(System.Dynamic.SetIndexBinder, System.Object[], System.Object)" attrs="145">
- <size>140</size>
+ <size>139</size>
</method>
<method name="Void <SetMember_1>m__35(System.Dynamic.SetMemberBinder, System.Object)" attrs="145">
<size>102</size>
<test name="dtest-044.cs">
<type name="C">
<method name="Int32 Main()" attrs="150">
- <size>868</size>
+ <size>867</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>2</size>
</method>
<method name="Void Main()" attrs="150">
- <size>383</size>
+ <size>381</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>23</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>213</size>
+ <size>212</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>84</size>
</method>
<method name="Void .ctor()" attrs="6278">
- <size>20</size>
+ <size>19</size>
</method>
<method name="Void .ctor(E[])" attrs="6278">
<size>15</size>
</type>
<type name="ExtensibleTester`1[U]">
<method name="Void Direct()" attrs="134">
- <size>25</size>
+ <size>24</size>
</method>
<method name="Void .ctor(U)" attrs="6278">
<size>15</size>
</type>
<type name="Crash">
<method name="Void Main()" attrs="150">
- <size>15</size>
+ <size>14</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="Tests">
<method name="Void Main()" attrs="150">
- <size>22</size>
+ <size>21</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="Tests">
<method name="Void Main()" attrs="150">
- <size>39</size>
+ <size>38</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<test name="gtest-340.cs">
<type name="Tests">
<method name="T[] FindAll[T](T[], System.Predicate`1[T])" attrs="150">
- <size>15</size>
+ <size>14</size>
</method>
<method name="Boolean ProtectedOnly(System.Reflection.MemberInfo)" attrs="129">
<size>10</size>
<size>16</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>25</size>
+ <size>24</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>2</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>189</size>
+ <size>187</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="TestIssue.Program">
<method name="Int32 Main()" attrs="150">
- <size>32</size>
+ <size>31</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="Base">
<method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
- <size>20</size>
+ <size>19</size>
</method>
</type>
</test>
<size>10</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>51</size>
+ <size>50</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>7</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>37</size>
+ <size>36</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>25</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>27</size>
+ <size>26</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<test name="gtest-495.cs">
<type name="Repro">
<method name="Void Main()" attrs="150">
- <size>13</size>
+ <size>12</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>2</size>
</method>
<method name="Void Test()" attrs="134">
- <size>38</size>
+ <size>37</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="C">
<method name="Int32 Main()" attrs="150">
- <size>80</size>
+ <size>78</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>2</size>
</method>
<method name="Void Main()" attrs="150">
- <size>51</size>
+ <size>48</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="X2">
<method name="Void Main()" attrs="150">
- <size>24</size>
+ <size>22</size>
</method>
<method name="Void Foo[T1,T2](T2[])" attrs="145">
<size>9</size>
<size>42</size>
</method>
<method name="System.Linq.Expressions.Expression`1[System.Func`1[System.Func`1[System.Boolean]]] GetEvent()" attrs="134">
- <size>41</size>
+ <size>40</size>
</method>
<method name="Void set_MyTypeProperty(MyType)" attrs="2182">
<size>9</size>
<size>244</size>
</method>
<method name="Void ArrayIndexTest_5()" attrs="129">
- <size>109</size>
+ <size>108</size>
</method>
<method name="Void ArrayIndexTest_6()" attrs="129">
<size>123</size>
</method>
<method name="Void ArrayIndexTest_7()" attrs="129">
- <size>127</size>
+ <size>126</size>
</method>
<method name="Void ArrayLengthTest()" attrs="129">
- <size>100</size>
+ <size>99</size>
</method>
<method name="Void ArrayLengthTest_2()" attrs="129">
<size>92</size>
<size>196</size>
</method>
<method name="Void CallTest_4()" attrs="129">
- <size>110</size>
+ <size>108</size>
</method>
<method name="Void CallTest_5()" attrs="129">
<size>100</size>
</method>
<method name="Void CallTest_6()" attrs="129">
- <size>71</size>
+ <size>70</size>
</method>
<method name="Void CallTest_7()" attrs="129">
<size>125</size>
<size>184</size>
</method>
<method name="Void ConditionTest_5()" attrs="129">
- <size>108</size>
+ <size>107</size>
</method>
<method name="Void ConstantTest()" attrs="129">
- <size>60</size>
+ <size>59</size>
</method>
<method name="Void ConstantTest_2()" attrs="129">
- <size>63</size>
+ <size>62</size>
</method>
<method name="Void ConstantTest_3()" attrs="129">
- <size>55</size>
+ <size>54</size>
</method>
<method name="Void ConstantTest_4()" attrs="129">
- <size>45</size>
+ <size>44</size>
</method>
<method name="Void ConstantTest_5()" attrs="129">
- <size>60</size>
+ <size>59</size>
</method>
<method name="Void ConstantTest_6()" attrs="129">
- <size>68</size>
+ <size>67</size>
</method>
<method name="Void ConstantTest_7()" attrs="129">
- <size>63</size>
+ <size>62</size>
</method>
<method name="Void ConstantTest_8()" attrs="129">
- <size>73</size>
+ <size>72</size>
</method>
<method name="Void ConstantTest_9()" attrs="129">
- <size>73</size>
+ <size>72</size>
</method>
<method name="Void ConstantTest_10()" attrs="129">
- <size>73</size>
+ <size>72</size>
</method>
<method name="Void ConstantTest_11()" attrs="129">
- <size>60</size>
+ <size>59</size>
</method>
<method name="Void ConstantTest_13()" attrs="129">
- <size>60</size>
+ <size>59</size>
</method>
<method name="Void ConstantTest_14()" attrs="129">
- <size>73</size>
+ <size>72</size>
</method>
<method name="Void ConstantTest_15()" attrs="129">
- <size>63</size>
+ <size>62</size>
</method>
<method name="Void ConvertTest()" attrs="129">
<size>83</size>
<size>119</size>
</method>
<method name="Void ConvertTest_9()" attrs="129">
- <size>98</size>
+ <size>97</size>
</method>
<method name="Void ConvertTest_10()" attrs="129">
<size>181</size>
<size>102</size>
</method>
<method name="Void ConvertTest_12()" attrs="129">
- <size>141</size>
+ <size>140</size>
</method>
<method name="Void ConvertTest_13()" attrs="129">
<size>87</size>
<size>170</size>
</method>
<method name="Void InvokeTest()" attrs="129">
- <size>91</size>
+ <size>90</size>
</method>
<method name="Void InvokeTest_2()" attrs="129">
<size>139</size>
</method>
<method name="Void LambdaTest()" attrs="129">
- <size>90</size>
+ <size>89</size>
</method>
<method name="Void LeftShiftTest()" attrs="129">
<size>156</size>
<size>170</size>
</method>
<method name="Void ListInitTest()" attrs="129">
- <size>405</size>
+ <size>404</size>
</method>
<method name="Void ListInitTest_2()" attrs="129">
<size>293</size>
</method>
<method name="Void MemberAccessTest()" attrs="129">
- <size>133</size>
+ <size>132</size>
</method>
<method name="Void MemberAccessTest_2()" attrs="129">
- <size>64</size>
+ <size>63</size>
</method>
<method name="Void MemberAccessTest_3()" attrs="129">
- <size>114</size>
+ <size>113</size>
</method>
<method name="Void MemberAccessTest_4()" attrs="129">
- <size>92</size>
+ <size>91</size>
</method>
<method name="Void MemberAccessTest_5()" attrs="129">
<size>40</size>
</method>
<method name="Void MemberAccessTest_6()" attrs="129">
- <size>105</size>
+ <size>104</size>
</method>
<method name="Void MemberAccessTest_7()" attrs="129">
<size>110</size>
</method>
<method name="Void MemberAccessTest_8()" attrs="129">
- <size>64</size>
+ <size>63</size>
</method>
<method name="Void MemberAccessTest_9()" attrs="129">
- <size>92</size>
+ <size>91</size>
</method>
<method name="Void MemberInitTest()" attrs="129">
- <size>303</size>
+ <size>302</size>
</method>
<method name="Void MemberInitTest_2()" attrs="129">
- <size>251</size>
+ <size>250</size>
</method>
<method name="Void MemberInitTest_3()" attrs="129">
<size>125</size>
</method>
<method name="Void MemberInitTest_4()" attrs="129">
- <size>67</size>
+ <size>65</size>
</method>
<method name="Void MemberInitTest_5()" attrs="129">
- <size>119</size>
+ <size>117</size>
</method>
<method name="Void ModuloTest()" attrs="129">
<size>101</size>
<size>89</size>
</method>
<method name="Void NewArrayInitTest()" attrs="129">
- <size>93</size>
+ <size>92</size>
</method>
<method name="Void NewArrayInitTest_2()" attrs="129">
- <size>65</size>
+ <size>62</size>
</method>
<method name="Void NewArrayInitTest_3()" attrs="129">
<size>137</size>
</method>
<method name="Void NewArrayInitTest_4()" attrs="129">
- <size>121</size>
+ <size>120</size>
</method>
<method name="Void NewArrayInitTest_5()" attrs="129">
- <size>159</size>
+ <size>158</size>
</method>
<method name="Void NewArrayInitTest_6()" attrs="129">
- <size>104</size>
+ <size>103</size>
</method>
<method name="Void NewArrayBoundsTest()" attrs="129">
- <size>124</size>
+ <size>123</size>
</method>
<method name="Void NewArrayBoundsTest_2()" attrs="129">
- <size>124</size>
+ <size>123</size>
</method>
<method name="Void NewArrayBoundsTest_3()" attrs="129">
- <size>86</size>
+ <size>85</size>
</method>
<method name="Void NewArrayBoundsTest_4()" attrs="129">
- <size>83</size>
+ <size>82</size>
</method>
<method name="Void NewTest()" attrs="129">
- <size>94</size>
+ <size>93</size>
</method>
<method name="Void NewTest_2()" attrs="129">
- <size>62</size>
+ <size>61</size>
</method>
<method name="Void NewTest_3()" attrs="129">
- <size>99</size>
+ <size>98</size>
</method>
<method name="Void NewTest_4()" attrs="129">
<size>253</size>
</method>
<method name="Void NewTest_5()" attrs="129">
- <size>376</size>
+ <size>375</size>
</method>
<method name="Void NewTest_6()" attrs="129">
- <size>183</size>
+ <size>182</size>
</method>
<method name="Void NewTest_7()" attrs="129">
- <size>54</size>
+ <size>53</size>
</method>
<method name="Void NotTest()" attrs="129">
<size>71</size>
<size>74</size>
</method>
<method name="Void ParameterTest_2()" attrs="129">
- <size>76</size>
+ <size>74</size>
</method>
<method name="Void ParameterTest_3()" attrs="129">
<size>74</size>
<size>101</size>
</method>
<method name="Void QuoteTest()" attrs="129">
- <size>86</size>
+ <size>84</size>
</method>
<method name="Void QuoteTest_2()" attrs="129">
- <size>100</size>
+ <size>99</size>
</method>
<method name="Void RightShiftTest()" attrs="129">
<size>153</size>
<size>81</size>
</method>
<method name="Void TypeIsTest_5()" attrs="129">
- <size>75</size>
+ <size>74</size>
</method>
<method name="Void TypeIsTest_6()" attrs="129">
<size>112</size>
<size>12</size>
</method>
<method name="Void NewTest_8()" attrs="129">
- <size>64</size>
+ <size>63</size>
</method>
<method name="Void CallTest_10()" attrs="129">
- <size>137</size>
+ <size>136</size>
</method>
</type>
</test>
<size>2</size>
</method>
<method name="System.String Param(System.String)" attrs="145">
- <size>122</size>
+ <size>121</size>
</method>
<method name="Int32 Main()" attrs="150">
<size>173</size>
</type>
<type name="C">
<method name="Int32 Main()" attrs="150">
- <size>495</size>
+ <size>490</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>48</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>358</size>
+ <size>357</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<test name="gtest-etree-06.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
- <size>53</size>
+ <size>52</size>
</method>
<method name="Int32 Value()" attrs="145">
<size>10</size>
<size>2</size>
</method>
<method name="Int32 TestInstance()" attrs="129">
- <size>337</size>
+ <size>336</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>580</size>
+ <size>577</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>11</size>
</method>
<method name="Int32 Goo(Boolean)" attrs="134">
- <size>231</size>
+ <size>228</size>
</method>
<method name="Int32 Main()" attrs="150">
<size>22</size>
<test name="gtest-etree-09.cs">
<type name="Mono.C">
<method name="Int32 Main()" attrs="150">
- <size>296</size>
+ <size>294</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="Foo`1[T]">
<method name="Boolean ContainsAll[U](System.Collections.Generic.IEnumerable`1[U])" attrs="134">
- <size>200</size>
+ <size>199</size>
</method>
</type>
</test>
</type>
<type name="Test">
<method name="Void Invalid(Int32)" attrs="134">
- <size>125</size>
+ <size>124</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>19</size>
</method>
<method name="Boolean MoveNext()" attrs="486">
- <size>148</size>
+ <size>147</size>
</method>
<method name="Void Dispose()" attrs="486">
<size>15</size>
<size>33</size>
</method>
<method name="T Value[T]()" attrs="145">
- <size>86</size>
+ <size>85</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="FieldInfoBug.GenericClass`1[T]">
<method name="Void .ctor(String)" attrs="6278">
- <size>59</size>
+ <size>58</size>
</method>
</type>
<type name="FieldInfoBug.GenericClass`1+<GenericClass>c__AnonStorey0[T]">
</type>
<type name="NotifyingPropertyTest">
<method name="Void CreateDependent_NotifierNull()" attrs="134">
- <size>59</size>
+ <size>57</size>
</method>
<method name="Void CreateDependent_DependentsNull()" attrs="134">
- <size>84</size>
+ <size>83</size>
</method>
<method name="Void Main()" attrs="150">
<size>2</size>
</type>
<type name="A`1+B`1[TA,TB]">
<method name="Void foo()" attrs="150">
- <size>40</size>
+ <size>39</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>8</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>1210</size>
+ <size>1204</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>19</size>
<test name="gtest-etree-28.cs">
<type name="Repro">
<method name="Void UseField()" attrs="129">
- <size>70</size>
+ <size>69</size>
</method>
<method name="Void TakeExpression(System.Linq.Expressions.Expression`1[System.Action])" attrs="129">
<size>2</size>
<test name="gtest-exmethod-20.cs">
<type name="Outer.Inner.Test">
<method name="Void M(I)" attrs="145">
- <size>14</size>
+ <size>13</size>
</method>
<method name="Void Main()" attrs="150">
<size>2</size>
<test name="gtest-exmethod-27.cs">
<type name="Bar.Program">
<method name="Void Main()" attrs="150">
- <size>18</size>
+ <size>17</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="A">
<method name="Void Main()" attrs="150">
- <size>13</size>
+ <size>12</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>23</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>88</size>
+ <size>87</size>
</method>
<method name="Boolean Foo(Int32[])" attrs="145">
<size>52</size>
<test name="gtest-friend-14.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
- <size>21</size>
+ <size>20</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="C`1[T]">
<method name="System.Collections.IEnumerator GetEnumerator()" attrs="134">
- <size>20</size>
+ <size>19</size>
</method>
</type>
<type name="C`1+<Filter>c__Iterator0[T]">
<size>10</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>53</size>
+ <size>52</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<test name="gtest-linq-01.cs">
<type name="from.C">
<method name="Void Main()" attrs="150">
- <size>2181</size>
+ <size>2179</size>
</method>
<method name="Void Foo(Int32, Boolean)" attrs="129">
<size>16</size>
</type>
<type name="NameCollisionTest.C">
<method name="Void Main()" attrs="150">
- <size>79</size>
+ <size>78</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="C">
<method name="Void <Main>m__0()" attrs="145">
- <size>162</size>
+ <size>159</size>
</method>
<method name="System.Collections.Generic.IEnumerable`1[B] <Main>m__1(A)" attrs="145">
- <size>15</size>
+ <size>14</size>
</method>
<method name="<>__AnonType0`2[A,B] <Main>m__2(A, B)" attrs="145">
<size>16</size>
<size>10</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>192</size>
+ <size>190</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>10</size>
</method>
<method name="Int32 Main()" attrs="145">
- <size>42</size>
+ <size>41</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
</test>
+ <test name="gtest-optional-36.cs">
+ <type name="Program">
+ <method name="Int32 Arg(UInt32, Int64)" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Int32 Arg(Int32, UInt64, Int32)" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Int32 Arg_2(UInt32, Int64, Int32[])" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Int32 Arg_2(Int32, UInt64, Int32)" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Int32 Arg_3(Int32, Int64, Int32[])" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Int32 Arg_3(UInt32, UInt64, Int32, Int32, Int32[])" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Int32 Main()" attrs="150">
+ <size>237</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-partial-01.cs">
<type name="B`1[U]">
<method name="Void .ctor()" attrs="6278">
<test name="gtest-variance-13.cs">
<type name="A">
<method name="Void Test()" attrs="150">
- <size>18</size>
+ <size>17</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<test name="gtest-variance-19.cs">
<type name="Test">
<method name="Void Bla[T,U]()" attrs="145">
- <size>13</size>
+ <size>12</size>
</method>
<method name="Void Main()" attrs="150">
<size>7</size>
<size>9</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>94</size>
+ <size>93</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<test name="test-232.cs">
<type name="CtorInfoTest">
<method name="Void Main(System.String[])" attrs="150">
- <size>978</size>
+ <size>977</size>
</method>
<method name="Void Assert(System.Object, System.Object)" attrs="145">
<size>43</size>
</type>
<type name="UnsupportedClassVersionError">
<method name="Void .ctor(String)" attrs="6275">
- <size>15</size>
+ <size>14</size>
</method>
</type>
</test>
</type>
<type name="ChildClass">
<method name="Void .ctor()" attrs="6278">
- <size>13</size>
+ <size>12</size>
</method>
</type>
<type name="M">
<size>2</size>
</method>
<method name="Void Main()" attrs="150">
- <size>243</size>
+ <size>242</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="SimpleAttribute">
<method name="Int64[] get_ArrayValue()" attrs="2182">
- <size>15</size>
+ <size>14</size>
</method>
<method name="Void set_ArrayValue(Int64[])" attrs="2182">
<size>2</size>
</type>
<type name="X+Derived+Nested">
<method name="Void G()" attrs="134">
- <size>22</size>
+ <size>21</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>41</size>
</method>
<method name="Void Main(System.String[])" attrs="150">
- <size>259</size>
+ <size>257</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<test name="test-555.cs">
<type name="Test">
<method name="Int32 Main()" attrs="150">
- <size>361</size>
+ <size>360</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>60</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>165</size>
+ <size>164</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<test name="test-772.cs">
<type name="Test">
<method name="Void Main()" attrs="150">
- <size>15</size>
+ <size>14</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>7</size>
</method>
<method name="System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">
- <size>20</size>
+ <size>19</size>
</method>
</type>
</test>
<size>12</size>
</method>
<method name="Void TestCallOnly()" attrs="129">
- <size>66</size>
+ <size>65</size>
</method>
<method name="Void SomeMethod()" attrs="486">
<size>2</size>
<test name="test-850.cs">
<type name="C">
<method name="Int32 Main()" attrs="150">
- <size>39</size>
+ <size>38</size>
</method>
<method name="Int32 F(System.String, System.String[])" attrs="145">
<size>10</size>
<size>20</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>71</size>
+ <size>70</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>2</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>288</size>
+ <size>284</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
</test>
+ <test name="test-933.cs">
+ <type name="X">
+ <method name="Int32 Foo(X[])" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Int32 Foo(System.Object)" attrs="145">
+ <size>10</size>
+ </method>
+ <method name="Int32 Main()" attrs="145">
+ <size>29</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-94.cs">
<type name="Base">
<method name="Int32 IVehicle.Start()" attrs="481">
<size>10</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>95</size>
+ <size>94</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="Foo`1+<ContainsAll>c__AnonStorey0`1[T,U]">
<method name="Boolean <>m__0()" attrs="131">
- <size>210</size>
+ <size>209</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="AwaitNS.MemberAccess">
<method name="Void M()" attrs="145">
- <size>13</size>
+ <size>12</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</type>
<type name="O">
<method name="Void Main()" attrs="150">
- <size>23</size>
+ <size>22</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>76</size>
</method>
<method name="Void Test_2()" attrs="129">
- <size>51</size>
+ <size>49</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>14</size>
</method>
<method name="Boolean MoveNext()" attrs="486">
- <size>168</size>
+ <size>167</size>
</method>
<method name="Void Dispose()" attrs="486">
<size>15</size>
<size>477</size>
</method>
<method name="Int32 TestReferenceType()" attrs="145">
- <size>229</size>
+ <size>227</size>
</method>
<method name="Int32 TestGeneric[T](T)" attrs="145">
<size>118</size>
LOCAL_MCS_FLAGS= $(OTHER_RES:%=-resource:%)
LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE
-LIB_REFS = System.Xml System
+LIB_REFS = System.Xml System System.Core
EXTRA_DISTFILES = $(RESOURCE_FILES)
// Miguel de Icaza
//
// (C) Novell, Inc 2004
+// (C) 2016 Xamarin Inc
+//
+// Missing features:
+// * Implement --cross, --local-targets, --list-targets, --no-auto-fetch
+// * concatenate target with package to form native binary
//
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using IKVM.Reflection;
-
-
+using System.Linq;
+using System.Diagnostics;
using System.Threading.Tasks;
class MakeBundle {
static bool skip_scan;
static string ctor_func;
static bool quiet;
+ static bool custom_mode = true;
+ static string embedded_options = null;
+ static string runtime = null;
static int Main (string [] args)
{
Help ();
return 1;
+ case "--simple":
+ custom_mode = false;
+ autodeps = true;
+ break;
+
+ case "--custom":
+ custom_mode = true;
+ break;
+
case "-c":
compile_only = true;
break;
output = args [++i];
break;
+ case "--options":
+ if (i+1 == top){
+ Help ();
+ return 1;
+ }
+ embedded_options = args [++i];
+ break;
+ case "--runtime":
+ if (i+1 == top){
+ Help ();
+ return 1;
+ }
+ runtime = args [++i];
+ break;
case "-oo":
if (i+1 == top){
Help ();
case "--keeptemp":
keeptemp = true;
break;
+
case "--static":
static_link = true;
break;
foreach (string file in assemblies)
if (!QueueAssembly (files, file))
return 1;
-
- GenerateBundles (files);
- //GenerateJitWrapper ();
+
+ if (custom_mode)
+ GenerateBundles (files);
+ else
+ GeneratePackage (files);
return 0;
}
ts.WriteLine ();
}
+
+ class PackageMaker {
+ Dictionary<string, Tuple<long,int>> locations = new Dictionary<string, Tuple<long,int>> ();
+ const int align = 4096;
+ Stream package;
+
+ public PackageMaker (string output)
+ {
+ package = File.Create (output, 128*1024);
+ if (IsUnix){
+ File.SetAttributes (output, unchecked ((FileAttributes) 0x80000000));
+ }
+ }
+
+ public int AddFile (string fname)
+ {
+ using (Stream fileStream = File.OpenRead (fname)){
+ var ret = fileStream.Length;
+
+ Console.WriteLine ("At {0:x} with input {1}", package.Position, fileStream.Length);
+ fileStream.CopyTo (package);
+ package.Position = package.Position + (align - (package.Position % align));
+
+ return (int) ret;
+ }
+ }
+
+ public void Add (string entry, string fname)
+ {
+ var p = package.Position;
+ var size = AddFile (fname);
+
+ locations [entry] = Tuple.Create(p, size);
+ }
+
+ public void AddString (string entry, string text)
+ {
+ var bytes = Encoding.UTF8.GetBytes (text);
+ locations [entry] = Tuple.Create (package.Position, bytes.Length);
+ package.Write (bytes, 0, bytes.Length);
+ package.Position = package.Position + (align - (package.Position % align));
+ }
+
+ public void Dump ()
+ {
+ foreach (var floc in locations.Keys){
+ Console.WriteLine ($"{floc} at {locations[floc]:x}");
+ }
+ }
+
+ public void WriteIndex ()
+ {
+ var indexStart = package.Position;
+ var binary = new BinaryWriter (package);
+
+ binary.Write (locations.Count);
+ foreach (var entry in from entry in locations orderby entry.Value.Item1 ascending select entry){
+ var bytes = Encoding.UTF8.GetBytes (entry.Key);
+ binary.Write (bytes.Length+1);
+ binary.Write (bytes);
+ binary.Write ((byte) 0);
+ binary.Write (entry.Value.Item1);
+ binary.Write (entry.Value.Item2);
+ }
+ binary.Write (indexStart);
+ binary.Write (Encoding.UTF8.GetBytes ("xmonkeysloveplay"));
+ binary.Flush ();
+ }
+
+ public void Close ()
+ {
+ WriteIndex ();
+ package.Close ();
+ package = null;
+ }
+ }
+
+ static bool MaybeAddFile (PackageMaker maker, string code, string file)
+ {
+ if (file == null)
+ return true;
+
+ if (!File.Exists (file)){
+ Console.Error.WriteLine ("The file {0} does not exist", file);
+ return false;
+ }
+ maker.Add (code, file);
+ return true;
+ }
+
+ static bool GeneratePackage (List<string> files)
+ {
+ if (runtime == null){
+ if (IsUnix)
+ runtime = Process.GetCurrentProcess().MainModule.FileName;
+ else {
+ Console.Error.WriteLine ("You must specify at least one runtime with --runtime or --cross");
+ Environment.Exit (1);
+ }
+ }
+ if (!File.Exists (runtime)){
+ Console.Error.WriteLine ($"The specified runtime at {runtime} does not exist");
+ Environment.Exit (1);
+ }
+
+ if (ctor_func != null){
+ Console.Error.WriteLine ("--static-ctor not supported with package bundling, you must use native compilation for this");
+ return false;
+ }
+
+ var maker = new PackageMaker (output);
+ maker.AddFile (runtime);
+
+ foreach (var url in files){
+ string fname = LocateFile (new Uri (url).LocalPath);
+ string aname = Path.GetFileName (fname);
+
+ maker.Add ("assembly:" + aname, fname);
+ if (File.Exists (fname + ".config"))
+ maker.Add ("config:" + aname, fname + ".config");
+ }
+ if (!MaybeAddFile (maker, "systemconfig:", config_file) || !MaybeAddFile (maker, "machineconfig:", machine_config_file))
+ return false;
+
+ if (config_dir != null)
+ maker.Add ("config_dir:", config_dir);
+ if (embedded_options != null)
+ maker.AddString ("options:", embedded_options);
+ maker.Dump ();
+ maker.Close ();
+ return true;
+ }
static void GenerateBundles (List<string> files)
{
{
Console.WriteLine ("Usage is: mkbundle [options] assembly1 [assembly2...]\n\n" +
"Options:\n" +
- " -c Produce stub only, do not compile\n" +
+ " --config F Bundle system config file `F'\n" +
+ " --config-dir D Set MONO_CFG_DIR to `D'\n" +
+ " --deps Turns on automatic dependency embedding (default on simple)\n" +
+ " -L path Adds `path' to the search path for assemblies\n" +
+ " --machine-config F Use the given file as the machine.config for the application.\n" +
" -o out Specifies output filename\n" +
+ " --nodeps Turns off automatic dependency embedding (default on custom)\n" +
+ " --skip-scan Skip scanning assemblies that could not be loaded (but still embed them).\n" +
+ "\n" +
+ "--simple Simple mode does not require a C toolchain and can cross compile\n" +
+ " --cross TARGET Generates a binary for the given TARGET\n"+
+ " --local-targets Lists locally available targets\n" +
+ " --list-targets [SERVER] Lists available targets on the remote server\n" +
+ " --no-auto-fetch Prevents the tool from auto-fetching a TARGET\n" +
+ " --options OPTIONS Embed the specified Mono command line options on target\n" +
+ " --runtime RUNTIME Manually specifies the Mono runtime to use\n" +
+ "\n" +
+ "--custom Builds a custom launcher, options for --custom\n" +
+ " -c Produce stub only, do not compile\n" +
" -oo obj Specifies output filename for helper object file\n" +
- " -L path Adds `path' to the search path for assemblies\n" +
- " --nodeps Turns off automatic dependency embedding (default)\n" +
- " --deps Turns on automatic dependency embedding\n" +
" --dos2unix[=true|false]\n" +
" When no value provided, or when `true` specified\n" +
" `dos2unix` will be invoked to convert paths on Windows.\n" +
" When `--dos2unix=false` used, dos2unix is NEVER used.\n" +
" --keeptemp Keeps the temporary files\n" +
- " --config F Bundle system config file `F'\n" +
- " --config-dir D Set MONO_CFG_DIR to `D'\n" +
- " --machine-config F Use the given file as the machine.config for the application.\n" +
" --static Statically link to mono libs\n" +
" --nomain Don't include a main() function, for libraries\n" +
- " --custom-main C Link the specified compilation unit (.c or .obj) with entry point/init code\n" +
+ " --custom-main C Link the specified compilation unit (.c or .obj) with entry point/init code\n" +
" -z Compress the assemblies before embedding.\n" +
- " --skip-scan Skip scanning assemblies that could not be loaded (but still embed them).\n" +
" --static-ctor ctor Add a constructor call to the supplied function.\n" +
" You need zlib development headers and libraries.\n");
}
ICALL(ASSEMB_1, "InternalAddModule", ves_icall_System_Reflection_Emit_AssemblyBuilder_InternalAddModule)
ICALL(ASSEMB_2, "basic_init", mono_image_basic_init)
+#ifndef DISABLE_REFLECTION_EMIT
ICALL_TYPE(CATTRB, "System.Reflection.Emit.CustomAttributeBuilder", CATTRB_1)
ICALL(CATTRB_1, "GetBlob", ves_icall_System_Reflection_Emit_CustomAttributeBuilder_GetBlob)
-#ifndef DISABLE_REFLECTION_EMIT
ICALL_TYPE(DERIVEDTYPE, "System.Reflection.Emit.DerivedType", DERIVEDTYPE_1)
ICALL(DERIVEDTYPE_1, "create_unmanaged_type", mono_reflection_create_unmanaged_type)
#endif
mono_error_set_pending_exception (&error);
}
+#ifndef DISABLE_REFLECTION_EMIT
ICALL_EXPORT MonoArray*
ves_icall_System_Reflection_Emit_CustomAttributeBuilder_GetBlob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *propValues, MonoArray *fields, MonoArray* fieldValues)
{
mono_error_set_pending_exception (&error);
return result;
}
+#endif
static gboolean
get_executing (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data)
#endif
}
+#ifndef DISABLE_JIT
/* Free the locals list so mono_mb_free () doesn't free the types twice */
g_list_free (mb->locals_list);
mb->locals_list = NULL;
+#endif
method->signature = signature;
if (!signature->hasthis)
}
gpointer
-mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context)
+mono_reflection_lookup_dynamic_token (MonoImage *image, guint32 token, gboolean valid_token, MonoClass **handle_class, MonoGenericContext *context, MonoError *error)
{
+ mono_error_init (error);
return NULL;
}
mono_do_crash_chaining = chain_crashes;
}
-void
-mono_parse_env_options (int *ref_argc, char **ref_argv [])
+/**
+ * mono_parse_options_from:
+ * @options: string containing strings
+ * @ref_argc: pointer to the argc variable that might be updated
+ * @ref_argv: pointer to the argv string vector variable that might be updated
+ *
+ * This function parses the contents of the `MONO_ENV_OPTIONS`
+ * environment variable as if they were parsed by a command shell
+ * splitting the contents by spaces into different elements of the
+ * @argv vector. This method supports quoting with both the " and '
+ * characters. Inside quoting, spaces and tabs are significant,
+ * otherwise, they are considered argument separators.
+ *
+ * The \ character can be used to escape the next character which will
+ * be added to the current element verbatim. Typically this is used
+ * inside quotes. If the quotes are not balanced, this method
+ *
+ * If the environment variable is empty, no changes are made
+ * to the values pointed by @ref_argc and @ref_argv.
+ *
+ * Otherwise the @ref_argv is modified to point to a new array that contains
+ * all the previous elements contained in the vector, plus the values parsed.
+ * The @argc is updated to match the new number of parameters.
+ *
+ * Returns: The value NULL is returned on success, otherwise a g_strdup allocated
+ * string is returned (this is an alias to malloc under normal circumstances) that
+ * contains the error message that happened during parsing.
+ */
+char *
+mono_parse_options_from (const char *options, int *ref_argc, char **ref_argv [])
{
int argc = *ref_argc;
char **argv = *ref_argv;
-
- const char *env_options = g_getenv ("MONO_ENV_OPTIONS");
- if (env_options != NULL){
- GPtrArray *array = g_ptr_array_new ();
- GString *buffer = g_string_new ("");
- const char *p;
- unsigned i;
- gboolean in_quotes = FALSE;
- char quote_char = '\0';
-
- for (p = env_options; *p; p++){
- switch (*p){
- case ' ': case '\t':
- if (!in_quotes) {
- if (buffer->len != 0){
- g_ptr_array_add (array, g_strdup (buffer->str));
- g_string_truncate (buffer, 0);
- }
- } else {
- g_string_append_c (buffer, *p);
- }
- break;
- case '\\':
- if (p [1]){
- g_string_append_c (buffer, p [1]);
- p++;
- }
- break;
- case '\'':
- case '"':
- if (in_quotes) {
- if (quote_char == *p)
- in_quotes = FALSE;
- else
- g_string_append_c (buffer, *p);
- } else {
- in_quotes = TRUE;
- quote_char = *p;
+ GPtrArray *array = g_ptr_array_new ();
+ GString *buffer = g_string_new ("");
+ const char *p;
+ unsigned i;
+ gboolean in_quotes = FALSE;
+ char quote_char = '\0';
+
+ if (options == NULL)
+ return NULL;
+
+ for (p = options; *p; p++){
+ switch (*p){
+ case ' ': case '\t':
+ if (!in_quotes) {
+ if (buffer->len != 0){
+ g_ptr_array_add (array, g_strdup (buffer->str));
+ g_string_truncate (buffer, 0);
}
- break;
- default:
+ } else {
g_string_append_c (buffer, *p);
- break;
}
+ break;
+ case '\\':
+ if (p [1]){
+ g_string_append_c (buffer, p [1]);
+ p++;
+ }
+ break;
+ case '\'':
+ case '"':
+ if (in_quotes) {
+ if (quote_char == *p)
+ in_quotes = FALSE;
+ else
+ g_string_append_c (buffer, *p);
+ } else {
+ in_quotes = TRUE;
+ quote_char = *p;
+ }
+ break;
+ default:
+ g_string_append_c (buffer, *p);
+ break;
}
- if (in_quotes) {
- fprintf (stderr, "Unmatched quotes in value of MONO_ENV_OPTIONS: [%s]\n", env_options);
- exit (1);
- }
-
- if (buffer->len != 0)
- g_ptr_array_add (array, g_strdup (buffer->str));
- g_string_free (buffer, TRUE);
+ }
+ if (in_quotes)
+ return g_strdup_printf ("Unmatched quotes in value: [%s]\n", options);
+
+ if (buffer->len != 0)
+ g_ptr_array_add (array, g_strdup (buffer->str));
+ g_string_free (buffer, TRUE);
- if (array->len > 0){
- int new_argc = array->len + argc;
- char **new_argv = g_new (char *, new_argc + 1);
- int j;
+ if (array->len > 0){
+ int new_argc = array->len + argc;
+ char **new_argv = g_new (char *, new_argc + 1);
+ int j;
- new_argv [0] = argv [0];
-
- /* First the environment variable settings, to allow the command line options to override */
- for (i = 0; i < array->len; i++)
- new_argv [i+1] = (char *)g_ptr_array_index (array, i);
- i++;
- for (j = 1; j < argc; j++)
- new_argv [i++] = argv [j];
- new_argv [i] = NULL;
-
- *ref_argc = new_argc;
- *ref_argv = new_argv;
- }
- g_ptr_array_free (array, TRUE);
+ new_argv [0] = argv [0];
+
+ /* First the environment variable settings, to allow the command line options to override */
+ for (i = 0; i < array->len; i++)
+ new_argv [i+1] = (char *)g_ptr_array_index (array, i);
+ i++;
+ for (j = 1; j < argc; j++)
+ new_argv [i++] = argv [j];
+ new_argv [i] = NULL;
+
+ *ref_argc = new_argc;
+ *ref_argv = new_argv;
}
+ g_ptr_array_free (array, TRUE);
+ return NULL;
+}
+
+/**
+ * mono_parse_env_options:
+ * @ref_argc: pointer to the argc variable that might be updated
+ * @ref_argv: pointer to the argv string vector variable that might be updated
+ *
+ * This function parses the contents of the `MONO_ENV_OPTIONS`
+ * environment variable as if they were parsed by a command shell
+ * splitting the contents by spaces into different elements of the
+ * @argv vector. This method supports quoting with both the " and '
+ * characters. Inside quoting, spaces and tabs are significant,
+ * otherwise, they are considered argument separators.
+ *
+ * The \ character can be used to escape the next character which will
+ * be added to the current element verbatim. Typically this is used
+ * inside quotes. If the quotes are not balanced, this method
+ *
+ * If the environment variable is empty, no changes are made
+ * to the values pointed by @ref_argc and @ref_argv.
+ *
+ * Otherwise the @ref_argv is modified to point to a new array that contains
+ * all the previous elements contained in the vector, plus the values parsed.
+ * The @argc is updated to match the new number of parameters.
+ *
+ * If there is an error parsing, this method will terminate the process by
+ * calling exit(1).
+ *
+ * An alternative to this method that allows an arbitrary string to be parsed
+ * and does not exit on error is the `api:mono_parse_options_from`.
+ */
+void
+mono_parse_env_options (int *ref_argc, char **ref_argv [])
+{
+ char *ret;
+
+ const char *env_options = g_getenv ("MONO_ENV_OPTIONS");
+ if (env_options == NULL)
+ return;
+ ret = mono_parse_options_from (env_options, ref_argc, ref_argv);
+ if (ret == NULL)
+ return;
+ fprintf (stderr, "%s", ret);
+ exit (1);
}
+
#include <config.h>
+#include <fcntl.h>
+#include <mono/metadata/assembly.h>
+#include <mono/utils/mono-mmap.h>
#include "mini.h"
-#ifndef HOST_WIN32
-#ifndef BUILDVER_INCLUDED
-#include "buildver-boehm.h"
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
#endif
+#ifdef HOST_WIN32
+# include <io.h>
+#else
+# ifndef BUILDVER_INCLUDED
+# include "buildver-boehm.h"
+# endif
#endif
/*
return mono_main (argc, argv);
}
+#define STREAM_INT(x) (*(uint32_t*)x)
+#define STREAM_LONG(x) (*(uint64_t*)x)
+
+static gboolean
+probe_embedded (const char *program, int *ref_argc, char **ref_argv [])
+{
+ MonoBundledAssembly last = { NULL, 0, 0 };
+ char sigbuffer [16+sizeof (uint64_t)];
+ gboolean status = FALSE;
+ uint64_t directory_location;
+ off_t sigstart, baseline = 0;
+ uint64_t directory_size;
+ char *directory, *p;
+ int items, i;
+ unsigned char *mapaddress = NULL;
+ void *maphandle = NULL;
+ GArray *assemblies;
+ char *entry_point = NULL;
+ char **new_argv;
+ int j;
+
+ int fd = open (program, O_RDONLY);
+ if (fd == -1)
+ return FALSE;
+ if ((sigstart = lseek (fd, -(16+sizeof(uint64_t)), SEEK_END)) == -1)
+ goto doclose;
+ if (read (fd, sigbuffer, sizeof (sigbuffer)) == -1)
+ goto doclose;
+ if (memcmp (sigbuffer+sizeof(uint64_t), "xmonkeysloveplay", 16) != 0)
+ goto doclose;
+ directory_location = GUINT64_FROM_LE ((*(uint64_t *) &sigbuffer [0]));
+ if (lseek (fd, directory_location, SEEK_SET) == -1)
+ goto doclose;
+ directory_size = sigstart-directory_location;
+ directory = g_malloc (directory_size);
+ if (directory == NULL)
+ goto doclose;
+ if (read (fd, directory, directory_size) == -1)
+ goto dofree;
+
+ items = STREAM_INT (directory);
+ p = directory+4;
+
+ assemblies = g_array_new (0, 0, sizeof (MonoBundledAssembly*));
+ for (i = 0; i < items; i++){
+ char *kind;
+ int strsize = STREAM_INT (p);
+ uint64_t offset, item_size;
+ kind = p+4;
+ p += 4 + strsize;
+ offset = STREAM_LONG(p);
+ p += 8;
+ item_size = STREAM_INT (p);
+ p += 4;
+
+ if (mapaddress == NULL){
+ mapaddress = mono_file_map (directory_location-offset, MONO_MMAP_READ | MONO_MMAP_PRIVATE, fd, offset, &maphandle);
+ if (mapaddress == NULL){
+ perror ("Error mapping file");
+ exit (1);
+ }
+ baseline = offset;
+ }
+ if (strncmp (kind, "assembly:", strlen ("assembly:")) == 0){
+ char *aname = kind + strlen ("assembly:");
+ MonoBundledAssembly mba = { aname, mapaddress + offset - baseline, item_size }, *ptr;
+ ptr = g_new (MonoBundledAssembly, 1);
+ memcpy (ptr, &mba, sizeof (MonoBundledAssembly));
+ g_array_append_val (assemblies, ptr);
+ if (entry_point == NULL)
+ entry_point = aname;
+ } else if (strncmp (kind, "config:", strlen ("config:")) == 0){
+ printf ("c-Found: %s %llx\n", kind, offset);
+ char *config = kind + strlen ("config:");
+ char *aname = g_strdup (config);
+ aname [strlen(aname)-strlen(".config")] = 0;
+ mono_register_config_for_assembly (aname, config);
+ } else if (strncmp (kind, "system_config:", strlen ("system_config:")) == 0){
+ printf ("TODO s-Found: %s %llx\n", kind, offset);
+ } else if (strncmp (kind, "options:", strlen ("options:")) == 0){
+ mono_parse_options_from (kind + strlen("options:"), ref_argc, ref_argv);
+ } else if (strncmp (kind, "config_dir:", strlen ("config_dir:")) == 0){
+ printf ("TODO Found: %s %llx\n", kind, offset);
+ } else {
+ fprintf (stderr, "Unknown stream on embedded package: %s\n", kind);
+ exit (1);
+ }
+ }
+ g_array_append_val (assemblies, last);
+
+ mono_register_bundled_assemblies ((const MonoBundledAssembly **) assemblies->data);
+ new_argv = g_new (char *, (*ref_argc)+1);
+ for (j = 0; j < *ref_argc; j++)
+ new_argv [j] = (*ref_argv)[j];
+ new_argv [j] = entry_point;
+ *ref_argv = new_argv;
+ (*ref_argc)++;
+
+ return TRUE;
+
+dofree:
+ g_free (directory);
+doclose:
+ if (!status)
+ close (fd);
+ return status;
+}
+
#ifdef HOST_WIN32
#include <shellapi.h>
int
main (void)
{
+ TCHAR szFileName[MAX_PATH];
int argc;
gunichar2** argvw;
gchar** argv;
int i;
-
+ DWORD count;
+
argvw = CommandLineToArgvW (GetCommandLine (), &argc);
argv = g_new0 (gchar*, argc + 1);
for (i = 0; i < argc; i++)
LocalFree (argvw);
+ if ((count = GetModuleFileName (NULL, szFileName, MAX_PATH)) != 0){
+ char *entry = g_utf16_to_utf8 (szFileName, count, NULL, NULL, NULL);
+ probe_embedded (entry, &argc, &argv);
+ }
+
return mono_main_with_options (argc, argv);
}
main (int argc, char* argv[])
{
mono_build_date = build_date;
-
+
+ probe_embedded (argv [0], &argc, &argv);
return mono_main_with_options (argc, argv);
}
MONO_API int mono_main (int argc, char* argv[]);
MONO_API void mono_set_defaults (int verbose_level, guint32 opts);
MONO_API void mono_parse_env_options (int *ref_argc, char **ref_argv []);
+MONO_API char *mono_parse_options_from (const char *options, int *ref_argc, char **ref_argv []);
+
MonoDomain* mini_init (const char *filename, const char *runtime_version);
void mini_cleanup (MonoDomain *domain);
MONO_API MonoDebugOptions *mini_get_debug_options (void);
return NULL;
}
+gpointer
+mono_arch_create_handler_block_trampoline (MonoTrampInfo **info, gboolean aot)
+{
+ g_assert_not_reached ();
+ return NULL;
+}
+
gpointer
mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr)
{
mono_param_get_objects
mono_parse_default_optimizations
mono_parse_env_options
+mono_parse_options_from
mono_path_canonicalize
mono_path_resolve_symlinks
mono_pe_file_open
mono_param_get_objects
mono_parse_default_optimizations
mono_parse_env_options
+mono_parse_options_from
mono_path_canonicalize
mono_path_resolve_symlinks
mono_pe_file_open