mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 08:14:09 -08:00
Move metaprogramming API implementation into separate module
This commit is contained in:
parent
74a0278881
commit
f63ec25ed3
|
@ -26,6 +26,7 @@
|
|||
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
|
||||
<outputRelativeToContentRoot value="true" />
|
||||
<processorPath useClasspath="true" />
|
||||
<module name="impl" />
|
||||
<module name="teavm-chrome-rdp" />
|
||||
<module name="teavm-classlib" />
|
||||
<module name="teavm-cli" />
|
||||
|
@ -52,6 +53,7 @@
|
|||
</profile>
|
||||
</annotationProcessing>
|
||||
<bytecodeTargetLevel>
|
||||
<module name="impl" target="1.8" />
|
||||
<module name="teavm" target="1.5" />
|
||||
<module name="teavm-chrome-rdp" target="1.8" />
|
||||
<module name="teavm-classlib" target="1.8" />
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
<file url="file://$PROJECT_DIR$/jso/apis" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/jso/core" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/jso/impl" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/metaprogramming-api" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/metaprogramming/api" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/metaprogramming/impl" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/platform" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/samples" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/samples/async" charset="UTF-8" />
|
||||
|
|
|
@ -45,7 +45,8 @@
|
|||
<file type="gwt" url="file://$PROJECT_DIR$/samples/benchmark" />
|
||||
<file type="Osmorc" url="file://$PROJECT_DIR$/classlib" />
|
||||
<file type="Osmorc" url="file://$PROJECT_DIR$/core" />
|
||||
<file type="Osmorc" url="file://$PROJECT_DIR$/metaprogramming-api" />
|
||||
<file type="Osmorc" url="file://$PROJECT_DIR$/metaprogramming/api" />
|
||||
<file type="Osmorc" url="file://$PROJECT_DIR$/metaprogramming/impl" />
|
||||
<file type="Osmorc" url="file://$PROJECT_DIR$/platform" />
|
||||
<file type="Osmorc" url="file://$PROJECT_DIR$/tools/chrome-rdp" />
|
||||
<file type="Osmorc" url="file://$PROJECT_DIR$/tools/core" />
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/all-deps/all-deps.iml" filepath="$PROJECT_DIR$/all-deps/all-deps.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/metaprogramming/impl/impl.iml" filepath="$PROJECT_DIR$/metaprogramming/impl/impl.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/teavm.iml" filepath="$PROJECT_DIR$/teavm.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/tools/chrome-rdp/teavm-chrome-rdp.iml" filepath="$PROJECT_DIR$/tools/chrome-rdp/teavm-chrome-rdp.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/classlib/teavm-classlib.iml" filepath="$PROJECT_DIR$/classlib/teavm-classlib.iml" />
|
||||
|
@ -19,7 +20,7 @@
|
|||
<module fileurl="file://$PROJECT_DIR$/tools/maven/teavm-maven.iml" filepath="$PROJECT_DIR$/tools/maven/teavm-maven.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/tools/maven/plugin/teavm-maven-plugin.iml" filepath="$PROJECT_DIR$/tools/maven/plugin/teavm-maven-plugin.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/tools/maven/webapp/teavm-maven-webapp.iml" filepath="$PROJECT_DIR$/tools/maven/webapp/teavm-maven-webapp.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/metaprogramming-api/teavm-metaprogramming-api.iml" filepath="$PROJECT_DIR$/metaprogramming-api/teavm-metaprogramming-api.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/metaprogramming/api/teavm-metaprogramming-api.iml" filepath="$PROJECT_DIR$/metaprogramming/api/teavm-metaprogramming-api.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/platform/teavm-platform.iml" filepath="$PROJECT_DIR$/platform/teavm-platform.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/samples/teavm-samples.iml" filepath="$PROJECT_DIR$/samples/teavm-samples.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/samples/async/teavm-samples-async.iml" filepath="$PROJECT_DIR$/samples/async/teavm-samples-async.iml" />
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<property key="Bundle-Description" value="TeaVM Java class library emulation" />
|
||||
<property key="Export-Package" value="org.teavm.classlib.*" />
|
||||
<property key="Bundle-Name" value="TeaVM Java class library" />
|
||||
<property key="Include-Resource" value="META-INF/services/org.teavm.vm.spi.TeaVMPlugin=$MODULE_DIR$/src/main/resources/META-INF/services/org.teavm.vm.spi.TeaVMPlugin,META-INF/teavm.properties=$MODULE_DIR$/src/main/resources/META-INF/teavm.properties,html/field_public_obj.png=$MODULE_DIR$/src/main/resources/html/field_public_obj.png,html/methpro_obj.png=$MODULE_DIR$/src/main/resources/html/methpro_obj.png,html/int_obj.png=$MODULE_DIR$/src/main/resources/html/int_obj.png,html/jcl-class.html=$MODULE_DIR$/src/main/resources/html/jcl-class.html,html/enum_obj.png=$MODULE_DIR$/src/main/resources/html/enum_obj.png,html/jcl.css=$MODULE_DIR$/src/main/resources/html/jcl.css,html/field_protected_obj.png=$MODULE_DIR$/src/main/resources/html/field_protected_obj.png,html/class_obj.png=$MODULE_DIR$/src/main/resources/html/class_obj.png,html/package_obj.png=$MODULE_DIR$/src/main/resources/html/package_obj.png,html/methpub_obj.png=$MODULE_DIR$/src/main/resources/html/methpub_obj.png,html/annotation_obj.png=$MODULE_DIR$/src/main/resources/html/annotation_obj.png,html/jcl.html=$MODULE_DIR$/src/main/resources/html/jcl.html,org/teavm/classlib/impl/currency/iso4217.xml=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/currency/iso4217.xml,org/teavm/classlib/impl/currency/iso3166.csv=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/currency/iso3166.csv,org/teavm/classlib/impl/unicode/UnicodeData.txt=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/unicode/UnicodeData.txt,org/teavm/classlib/impl/unicode/cldr-json.zip=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/unicode/cldr-json.zip,org/teavm/classlib/impl/tz/tzdata2015d.zip=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/tz/tzdata2015d.zip" />
|
||||
<property key="Include-Resource" value="html/jcl.html=$MODULE_DIR$/src/main/resources/html/jcl.html,html/annotation_obj.png=$MODULE_DIR$/src/main/resources/html/annotation_obj.png,html/enum_obj.png=$MODULE_DIR$/src/main/resources/html/enum_obj.png,html/jcl.css=$MODULE_DIR$/src/main/resources/html/jcl.css,html/package_obj.png=$MODULE_DIR$/src/main/resources/html/package_obj.png,html/field_public_obj.png=$MODULE_DIR$/src/main/resources/html/field_public_obj.png,html/class_obj.png=$MODULE_DIR$/src/main/resources/html/class_obj.png,html/int_obj.png=$MODULE_DIR$/src/main/resources/html/int_obj.png,html/jcl-class.html=$MODULE_DIR$/src/main/resources/html/jcl-class.html,html/methpro_obj.png=$MODULE_DIR$/src/main/resources/html/methpro_obj.png,html/methpub_obj.png=$MODULE_DIR$/src/main/resources/html/methpub_obj.png,html/field_protected_obj.png=$MODULE_DIR$/src/main/resources/html/field_protected_obj.png,META-INF/teavm.properties=$MODULE_DIR$/src/main/resources/META-INF/teavm.properties,META-INF/services/org.teavm.vm.spi.TeaVMPlugin=$MODULE_DIR$/src/main/resources/META-INF/services/org.teavm.vm.spi.TeaVMPlugin,org/teavm/classlib/impl/tz/tzdata2015d.zip=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/tz/tzdata2015d.zip,org/teavm/classlib/impl/currency/iso4217.xml=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/currency/iso4217.xml,org/teavm/classlib/impl/currency/iso3166.csv=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/currency/iso3166.csv,org/teavm/classlib/impl/unicode/UnicodeData.txt=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/unicode/UnicodeData.txt,org/teavm/classlib/impl/unicode/cldr-json.zip=$MODULE_DIR$/src/main/resources/org/teavm/classlib/impl/unicode/cldr-json.zip" />
|
||||
</additionalProperties>
|
||||
<additionalJARContents />
|
||||
</configuration>
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.teavm.javascript.spi.GeneratedBy;
|
|||
import org.teavm.javascript.spi.Generator;
|
||||
import org.teavm.javascript.spi.InjectedBy;
|
||||
import org.teavm.javascript.spi.Injector;
|
||||
import org.teavm.metaprogramming.impl.MetaprogrammingDependencyListener;
|
||||
import org.teavm.model.*;
|
||||
import org.teavm.model.instructions.*;
|
||||
import org.teavm.model.util.*;
|
||||
|
@ -356,8 +355,6 @@ public class TeaVM implements TeaVMHost, ServiceRepository {
|
|||
return;
|
||||
}
|
||||
|
||||
dependencyChecker.addDependencyListener(new MetaprogrammingDependencyListener());
|
||||
|
||||
AliasProvider aliasProvider = minifying ? new MinifyingAliasProvider() : new DefaultAliasProvider();
|
||||
dependencyChecker.setInterruptor(() -> progressListener.progressReached(0) == TeaVMProgressFeedback.CONTINUE);
|
||||
dependencyChecker.linkMethod(new MethodReference(Class.class.getName(), "getClass",
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<artifactId>teavm-metaprogramming-api</artifactId>
|
||||
|
||||
|
@ -46,7 +47,8 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<configuration>
|
||||
<configLocation>../checkstyle.xml</configLocation>
|
||||
<configLocation>../../checkstyle.xml</configLocation>
|
||||
<propertyExpansion>config_loc=${basedir}/../..</propertyExpansion>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
|
@ -66,6 +66,7 @@ public class SourceLocation {
|
|||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(method.getName());
|
||||
return lineNumber > 0 ? fileName + ":" + lineNumber : fileName;
|
||||
sb.append(lineNumber > 0 ? fileName + ":" + lineNumber : fileName);
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
|
@ -17,7 +17,6 @@
|
|||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
34
metaprogramming/impl/impl.iml
Normal file
34
metaprogramming/impl/impl.iml
Normal file
|
@ -0,0 +1,34 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="Osmorc" name="OSGi">
|
||||
<configuration manifestGenerationMode="OsmorcControlled" manifestLocation="" jarfileLocation="teavm-metaprogramming-impl-1.0.0-SNAPSHOT.jar" outputPathType="CompilerOutputPath" bndFileLocation="" bundlorFileLocation="" bundleActivator="" bundleSymbolicName="teavm-metaprogramming-api" bundleVersion="1.0.0.SNAPSHOT" ignoreFilePattern="" useProjectDefaultManifestFileLocation="true" alwaysRebuildBundleJAR="false" doNotSynchronizeWithMaven="false">
|
||||
<additionalProperties>
|
||||
<property key="Bundle-Description" value="Implementation of metaprogramming API" />
|
||||
<property key="Export-Package" value="org.teavm.metaprogramming.*" />
|
||||
<property key="Bundle-Name" value="TeaVM metaprogramming API implementation" />
|
||||
</additionalProperties>
|
||||
<additionalJARContents />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="teavm-core" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.ow2.asm:asm-debug-all:5.0.4" level="project" />
|
||||
<orderEntry type="library" name="Maven: com.carrotsearch:hppc:0.6.1" level="project" />
|
||||
<orderEntry type="module" module-name="teavm-metaprogramming-api" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
</component>
|
||||
</module>
|
96
metaprogramming/impl/pom.xml
Normal file
96
metaprogramming/impl/pom.xml
Normal file
|
@ -0,0 +1,96 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~ 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.
|
||||
-->
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>teavm</artifactId>
|
||||
<groupId>org.teavm</groupId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<relativePath>../../pom.xml</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>teavm-metaprogramming-impl</artifactId>
|
||||
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<name>TeaVM metaprogramming API implementation</name>
|
||||
<description>Implementation of metaprogramming API</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-metaprogramming-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<configuration>
|
||||
<configLocation>../../checkstyle.xml</configLocation>
|
||||
<propertyExpansion>config_loc=${basedir}/../..</propertyExpansion>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Export-Package>org.teavm.metaprogramming.*</Export-Package>
|
||||
<Bundle-SymbolicName>teavm-metaprogramming-api</Bundle-SymbolicName>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
|
@ -42,16 +42,11 @@ import org.teavm.model.instructions.InvocationType;
|
|||
import org.teavm.model.instructions.NumericOperandType;
|
||||
import org.teavm.model.instructions.SwitchTableEntryReader;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public class AliasFinder {
|
||||
int[] aliases;
|
||||
Object[] constants;
|
||||
ArrayElement[] arrayElements;
|
||||
class AliasFinder {
|
||||
private int[] aliases;
|
||||
private ArrayElement[] arrayElements;
|
||||
|
||||
public void findAliases(ProgramReader program) {
|
||||
void findAliases(ProgramReader program) {
|
||||
DisjointSet set = new DisjointSet();
|
||||
for (int i = 0; i < program.variableCount(); ++i) {
|
||||
set.create();
|
||||
|
@ -85,7 +80,7 @@ public class AliasFinder {
|
|||
}
|
||||
|
||||
aliases = variables;
|
||||
constants = reader.constants;
|
||||
Object[] constants = reader.constants;
|
||||
arrayElements = reader.arrayElements;
|
||||
|
||||
for (int i = 0; i < arrayElements.length; ++i) {
|
||||
|
@ -102,29 +97,25 @@ public class AliasFinder {
|
|||
}
|
||||
}
|
||||
|
||||
public static class ArrayElement {
|
||||
static class ArrayElement {
|
||||
public int array;
|
||||
public int index;
|
||||
}
|
||||
|
||||
public int[] getAliases() {
|
||||
int[] getAliases() {
|
||||
return aliases.clone();
|
||||
}
|
||||
|
||||
public Object[] getConstants() {
|
||||
return constants.clone();
|
||||
}
|
||||
|
||||
public ArrayElement[] getArrayElements() {
|
||||
ArrayElement[] getArrayElements() {
|
||||
return arrayElements.clone();
|
||||
}
|
||||
|
||||
static class AliasReader implements InstructionReader {
|
||||
private static class AliasReader implements InstructionReader {
|
||||
DisjointSet disjointSet;
|
||||
Object[] constants;
|
||||
ArrayElement[] arrayElements;
|
||||
|
||||
AliasReader(DisjointSet disjointSet, int variableCount) {
|
||||
private AliasReader(DisjointSet disjointSet, int variableCount) {
|
||||
this.disjointSet = disjointSet;
|
||||
this.constants = new Object[variableCount];
|
||||
this.arrayElements = new ArrayElement[variableCount];
|
|
@ -26,7 +26,6 @@ import java.util.stream.Stream;
|
|||
import org.teavm.diagnostics.Diagnostics;
|
||||
import org.teavm.metaprogramming.ReflectClass;
|
||||
import org.teavm.metaprogramming.Value;
|
||||
import org.teavm.metaprogramming.impl.AliasFinder.ArrayElement;
|
||||
import org.teavm.metaprogramming.impl.reflect.ReflectClassImpl;
|
||||
import org.teavm.metaprogramming.impl.reflect.ReflectFieldImpl;
|
||||
import org.teavm.metaprogramming.impl.reflect.ReflectMethodImpl;
|
||||
|
@ -454,10 +453,10 @@ public class CompositeMethodGenerator {
|
|||
private int variableOffset;
|
||||
int[] variableMapping;
|
||||
CapturedValue[] capturedValues;
|
||||
ArrayElement[] arrayElements;
|
||||
AliasFinder.ArrayElement[] arrayElements;
|
||||
|
||||
TemplateSubstitutor(CapturedValue[] capturedValues, int[] variableMapping, ArrayElement[] arrayElements,
|
||||
int blockOffset, int variableOffset) {
|
||||
TemplateSubstitutor(CapturedValue[] capturedValues, int[] variableMapping,
|
||||
AliasFinder.ArrayElement[] arrayElements, int blockOffset, int variableOffset) {
|
||||
this.capturedValues = capturedValues;
|
||||
this.variableMapping = variableMapping;
|
||||
this.arrayElements = arrayElements;
|
||||
|
@ -482,7 +481,7 @@ public class CompositeMethodGenerator {
|
|||
if (capturedValues[index] != null) {
|
||||
return captureValue(capturedValues[index]);
|
||||
}
|
||||
ArrayElement elem = arrayElements[index];
|
||||
AliasFinder.ArrayElement elem = arrayElements[index];
|
||||
if (elem != null) {
|
||||
int arrayVar = variableMapping[elem.array];
|
||||
if (capturedValues[arrayVar] != null) {
|
||||
|
@ -770,7 +769,7 @@ public class CompositeMethodGenerator {
|
|||
public void getElement(VariableReader receiver, VariableReader array, VariableReader index) {
|
||||
int arrayIndex = variableMapping[array.getIndex()];
|
||||
|
||||
ArrayElement elem = arrayElements[receiver.getIndex()];
|
||||
AliasFinder.ArrayElement elem = arrayElements[receiver.getIndex()];
|
||||
if (elem != null && capturedValues[arrayIndex] != null) {
|
||||
AssignInstruction insn = new AssignInstruction();
|
||||
insn.setAssignee(var(receiver));
|
|
@ -20,10 +20,6 @@ import org.teavm.metaprogramming.Value;
|
|||
import org.teavm.model.InstructionLocation;
|
||||
import org.teavm.model.ValueType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public class LazyValueImpl<T> implements Value<T> {
|
||||
boolean evaluated;
|
||||
VariableContext context;
|
|
@ -26,6 +26,7 @@ import org.teavm.metaprogramming.LazyComputation;
|
|||
import org.teavm.metaprogramming.ReflectClass;
|
||||
import org.teavm.metaprogramming.SourceLocation;
|
||||
import org.teavm.metaprogramming.Value;
|
||||
import org.teavm.metaprogramming.impl.optimization.Optimizations;
|
||||
import org.teavm.metaprogramming.impl.reflect.ReflectClassImpl;
|
||||
import org.teavm.metaprogramming.impl.reflect.ReflectContext;
|
||||
import org.teavm.metaprogramming.impl.reflect.ReflectFieldImpl;
|
||||
|
@ -277,7 +278,7 @@ public final class MetaprogrammingImpl {
|
|||
jumpToStart.setTarget(program.basicBlockAt(startBlock.getIndex() + 1));
|
||||
startBlock.getInstructions().add(jumpToStart);
|
||||
|
||||
//new BoxingEliminator().optimize(program);
|
||||
new Optimizations().apply(program);
|
||||
cls.addMethod(methodHolder);
|
||||
} finally {
|
||||
returnType = returnTypeBackup;
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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.metaprogramming.impl;
|
||||
|
||||
import org.teavm.vm.spi.TeaVMHost;
|
||||
import org.teavm.vm.spi.TeaVMPlugin;
|
||||
|
||||
public class MetaprogrammingPlugin implements TeaVMPlugin {
|
||||
@Override
|
||||
public void install(TeaVMHost host) {
|
||||
host.add(new MetaprogrammingDependencyListener());
|
||||
}
|
||||
}
|
|
@ -62,7 +62,7 @@ class UsageGenerator {
|
|||
this.classLoader = classLoader;
|
||||
}
|
||||
|
||||
public void installProxyEmitter() {
|
||||
void installProxyEmitter() {
|
||||
Diagnostics diagnostics = agent.getDiagnostics();
|
||||
|
||||
try {
|
|
@ -47,10 +47,6 @@ class AnnotationProxy implements InvocationHandler {
|
|||
this.annotationType = annotationType;
|
||||
}
|
||||
|
||||
AnnotationProxy(AnnotationReader reader) {
|
||||
this.reader = reader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
|
||||
if (method.getName().equals("annotationType")) {
|
|
@ -53,7 +53,7 @@ public class ReflectClassImpl<T> implements ReflectClass<T> {
|
|||
this.context = context;
|
||||
}
|
||||
|
||||
public ReflectContext getReflectContext() {
|
||||
ReflectContext getReflectContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ public class ReflectClassImpl<T> implements ReflectClass<T> {
|
|||
});
|
||||
}
|
||||
|
||||
public ReflectMethodImpl getDeclaredMethod(MethodDescriptor method) {
|
||||
private ReflectMethodImpl getDeclaredMethod(MethodDescriptor method) {
|
||||
resolve();
|
||||
return methods.computeIfAbsent(method, m -> {
|
||||
MethodReader methodReader = classReader.getMethod(m);
|
|
@ -24,10 +24,6 @@ import org.teavm.model.ElementModifier;
|
|||
import org.teavm.model.ElementReader;
|
||||
import org.teavm.model.ValueType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public class ReflectContext {
|
||||
private ClassReaderSource classSource;
|
||||
private Map<ValueType, ReflectClassImpl<?>> classes = new HashMap<>();
|
|
@ -21,10 +21,6 @@ import org.teavm.metaprogramming.reflect.ReflectField;
|
|||
import org.teavm.model.ElementModifier;
|
||||
import org.teavm.model.FieldReader;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public class ReflectFieldImpl implements ReflectField {
|
||||
private ReflectContext context;
|
||||
private ReflectClassImpl<?> declaringClass;
|
|
@ -24,10 +24,6 @@ import org.teavm.metaprogramming.reflect.ReflectAnnotatedElement;
|
|||
import org.teavm.metaprogramming.reflect.ReflectMethod;
|
||||
import org.teavm.model.MethodReader;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Alexey Andreev
|
||||
*/
|
||||
public class ReflectMethodImpl implements ReflectMethod {
|
||||
private ReflectContext context;
|
||||
private ReflectClassImpl<?> declaringClass;
|
|
@ -0,0 +1,17 @@
|
|||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
org.teavm.metaprogramming.impl.MetaprogrammingPlugin
|
3
pom.xml
3
pom.xml
|
@ -79,7 +79,7 @@
|
|||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>metaprogramming-api</module>
|
||||
<module>metaprogramming/api</module>
|
||||
<module>core</module>
|
||||
<module>classlib</module>
|
||||
<module>jso/core</module>
|
||||
|
@ -95,6 +95,7 @@
|
|||
<module>tools/junit</module>
|
||||
<module>tests</module>
|
||||
<module>extras-slf4j</module>
|
||||
<module>metaprogramming/impl</module>
|
||||
</modules>
|
||||
|
||||
<dependencyManagement>
|
||||
|
|
|
@ -57,10 +57,8 @@
|
|||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.teavm</groupId>
|
||||
<artifactId>teavm-metaprogramming-api</artifactId>
|
||||
<artifactId>teavm-metaprogramming-impl</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<classifier>tests</classifier>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
|
@ -22,7 +22,6 @@ import static org.teavm.metaprogramming.Metaprogramming.exit;
|
|||
import static org.teavm.metaprogramming.Metaprogramming.proxy;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.teavm.classlib.java.lang.StringBuilderTest;
|
||||
import org.teavm.junit.SkipJVM;
|
||||
import org.teavm.junit.TeaVMTestRunner;
|
||||
import org.teavm.metaprogramming.CompileTime;
|
||||
|
|
|
@ -10,14 +10,6 @@
|
|||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.sourceforge.htmlunit:htmlunit:2.19" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.apache.httpcomponents:httpmime:4.5.1" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: net.sourceforge.cssparser:cssparser:0.9.18" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.eclipse.jetty:jetty-util:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.eclipse.jetty:jetty-io:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="module" module-name="teavm-core" />
|
||||
<orderEntry type="module" module-name="teavm-metaprogramming-api" />
|
||||
<orderEntry type="library" name="Maven: commons-io:commons-io:2.4" level="project" />
|
||||
|
@ -33,7 +25,7 @@
|
|||
<orderEntry type="module" module-name="teavm-platform" />
|
||||
<orderEntry type="module" module-name="teavm-jso-apis" />
|
||||
<orderEntry type="module" module-name="teavm-jso-apis" production-on-test="" />
|
||||
<orderEntry type="module" module-name="teavm-metaprogramming-api" production-on-test="" />
|
||||
<orderEntry type="module" module-name="impl" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.11" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="module" module-name="teavm-tooling" scope="TEST" />
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<property key="Bundle-Description" value="TeaVM API that helps to create tooling" />
|
||||
<property key="Export-Package" value="org.teavm.*" />
|
||||
<property key="Bundle-Name" value="TeaVM tooling core" />
|
||||
<property key="Include-Resource" value="org/teavm/tooling/test/junit.html=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/junit.html,org/teavm/tooling/test/res/junit.css=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/junit.css,org/teavm/tooling/test/res/tick-small.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/tick-small.png,org/teavm/tooling/test/res/tick-small-red.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/tick-small-red.png,org/teavm/tooling/test/res/toggle-small-expand.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/toggle-small-expand.png,org/teavm/tooling/test/res/control-000-small.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/control-000-small.png,org/teavm/tooling/test/res/junit-support.js=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/junit-support.js,org/teavm/tooling/test/res/class_obj.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/class_obj.png,org/teavm/tooling/test/res/package_obj.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/package_obj.png,org/teavm/tooling/test/res/methpub_obj.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/methpub_obj.png,org/teavm/tooling/test/res/junit-client.js=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/junit-client.js,org/teavm/tooling/test/res/toggle-small.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/toggle-small.png,org/teavm/tooling/test/junit-client.html=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/junit-client.html,org/teavm/tooling/main.html=$MODULE_DIR$/src/main/resources/org/teavm/tooling/main.html" />
|
||||
<property key="Include-Resource" value="org/teavm/tooling/main.html=$MODULE_DIR$/src/main/resources/org/teavm/tooling/main.html,org/teavm/tooling/test/junit.html=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/junit.html,org/teavm/tooling/test/junit-client.html=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/junit-client.html,org/teavm/tooling/test/res/junit-support.js=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/junit-support.js,org/teavm/tooling/test/res/control-000-small.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/control-000-small.png,org/teavm/tooling/test/res/package_obj.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/package_obj.png,org/teavm/tooling/test/res/junit-client.js=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/junit-client.js,org/teavm/tooling/test/res/junit.css=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/junit.css,org/teavm/tooling/test/res/tick-small-red.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/tick-small-red.png,org/teavm/tooling/test/res/tick-small.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/tick-small.png,org/teavm/tooling/test/res/class_obj.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/class_obj.png,org/teavm/tooling/test/res/toggle-small.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/toggle-small.png,org/teavm/tooling/test/res/toggle-small-expand.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/toggle-small-expand.png,org/teavm/tooling/test/res/methpub_obj.png=$MODULE_DIR$/src/main/resources/org/teavm/tooling/test/res/methpub_obj.png" />
|
||||
</additionalProperties>
|
||||
<additionalJARContents />
|
||||
</configuration>
|
||||
|
|
|
@ -11,14 +11,6 @@
|
|||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Maven: net.sourceforge.htmlunit:htmlunit:2.19" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpmime:4.5.1" level="project" />
|
||||
<orderEntry type="library" name="Maven: net.sourceforge.cssparser:cssparser:0.9.18" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-client:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-util:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty:jetty-io:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-common:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="library" name="Maven: org.eclipse.jetty.websocket:websocket-api:9.2.13.v20150730" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: junit:junit:4.11" level="project" />
|
||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
|
||||
<orderEntry type="module" module-name="teavm-tooling" />
|
||||
|
|
Loading…
Reference in New Issue
Block a user