1.1 --- a/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java Thu May 22 10:48:09 2014 +0200
1.2 +++ b/rt/vm/src/main/java/org/apidesign/vm4brwsr/VM.java Thu May 22 19:06:44 2014 +0200
1.3 @@ -34,13 +34,18 @@
1.4 private final Bck2Brwsr.Resources resources;
1.5 private final ExportedSymbols exportedSymbols;
1.6 private final StringArray invokerMethods;
1.7 + private final StringArray asBinary;
1.8
1.9 - private VM(Appendable out, Bck2Brwsr.Resources resources, StringArray explicitlyExported) {
1.10 + private VM(
1.11 + Appendable out, Bck2Brwsr.Resources resources,
1.12 + StringArray explicitlyExported, StringArray asBinary
1.13 + ) {
1.14 super(out);
1.15 this.resources = resources;
1.16 this.classDataCache = new ClassDataCache(resources);
1.17 this.exportedSymbols = new ExportedSymbols(resources, explicitlyExported);
1.18 this.invokerMethods = new StringArray();
1.19 + this.asBinary = asBinary;
1.20 }
1.21
1.22 static {
1.23 @@ -70,17 +75,23 @@
1.24 VM vm;
1.25 if (config.isExtension()) {
1.26 fixedNames.add(VM.class.getName().replace('.', '/'));
1.27 - vm = new Extension(out, config.getResources(), both, config.exported());
1.28 + vm = new Extension(out,
1.29 + config.getResources(), both, config.exported(),
1.30 + config.allResources()
1.31 + );
1.32 } else {
1.33 if (config.includeVM()) {
1.34 fixedNames.add(VM.class.getName().replace('.', '/'));
1.35 }
1.36 - vm = new Standalone(out, config.getResources(), config.exported());
1.37 + vm = new Standalone(out,
1.38 + config.getResources(), config.exported(),
1.39 + config.allResources()
1.40 + );
1.41 }
1.42 - vm.doCompile(fixedNames.addAndNew(both), config.allResources());
1.43 + vm.doCompile(fixedNames.addAndNew(both));
1.44 }
1.45
1.46 - private void doCompile(StringArray names, StringArray asBinary) throws IOException {
1.47 + private void doCompile(StringArray names) throws IOException {
1.48 generatePrologue();
1.49 append(
1.50 "\n var invoker = {};");
1.51 @@ -229,6 +240,7 @@
1.52 throw new IOException("Can't find " + resource);
1.53 }
1.54 readResource(emul, this);
1.55 + asBinary.remove(resource);
1.56 }
1.57 scripts = new StringArray();
1.58
1.59 @@ -441,8 +453,11 @@
1.60 }
1.61
1.62 private static final class Standalone extends VM {
1.63 - private Standalone(Appendable out, Bck2Brwsr.Resources resources, StringArray explicitlyExported) {
1.64 - super(out, resources, explicitlyExported);
1.65 + private Standalone(Appendable out,
1.66 + Bck2Brwsr.Resources resources,
1.67 + StringArray explicitlyExported, StringArray asBinary
1.68 + ) {
1.69 + super(out, resources, explicitlyExported, asBinary);
1.70 }
1.71
1.72 @Override
1.73 @@ -578,8 +593,10 @@
1.74 private final StringArray extensionClasses;
1.75
1.76 private Extension(Appendable out, Bck2Brwsr.Resources resources,
1.77 - String[] extClassesArray, StringArray explicitlyExported) {
1.78 - super(out, resources, explicitlyExported);
1.79 + String[] extClassesArray, StringArray explicitlyExported,
1.80 + StringArray asBinary
1.81 + ) {
1.82 + super(out, resources, explicitlyExported, asBinary);
1.83 this.extensionClasses = StringArray.asList(extClassesArray);
1.84 }
1.85