Class WasmGenerationEnvironment

java.lang.Object
com.google.j2cl.transpiler.backend.wasm.WasmGenerationEnvironment

public class WasmGenerationEnvironment extends Object
Allows mapping of middle end constructors to the backend.
  • Method Details

    • getTypeSignature

      public String getTypeSignature(com.google.j2cl.transpiler.ast.TypeDeclaration typeDeclaration)
    • getTypeSignature

      public String getTypeSignature(com.google.j2cl.transpiler.ast.TypeDescriptor typeDescriptor)
    • getWasmEmptyArrayGlobalName

      public String getWasmEmptyArrayGlobalName(com.google.j2cl.transpiler.ast.ArrayTypeDescriptor arrayTypeDescriptor)
    • getWasmItableGlobalName

      public String getWasmItableGlobalName(com.google.j2cl.transpiler.ast.DeclaredTypeDescriptor typeDescriptor)
      Returns the name of the global that stores the itable for a Java type.
    • getWasmItableGlobalName

      public String getWasmItableGlobalName(com.google.j2cl.transpiler.ast.TypeDeclaration typeDeclaration)
      Returns the name of the global that stores the itable for a Java type.
    • getWasmVtableTypeName

      public String getWasmVtableTypeName(com.google.j2cl.transpiler.ast.DeclaredTypeDescriptor typeDescriptor)
      Returns the name of the wasm type of the vtable for a Java type.
    • getWasmVtableTypeName

      public String getWasmVtableTypeName(com.google.j2cl.transpiler.ast.TypeDeclaration typeDeclaration)
      Returns the name of the wasm type of the vtable for a Java type.
    • getWasmItableTypeName

      public String getWasmItableTypeName(com.google.j2cl.transpiler.ast.TypeDeclaration typeDeclaration)
      Returns the name of the wasm type of the itable for a Java type.
    • getWasmItableInterfaceGetter

      public String getWasmItableInterfaceGetter(com.google.j2cl.transpiler.ast.TypeDeclaration typeDeclaration)
      Returns the name of the itable interface getter.
    • getWasmItableInterfaceGetter

      public String getWasmItableInterfaceGetter(String fieldName)
      Returns the name of the itable interface getter.
    • getWasmInterfaceVtableGlobalName

      public String getWasmInterfaceVtableGlobalName(com.google.j2cl.transpiler.ast.TypeDeclaration ifce, com.google.j2cl.transpiler.ast.TypeDeclaration inClass)
      Returns the name of the global that stores the vtable for a Java type.
    • getWasmVtableGlobalName

      public String getWasmVtableGlobalName(com.google.j2cl.transpiler.ast.DeclaredTypeDescriptor typeDescriptor)
      Returns the name of the global that stores the vtable for a Java type.
    • getWasmVtableGlobalName

      public String getWasmVtableGlobalName(com.google.j2cl.transpiler.ast.TypeDeclaration typeDeclaration)
      Returns the name of the global that stores the vtable for a Java type.
    • getVtableFieldName

      public String getVtableFieldName(com.google.j2cl.transpiler.ast.MethodDescriptor methodDescriptor)
      Returns the name of the field in the vtable that corresponds to methodDescriptor.
    • getMethodImplementationName

      public String getMethodImplementationName(com.google.j2cl.transpiler.ast.MethodDescriptor methodDescriptor)
      Returns the name of the global function that implements the method.

      Note that these names need to be globally unique and are different than the names of the slots in the vtable which maps nicely to our concept of mangled names.

    • registerDataSegmentLiteral

      public boolean registerDataSegmentLiteral(com.google.j2cl.transpiler.ast.ArrayLiteral arrayLiteral, String typeQualifiedName)
      Registers the ArrayLiteral as a data segment and returns true if it was not present.
    • getDataElementNameForLiteral

      public String getDataElementNameForLiteral(com.google.j2cl.transpiler.ast.ArrayLiteral arrayLiteral)
      Returns the data segment index for this literal and null if it does not have one.
    • getJsImports

      public JsImportsGenerator.Imports getJsImports()
    • getJsMethodImport

      public com.google.j2cl.transpiler.backend.wasm.JsMethodImport getJsMethodImport(com.google.j2cl.transpiler.ast.MethodDescriptor methodDescriptor)
    • isJsImport

      public boolean isJsImport(com.google.j2cl.transpiler.ast.Method method)