* test-cattr-1.il: New. Test for custom attributes on return type of
a method.
In ilasm/codegen:
* MethodDef.cs (MethodDef): Use a ParamDef for return type, instead of a
BaseTypeRef.
(MethodDef.ctor): Update.
(MethodDef.AddParamDefaultValue): Remove.
(MethodDef.GetParam): Likewise.
(MethodDef.Resolve): Update to use ret_param instead of ret_type.
In ilasm/errors:
* err-cattr.il: New.
In ilasm/parser:
* ILParser.jay (method_decl | D_PARAM ..): Param index is zero-based,
with zero representing the return value.
Update to check CurrentCustomAttrTarget for null before using it.
In class/PEAPI:
* PEAPI.cs (PEFile.AddMethod): Add overload for return type as Param
instead of PEAPI.Type .
* Metadata.cs (MetaDataElement.HasCustomAttr): New. Temporary hack.
(Param.HasMarshalInfo): New.
(ClassDef.AddMethod): Add overload for return type as Param.
(MethodDef.ctor): Change internal .ctor's sig to take Param instead of
PEAPI.Type for return type.
(MethodDef.retType): Remove.
(MethodDef.TypeSig): Update to use ret_param always.
(MethodDef.BuildTables): Add ret_param to Param table only if it has
marshal info or custom attributes.
svn path=/trunk/mcs/; revision=61358
In ilasm/tests:
* test-perm_pass-3.il: New. Test for 2.0 style declarative security
attributes.
In ilasm/codegen:
* PermissionSet.cs: New.
* Permission.cs: New.
* PermissionMember.cs: New. Classes for 2.0 metadata format of
declarative security.
* DeclSecurity.cs (DeclSecurity.AddPermissionSet): New. Overload for new
PermissionSet class.
(DeclSecurity.AddTo): Add new style PermissionSets also.
* CodeGen.cs (CodeGen.AddPermisson): Handle new PermissionSets also.
* ExternTable.cs (ExternAssembly.AssemblyName): New.
In ilasm/scanner:
* ILTables.cs (keywords): Move 'property' out of NET_2_0 .
In ilasm/parser:
Add support or 2.0 style declarative security attributes.
* ILParser.jay (primitive_type): New. Extracted from 'type'.
(field_init_primitive): New. Extracted from 'field_init', with all
primitive types.
(sec_decl | ..): New rule for 2.0 style permissions.
(permissions):
(permission):
(permission_members):
(permission_member):
(perm_mbr_nameval_pair):
(prop_or_field): New rules for 2.0 style permissions.
(AddSecDecl): New.
In class/PEAPI:
* Metadata.cs (DeclSecurity): Rename to ..
(BaseDeclSecurity): .. this.
(DeclSecurity): New. Derive from BaseDeclSecurity.
(DeclSecurity_20): Likewise. For 2.0 style declaritive security.
(PermissionSet): New.
(Permission): New.
(PermissionMember): New.
(MetaData.AddDeclSecurity): Update to use BaseDeclSecurity.
(MetaData.BuildMetaData): Likewise.
* PEAPI.cs (PEFile.AddDeclSecurity): New overload for new PermissionSet
class.
svn path=/trunk/mcs/; revision=61158
In ilasm/codegen:
2006-02-20 Ankit Jain <[email protected]>
* *.cs: Update all .cs files to use Report.Error instead of directly
throwing an exception.
* CodeGen.cs (CodeGen.ctor): Remove 'report' param, and the related
field & property.
In ilasm:
2006-02-20 Ankit Jain <[email protected]>
* Report.cs (Report): Make all methods,fields static.
(Report.Error): Update to throw ILAsmException.
(ILAsmException): New.
(InternalErrorException): New. Derive from ILAsmException.
* Driver.cs (Driver.Run): Catch ILAsmException and PEFileException and
print error messages instead of dumping the stack trace, and delete the
output file if CodeGen.Write() fails.
Move the check for entrypoint from CodeGen.Write to here.
In ilasm/scanner:
2006-02-20 Ankit Jain <[email protected]>
* ILTokenizingException.cs (ILTokenizingException): Derive from
ILAsmException.
In ilasm/parser:
2006-02-20 Ankit Jain <[email protected]>
* ILParser.jay: Update to use Report.Error instead of directly throwing
an exception.
In class/PEAPI:
2006-02-20 Ankit Jain <[email protected]>
* PEAPI.cs (PEFileException): Update error message.
* Metadata.cs: Update to throw PEFileException instead of Exception.
svn path=/trunk/mcs/; revision=57063
* ILParser.jay (type | BANG ..): Move !* and !!* rules to ..
(generic_class_ref): ..this, to allow using VAR/MVARs as class refs.
Eg. "extends !0"
In class/PEAPI:
* Metadata.cs (GenParam): Don't use GetTypeSpec to create typespec for GenParam.
Adding required methods directly to GenParam.
* PEAPI.cs (PEFile.AddGenericParam): Add it to the TypeSpec table directly.
svn path=/trunk/mcs/; revision=55306
* GenericTypeRef.cs: Rename to ..
* GenericParamRef.cs: .. this.
(IGenericTypeRef): New.
(GenericParamRef): Implement IGenericTypeRef.
* GenericTypeInst.cs (GenericTypeInst): Implement IGenericTypeRef instead
of IClassRef.
(GenericTypeInst.ResolveOnly): Rename to ResolveNoTypeSpec to implement
IGenericTypeRef.ResolveNoTypeSpec .
* MethodDef.cs (MethodDef.ResolveGenParams): Update to use GenericParamRef.
* Local.cs (Local.GetPeapiLocal): Use IGenericTypeRef.
In ilasm:
* ilasm.exe.sources: Replace GenericTypeRef.cs with GenericParamRef.cs
In ilasm/parser:
* ILParser.jay: Update to use GenericParamRef instead of GenericTypeRef.
In class/PEAPI:
* PEAPI.cs (PEFile.AddGenricParam): New. Adds a GenParam to the TypeSpec
table.
* Metadata.cs (GenParam): Inherit from 'Class' instead of 'Type'.
(GenParam.name): Rename to param_name as it hides Class.name .
(GenParam.GetTypeSpec): Override to create TypeSpec for genparam.
svn path=/trunk/mcs/; revision=55238
* IClassRef.cs (IClassRef.Clone): New.
(IClassRef.GetGenericTypeInst): Get the Generic Instance of the IClassRef.
(IClassRef.ResolveInstance): Resolves the generic instance and returns the
resolved PEAPI type.
* TypeRef.cs:
* ExternTypeRef.cs: Implement new methods of IClassRef.
Classes implementing IClassRef cache their generic instances (GenericTypeInst)
and their corresponding resolved PEAPI types.
* CodeGen.cs (CodeGen.GetTypeRef): Gets a TypeRef given a type name and caches them.
GenericTypeInst is now used for any Generic Type Instance, including any
extern types. ExternTypeRefInst is not used now.
* GenericTypeInst.cs (GenericTypeInst): Implement IClassRef instead of ITypeRef.
(GenericTypeInst.ResolveAsClass): Adds the instance to the TypeSpec table after Resolve()'ing it.
Clone () returns a cloned instance which shares its class_ref and generic arguments.
* TypeDef.cs (TypeDef.Define): Use ResolveAsClass for base class and interfaces
being implemented if they are GenericTypeInsts.
In ilasm:
* ilasm.exe.sources: Remove ExternTypeRefInst from build.
In ilasm/parser:
* ILParser.jay (GetTypeRef): Use new IClassRef.Clone .
(extends_clause): Use new IClassRef.GetGenericTypeInst.
(impl_clause | K_IMPLEMENTS class_refs): Remove.
(impl_clause | impl_class_refs): New.
(impl_class_refs): New. Add rules for generic and non-generic interface
implementations.
(class_ref | slashed_name): Use new codegen.GetTypeRef so that the TypeRef
gets cached.
(type | K_CLASS class_ref): Add typars_clause to the rule and handle accordingly.
(type | K_VALUETYPE ...): Likewise.
In class/PEAPI:
* PEAPI.cs (PEFile.AddGenericClass): New. Adds a GenericTypeInst to the TypeSpec table.
* Metadata.cs (GenericTypeInst): Change base class from 'Type' to 'Class'.
(GenericTypeInst.GetTypeSpec):
(GenericTypeInst.BuildTables):
(GenericTypeInst.Size):
(GenericTypeInst.Write):
(GenericTypeInst.GetCodedIx): Implement these for GenericTypeInst.
(ClassDef.SetSuper): Set typeIndexChecked to false if 'super' is not GenericTypeInst.
Fixup of typeIndex is not required for GenericTypeInst .
(ClassDef.CheckTypeIndex): Recursively fix typeIndex if superType is ClassDef.
(MetaData.BuildMetaData): BuildTable for TypeSpec.
svn path=/trunk/mcs/; revision=55094
2005-12-09 Ankit Jain <[email protected]>
* ITypeRef.cs (ITypeRef.GetMethodRef): Add 'gen_param_count' param.
* Sentinel.cs (Sentinel.GetMethodRef): Update.
* GlobalMethodRef.cs (GlobalMethodRef.ctor): Add 'gen_param_count' param.
(GlobalMethodRef.Resolve): Update usage of MethodDef.CreateSignature .
* TypeDef.cs (TypeDef.GetGenericParamNum): New.
(TypeDef.DefineContents): Update usage of ITypeRef.GetMethodRef .
* ExternTypeRefInst.cs (ExternTypeRefInst.ctor): Add parameter for list of type
parameters (type_list).
(ExternTypeRefInst.Clone): Clone type_list also.
(ExternTypeRefInst.Resolve): Resolve the list of type parameters, and create
instance of PEAPI.GenericTypeInst instead of PEAPI.ClassRefInst .
(ExternTypeRefInst.GetMethodRef): Update.
* GenericTypeInst.cs (GenericTypeInst.GetMethodRef): Update signature. Update
usage of TypeSpecMethodRef.ctor .
* MethodRef.cs (MethodRef.ctor): Add 'gen_param_count' param.
(MethodRef.Resolve): Throw exception for non-existant owner. Update usage of
MethodDef.CreateSignature .
* ExternMethodRef.cs (ExternMethodRef.ctor): Add 'gen_param_count' param.
(ExternMethodRef.Resolve): Update usage of PEFile.AddMethodToTypeSpec and .AddMethod
* GenericMethodRef.cs (GenericMethodRef.PeapiMethod): Return PEAPI.Method obtained in
.Resolve .
* GenericTypeRef.cs (GenericTypeRef.GetMethodRef): Update.
* MethodPointerTypeRef.cs (MethodPointerTypeRef.GetMethodRef): Likewise.
* TypeSpecMethodRef.cs (TypeSpecMethodRef.ctor): Add 'gen_param_count' param.
(TypeSpecMethodRef.Resolve): Update usage of PEFile.AddMethodToTypeSpec .
* MethodDef.cs (MethodDef.ctor): Add 'typars_list' param.
(MethodDef.AddGenericParam): Replace ..
(MethodDef.AddGenericParams): .. with this.
(MethodDef.GenParamCount): New.
(MethodDef.GetGenericParamNum): New. Returns index for a given method type parameter name.
(MethodDef.ResolveGenParams): Resolves type parameter names in the parameter
list to their corresponding indices.
(MethodDef.ResolveGenParam): Resolves a give type parameter to its corresponding
index.
(MethodDef.CreateSignature): Add 'gen_param_count' param.
* TypeRef.cs (TypeRef.GetMethodRef): Update.
* ExternTypeRef.cs (ExternTypeRef.GetMethodRef): Likewise.
* PrimitiveTypeRef.cs (PrimitiveTypeRef.GetMethodRef): Likewise.
In ilasm/parser:
2005-12-09 Ankit Jain <[email protected]>
* ILParser.jay (class_decl | D_OVERRIDE ..): Update usage of ITypeRef.GetMethodRef
and MethodDef.CreateSignature .
(method_head | D_METHOD ..): Update usage of MethodDef.ctor .
Use MethodDef.ResolveGenParams to resolve VARs/MVARs in parameter list.
(type | K_CLASS slashed_name ..): Remove redundant rule.
(type | BANG id): New. Generic type parameter.
(type | BANG BANG id): New. Generic method type parameter.
(instr | INSTR_FIELD type ..): Resolve generic param for 'type'.
(method_ref | call_conv ..): Set MethodRef's GenParamCount.
(method_ref | call_conv type ..): Update usage of TypeSpecMethodRef.ctor and GetMethodRef.
(method_ref | call_conv type ..): New. Rule for global generic method refs.
(custom_type | call_conv ..): Update usage of GlobalMethodRef.ctor .
In class/PEAPI:
2005-12-09 Ankit Jain <[email protected]>
* Metadata.cs (Method.ctor): Remove rType parameter.
(Method.GetRetType): Remove.
(Method.AddCallConv): Make it abstract.
(Method.GetSigIx): Likewise.
(MethodDef): Override and implement abstract methods from Method class.
(MethodRef): Likewise.
(MethodSpec): Change base class from MetaDataElement to Method. Override
abstract methods from Method but throw Exception as they are not meant to be used here.
(MethodDef.TypeSig): Write gen_param_count before num of params.
(ClassRef.AddMethod): New overload with an extra gen_param_count param.
* PEAPI.cs (PEFile.AddMethodToTypeSpec): New overload with an extra gen_param_count
param.
(PEFile.AddMethodSpec): Change return type from void to Method.
svn path=/trunk/mcs/; revision=54160
(FileImage.WritePEHeader): Write stackReserve instead of the default value.
(PEFile.SetStackReserve): Set stack reserve for fileImage.
svn path=/trunk/mcs/; revision=49698
Class[].
(MSCorLib.ctor): Add assembly ref to mscorlib for non-mscorlib assemblies
only.
(MSCorLib.AddClass): Use Class instead of ClassRef.
(MSCorLib.GetSpecialClass): Change return type to Class from ClassRef.
Don't instantiate object of SystemClass if this assembly is mscorlib.
(MSCorLib.SetSpecialSystemClass): New. Set a System.* class for primitive
types, used for compiling mscorlib.
(MSCorLib.GetValueClass): Change to handle new type of systemClasses.
(MSCorLib.ValueType),
(MSCorLib.EnumType): Don't instantiate ClassRef if this assembly is mscorlib.
(ClassDef.ctor): Don't superType to System.Object for System.Object and <Module>.
(ClassDef.MakeValueClass): Set typeIndex to ValueType's typeIndex.
(ClassDef.IsValueType),
(ClassDef.IsEnum): Use "==" instead of .CompareTo for string comparison.
(ClassDef.AddNestedClass): Set typeIndexChecked = true for the nested class.
(PEFile.isMSCorlib): New. bool field.
(PEFile.ctor): Move all ctor logic into one overload and call that from others.
(PEFile.ctor): Add outputDir parameter.
(PEFile.SetName): Set name of the assembly and set isMSCorlib accordingly.
(PEFile.IsMSCorlib): New. bool Property.
(PEFile.AddClass): Call overload.
(PEFile.AddClass): Set superType and SetSpecialSystemClass if compiling mscorlib.
(PEFile.AddValueClass): Call MakeValueClass only if the class is not System.ValueType
or System.Enum itself, else set the supertype correctly.
svn path=/trunk/mcs/; revision=48736
(ParamAttr): Move HasDefault and HasFieldMarshal from Param to this.
(ManifestResource.ctor): Use 'mres' param to clone.
(MethodDef.ret_param): New.
(MethodDef.AddRetTypeMarshallInfo): New.
(MethodDef.TypeSig): Set seqNo for ret_param to zero.
(MethodDef.BuildTables): Add ret_param to Param table, and BuildTables
for it.
(FixedSysString): New. Class to represent Fixed SysString native type.
(NativeArray): Rename len to numElem. Init numElem, parNum and elemMult
to -1.
(NativeArray.ctor): Uncomment ctor with one param (elemType).
(NativeArray.ctor): Move ctor logic to the one with all params.
(NativeArray.ToBlob): Emit values in correct order.
(SafeArray.hasElemType): New. bool var to indicate presence of ElemType.
(SafeArray.ctor): New. Parameterless constructor.
(SafeArray.ToBlob): Emit correctly.
(FixedArray.ctor): Remove elemType param.
(FixedArray.ToBlob): Don't emit elemType.
svn path=/trunk/mcs/; revision=48409
2005-08-08 Ankit Jain <[email protected]>
* CodeGen.cs (CodeGen.entry_point): New bool field.
(CodeGen.HasEntryPoint): New. Property to mark that the assembly
has an entrypoint.
(CodeGen.Write): Throw Exception if an EXE has been requested but the
source file has no entrypoint defined.
In ilasm/parser:
2005-08-08 Ankit Jain <[email protected]>
* ILParser.jay (method_decl | D_ENTRYPOINT): Set codegen.HasEntryPoint
to true.
In class/PEAPI:
2005-08-08 Ankit Jain <[email protected]>
* PEAPI.cs (FileImage.WriteCLIHeader): Move the check for no entrypoint
in case of an EXE to ilasm/codegen/CodeGen.cs to avoid creating unnecessary
.exe.
svn path=/trunk/mcs/; revision=48097
(MethAttr): Likewise.
(SecurityAction): New enum.
(DeclSecurity.ctor): Add 'byte []' as the third parameter.
(DeclSecurity.BuildTables): Write the byte array to the blob.
(MetaData.AddDeclSecurity): Add DeclSecurity to declsec_list.
(MetaData.BuildMetaData): Call BuildTables for declsec_list members.
(PEFile.AddDeclSecurity): New. Add DeclSecurity to metaData.
svn path=/trunk/mcs/; revision=48028
2005-04-18 Ankit Jain <[email protected]>
* PEAPI.cs (ManifestResource.InitResource): New. Used by constructors
to initialize the resource.
(ManifestResource.ctor): New. Constructor to accept resource as a
byte array.
(ManifestResource.ctor): New. Constructor to accept an object of self.
(ManifestResource.BuildTables): Update.
(MetaData.AddResource): New. Add the resource to the list, adjust
resourcesSize.
(MetaData.WriteResource): New. Write resources to the FileImage.
(PEFile.AddExternalManagedResource): New. Add a new resource.
(PEFile.GetResource): New. Get resource by name.
(PEFile.GetResources): New. Get array of resources.
In ilasm/codegen:
2005-04-18 Ankit Jain <[email protected]>
* CodeGen.cs (CodeGen.AddManifestResource): Add a
ManifestResource to manifestResources ArrayList.
(CodeGen.Write): Add all resources to the pefile.
In ilasm/parser:
2005-04-18 Ankit Jain <[email protected]>
* ILParser.jay (manifestres_head): Read resource file and
add ManifestResource with CodeGen.
(manres_attr): Set visibility flag of the resource.
svn path=/trunk/mcs/; revision=43182
2005-04-08 Ankit Jain <[email protected]>
* MethodDef.cs (named_param_table, CreateNamedParamTable): Remove.
(GetNamedParamPos): Implement using a linear scan.
* TypeDef.cs (TypeDef): Initialize 'is_enum_class'.
(Define): Set 'is_value_class' or 'is_enum_class' depending on
whether the parent is System.ValueType or System.Enum. Update to
changes in PEAPI.cs.
In ilasm/parser:
2005-04-08 Ankit Jain <[email protected]>
* ILParser.jay (type): When parsing K_VALUETYPE, mark the typeref
as a value type.
(field_init): The float32 and float64 constructor argument is
the hex representation, not the integer equivalent value.
In class/PEAPI:
2005-04-08 Ankit Jain <[email protected]>
* PEAPI.cs (MSCorLib.GetSpecialClass): Don't encode
System.ValueType and System.Enum as value types.
(ValueClass): New enum.
(Class.MakeValueClass): Add a 'ValueClass' parameter.
(ClassDef.MakeValueClass): Set supertype to ValueType or Enum
according to ValueClass parameter.
(IsValueType,IsEnum): New. Test if type is System.ValueType or
System.Enum.
(ClassDef.AddNestedClass): Don't encode System.ValueType and
System.Enum as value types.
svn path=/trunk/mcs/; revision=42684
now.
Fixes the code for ParamAttr.Opt. Fix bug #73517.
ilasm/codegen/MethodDef.cs: Added method AddParamDefaultValue
for adding DefaultValue to a method parameter.
ilasm/codegen/ParamDef.cs: Added method AddDefaultValue and
handling of
default value.
ilasm/parser/ILParser.jay(method_decl): Add default value for
a method param.
Patches by Ankit Jain
svn path=/trunk/mcs/; revision=42483
* PEAPI.cs: Added support for allocating and storing strongname
signatures when a .publickey directive is present in source. Fix bug
#69721.
svn path=/trunk/mcs/; revision=37383
the code was like that and finally realized today that it was like
that because it was wrong. Wait until the opportune momement to
calculate the index sizes (after everything has been added to the
streams, and before writing anything).
svn path=/trunk/mcs/; revision=31348
ClassRefs. This way modified types can be used. I am having alot
of trouble remembering why I actually even need this class
though.
svn path=/trunk/mcs/; revision=31329
checking the byte hashtable for duplicate entries actually
works. Old method was valid but created larger then needed
binaries.
svn path=/trunk/mcs/; revision=31088
can ensure they are emitted no matter what table they are
in. Previously not all custom attributes were getting emitted.
svn path=/trunk/mcs/; revision=30882
that sequentially laid out fields are laid out in the right
order. When building custom attribute tables actually emit the
custom attribute data. When writing the .sdata section make sure
to pad to its size. The constants itself will not make up the
entire section because it is aligned on 512 byte blocks.
svn path=/trunk/mcs/; revision=30458