Refactoring

This commit is contained in:
Alexey Andreev 2016-08-20 14:17:03 +03:00
parent 7679d12888
commit 9fb97fd53f
206 changed files with 898 additions and 603 deletions

View File

@ -24,7 +24,7 @@ import java.util.ServiceLoader;
import org.teavm.classlib.impl.lambda.LambdaMetafactorySubstitutor; import org.teavm.classlib.impl.lambda.LambdaMetafactorySubstitutor;
import org.teavm.classlib.impl.unicode.CLDRReader; import org.teavm.classlib.impl.unicode.CLDRReader;
import org.teavm.classlib.java.lang.reflect.AnnotationDependencyListener; import org.teavm.classlib.java.lang.reflect.AnnotationDependencyListener;
import org.teavm.javascript.backend.TeaVMJavaScriptHost; import org.teavm.backend.javascript.TeaVMJavaScriptHost;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.platform.PlatformClass; import org.teavm.platform.PlatformClass;
import org.teavm.vm.spi.TeaVMHost; import org.teavm.vm.spi.TeaVMHost;

View File

@ -27,13 +27,13 @@ import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.dependency.AbstractDependencyListener; import org.teavm.dependency.AbstractDependencyListener;
import org.teavm.dependency.DependencyAgent; import org.teavm.dependency.DependencyAgent;
import org.teavm.dependency.DependencyNode; import org.teavm.dependency.DependencyNode;
import org.teavm.dependency.MethodDependency; import org.teavm.dependency.MethodDependency;
import org.teavm.javascript.spi.Generator; import org.teavm.backend.javascript.spi.Generator;
import org.teavm.javascript.spi.GeneratorContext; import org.teavm.backend.javascript.spi.GeneratorContext;
import org.teavm.model.CallLocation; import org.teavm.model.CallLocation;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;

View File

