Mutates member
adding CLR attributes (if any) based on sym.
Mutates member
adding CLR attributes (if any) based on sym.annotations.
Please notice that CLR custom modifiers are a different beast (see customModifiers below)
and thus shouldn't be added by this method.
Form of the custom Attribute parameter (Ecma-335.
Form of the custom Attribute parameter (Ecma-335.pdf)
1: Prolog (unsigned int16, value 0x0001) -> symtab[0] = 0x01, symtab[1] = 0x00 2: FixedArgs (directly the data, get number and types from related constructor) 2.1: length of the array (unsigned int32, 4 bytes, least significant first) 2.2: the byte array data 3: NumNamed (unsigned int16, number of named fields and properties, 0x0000)
Compute the indexes of each local variable of the given method.
When emitting the code (genBlock), the number of currently active try / catch blocks.
When emitting the code (genBlock), the number of currently active try / catch
blocks. When seeing a RETURN' inside a try / catch, we need to
- store the result in a local (if it's not UNIT)
- emit
Leave handlerReturnLabel instead of the Return
- emit code at the end: load the local and return its value
What's a CLR custom modifier? Intro available as source comments in compiler.
What's a CLR custom modifier? Intro available as source comments in compiler.msil.CustomModifier. It's basically a marker associated with a location (think of FieldInfo, ParameterInfo, and PropertyInfo) and thus that marker (be it optional or required) becomes part of the signature of that location. Some annotations will become CLR attributes (see addAttributes above), others custom modifiers (this method).
For try/catch nested inside a finally, we can't use Leave OutsideFinally
, the
Leave target has to be inside the finally (and it has to be the endfinally
instruction).
For try/catch nested inside a finally, we can't use Leave OutsideFinally
, the
Leave target has to be inside the finally (and it has to be the endfinally
instruction).
So for every finalizer, we have a label which marks the place of the endfinally
,
nested try/catch blocks will leave there.
the BasicBlock to emit code for
the following BasicBlock, null
if block
is the last one
Get an MSIL type from a symbol.
Get an MSIL type from a symbol. First look in the clrTypes.types map, then lookup the name using clrTypes.getType
Returns a Triple (Boolean, Boolean, Option[Label])
Returns a Triple (Boolean, Boolean, Option[Label])
endfinally
. Some(label) to emit leave label
(for try / catch inside a finally handler)
cut&pasted from GenJVM
Special linearizer for methods with at least one exception handler.
Special linearizer for methods with at least one exception handler. This linearizer brings all basic blocks in the right order so that nested try-catch and try-finally blocks can be emitted.
Return the a name of this symbol that can be used on the .
Return the a name of this symbol that can be used on the .NET platform. It removes spaces from names.
Special handling: scala.All and scala.AllRef are 'erased' to scala.All$ and scala.AllRef$. This is needed because they are not real classes, and they mean 'abrupt termination upon evaluation of that expression' or 'null' respectively. This handling is done already in GenICode, but here we need to remove references from method signatures to these types, because such classes can not exist in the classpath: the type checker will be very confused.
MSIL bytecode generator.