Giter VIP home page Giter VIP logo

mariana's Introduction

Mariana

An ActionScript 3 runtime and bytecode-to-IL compiler for .NET, implemented in C#.

.NET platform support

This project targets .NET Standard 2.1, which is compatible with .NET Core 3.0, Mono 6.4 and some other platforms.

.NET Framework is not supported.

The runtime dynamically compiles ActionScript 3 bytecode into IL, so it will not work on AOT-only platforms (such as iOS).

Usage

Sample usage code is available here.

Features

  • Full implementation of the ActionScript Virtual Machine 2 specification.
  • Run-time performance of AS3 code is comparable to equivalent C# code when everything is statically typed (no untyped variables or dynamic property access).
  • Attribute based API for exposing .NET classes to AS3.
  • Supports all ActionScript 3 top-level classes and functions.
  • Full support for E4X (ECMAScript for XML).
  • Supports AVM2 global memory instructions (used by code compiled with Alchemy/CrossBridge).

API documentation

API documentation can be generated using the generateApiDocs.py Python script. This requires docfx to be installed.

Component index

Building

Build with dotnet build -c config where config is either Debug (for debug build) or Release (for release build).

Running tests

Run dotnet test when in a test project directory.

To run specific test classes or methods, pass a --filter argument.

Caution: Some tests are long running

mariana's People

Contributors

jfd16 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mariana's Issues

System.TypeInitializationException: The type initializer for 'Mariana.CodeGen.TypeSignature' threw an exception. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.

Hello, I tried to use Mariana with Mono x64

var domain = new ApplicationDomain();
var loader = domain.createScriptLoader();

And got an error:

System.TypeInitializationException: The type initializer for 'Mariana.CodeGen.TypeSignature' threw an exception. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at Mariana.Common.ReferenceDictionary`2[TKey,TValue].getValueRef (TKey key, System.Boolean createIfNotExists) [0x001a4] in <cc2e8d4f9c6949a2bc4d71339b5ea90d>:0
  at Mariana.Common.ReferenceDictionary`2[TKey,TValue].set_Item (TKey key, TValue value) [0x00000] in <cc2e8d4f9c6949a2bc4d71339b5ea90d>:0
  at Mariana.CodeGen.TypeSignature..cctor () [0x000d5] in <c09d1fe0ee5649bc956390c8abb3bbf4>:0
   --- End of inner exception stack trace ---
  at Mariana.CodeGen.TypeBuilder..ctor (Mariana.CodeGen.TypeName name, System.Reflection.TypeAttributes attrs, System.Boolean isValueType, System.Int32 genParamCount, Mariana.CodeGen.MetadataContext metadataContext, System.Reflection.Metadata.EntityHandle handle) [0x00050] in <c09d1fe0ee5649bc956390c8abb3bbf4>:0
  at Mariana.CodeGen.AssemblyBuilder.defineType (Mariana.CodeGen.TypeName name, System.Reflection.TypeAttributes attrs, System.Boolean isValueType, System.Int32 genParamCount) [0x000c4] in <c09d1fe0ee5649bc956390c8abb3bbf4>:0
  at Mariana.AVM2.Compiler.EmitConstantData..ctor (Mariana.AVM2.Core.ApplicationDomain domain, Mariana.CodeGen.AssemblyBuilder assembly) [0x0009c] in <6b026edf6062485896980f8dde41b4f4>:0
  at Mariana.AVM2.Compiler.ScriptCompileContext._initAssemblyBuilder () [0x00087] in <6b026edf6062485896980f8dde41b4f4>:0
  at Mariana.AVM2.Compiler.ScriptCompileContext..ctor (Mariana.AVM2.Core.ApplicationDomain domain, Mariana.AVM2.Compiler.ScriptCompileOptions options) [0x00170] in <6b026edf6062485896980f8dde41b4f4>:0
  at Mariana.AVM2.Compiler.ScriptLoader..ctor (Mariana.AVM2.Core.ApplicationDomain appDomain, Mariana.AVM2.Compiler.ScriptCompileOptions compileOptions) [0x00014] in <6b026edf6062485896980f8dde41b4f4>:0
  at Mariana.AVM2.Core.ApplicationDomain.createScriptLoader (Mariana.AVM2.Compiler.ScriptCompileOptions compileOptions) [0x00028] in <6b026edf6062485896980f8dde41b4f4>:0
  at MarianaTest.Program.Main (System.String[] args) [0x00008] in <c6f2dbc68fda4bef8cb2dfe5dbe6a2f2>:0