@ -9,10 +9,10 @@ import java.util.ServiceLoader;
import java.util.Set; import java.util.Set;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.teavm.classlib.ResourceSupplier; import org.teavm.classlib.ResourceSupplier;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.javascript.Renderer; import org.teavm.backend.javascript.rendering.Renderer;
import org.teavm.javascript.spi.Injector; import org.teavm.backend.javascript.spi.Injector;
import org.teavm.javascript.spi.InjectorContext; import org.teavm.backend.javascript.spi.InjectorContext;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
/** /**

View File

@ -16,9 +16,9 @@
package org.teavm.classlib.java.lang; package org.teavm.classlib.java.lang;
import java.io.IOException; import java.io.IOException;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.javascript.spi.Generator; import org.teavm.backend.javascript.spi.Generator;
import org.teavm.javascript.spi.GeneratorContext; import org.teavm.backend.javascript.spi.GeneratorContext;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
/** /**

View File

@ -16,9 +16,9 @@
package org.teavm.classlib.java.lang; package org.teavm.classlib.java.lang;
import java.io.IOException; import java.io.IOException;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.javascript.spi.Generator; import org.teavm.backend.javascript.spi.Generator;
import org.teavm.javascript.spi.GeneratorContext; import org.teavm.backend.javascript.spi.GeneratorContext;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
/** /**

View File

@ -16,10 +16,10 @@
package org.teavm.classlib.java.lang; package org.teavm.classlib.java.lang;
import java.io.IOException; import java.io.IOException;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.dependency.*; import org.teavm.dependency.*;
import org.teavm.javascript.spi.Generator; import org.teavm.backend.javascript.spi.Generator;
import org.teavm.javascript.spi.GeneratorContext; import org.teavm.backend.javascript.spi.GeneratorContext;
import org.teavm.model.CallLocation; import org.teavm.model.CallLocation;
import org.teavm.model.FieldReference; import org.teavm.model.FieldReference;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;

View File

@ -18,7 +18,7 @@ package org.teavm.classlib.java.lang;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.InputStream; import java.io.InputStream;
import org.teavm.classlib.impl.Base64; import org.teavm.classlib.impl.Base64;
import org.teavm.javascript.spi.InjectedBy; import org.teavm.backend.javascript.spi.InjectedBy;
import org.teavm.jso.JSIndexer; import org.teavm.jso.JSIndexer;
import org.teavm.jso.JSObject; import org.teavm.jso.JSObject;

View File

@ -15,7 +15,7 @@
*/ */
package org.teavm.classlib.java.lang; package org.teavm.classlib.java.lang;
import org.teavm.javascript.spi.GeneratedBy; import org.teavm.backend.javascript.spi.GeneratedBy;
public class TLong extends TNumber implements TComparable<TLong> { public class TLong extends TNumber implements TComparable<TLong> {
public static final long MIN_VALUE = -0x8000000000000000L; public static final long MIN_VALUE = -0x8000000000000000L;

View File

@ -15,7 +15,7 @@
*/ */
package org.teavm.classlib.java.lang; package org.teavm.classlib.java.lang;
import org.teavm.javascript.spi.GeneratedBy; import org.teavm.backend.javascript.spi.GeneratedBy;
/** /**
* *

View File

@ -20,7 +20,7 @@ import org.teavm.classlib.java.io.TInputStream;
import org.teavm.classlib.java.io.TPrintStream; import org.teavm.classlib.java.io.TPrintStream;
import org.teavm.classlib.java.lang.reflect.TArray; import org.teavm.classlib.java.lang.reflect.TArray;
import org.teavm.dependency.PluggableDependency; import org.teavm.dependency.PluggableDependency;
import org.teavm.javascript.spi.GeneratedBy; import org.teavm.backend.javascript.spi.GeneratedBy;
/** /**
* *

View File

@ -16,10 +16,10 @@
package org.teavm.classlib.java.lang.reflect; package org.teavm.classlib.java.lang.reflect;
import java.io.IOException; import java.io.IOException;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.dependency.*; import org.teavm.dependency.*;
import org.teavm.javascript.spi.Generator; import org.teavm.backend.javascript.spi.Generator;
import org.teavm.javascript.spi.GeneratorContext; import org.teavm.backend.javascript.spi.GeneratorContext;
import org.teavm.model.CallLocation; import org.teavm.model.CallLocation;
import org.teavm.model.ClassReader; import org.teavm.model.ClassReader;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;

View File

@ -18,7 +18,7 @@ package org.teavm.classlib.java.lang.reflect;
import org.teavm.classlib.java.lang.*; import org.teavm.classlib.java.lang.*;
import org.teavm.dependency.PluggableDependency; import org.teavm.dependency.PluggableDependency;
import org.teavm.interop.DelegateTo; import org.teavm.interop.DelegateTo;
import org.teavm.javascript.spi.GeneratedBy; import org.teavm.backend.javascript.spi.GeneratedBy;
import org.teavm.platform.PlatformClass; import org.teavm.platform.PlatformClass;
import org.teavm.runtime.Allocator; import org.teavm.runtime.Allocator;
import org.teavm.runtime.RuntimeClass; import org.teavm.runtime.RuntimeClass;

View File

@ -18,7 +18,7 @@ package org.teavm.ast;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import org.teavm.javascript.spi.Generator; import org.teavm.backend.javascript.spi.Generator;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
public class NativeMethodNode extends MethodNode { public class NativeMethodNode extends MethodNode {

View File

@ -50,9 +50,9 @@ import org.teavm.common.GraphIndexer;
import org.teavm.common.Loop; import org.teavm.common.Loop;
import org.teavm.common.LoopGraph; import org.teavm.common.LoopGraph;
import org.teavm.common.RangeTree; import org.teavm.common.RangeTree;
import org.teavm.javascript.spi.GeneratedBy; import org.teavm.backend.javascript.spi.GeneratedBy;
import org.teavm.javascript.spi.Generator; import org.teavm.backend.javascript.spi.Generator;
import org.teavm.javascript.spi.InjectedBy; import org.teavm.backend.javascript.spi.InjectedBy;
import org.teavm.model.AnnotationHolder; import org.teavm.model.AnnotationHolder;
import org.teavm.model.ClassHolder; import org.teavm.model.ClassHolder;
import org.teavm.model.ClassHolderSource; import org.teavm.model.ClassHolderSource;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript; package org.teavm.ast.optimization;
import java.util.List; import java.util.List;
import org.teavm.ast.BinaryExpr; import org.teavm.ast.BinaryExpr;

View File

@ -58,7 +58,6 @@ import org.teavm.ast.UnaryOperation;
import org.teavm.ast.UnwrapArrayExpr; import org.teavm.ast.UnwrapArrayExpr;
import org.teavm.ast.VariableExpr; import org.teavm.ast.VariableExpr;
import org.teavm.ast.WhileStatement; import org.teavm.ast.WhileStatement;
import org.teavm.javascript.ExpressionSideEffectDecomposer;
class OptimizingVisitor implements StatementVisitor, ExprVisitor { class OptimizingVisitor implements StatementVisitor, ExprVisitor {
private Expr resultExpr; private Expr resultExpr;

View File

@ -0,0 +1,358 @@
/*
* Copyright 2016 Alexey Andreev.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.teavm.backend.javascript;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.teavm.ast.ClassNode;
import org.teavm.ast.cache.EmptyRegularMethodNodeCache;
import org.teavm.ast.cache.MethodNodeCache;
import org.teavm.ast.decompilation.Decompiler;
import org.teavm.backend.javascript.rendering.Renderer;
import org.teavm.backend.javascript.rendering.RenderingException;
import org.teavm.backend.javascript.spi.GeneratedBy;
import org.teavm.backend.javascript.spi.InjectedBy;
import org.teavm.backend.javascript.spi.Injector;
import org.teavm.backend.javascript.codegen.AliasProvider;
import org.teavm.backend.javascript.codegen.DefaultAliasProvider;
import org.teavm.backend.javascript.codegen.DefaultNamingStrategy;
import org.teavm.backend.javascript.codegen.MinifyingAliasProvider;
import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.backend.javascript.codegen.SourceWriterBuilder;
import org.teavm.debugging.information.DebugInformationEmitter;
import org.teavm.debugging.information.SourceLocation;
import org.teavm.dependency.DependencyChecker;
import org.teavm.dependency.DependencyListener;
import org.teavm.dependency.MethodDependency;
import org.teavm.backend.javascript.spi.Generator;
import org.teavm.model.BasicBlock;
import org.teavm.model.CallLocation;
import org.teavm.model.ClassHolder;
import org.teavm.model.ClassHolderTransformer;
import org.teavm.model.ElementModifier;
import org.teavm.model.TextLocation;
import org.teavm.model.ListableClassHolderSource;
import org.teavm.model.MethodHolder;
import org.teavm.model.MethodReference;
import org.teavm.model.Program;
import org.teavm.model.ValueType;
import org.teavm.model.Variable;
import org.teavm.model.instructions.ConstructInstruction;
import org.teavm.model.instructions.InvocationType;
import org.teavm.model.instructions.InvokeInstruction;
import org.teavm.model.instructions.RaiseInstruction;
import org.teavm.model.instructions.StringConstantInstruction;
import org.teavm.model.util.AsyncMethodFinder;
import org.teavm.model.util.ProgramUtils;
import org.teavm.vm.BuildTarget;
import org.teavm.vm.TeaVMEntryPoint;
import org.teavm.vm.TeaVMTarget;
import org.teavm.vm.TeaVMTargetController;
import org.teavm.vm.spi.RendererListener;
import org.teavm.vm.spi.TeaVMHostExtension;
public class JavaScriptTarget implements TeaVMTarget, TeaVMJavaScriptHost {
private TeaVMTargetController controller;
private boolean minifying = true;
private final Map<MethodReference, Generator> methodGenerators = new HashMap<>();
private final Map<MethodReference, Injector> methodInjectors = new HashMap<>();
private final List<RendererListener> rendererListeners = new ArrayList<>();
private DebugInformationEmitter debugEmitter;
private MethodNodeCache astCache = new EmptyRegularMethodNodeCache();
private final Set<MethodReference> asyncMethods = new HashSet<>();
private final Set<MethodReference> asyncFamilyMethods = new HashSet<>();
@Override
public List<ClassHolderTransformer> getTransformers() {
return Collections.emptyList();
}
@Override
public List<DependencyListener> getDependencyListeners() {
return Collections.emptyList();
}
@Override
public void setController(TeaVMTargetController controller) {
this.controller = controller;
}
@Override
public void add(RendererListener listener) {
rendererListeners.add(listener);
}
@Override
public void add(MethodReference methodRef, Generator generator) {
methodGenerators.put(methodRef, generator);
}
@Override
public void add(MethodReference methodRef, Injector injector) {
methodInjectors.put(methodRef, injector);
}
/**
* Reports whether this TeaVM instance uses obfuscation when generating the JavaScript code.
*
* @see #setMinifying(boolean)
* @return whether TeaVM produces obfuscated code.
*/
public boolean isMinifying() {
return minifying;
}
/**
* Specifies whether this TeaVM instance uses obfuscation when generating the JavaScript code.
*
* @see #isMinifying()
* @param minifying whether TeaVM should obfuscate code.
*/
public void setMinifying(boolean minifying) {
this.minifying = minifying;
}
public MethodNodeCache getAstCache() {
return astCache;
}
public void setAstCache(MethodNodeCache methodAstCache) {
this.astCache = methodAstCache;
}
public DebugInformationEmitter getDebugEmitter() {
return debugEmitter;
}
public void setDebugEmitter(DebugInformationEmitter debugEmitter) {
this.debugEmitter = debugEmitter;
}
@Override
public boolean requiresRegisterAllocation() {
return true;
}
@Override
public List<TeaVMHostExtension> getHostExtensions() {
return Collections.singletonList(this);
}
@Override
public void contributeDependencies(DependencyChecker dependencyChecker) {
dependencyChecker.linkMethod(new MethodReference(Class.class.getName(), "getClass",
ValueType.object("org.teavm.platform.PlatformClass"), ValueType.parse(Class.class)), null).use();
dependencyChecker.linkMethod(new MethodReference(String.class, "<init>", char[].class, void.class),
null).use();
dependencyChecker.linkMethod(new MethodReference(String.class, "getChars", int.class, int.class, char[].class,
int.class, void.class), null).use();
MethodDependency internDep = dependencyChecker.linkMethod(new MethodReference(String.class, "intern",
String.class), null);
internDep.getVariable(0).propagate(dependencyChecker.getType("java.lang.String"));
internDep.use();
dependencyChecker.linkMethod(new MethodReference(String.class, "length", int.class), null).use();
dependencyChecker.linkMethod(new MethodReference(Object.class, "clone", Object.class), null).use();
dependencyChecker.linkMethod(new MethodReference(Thread.class, "currentThread", Thread.class), null).use();
dependencyChecker.linkMethod(new MethodReference(Thread.class, "getMainThread", Thread.class), null).use();
dependencyChecker.linkMethod(
new MethodReference(Thread.class, "setCurrentThread", Thread.class, void.class), null).use();
MethodDependency exceptionCons = dependencyChecker.linkMethod(new MethodReference(
NoClassDefFoundError.class, "<init>", String.class, void.class), null);
exceptionCons.getVariable(0).propagate(dependencyChecker.getType(NoClassDefFoundError.class.getName()));
exceptionCons.getVariable(1).propagate(dependencyChecker.getType("java.lang.String"));
exceptionCons = dependencyChecker.linkMethod(new MethodReference(NoSuchFieldError.class, "<init>",
String.class, void.class), null);
exceptionCons.use();
exceptionCons.getVariable(0).propagate(dependencyChecker.getType(NoSuchFieldError.class.getName()));
exceptionCons.getVariable(1).propagate(dependencyChecker.getType("java.lang.String"));
exceptionCons = dependencyChecker.linkMethod(new MethodReference(NoSuchMethodError.class, "<init>",
String.class, void.class), null);
exceptionCons.use();
exceptionCons.getVariable(0).propagate(dependencyChecker.getType(NoSuchMethodError.class.getName()));
exceptionCons.getVariable(1).propagate(dependencyChecker.getType("java.lang.String"));
}
@Override
public void emit(ListableClassHolderSource classes, OutputStream output, BuildTarget target) {
try (Writer writer = new OutputStreamWriter(output, "UTF-8")) {
emit(classes, writer, target);
} catch (IOException e) {
throw new RenderingException(e);
}
}
private void emit(ListableClassHolderSource classes, Writer writer, BuildTarget target) {
List<ClassNode> clsNodes = modelToAst(classes);
if (controller.wasCancelled()) {
return;
}
AliasProvider aliasProvider = minifying ? new MinifyingAliasProvider() : new DefaultAliasProvider();
DefaultNamingStrategy naming = new DefaultNamingStrategy(aliasProvider, controller.getUnprocessedClassSource());
SourceWriterBuilder builder = new SourceWriterBuilder(naming);
builder.setMinified(minifying);
SourceWriter sourceWriter = builder.build(writer);
Renderer renderer = new Renderer(sourceWriter, classes, controller.getClassLoader(), controller.getServices(),
asyncMethods, asyncFamilyMethods, controller.getDiagnostics());
renderer.setProperties(controller.getProperties());
renderer.setMinifying(minifying);
if (debugEmitter != null) {
for (String className : classes.getClassNames()) {
ClassHolder cls = classes.get(className);
for (MethodHolder method : cls.getMethods()) {
if (method.getProgram() != null) {
emitCFG(debugEmitter, method.getProgram());
}
}
if (controller.wasCancelled()) {
return;
}
}
renderer.setDebugEmitter(debugEmitter);
}
renderer.getDebugEmitter().setLocationProvider(sourceWriter);
for (Map.Entry<MethodReference, Injector> entry : methodInjectors.entrySet()) {
renderer.addInjector(entry.getKey(), entry.getValue());
}
try {
for (RendererListener listener : rendererListeners) {
listener.begin(renderer, target);
}
sourceWriter.append("\"use strict\";").newLine();
renderer.renderRuntime();
renderer.render(clsNodes);
renderer.renderStringPool();
for (Map.Entry<String, TeaVMEntryPoint> entry : controller.getEntryPoints().entrySet()) {
sourceWriter.append("var ").append(entry.getKey()).ws().append("=").ws();
MethodReference ref = entry.getValue().getReference();
sourceWriter.append(naming.getFullNameFor(ref));
sourceWriter.append(";").newLine();
}
for (Map.Entry<String, String> entry : controller.getExportedClasses().entrySet()) {
sourceWriter.append("var ").append(entry.getKey()).ws().append("=").ws()
.appendClass(entry.getValue()).append(";").newLine();
}
for (RendererListener listener : rendererListeners) {
listener.complete();
}
} catch (IOException e) {
throw new RenderingException("IO Error occured", e);
}
}
private List<ClassNode> modelToAst(ListableClassHolderSource classes) {
AsyncMethodFinder asyncFinder = new AsyncMethodFinder(controller.getDependencyInfo().getCallGraph(),
controller.getDiagnostics());
asyncFinder.find(classes);
asyncMethods.addAll(asyncFinder.getAsyncMethods());
asyncFamilyMethods.addAll(asyncFinder.getAsyncFamilyMethods());
Decompiler decompiler = new Decompiler(classes, controller.getClassLoader(), asyncMethods, asyncFamilyMethods);
decompiler.setRegularMethodCache(controller.isIncremental() ? astCache : null);
for (Map.Entry<MethodReference, Generator> entry : methodGenerators.entrySet()) {
decompiler.addGenerator(entry.getKey(), entry.getValue());
}
for (MethodReference injectedMethod : methodInjectors.keySet()) {
decompiler.addMethodToSkip(injectedMethod);
}
List<String> classOrder = decompiler.getClassOrdering(classes.getClassNames());
List<ClassNode> classNodes = new ArrayList<>();
for (String className : classOrder) {
ClassHolder cls = classes.get(className);
for (MethodHolder method : cls.getMethods()) {
preprocessNativeMethod(method);
if (controller.wasCancelled()) {
break;
}
}
classNodes.add(decompiler.decompile(cls));
}
return classNodes;
}
private void preprocessNativeMethod(MethodHolder method) {
if (!method.getModifiers().contains(ElementModifier.NATIVE)
|| methodGenerators.get(method.getReference()) != null
|| methodInjectors.get(method.getReference()) != null
|| method.getAnnotations().get(GeneratedBy.class.getName()) != null
|| method.getAnnotations().get(InjectedBy.class.getName()) != null) {
return;
}
method.getModifiers().remove(ElementModifier.NATIVE);
Program program = new Program();
method.setProgram(program);
BasicBlock block = program.createBasicBlock();
Variable exceptionVar = program.createVariable();
ConstructInstruction newExceptionInsn = new ConstructInstruction();
newExceptionInsn.setType(NoSuchMethodError.class.getName());
newExceptionInsn.setReceiver(exceptionVar);
block.getInstructions().add(newExceptionInsn);
Variable constVar = program.createVariable();
StringConstantInstruction constInsn = new StringConstantInstruction();
constInsn.setConstant("Native method implementation not found: " + method.getReference());
constInsn.setReceiver(constVar);
block.getInstructions().add(constInsn);
InvokeInstruction initExceptionInsn = new InvokeInstruction();
initExceptionInsn.setInstance(exceptionVar);
initExceptionInsn.setMethod(new MethodReference(NoSuchMethodError.class, "<init>", String.class, void.class));
initExceptionInsn.setType(InvocationType.SPECIAL);
initExceptionInsn.getArguments().add(constVar);
block.getInstructions().add(initExceptionInsn);
RaiseInstruction raiseInsn = new RaiseInstruction();
raiseInsn.setException(exceptionVar);
block.getInstructions().add(raiseInsn);
controller.getDiagnostics().error(new CallLocation(method.getReference()),
"Native method {{m0}} has no implementation", method.getReference());
}
private void emitCFG(DebugInformationEmitter emitter, Program program) {
Map<TextLocation, TextLocation[]> cfg = ProgramUtils.getLocationCFG(program);
for (Map.Entry<TextLocation, TextLocation[]> entry : cfg.entrySet()) {
SourceLocation location = map(entry.getKey());
SourceLocation[] successors = new SourceLocation[entry.getValue().length];
for (int i = 0; i < entry.getValue().length; ++i) {
successors[i] = map(entry.getValue()[i]);
}
emitter.addSuccessors(location, successors);
}
}
private static SourceLocation map(TextLocation location) {
if (location == null) {
return null;
}
return new SourceLocation(location.getFileName(), location.getLine());
}
}

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript; package org.teavm.backend.javascript;
import org.teavm.diagnostics.Diagnostics; import org.teavm.diagnostics.Diagnostics;
import org.teavm.model.*; import org.teavm.model.*;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript; package org.teavm.backend.javascript;
public final class RuntimeSupport { public final class RuntimeSupport {
private RuntimeSupport() { private RuntimeSupport() {

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript.backend; package org.teavm.backend.javascript;
import org.teavm.javascript.spi.Generator; import org.teavm.backend.javascript.spi.Generator;
import org.teavm.javascript.spi.Injector; import org.teavm.backend.javascript.spi.Injector;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.vm.spi.RendererListener; import org.teavm.vm.spi.RendererListener;
import org.teavm.vm.spi.TeaVMHostExtension; import org.teavm.vm.spi.TeaVMHostExtension;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
import org.teavm.model.FieldReference; import org.teavm.model.FieldReference;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2011 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
@ -41,11 +41,7 @@ public class DefaultNamingStrategy implements NamingStrategy {
@Override @Override
public String getNameFor(MethodDescriptor method) { public String getNameFor(MethodDescriptor method) {
return getNameFor(method, 'M'); String key = method.toString();
}
private String getNameFor(MethodDescriptor method, char classifier) {
String key = classifier + method.toString();
String alias = aliases.get(key); String alias = aliases.get(key);
if (alias == null) { if (alias == null) {
alias = aliasProvider.getMethodAlias(method); alias = aliasProvider.getMethodAlias(method);

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
/** /**
* *

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2013 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2015 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
import org.teavm.model.FieldReference; import org.teavm.model.FieldReference;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2013 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
/** /**
* *

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2015 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
import java.util.*; import java.util.*;
import org.teavm.model.FieldReference; import org.teavm.model.FieldReference;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2011 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
import org.teavm.model.FieldReference; import org.teavm.model.FieldReference;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2013 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
import java.io.IOException; import java.io.IOException;
import org.teavm.model.FieldReference; import org.teavm.model.FieldReference;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2013 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.codegen; package org.teavm.backend.javascript.codegen;
/** /**
* *

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2015 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript; package org.teavm.backend.javascript.rendering;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -60,7 +60,7 @@ import org.teavm.ast.UnaryExpr;
import org.teavm.ast.UnwrapArrayExpr; import org.teavm.ast.UnwrapArrayExpr;
import org.teavm.ast.VariableExpr; import org.teavm.ast.VariableExpr;
import org.teavm.ast.WhileStatement; import org.teavm.ast.WhileStatement;
import org.teavm.codegen.NameFrequencyConsumer; import org.teavm.backend.javascript.codegen.NameFrequencyConsumer;
import org.teavm.model.ClassReader; import org.teavm.model.ClassReader;
import org.teavm.model.ClassReaderSource; import org.teavm.model.ClassReaderSource;
import org.teavm.model.ElementModifier; import org.teavm.model.ElementModifier;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2015 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript; package org.teavm.backend.javascript.rendering;
public enum Precedence { public enum Precedence {
COMMA, COMMA,

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2012 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript; package org.teavm.backend.javascript.rendering;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -75,19 +75,19 @@ import org.teavm.ast.UnwrapArrayExpr;
import org.teavm.ast.VariableExpr; import org.teavm.ast.VariableExpr;
import org.teavm.ast.VariableNode; import org.teavm.ast.VariableNode;
import org.teavm.ast.WhileStatement; import org.teavm.ast.WhileStatement;
import org.teavm.codegen.NamingException; import org.teavm.backend.javascript.spi.InjectedBy;
import org.teavm.codegen.NamingOrderer; import org.teavm.backend.javascript.spi.Injector;
import org.teavm.codegen.NamingStrategy; import org.teavm.backend.javascript.spi.InjectorContext;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.NamingException;
import org.teavm.backend.javascript.codegen.NamingOrderer;
import org.teavm.backend.javascript.codegen.NamingStrategy;
import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.common.ServiceRepository; import org.teavm.common.ServiceRepository;
import org.teavm.debugging.information.DebugInformationEmitter; import org.teavm.debugging.information.DebugInformationEmitter;
import org.teavm.debugging.information.DeferredCallSite; import org.teavm.debugging.information.DeferredCallSite;
import org.teavm.debugging.information.DummyDebugInformationEmitter; import org.teavm.debugging.information.DummyDebugInformationEmitter;
import org.teavm.diagnostics.Diagnostics; import org.teavm.diagnostics.Diagnostics;
import org.teavm.javascript.spi.GeneratorContext; import org.teavm.backend.javascript.spi.GeneratorContext;
import org.teavm.javascript.spi.InjectedBy;
import org.teavm.javascript.spi.Injector;
import org.teavm.javascript.spi.InjectorContext;
import org.teavm.model.AnnotationHolder; import org.teavm.model.AnnotationHolder;
import org.teavm.model.ClassHolder; import org.teavm.model.ClassHolder;
import org.teavm.model.ClassReader; import org.teavm.model.ClassReader;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript; package org.teavm.backend.javascript.rendering;
import java.util.Properties; import java.util.Properties;
import org.teavm.codegen.NamingStrategy; import org.teavm.backend.javascript.codegen.NamingStrategy;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.common.ServiceRepository; import org.teavm.common.ServiceRepository;
import org.teavm.model.ListableClassReaderSource; import org.teavm.model.ListableClassReaderSource;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2013 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript; package org.teavm.backend.javascript.rendering;
public class RenderingException extends RuntimeException { public class RenderingException extends RuntimeException {
private static final long serialVersionUID = 631804556597569547L; private static final long serialVersionUID = 631804556597569547L;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript; package org.teavm.backend.javascript.rendering;
import java.util.List; import java.util.List;
import org.teavm.ast.AssignmentStatement; import org.teavm.ast.AssignmentStatement;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2013 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript.spi; package org.teavm.backend.javascript.spi;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2013 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript.spi; package org.teavm.backend.javascript.spi;
import java.io.IOException; import java.io.IOException;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
/** /**

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2013 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript.spi; package org.teavm.backend.javascript.spi;
import java.util.Properties; import java.util.Properties;
import org.teavm.common.ServiceRepository; import org.teavm.common.ServiceRepository;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript.spi; package org.teavm.backend.javascript.spi;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript.spi; package org.teavm.backend.javascript.spi;
import java.io.IOException; import java.io.IOException;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2014 Alexey Andreev. * Copyright 2016 Alexey Andreev.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.javascript.spi; package org.teavm.backend.javascript.spi;
import java.io.IOException; import java.io.IOException;
import java.util.Properties; import java.util.Properties;
import org.teavm.ast.Expr; import org.teavm.ast.Expr;
import org.teavm.codegen.SourceWriter; import org.teavm.backend.javascript.codegen.SourceWriter;
import org.teavm.common.ServiceRepository; import org.teavm.common.ServiceRepository;
import org.teavm.javascript.Precedence; import org.teavm.backend.javascript.rendering.Precedence;
import org.teavm.model.ListableClassReaderSource; import org.teavm.model.ListableClassReaderSource;
import org.teavm.model.ValueType; import org.teavm.model.ValueType;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm; package org.teavm.backend.wasm;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm; package org.teavm.backend.wasm;
import org.teavm.interop.Address; import org.teavm.interop.Address;
import org.teavm.interop.Import; import org.teavm.interop.Import;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm; package org.teavm.backend.wasm;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
@ -65,41 +65,41 @@ import org.teavm.vm.TeaVMEntryPoint;
import org.teavm.vm.TeaVMTarget; import org.teavm.vm.TeaVMTarget;
import org.teavm.vm.TeaVMTargetController; import org.teavm.vm.TeaVMTargetController;
import org.teavm.vm.spi.TeaVMHostExtension; import org.teavm.vm.spi.TeaVMHostExtension;
import org.teavm.wasm.binary.BinaryWriter; import org.teavm.backend.wasm.binary.BinaryWriter;
import org.teavm.wasm.generate.WasmClassGenerator; import org.teavm.backend.wasm.generate.WasmClassGenerator;
import org.teavm.wasm.generate.WasmDependencyListener; import org.teavm.backend.wasm.generate.WasmDependencyListener;
import org.teavm.wasm.generate.WasmGenerationContext; import org.teavm.backend.wasm.generate.WasmGenerationContext;
import org.teavm.wasm.generate.WasmGenerator; import org.teavm.backend.wasm.generate.WasmGenerator;
import org.teavm.wasm.generate.WasmMangling; import org.teavm.backend.wasm.generate.WasmMangling;
import org.teavm.wasm.generate.WasmStringPool; import org.teavm.backend.wasm.generate.WasmStringPool;
import org.teavm.wasm.intrinsics.AllocatorIntrinsic; import org.teavm.backend.wasm.intrinsics.AllocatorIntrinsic;
import org.teavm.wasm.intrinsics.ClassIntrinsic; import org.teavm.backend.wasm.intrinsics.ClassIntrinsic;
import org.teavm.wasm.intrinsics.PlatformClassIntrinsic; import org.teavm.backend.wasm.intrinsics.PlatformClassIntrinsic;
import org.teavm.wasm.intrinsics.PlatformClassMetadataIntrinsic; import org.teavm.backend.wasm.intrinsics.PlatformClassMetadataIntrinsic;
import org.teavm.wasm.intrinsics.PlatformIntrinsic; import org.teavm.backend.wasm.intrinsics.PlatformIntrinsic;
import org.teavm.wasm.intrinsics.PlatformObjectIntrinsic; import org.teavm.backend.wasm.intrinsics.PlatformObjectIntrinsic;
import org.teavm.wasm.intrinsics.WasmAddressIntrinsic; import org.teavm.backend.wasm.intrinsics.WasmAddressIntrinsic;
import org.teavm.wasm.intrinsics.WasmRuntimeIntrinsic; import org.teavm.backend.wasm.intrinsics.WasmRuntimeIntrinsic;
import org.teavm.wasm.intrinsics.WasmStructureIntrinsic; import org.teavm.backend.wasm.intrinsics.WasmStructureIntrinsic;
import org.teavm.wasm.model.WasmFunction; import org.teavm.backend.wasm.model.WasmFunction;
import org.teavm.wasm.model.WasmMemorySegment; import org.teavm.backend.wasm.model.WasmMemorySegment;
import org.teavm.wasm.model.WasmModule; import org.teavm.backend.wasm.model.WasmModule;
import org.teavm.wasm.model.WasmType; import org.teavm.backend.wasm.model.WasmType;
import org.teavm.wasm.model.expression.WasmBlock; import org.teavm.backend.wasm.model.expression.WasmBlock;
import org.teavm.wasm.model.expression.WasmBranch; import org.teavm.backend.wasm.model.expression.WasmBranch;
import org.teavm.wasm.model.expression.WasmCall; import org.teavm.backend.wasm.model.expression.WasmCall;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.wasm.model.expression.WasmInt32Constant; import org.teavm.backend.wasm.model.expression.WasmInt32Constant;
import org.teavm.wasm.model.expression.WasmInt32Subtype; import org.teavm.backend.wasm.model.expression.WasmInt32Subtype;
import org.teavm.wasm.model.expression.WasmIntBinary; import org.teavm.backend.wasm.model.expression.WasmIntBinary;
import org.teavm.wasm.model.expression.WasmIntBinaryOperation; import org.teavm.backend.wasm.model.expression.WasmIntBinaryOperation;
import org.teavm.wasm.model.expression.WasmIntType; import org.teavm.backend.wasm.model.expression.WasmIntType;
import org.teavm.wasm.model.expression.WasmLoadInt32; import org.teavm.backend.wasm.model.expression.WasmLoadInt32;
import org.teavm.wasm.model.expression.WasmReturn; import org.teavm.backend.wasm.model.expression.WasmReturn;
import org.teavm.wasm.model.expression.WasmStoreInt32; import org.teavm.backend.wasm.model.expression.WasmStoreInt32;
import org.teavm.wasm.patches.ClassPatch; import org.teavm.backend.wasm.patches.ClassPatch;
import org.teavm.wasm.patches.ObjectPatch; import org.teavm.backend.wasm.patches.ObjectPatch;
import org.teavm.wasm.render.WasmRenderer; import org.teavm.backend.wasm.render.WasmRenderer;
public class WasmTarget implements TeaVMTarget { public class WasmTarget implements TeaVMTarget {
private TeaVMTargetController controller; private TeaVMTargetController controller;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.binary; package org.teavm.backend.wasm.binary;
public enum AddressMode { public enum AddressMode {
ADDRESS_32, ADDRESS_32,

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.binary; package org.teavm.backend.wasm.binary;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.binary; package org.teavm.backend.wasm.binary;
public class DataArray extends DataType { public class DataArray extends DataType {
private DataType componentType; private DataType componentType;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.binary; package org.teavm.backend.wasm.binary;
public final class DataPrimitives { public final class DataPrimitives {
private DataPrimitives() { private DataPrimitives() {

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.binary; package org.teavm.backend.wasm.binary;
public class DataStructure extends DataType { public class DataStructure extends DataType {
private byte alignment; private byte alignment;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.binary; package org.teavm.backend.wasm.binary;
public abstract class DataType { public abstract class DataType {
public abstract DataValue createValue(); public abstract DataValue createValue();

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.binary; package org.teavm.backend.wasm.binary;
public abstract class DataValue { public abstract class DataValue {
private DataType type; private DataType type;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.binary; package org.teavm.backend.wasm.binary;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.generate; package org.teavm.backend.wasm.generate;
import com.carrotsearch.hppc.ObjectIntMap; import com.carrotsearch.hppc.ObjectIntMap;
import com.carrotsearch.hppc.ObjectIntOpenHashMap; import com.carrotsearch.hppc.ObjectIntOpenHashMap;
@ -37,12 +37,12 @@ import org.teavm.model.classes.VirtualTable;
import org.teavm.model.classes.VirtualTableEntry; import org.teavm.model.classes.VirtualTableEntry;
import org.teavm.model.classes.VirtualTableProvider; import org.teavm.model.classes.VirtualTableProvider;
import org.teavm.runtime.RuntimeClass; import org.teavm.runtime.RuntimeClass;
import org.teavm.wasm.binary.BinaryWriter; import org.teavm.backend.wasm.binary.BinaryWriter;
import org.teavm.wasm.binary.DataArray; import org.teavm.backend.wasm.binary.DataArray;
import org.teavm.wasm.binary.DataPrimitives; import org.teavm.backend.wasm.binary.DataPrimitives;
import org.teavm.wasm.binary.DataStructure; import org.teavm.backend.wasm.binary.DataStructure;
import org.teavm.wasm.binary.DataType; import org.teavm.backend.wasm.binary.DataType;
import org.teavm.wasm.binary.DataValue; import org.teavm.backend.wasm.binary.DataValue;
public class WasmClassGenerator { public class WasmClassGenerator {
private ClassReaderSource classSource; private ClassReaderSource classSource;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.generate; package org.teavm.backend.wasm.generate;
import org.teavm.dependency.AbstractDependencyListener; import org.teavm.dependency.AbstractDependencyListener;
import org.teavm.dependency.DependencyAgent; import org.teavm.dependency.DependencyAgent;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.generate; package org.teavm.backend.wasm.generate;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -32,7 +32,7 @@ import org.teavm.model.MethodReference;
import org.teavm.model.ValueType; import org.teavm.model.ValueType;
import org.teavm.model.classes.TagRegistry; import org.teavm.model.classes.TagRegistry;
import org.teavm.model.classes.VirtualTableProvider; import org.teavm.model.classes.VirtualTableProvider;
import org.teavm.wasm.intrinsics.WasmIntrinsic; import org.teavm.backend.wasm.intrinsics.WasmIntrinsic;
public class WasmGenerationContext { public class WasmGenerationContext {
private ClassReaderSource classSource; private ClassReaderSource classSource;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.generate; package org.teavm.backend.wasm.generate;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -72,46 +72,46 @@ import org.teavm.model.classes.VirtualTableEntry;
import org.teavm.runtime.Allocator; import org.teavm.runtime.Allocator;
import org.teavm.runtime.RuntimeArray; import org.teavm.runtime.RuntimeArray;
import org.teavm.runtime.RuntimeClass; import org.teavm.runtime.RuntimeClass;
import org.teavm.wasm.WasmRuntime; import org.teavm.backend.wasm.WasmRuntime;
import org.teavm.wasm.intrinsics.WasmIntrinsic; import org.teavm.backend.wasm.intrinsics.WasmIntrinsic;
import org.teavm.wasm.intrinsics.WasmIntrinsicManager; import org.teavm.backend.wasm.intrinsics.WasmIntrinsicManager;
import org.teavm.wasm.model.WasmFunction; import org.teavm.backend.wasm.model.WasmFunction;
import org.teavm.wasm.model.WasmLocal; import org.teavm.backend.wasm.model.WasmLocal;
import org.teavm.wasm.model.WasmType; import org.teavm.backend.wasm.model.WasmType;
import org.teavm.wasm.model.expression.WasmBlock; import org.teavm.backend.wasm.model.expression.WasmBlock;
import org.teavm.wasm.model.expression.WasmBranch; import org.teavm.backend.wasm.model.expression.WasmBranch;
import org.teavm.wasm.model.expression.WasmBreak; import org.teavm.backend.wasm.model.expression.WasmBreak;
import org.teavm.wasm.model.expression.WasmCall; import org.teavm.backend.wasm.model.expression.WasmCall;
import org.teavm.wasm.model.expression.WasmConditional; import org.teavm.backend.wasm.model.expression.WasmConditional;
import org.teavm.wasm.model.expression.WasmConversion; import org.teavm.backend.wasm.model.expression.WasmConversion;
import org.teavm.wasm.model.expression.WasmDrop; import org.teavm.backend.wasm.model.expression.WasmDrop;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.wasm.model.expression.WasmFloat32Constant; import org.teavm.backend.wasm.model.expression.WasmFloat32Constant;
import org.teavm.wasm.model.expression.WasmFloat64Constant; import org.teavm.backend.wasm.model.expression.WasmFloat64Constant;
import org.teavm.wasm.model.expression.WasmFloatBinary; import org.teavm.backend.wasm.model.expression.WasmFloatBinary;
import org.teavm.wasm.model.expression.WasmFloatBinaryOperation; import org.teavm.backend.wasm.model.expression.WasmFloatBinaryOperation;
import org.teavm.wasm.model.expression.WasmFloatType; import org.teavm.backend.wasm.model.expression.WasmFloatType;
import org.teavm.wasm.model.expression.WasmGetLocal; import org.teavm.backend.wasm.model.expression.WasmGetLocal;
import org.teavm.wasm.model.expression.WasmIndirectCall; import org.teavm.backend.wasm.model.expression.WasmIndirectCall;
import org.teavm.wasm.model.expression.WasmInt32Constant; import org.teavm.backend.wasm.model.expression.WasmInt32Constant;
import org.teavm.wasm.model.expression.WasmInt32Subtype; import org.teavm.backend.wasm.model.expression.WasmInt32Subtype;
import org.teavm.wasm.model.expression.WasmInt64Constant; import org.teavm.backend.wasm.model.expression.WasmInt64Constant;
import org.teavm.wasm.model.expression.WasmInt64Subtype; import org.teavm.backend.wasm.model.expression.WasmInt64Subtype;
import org.teavm.wasm.model.expression.WasmIntBinary; import org.teavm.backend.wasm.model.expression.WasmIntBinary;
import org.teavm.wasm.model.expression.WasmIntBinaryOperation; import org.teavm.backend.wasm.model.expression.WasmIntBinaryOperation;
import org.teavm.wasm.model.expression.WasmIntType; import org.teavm.backend.wasm.model.expression.WasmIntType;
import org.teavm.wasm.model.expression.WasmLoadFloat32; import org.teavm.backend.wasm.model.expression.WasmLoadFloat32;
import org.teavm.wasm.model.expression.WasmLoadFloat64; import org.teavm.backend.wasm.model.expression.WasmLoadFloat64;
import org.teavm.wasm.model.expression.WasmLoadInt32; import org.teavm.backend.wasm.model.expression.WasmLoadInt32;
import org.teavm.wasm.model.expression.WasmLoadInt64; import org.teavm.backend.wasm.model.expression.WasmLoadInt64;
import org.teavm.wasm.model.expression.WasmReturn; import org.teavm.backend.wasm.model.expression.WasmReturn;
import org.teavm.wasm.model.expression.WasmSetLocal; import org.teavm.backend.wasm.model.expression.WasmSetLocal;
import org.teavm.wasm.model.expression.WasmStoreFloat32; import org.teavm.backend.wasm.model.expression.WasmStoreFloat32;
import org.teavm.wasm.model.expression.WasmStoreFloat64; import org.teavm.backend.wasm.model.expression.WasmStoreFloat64;
import org.teavm.wasm.model.expression.WasmStoreInt32; import org.teavm.backend.wasm.model.expression.WasmStoreInt32;
import org.teavm.wasm.model.expression.WasmStoreInt64; import org.teavm.backend.wasm.model.expression.WasmStoreInt64;
import org.teavm.wasm.model.expression.WasmSwitch; import org.teavm.backend.wasm.model.expression.WasmSwitch;
import org.teavm.wasm.model.expression.WasmUnreachable; import org.teavm.backend.wasm.model.expression.WasmUnreachable;
class WasmGenerationVisitor implements StatementVisitor, ExprVisitor { class WasmGenerationVisitor implements StatementVisitor, ExprVisitor {
private static FieldReference tagField = new FieldReference(RuntimeClass.class.getName(), "tag"); private static FieldReference tagField = new FieldReference(RuntimeClass.class.getName(), "tag");

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.generate; package org.teavm.backend.wasm.generate;
import org.teavm.ast.RegularMethodNode; import org.teavm.ast.RegularMethodNode;
import org.teavm.ast.VariableNode; import org.teavm.ast.VariableNode;
@ -24,21 +24,20 @@ import org.teavm.model.ElementModifier;
import org.teavm.model.FieldReference; import org.teavm.model.FieldReference;
import org.teavm.model.MethodHolder; import org.teavm.model.MethodHolder;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.model.Program;
import org.teavm.model.ValueType; import org.teavm.model.ValueType;
import org.teavm.runtime.RuntimeClass; import org.teavm.runtime.RuntimeClass;
import org.teavm.wasm.model.WasmFunction; import org.teavm.backend.wasm.model.WasmFunction;
import org.teavm.wasm.model.WasmLocal; import org.teavm.backend.wasm.model.WasmLocal;
import org.teavm.wasm.model.WasmType; import org.teavm.backend.wasm.model.WasmType;
import org.teavm.wasm.model.expression.WasmCall; import org.teavm.backend.wasm.model.expression.WasmCall;
import org.teavm.wasm.model.expression.WasmConditional; import org.teavm.backend.wasm.model.expression.WasmConditional;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.wasm.model.expression.WasmInt32Constant; import org.teavm.backend.wasm.model.expression.WasmInt32Constant;
import org.teavm.wasm.model.expression.WasmInt32Subtype; import org.teavm.backend.wasm.model.expression.WasmInt32Subtype;
import org.teavm.wasm.model.expression.WasmIntBinary; import org.teavm.backend.wasm.model.expression.WasmIntBinary;
import org.teavm.wasm.model.expression.WasmIntBinaryOperation; import org.teavm.backend.wasm.model.expression.WasmIntBinaryOperation;
import org.teavm.wasm.model.expression.WasmIntType; import org.teavm.backend.wasm.model.expression.WasmIntType;
import org.teavm.wasm.model.expression.WasmLoadInt32; import org.teavm.backend.wasm.model.expression.WasmLoadInt32;
public class WasmGenerator { public class WasmGenerator {
private Decompiler decompiler; private Decompiler decompiler;

View File

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.generate; package org.teavm.backend.wasm.generate;
import org.teavm.ast.OperationType; import org.teavm.ast.OperationType;
import org.teavm.model.ValueType; import org.teavm.model.ValueType;
import org.teavm.model.util.VariableType; import org.teavm.model.util.VariableType;
import org.teavm.wasm.model.WasmType; import org.teavm.backend.wasm.model.WasmType;
public final class WasmGeneratorUtil { public final class WasmGeneratorUtil {
private WasmGeneratorUtil() { private WasmGeneratorUtil() {

View File

@ -13,11 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.generate; package org.teavm.backend.wasm.generate;
import java.util.Arrays; import java.util.Arrays;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.model.ValueType; import org.teavm.model.ValueType;

View File

@ -13,16 +13,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.generate; package org.teavm.backend.wasm.generate;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.teavm.model.ValueType; import org.teavm.model.ValueType;
import org.teavm.wasm.binary.BinaryWriter; import org.teavm.backend.wasm.binary.BinaryWriter;
import org.teavm.wasm.binary.DataArray; import org.teavm.backend.wasm.binary.DataArray;
import org.teavm.wasm.binary.DataPrimitives; import org.teavm.backend.wasm.binary.DataPrimitives;
import org.teavm.wasm.binary.DataStructure; import org.teavm.backend.wasm.binary.DataStructure;
import org.teavm.wasm.binary.DataValue; import org.teavm.backend.wasm.binary.DataValue;
public class WasmStringPool { public class WasmStringPool {
private WasmClassGenerator classGenerator; private WasmClassGenerator classGenerator;

View File

@ -13,17 +13,17 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.interop.Address; import org.teavm.interop.Address;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.runtime.Allocator; import org.teavm.runtime.Allocator;
import org.teavm.wasm.WasmRuntime; import org.teavm.backend.wasm.WasmRuntime;
import org.teavm.wasm.generate.WasmMangling; import org.teavm.backend.wasm.generate.WasmMangling;
import org.teavm.wasm.model.expression.WasmCall; import org.teavm.backend.wasm.model.expression.WasmCall;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
public class AllocatorIntrinsic implements WasmIntrinsic { public class AllocatorIntrinsic implements WasmIntrinsic {
@Override @Override

View File

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.model.MethodDescriptor; import org.teavm.model.MethodDescriptor;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
public class ClassIntrinsic implements WasmIntrinsic { public class ClassIntrinsic implements WasmIntrinsic {
@Override @Override

View File

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.wasm.model.expression.WasmBlock; import org.teavm.backend.wasm.model.expression.WasmBlock;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
public class PlatformClassIntrinsic implements WasmIntrinsic { public class PlatformClassIntrinsic implements WasmIntrinsic {
private static final String PLATFORM_CLASS_NAME = "org.teavm.platform.PlatformClass"; private static final String PLATFORM_CLASS_NAME = "org.teavm.platform.PlatformClass";

View File

@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.ast.QualificationExpr; import org.teavm.ast.QualificationExpr;
import org.teavm.model.FieldReference; import org.teavm.model.FieldReference;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.runtime.RuntimeClass; import org.teavm.runtime.RuntimeClass;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
public class PlatformClassMetadataIntrinsic implements WasmIntrinsic { public class PlatformClassMetadataIntrinsic implements WasmIntrinsic {
private static final String PLATFORM_CLASS_METADATA_NAME = "org.teavm.platform.PlatformClassMetadata"; private static final String PLATFORM_CLASS_METADATA_NAME = "org.teavm.platform.PlatformClassMetadata";

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
public class PlatformIntrinsic implements WasmIntrinsic { public class PlatformIntrinsic implements WasmIntrinsic {
private static final String PLATFORM = "org.teavm.platform.Platform"; private static final String PLATFORM = "org.teavm.platform.Platform";

View File

@ -13,20 +13,20 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.model.FieldReference; import org.teavm.model.FieldReference;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.runtime.RuntimeObject; import org.teavm.runtime.RuntimeObject;
import org.teavm.wasm.generate.WasmClassGenerator; import org.teavm.backend.wasm.generate.WasmClassGenerator;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.wasm.model.expression.WasmInt32Constant; import org.teavm.backend.wasm.model.expression.WasmInt32Constant;
import org.teavm.wasm.model.expression.WasmInt32Subtype; import org.teavm.backend.wasm.model.expression.WasmInt32Subtype;
import org.teavm.wasm.model.expression.WasmIntBinary; import org.teavm.backend.wasm.model.expression.WasmIntBinary;
import org.teavm.wasm.model.expression.WasmIntBinaryOperation; import org.teavm.backend.wasm.model.expression.WasmIntBinaryOperation;
import org.teavm.wasm.model.expression.WasmIntType; import org.teavm.backend.wasm.model.expression.WasmIntType;
import org.teavm.wasm.model.expression.WasmLoadInt32; import org.teavm.backend.wasm.model.expression.WasmLoadInt32;
public class PlatformObjectIntrinsic implements WasmIntrinsic { public class PlatformObjectIntrinsic implements WasmIntrinsic {
private static final String PLATFORM_OBJECT = "org.teavm.platform.PlatformObject"; private static final String PLATFORM_OBJECT = "org.teavm.platform.PlatformObject";

View File

@ -13,28 +13,28 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.interop.Address; import org.teavm.interop.Address;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.model.ValueType; import org.teavm.model.ValueType;
import org.teavm.wasm.model.WasmType; import org.teavm.backend.wasm.model.WasmType;
import org.teavm.wasm.model.expression.WasmConversion; import org.teavm.backend.wasm.model.expression.WasmConversion;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.wasm.model.expression.WasmInt32Subtype; import org.teavm.backend.wasm.model.expression.WasmInt32Subtype;
import org.teavm.wasm.model.expression.WasmInt64Subtype; import org.teavm.backend.wasm.model.expression.WasmInt64Subtype;
import org.teavm.wasm.model.expression.WasmIntBinary; import org.teavm.backend.wasm.model.expression.WasmIntBinary;
import org.teavm.wasm.model.expression.WasmIntBinaryOperation; import org.teavm.backend.wasm.model.expression.WasmIntBinaryOperation;
import org.teavm.wasm.model.expression.WasmIntType; import org.teavm.backend.wasm.model.expression.WasmIntType;
import org.teavm.wasm.model.expression.WasmLoadFloat32; import org.teavm.backend.wasm.model.expression.WasmLoadFloat32;
import org.teavm.wasm.model.expression.WasmLoadFloat64; import org.teavm.backend.wasm.model.expression.WasmLoadFloat64;
import org.teavm.wasm.model.expression.WasmLoadInt32; import org.teavm.backend.wasm.model.expression.WasmLoadInt32;
import org.teavm.wasm.model.expression.WasmLoadInt64; import org.teavm.backend.wasm.model.expression.WasmLoadInt64;
import org.teavm.wasm.model.expression.WasmStoreFloat32; import org.teavm.backend.wasm.model.expression.WasmStoreFloat32;
import org.teavm.wasm.model.expression.WasmStoreFloat64; import org.teavm.backend.wasm.model.expression.WasmStoreFloat64;
import org.teavm.wasm.model.expression.WasmStoreInt32; import org.teavm.backend.wasm.model.expression.WasmStoreInt32;
import org.teavm.wasm.model.expression.WasmStoreInt64; import org.teavm.backend.wasm.model.expression.WasmStoreInt64;
public class WasmAddressIntrinsic implements WasmIntrinsic { public class WasmAddressIntrinsic implements WasmIntrinsic {
@Override @Override

View File

@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
public interface WasmIntrinsic { public interface WasmIntrinsic {
boolean isApplicable(MethodReference methodReference); boolean isApplicable(MethodReference methodReference);

View File

@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.Expr; import org.teavm.ast.Expr;
import org.teavm.wasm.generate.WasmClassGenerator; import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.wasm.generate.WasmGenerationContext;
import org.teavm.wasm.model.expression.WasmExpression;
public interface WasmIntrinsicManager { public interface WasmIntrinsicManager {
WasmExpression generate(Expr expr); WasmExpression generate(Expr expr);

View File

@ -13,20 +13,20 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.wasm.WasmRuntime; import org.teavm.backend.wasm.WasmRuntime;
import org.teavm.wasm.generate.WasmGeneratorUtil; import org.teavm.backend.wasm.generate.WasmGeneratorUtil;
import org.teavm.wasm.model.WasmType; import org.teavm.backend.wasm.model.WasmType;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.wasm.model.expression.WasmFloatBinary; import org.teavm.backend.wasm.model.expression.WasmFloatBinary;
import org.teavm.wasm.model.expression.WasmFloatBinaryOperation; import org.teavm.backend.wasm.model.expression.WasmFloatBinaryOperation;
import org.teavm.wasm.model.expression.WasmFloatType; import org.teavm.backend.wasm.model.expression.WasmFloatType;
import org.teavm.wasm.model.expression.WasmIntBinary; import org.teavm.backend.wasm.model.expression.WasmIntBinary;
import org.teavm.wasm.model.expression.WasmIntBinaryOperation; import org.teavm.backend.wasm.model.expression.WasmIntBinaryOperation;
import org.teavm.wasm.model.expression.WasmIntType; import org.teavm.backend.wasm.model.expression.WasmIntType;
public class WasmRuntimeIntrinsic implements WasmIntrinsic { public class WasmRuntimeIntrinsic implements WasmIntrinsic {
@Override @Override

View File

@ -13,16 +13,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.intrinsics; package org.teavm.backend.wasm.intrinsics;
import org.teavm.ast.ConstantExpr; import org.teavm.ast.ConstantExpr;
import org.teavm.ast.InvocationExpr; import org.teavm.ast.InvocationExpr;
import org.teavm.interop.Address; import org.teavm.interop.Address;
import org.teavm.model.MethodReference; import org.teavm.model.MethodReference;
import org.teavm.model.ValueType; import org.teavm.model.ValueType;
import org.teavm.wasm.generate.WasmClassGenerator; import org.teavm.backend.wasm.generate.WasmClassGenerator;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
import org.teavm.wasm.model.expression.WasmInt32Constant; import org.teavm.backend.wasm.model.expression.WasmInt32Constant;
public class WasmStructureIntrinsic implements WasmIntrinsic { public class WasmStructureIntrinsic implements WasmIntrinsic {
private WasmClassGenerator classGenerator; private WasmClassGenerator classGenerator;

View File

@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model; package org.teavm.backend.wasm.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import org.teavm.wasm.model.expression.WasmExpression; import org.teavm.backend.wasm.model.expression.WasmExpression;
public class WasmFunction { public class WasmFunction {
WasmModule module; WasmModule module;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model; package org.teavm.backend.wasm.model;
import java.util.Objects; import java.util.Objects;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model; package org.teavm.backend.wasm.model;
import java.util.Arrays; import java.util.Arrays;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model; package org.teavm.backend.wasm.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model; package org.teavm.backend.wasm.model;
public enum WasmType { public enum WasmType {
INT32, INT32,

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.Objects; import java.util.Objects;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.Objects; import java.util.Objects;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.Objects; import java.util.Objects;

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.Objects; import java.util.Objects;
import org.teavm.wasm.model.WasmType; import org.teavm.backend.wasm.model.WasmType;
public class WasmConversion extends WasmExpression { public class WasmConversion extends WasmExpression {
private WasmType sourceType; private WasmType sourceType;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public class WasmDefaultExpressionVisitor implements WasmExpressionVisitor { public class WasmDefaultExpressionVisitor implements WasmExpressionVisitor {
@Override @Override

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.Objects; import java.util.Objects;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import org.teavm.model.TextLocation; import org.teavm.model.TextLocation;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public interface WasmExpressionVisitor { public interface WasmExpressionVisitor {
void visit(WasmBlock expression); void visit(WasmBlock expression);

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public class WasmFloat32Constant extends WasmExpression { public class WasmFloat32Constant extends WasmExpression {
private float value; private float value;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public class WasmFloat64Constant extends WasmExpression { public class WasmFloat64Constant extends WasmExpression {
private double value; private double value;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.Objects; import java.util.Objects;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public enum WasmFloatBinaryOperation { public enum WasmFloatBinaryOperation {
ADD, ADD,

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public enum WasmFloatType { public enum WasmFloatType {
FLOAT32, FLOAT32,

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.Objects; import java.util.Objects;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public enum WasmFloatUnaryOperation { public enum WasmFloatUnaryOperation {
ABS, ABS,

View File

@ -13,10 +13,10 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.Objects; import java.util.Objects;
import org.teavm.wasm.model.WasmLocal; import org.teavm.backend.wasm.model.WasmLocal;
public class WasmGetLocal extends WasmExpression { public class WasmGetLocal extends WasmExpression {
private WasmLocal local; private WasmLocal local;

View File

@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Objects; import java.util.Objects;
import org.teavm.wasm.model.WasmType; import org.teavm.backend.wasm.model.WasmType;
public class WasmIndirectCall extends WasmExpression { public class WasmIndirectCall extends WasmExpression {
private List<WasmType> parameterTypes = new ArrayList<>(); private List<WasmType> parameterTypes = new ArrayList<>();

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public class WasmInt32Constant extends WasmExpression { public class WasmInt32Constant extends WasmExpression {
private int value; private int value;

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public enum WasmInt32Subtype { public enum WasmInt32Subtype {
INT8, INT8,

View File

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.teavm.wasm.model.expression; package org.teavm.backend.wasm.model.expression;
public class WasmInt64Constant extends WasmExpression { public class WasmInt64Constant extends WasmExpression {
private long value; private long value;

Some files were not shown because too many files have changed in this diff Show More