From d4012a751f11743a0c8d1648a6a685a44dc7de35 Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Thu, 13 Dec 2018 20:05:13 +0100 Subject: [PATCH] compile on the fly only the needed instead all given --- .../jwebassembly/JWebAssembly.java | 4 ---- .../jwebassembly/module/ModuleGenerator.java | 21 +++++-------------- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/src/de/inetsoftware/jwebassembly/JWebAssembly.java b/src/de/inetsoftware/jwebassembly/JWebAssembly.java index 935fd1b..187e3c7 100644 --- a/src/de/inetsoftware/jwebassembly/JWebAssembly.java +++ b/src/de/inetsoftware/jwebassembly/JWebAssembly.java @@ -255,10 +255,6 @@ public class JWebAssembly { generator.prepare( classFile ); } generator.prepareFinish(); - for( URL url : classFiles ) { - ClassFile classFile = new ClassFile( new BufferedInputStream( url.openStream() ) ); - generator.write( classFile ); - } generator.finish(); } } diff --git a/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java b/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java index 973e839..f8e2b75 100644 --- a/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java +++ b/src/de/inetsoftware/jwebassembly/module/ModuleGenerator.java @@ -91,18 +91,6 @@ public class ModuleGenerator { writer.prepareFinish(); } - /** - * Write the content of the class to the writer. - * - * @param classFile - * the class file - * @throws WasmException - * if some Java code can't converted - */ - public void write( ClassFile classFile ) throws WasmException { - iterateMethods( classFile, m -> writeMethod( m ) ); - } - /** * Finish the code generation. * @@ -163,10 +151,6 @@ public class ModuleGenerator { MethodInfo[] methods = classFile.getMethods(); for( MethodInfo method : methods ) { Code code = method.getCode(); - if( method.getName().equals( "" ) && method.getType().equals( "()V" ) - && code.isSuperInitReturn( classFile.getSuperClass() ) ) { - continue; //default constructor - } handler.accept( method ); } } catch( IOException ioex ) { @@ -192,6 +176,11 @@ public class ModuleGenerator { String importName = (String)annotationValues.get( "name" ); writer.prepareImport( name, impoarModule, importName ); writeMethodSignature( name, null, null ); + } else { + annotationValues = method.getAnnotation( JWebAssembly.EXPORT_ANNOTATION ); + if( annotationValues != null ) { + functions.functionCall( name ); + } } } catch( Exception ioex ) { throw WasmException.create( ioex, sourceFile, className, -1 );