[ERROR] FATAL UNHANDLED EXCEPTION: System.TypeInitializationException: The type initializer for 'Mariana.CodeGen.TypeSignature' threw an exception. ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
  at Mariana.Common.ReferenceDictionary`2[TKey,TValue].getValueRef (TKey key, System.Boolean createIfNotExists) [0x001a4] in <cc2e8d4f9c6949a2bc4d71339b5ea90d>:0
  at Mariana.Common.ReferenceDictionary`2[TKey,TValue].set_Item (TKey key, TValue value) [0x00000] in <cc2e8d4f9c6949a2bc4d71339b5ea90d>:0
  at Mariana.CodeGen.TypeSignature..cctor () [0x000d5] in <c09d1fe0ee5649bc956390c8abb3bbf4>:0
   --- End of inner exception stack trace ---
  at Mariana.CodeGen.TypeBuilder..ctor (Mariana.CodeGen.TypeName name, System.Reflection.TypeAttributes attrs, System.Boolean isValueType, System.Int32 genParamCount, Mariana.CodeGen.MetadataContext metadataContext, System.Reflection.Metadata.EntityHandle handle) [0x00050] in <c09d1fe0ee5649bc956390c8abb3bbf4>:0
  at Mariana.CodeGen.AssemblyBuilder.defineType (Mariana.CodeGen.TypeName name, System.Reflection.TypeAttributes attrs, System.Boolean isValueType, System.Int32 genParamCount) [0x000c4] in <c09d1fe0ee5649bc956390c8abb3bbf4>:0
  at Mariana.AVM2.Compiler.EmitConstantData..ctor (Mariana.AVM2.Core.ApplicationDomain domain, Mariana.CodeGen.AssemblyBuilder assembly) [0x0009c] in <6b026edf6062485896980f8dde41b4f4>:0
  at Mariana.AVM2.Compiler.ScriptCompileContext._initAssemblyBuilder () [0x00087] in <6b026edf6062485896980f8dde41b4f4>:0
  at Mariana.AVM2.Compiler.ScriptCompileContext..ctor (Mariana.AVM2.Core.ApplicationDomain domain, Mariana.AVM2.Compiler.ScriptCompileOptions options) [0x00170] in <6b026edf6062485896980f8dde41b4f4>:0
  at Mariana.AVM2.Compiler.ScriptLoader..ctor (Mariana.AVM2.Core.ApplicationDomain appDomain, Mariana.AVM2.Compiler.ScriptCompileOptions compileOptions) [0x00014] in <6b026edf6062485896980f8dde41b4f4>:0
  at Mariana.AVM2.Core.ApplicationDomain.createScriptLoader (Mariana.AVM2.Compiler.ScriptCompileOptions compileOptions) [0x00028] in <6b026edf6062485896980f8dde41b4f4>:0
  at Test.Program.Main (System.String[] args) [0x00008] in <c6f2dbc68fda4bef8cb2dfe5dbe6a2f2>:0

Unhandled exception. System.ArgumentException: The key 'class Parent' does not exist in the dictionary. (Parameter 'key')

Hello, experimented with inheritance and got an error

Unhandled exception. System.ArgumentException: The key 'class Parent' does not exist in the dictionary. (Parameter 'key')
   at Mariana.Common.ReferenceDictionary`2.getValueRef(TKey key, Boolean createIfNotExists) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.Common\src\ReferenceDictionary.cs:line 162
   at Mariana.Common.ReferenceDictionary`2.get_Item(TKey key) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.Common\src\ReferenceDictionary.cs:line 74
   at Mariana.AVM2.Compiler.ScriptCompileContext._createClassDefIfInContext(Class klass) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Compiler\ScriptCompileContext.cs:line 512
   at Mariana.AVM2.Compiler.ScriptCompileContext._createClassDefIfInContext(Class klass) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Compiler\ScriptCompileContext.cs:line 540
   at Mariana.AVM2.Compiler.ScriptCompileContext.compileFile(ABCFile file) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Compiler\ScriptCompileContext.cs:line 249
   at Mariana.AVM2.Compiler.ScriptLoader.compile(ABCFile abcFile) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Compiler\ScriptLoader.cs:line 68

Example code:

// Parent.as
public class Parent {}
// Child.as
public class Child extends Parent {}

// Main.as
public class Main
{
    public static function main():void 
    {
        new Child();
    }
}

Error when instantiating objects

After fix #2 I tried to run this example:

// Test.as
public class Test { }

// Main.as
public class Main
{
   public static function main():void 
   {
      new Test();
   }	
}

And got an error:

Process terminated. Assertion failed.
   at Mariana.AVM2.Core.MethodTrait.get_underlyingMethodInfo() in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Core\MethodTrait.cs:line 51
   at Mariana.AVM2.Core.RuntimeDispatch.generateMethodStub(MethodTrait method) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Core\RuntimeDispatch.cs:line 209
   at Mariana.AVM2.Core.MethodTrait.<.ctor>b__10_0() in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Core\MethodTrait.cs:line 39
   at Mariana.Common.LazyInitObject`1._internalGetValue() in E:\Work\Programing\NetProjects\Mariana-main\Mariana.Common\src\LazyInitObject.cs:line 179
   at Mariana.AVM2.Core.MethodTrait.tryInvoke(ASAny target, ASAny receiver, ReadOnlySpan`1 args, ASAny& result) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Core\MethodTrait.cs:line 226
   at Mariana.AVM2.Core.Trait.invoke(ASAny target, ASAny receiver, ReadOnlySpan`1 args) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Core\Trait.cs:line 225
   at Mariana.AVM2.Core.Trait.invoke(ASAny target, ReadOnlySpan`1 args) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Core\Trait.cs:line 214
   at Mariana.AVM2.Core.Trait.invoke(ReadOnlySpan`1 args) in E:\Work\Programing\NetProjects\Mariana-main\Mariana.AVM2\src\Core\Trait.cs:line 251

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.