1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/emul/compact/src/test/java/org/apidesign/bck2brwsr/compact/tck/ServiceLoaderTest.java Fri Jan 25 16:47:04 2013 +0100
1.3 @@ -0,0 +1,61 @@
1.4 +/**
1.5 + * Back 2 Browser Bytecode Translator
1.6 + * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
1.7 + *
1.8 + * This program is free software: you can redistribute it and/or modify
1.9 + * it under the terms of the GNU General Public License as published by
1.10 + * the Free Software Foundation, version 2 of the License.
1.11 + *
1.12 + * This program is distributed in the hope that it will be useful,
1.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1.15 + * GNU General Public License for more details.
1.16 + *
1.17 + * You should have received a copy of the GNU General Public License
1.18 + * along with this program. Look for COPYING file in the top folder.
1.19 + * If not, see http://opensource.org/licenses/GPL-2.0.
1.20 + */
1.21 +package org.apidesign.bck2brwsr.compact.tck;
1.22 +
1.23 +import java.io.IOException;
1.24 +import java.util.ServiceLoader;
1.25 +import org.apidesign.bck2brwsr.vmtest.Compare;
1.26 +import org.apidesign.bck2brwsr.vmtest.VMTest;
1.27 +import org.openide.util.lookup.ServiceProvider;
1.28 +import org.testng.annotations.Factory;
1.29 +
1.30 +/**
1.31 + *
1.32 + * @author Jaroslav Tulach <jtulach@netbeans.org>
1.33 + */
1.34 +public class ServiceLoaderTest {
1.35 + @Compare//(scripting = false)
1.36 + public Object findsIOException() {
1.37 +// delayStart();
1.38 + for (IOException e : ServiceLoader.load(IOException.class)) {
1.39 + return "Found service: " + e.getClass().getName();
1.40 + }
1.41 + return null;
1.42 + }
1.43 +/*
1.44 + @org.apidesign.bck2brwsr.core.JavaScriptBody(args = { "a" }, body = "alert(a);")
1.45 + private static void alert(String a) {
1.46 + }
1.47 + private void delayStart() {
1.48 + for (int i = 0; i < 10; i++) {
1.49 + alert("State: " + i);
1.50 + for (int j = 0; j < 493208409; j++) ;
1.51 + }
1.52 + }
1.53 +*/
1.54 +
1.55 + @Factory
1.56 + public static Object[] create() {
1.57 + return VMTest.create(ServiceLoaderTest.class);
1.58 + }
1.59 +
1.60 +
1.61 + @ServiceProvider(service = IOException.class)
1.62 + public static class MyException extends IOException {
1.63 + }
1.64 +}
2.1 --- a/emul/mini/src/main/java/java/lang/Character.java Fri Jan 25 15:47:46 2013 +0100
2.2 +++ b/emul/mini/src/main/java/java/lang/Character.java Fri Jan 25 16:47:04 2013 +0100
2.3 @@ -2026,7 +2026,7 @@
2.4 */
2.5 public static boolean isJavaIdentifierPart(int codePoint) {
2.6 return isJavaIdentifierStart(codePoint) ||
2.7 - ('0' <= codePoint && codePoint <= '9');
2.8 + ('0' <= codePoint && codePoint <= '9') || codePoint == '$';
2.9 }
2.10
2.11 /**
3.1 --- a/emul/mini/src/main/java/java/lang/Class.java Fri Jan 25 15:47:46 2013 +0100
3.2 +++ b/emul/mini/src/main/java/java/lang/Class.java Fri Jan 25 16:47:04 2013 +0100
3.3 @@ -32,6 +32,7 @@
3.4 import java.lang.reflect.Field;
3.5 import java.lang.reflect.Method;
3.6 import java.lang.reflect.TypeVariable;
3.7 +import java.net.URL;
3.8 import org.apidesign.bck2brwsr.core.JavaScriptBody;
3.9 import org.apidesign.bck2brwsr.emul.reflect.MethodImpl;
3.10
3.11 @@ -1030,15 +1031,16 @@
3.12 * @since JDK1.1
3.13 */
3.14 public java.net.URL getResource(String name) {
3.15 - name = resolveName(name);
3.16 - ClassLoader cl = null;
3.17 - if (cl==null) {
3.18 - // A system class.
3.19 - return ClassLoader.getSystemResource(name);
3.20 - }
3.21 - return cl.getResource(name);
3.22 + InputStream is = getResourceAsStream(name);
3.23 + return is == null ? null : newResourceURL(URL.class, "res:/" + name, is);
3.24 }
3.25 -
3.26 +
3.27 + @JavaScriptBody(args = { "url", "spec", "is" }, body =
3.28 + "var u = url.cnstr(true);\n"
3.29 + + "u.constructor.cons__VLjava_lang_String_2Ljava_io_InputStream_2.call(u, spec, is);\n"
3.30 + + "return u;"
3.31 + )
3.32 + private static native URL newResourceURL(Class<URL> url, String spec, InputStream is);
3.33
3.34 /**
3.35 * Add a package name prefix if the name is not absolute Remove leading "/"
4.1 --- a/emul/mini/src/main/java/java/lang/ClassLoader.java Fri Jan 25 15:47:46 2013 +0100
4.2 +++ b/emul/mini/src/main/java/java/lang/ClassLoader.java Fri Jan 25 16:47:04 2013 +0100
4.3 @@ -703,7 +703,7 @@
4.4 public static Enumeration<URL> getSystemResources(String name)
4.5 throws IOException
4.6 {
4.7 - ClassLoader system = getSystemClassLoader();
4.8 + ClassLoader system = null; // getSystemClassLoader();
4.9 if (system == null) {
4.10 return getBootstrapResources(name);
4.11 }
4.12 @@ -874,7 +874,29 @@
4.13 }
4.14
4.15 private static Enumeration<URL> getBootstrapResources(String name) {
4.16 - throw new UnsupportedOperationException();
4.17 + URL u = Object.class.getResource("/" + name);
4.18 + return new OneOrZeroEnum(u);
4.19 + }
4.20 +
4.21 + private static class OneOrZeroEnum implements Enumeration<URL> {
4.22 + private URL u;
4.23 +
4.24 + public OneOrZeroEnum(URL u) {
4.25 + this.u = u;
4.26 + }
4.27 +
4.28 + public boolean hasMoreElements() {
4.29 + return u != null;
4.30 + }
4.31 +
4.32 + public URL nextElement() {
4.33 + URL r = u;
4.34 + if (r == null) {
4.35 + throw new NoSuchElementException();
4.36 + }
4.37 + u = null;
4.38 + return r;
4.39 + }
4.40 }
4.41
4.42 private static class CompoundEnumeration implements Enumeration<URL> {
5.1 --- a/emul/mini/src/main/java/java/net/URL.java Fri Jan 25 15:47:46 2013 +0100
5.2 +++ b/emul/mini/src/main/java/java/net/URL.java Fri Jan 25 16:47:04 2013 +0100
5.3 @@ -29,6 +29,7 @@
5.4 import java.io.InputStream;
5.5 import org.apidesign.bck2brwsr.core.JavaScriptBody;
5.6
5.7 +
5.8 /**
5.9 * Class <code>URL</code> represents a Uniform Resource
5.10 * Locator, a pointer to a "resource" on the World
5.11 @@ -212,6 +213,9 @@
5.12 * @serial
5.13 */
5.14 private int hashCode = -1;
5.15 +
5.16 + /** input stream associated with the URL */
5.17 + private InputStream is;
5.18
5.19 /**
5.20 * Creates a <code>URL</code> object from the specified
5.21 @@ -421,6 +425,11 @@
5.22 public URL(String spec) throws MalformedURLException {
5.23 this(null, spec);
5.24 }
5.25 +
5.26 + private URL(String spec, InputStream is) throws MalformedURLException {
5.27 + this(null, spec);
5.28 + this.is = is;
5.29 + }
5.30
5.31 /**
5.32 * Creates a URL by parsing the given spec within a specified context.
5.33 @@ -950,8 +959,10 @@
5.34 * @see java.net.URLConnection#getInputStream()
5.35 */
5.36 public final InputStream openStream() throws java.io.IOException {
5.37 + if (is != null) {
5.38 + return is;
5.39 + }
5.40 throw new IOException();
5.41 -// return openConnection().getInputStream();
5.42 }
5.43
5.44 /**
5.45 @@ -1006,7 +1017,6 @@
5.46 }
5.47
5.48 }
5.49 -
5.50 class Parts {
5.51 String path, query, ref;
5.52
6.1 --- a/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java Fri Jan 25 15:47:46 2013 +0100
6.2 +++ b/vm/src/main/java/org/apidesign/vm4brwsr/ByteCodeToJavaScript.java Fri Jan 25 16:47:04 2013 +0100
6.3 @@ -270,6 +270,7 @@
6.4
6.5 int lastStackFrame = -1;
6.6 TrapData[] previousTrap = null;
6.7 + boolean wide = false;
6.8
6.9 out.append("\n var gt = 0;\n for(;;) switch(gt) {\n");
6.10 for (int i = 0; i < byteCodes.length; i++) {
6.11 @@ -295,7 +296,7 @@
6.12 out.append("try {");
6.13 previousTrap = trap.current();
6.14 }
6.15 - final int c = readByte(byteCodes, i);
6.16 + final int c = readUByte(byteCodes, i);
6.17 switch (c) {
6.18 case opc_aload_0:
6.19 emit(out, "var @1 = @2;", smapper.pushA(), lmapper.getA(0));
6.20 @@ -358,61 +359,91 @@
6.21 emit(out, "var @1 = @2;", smapper.pushD(), lmapper.getD(3));
6.22 break;
6.23 case opc_iload: {
6.24 - final int indx = readByte(byteCodes, ++i);
6.25 + ++i;
6.26 + final int indx = wide ? readUShort(byteCodes, i++)
6.27 + : readUByte(byteCodes, i);
6.28 + wide = false;
6.29 emit(out, "var @1 = @2;",
6.30 smapper.pushI(), lmapper.getI(indx));
6.31 break;
6.32 }
6.33 case opc_lload: {
6.34 - final int indx = readByte(byteCodes, ++i);
6.35 + ++i;
6.36 + final int indx = wide ? readUShort(byteCodes, i++)
6.37 + : readUByte(byteCodes, i);
6.38 + wide = false;
6.39 emit(out, "var @1 = @2;",
6.40 smapper.pushL(), lmapper.getL(indx));
6.41 break;
6.42 }
6.43 case opc_fload: {
6.44 - final int indx = readByte(byteCodes, ++i);
6.45 + ++i;
6.46 + final int indx = wide ? readUShort(byteCodes, i++)
6.47 + : readUByte(byteCodes, i);
6.48 + wide = false;
6.49 emit(out, "var @1 = @2;",
6.50 smapper.pushF(), lmapper.getF(indx));
6.51 break;
6.52 }
6.53 case opc_dload: {
6.54 - final int indx = readByte(byteCodes, ++i);
6.55 + ++i;
6.56 + final int indx = wide ? readUShort(byteCodes, i++)
6.57 + : readUByte(byteCodes, i);
6.58 + wide = false;
6.59 emit(out, "var @1 = @2;",
6.60 smapper.pushD(), lmapper.getD(indx));
6.61 break;
6.62 }
6.63 case opc_aload: {
6.64 - final int indx = readByte(byteCodes, ++i);
6.65 + ++i;
6.66 + final int indx = wide ? readUShort(byteCodes, i++)
6.67 + : readUByte(byteCodes, i);
6.68 + wide = false;
6.69 emit(out, "var @1 = @2;",
6.70 smapper.pushA(), lmapper.getA(indx));
6.71 break;
6.72 }
6.73 case opc_istore: {
6.74 - final int indx = readByte(byteCodes, ++i);
6.75 + ++i;
6.76 + final int indx = wide ? readUShort(byteCodes, i++)
6.77 + : readUByte(byteCodes, i);
6.78 + wide = false;
6.79 emit(out, "var @1 = @2;",
6.80 lmapper.setI(indx), smapper.popI());
6.81 break;
6.82 }
6.83 case opc_lstore: {
6.84 - final int indx = readByte(byteCodes, ++i);
6.85 + ++i;
6.86 + final int indx = wide ? readUShort(byteCodes, i++)
6.87 + : readUByte(byteCodes, i);
6.88 + wide = false;
6.89 emit(out, "var @1 = @2;",
6.90 lmapper.setL(indx), smapper.popL());
6.91 break;
6.92 }
6.93 case opc_fstore: {
6.94 - final int indx = readByte(byteCodes, ++i);
6.95 + ++i;
6.96 + final int indx = wide ? readUShort(byteCodes, i++)
6.97 + : readUByte(byteCodes, i);
6.98 + wide = false;
6.99 emit(out, "var @1 = @2;",
6.100 lmapper.setF(indx), smapper.popF());
6.101 break;
6.102 }
6.103 case opc_dstore: {
6.104 - final int indx = readByte(byteCodes, ++i);
6.105 + ++i;
6.106 + final int indx = wide ? readUShort(byteCodes, i++)
6.107 + : readUByte(byteCodes, i);
6.108 + wide = false;
6.109 emit(out, "var @1 = @2;",
6.110 lmapper.setD(indx), smapper.popD());
6.111 break;
6.112 }
6.113 case opc_astore: {
6.114 - final int indx = readByte(byteCodes, ++i);
6.115 + ++i;
6.116 + final int indx = wide ? readUShort(byteCodes, i++)
6.117 + : readUByte(byteCodes, i);
6.118 + wide = false;
6.119 emit(out, "var @1 = @2;",
6.120 lmapper.setA(indx), smapper.popA());
6.121 break;
6.122 @@ -588,8 +619,13 @@
6.123 emit(out, "@1 >>>= @2;", smapper.getL(1), smapper.popI());
6.124 break;
6.125 case opc_iinc: {
6.126 - final int varIndx = readByte(byteCodes, ++i);
6.127 - final int incrBy = byteCodes[++i];
6.128 + ++i;
6.129 + final int varIndx = wide ? readUShort(byteCodes, i++)
6.130 + : readUByte(byteCodes, i);
6.131 + ++i;
6.132 + final int incrBy = wide ? readIntArg(byteCodes, i++)
6.133 + : byteCodes[i];
6.134 + wide = false;
6.135 if (incrBy == 1) {
6.136 emit(out, "@1++;", lmapper.getI(varIndx));
6.137 } else {
6.138 @@ -713,7 +749,7 @@
6.139 emit(out, "var @1 = 5;", smapper.pushI());
6.140 break;
6.141 case opc_ldc: {
6.142 - int indx = readByte(byteCodes, ++i);
6.143 + int indx = readUByte(byteCodes, ++i);
6.144 String v = encodeConstant(indx);
6.145 int type = VarType.fromConstantType(jc.getTag(indx));
6.146 emit(out, "var @1 = @2;", smapper.pushT(type), v);
6.147 @@ -896,7 +932,7 @@
6.148 break;
6.149 }
6.150 case opc_newarray:
6.151 - int atype = readByte(byteCodes, ++i);
6.152 + int atype = readUByte(byteCodes, ++i);
6.153 String jvmType;
6.154 switch (atype) {
6.155 case 4: jvmType = "[Z"; break;
6.156 @@ -929,7 +965,7 @@
6.157 int type = readIntArg(byteCodes, i);
6.158 i += 2;
6.159 String typeName = jc.getClassName(type);
6.160 - int dim = readByte(byteCodes, ++i);
6.161 + int dim = readUByte(byteCodes, ++i);
6.162 StringBuilder dims = new StringBuilder();
6.163 dims.append('[');
6.164 for (int d = 0; d < dim; d++) {
6.165 @@ -1004,16 +1040,16 @@
6.166 break;
6.167 }
6.168 case opc_dup2: {
6.169 - if (smapper.get(0).isCategory2()) {
6.170 - final Variable v = smapper.get(0);
6.171 + final Variable vi1 = smapper.get(0);
6.172 +
6.173 + if (vi1.isCategory2()) {
6.174 emit(out, "var @1 = @2;",
6.175 - smapper.pushT(v.getType()), v);
6.176 + smapper.pushT(vi1.getType()), vi1);
6.177 } else {
6.178 - final Variable v1 = smapper.get(0);
6.179 - final Variable v2 = smapper.get(1);
6.180 + final Variable vi2 = smapper.get(1);
6.181 emit(out, "var @1 = @2, @3 = @4;",
6.182 - smapper.pushT(v2.getType()), v2,
6.183 - smapper.pushT(v1.getType()), v1);
6.184 + smapper.pushT(vi2.getType()), vi2,
6.185 + smapper.pushT(vi1.getType()), vi1);
6.186 }
6.187 break;
6.188 }
6.189 @@ -1028,10 +1064,11 @@
6.190 vo1, vi1, vo2, vi2, vo3, vo1);
6.191 break;
6.192 }
6.193 - case opc_dup_x2: {
6.194 - if (smapper.get(1).isCategory2()) {
6.195 - final Variable vi1 = smapper.pop();
6.196 - final Variable vi2 = smapper.pop();
6.197 + case opc_dup2_x1: {
6.198 + final Variable vi1 = smapper.pop();
6.199 + final Variable vi2 = smapper.pop();
6.200 +
6.201 + if (vi1.isCategory2()) {
6.202 final Variable vo3 = smapper.pushT(vi1.getType());
6.203 final Variable vo2 = smapper.pushT(vi2.getType());
6.204 final Variable vo1 = smapper.pushT(vi1.getType());
6.205 @@ -1039,8 +1076,32 @@
6.206 emit(out, "var @1 = @2, @3 = @4, @5 = @6;",
6.207 vo1, vi1, vo2, vi2, vo3, vo1);
6.208 } else {
6.209 - final Variable vi1 = smapper.pop();
6.210 - final Variable vi2 = smapper.pop();
6.211 + final Variable vi3 = smapper.pop();
6.212 + final Variable vo5 = smapper.pushT(vi2.getType());
6.213 + final Variable vo4 = smapper.pushT(vi1.getType());
6.214 + final Variable vo3 = smapper.pushT(vi3.getType());
6.215 + final Variable vo2 = smapper.pushT(vi2.getType());
6.216 + final Variable vo1 = smapper.pushT(vi1.getType());
6.217 +
6.218 + emit(out, "var @1 = @2, @3 = @4, @5 = @6,",
6.219 + vo1, vi1, vo2, vi2, vo3, vi3);
6.220 + emit(out, " @1 = @2, @3 = @4;",
6.221 + vo4, vo1, vo5, vo2);
6.222 + }
6.223 + break;
6.224 + }
6.225 + case opc_dup_x2: {
6.226 + final Variable vi1 = smapper.pop();
6.227 + final Variable vi2 = smapper.pop();
6.228 +
6.229 + if (vi2.isCategory2()) {
6.230 + final Variable vo3 = smapper.pushT(vi1.getType());
6.231 + final Variable vo2 = smapper.pushT(vi2.getType());
6.232 + final Variable vo1 = smapper.pushT(vi1.getType());
6.233 +
6.234 + emit(out, "var @1 = @2, @3 = @4, @5 = @6;",
6.235 + vo1, vi1, vo2, vi2, vo3, vo1);
6.236 + } else {
6.237 final Variable vi3 = smapper.pop();
6.238 final Variable vo4 = smapper.pushT(vi1.getType());
6.239 final Variable vo3 = smapper.pushT(vi3.getType());
6.240 @@ -1052,6 +1113,76 @@
6.241 }
6.242 break;
6.243 }
6.244 + case opc_dup2_x2: {
6.245 + final Variable vi1 = smapper.pop();
6.246 + final Variable vi2 = smapper.pop();
6.247 +
6.248 + if (vi1.isCategory2()) {
6.249 + if (vi2.isCategory2()) {
6.250 + final Variable vo3 = smapper.pushT(vi1.getType());
6.251 + final Variable vo2 = smapper.pushT(vi2.getType());
6.252 + final Variable vo1 = smapper.pushT(vi1.getType());
6.253 +
6.254 + emit(out, "var @1 = @2, @3 = @4, @5 = @6;",
6.255 + vo1, vi1, vo2, vi2, vo3, vo1);
6.256 + } else {
6.257 + final Variable vi3 = smapper.pop();
6.258 + final Variable vo4 = smapper.pushT(vi1.getType());
6.259 + final Variable vo3 = smapper.pushT(vi3.getType());
6.260 + final Variable vo2 = smapper.pushT(vi2.getType());
6.261 + final Variable vo1 = smapper.pushT(vi1.getType());
6.262 +
6.263 + emit(out, "var @1 = @2, @3 = @4, @5 = @6, @7 = @8;",
6.264 + vo1, vi1, vo2, vi2, vo3, vi3, vo4, vo1);
6.265 + }
6.266 + } else {
6.267 + final Variable vi3 = smapper.pop();
6.268 +
6.269 + if (vi3.isCategory2()) {
6.270 + final Variable vo5 = smapper.pushT(vi2.getType());
6.271 + final Variable vo4 = smapper.pushT(vi1.getType());
6.272 + final Variable vo3 = smapper.pushT(vi3.getType());
6.273 + final Variable vo2 = smapper.pushT(vi2.getType());
6.274 + final Variable vo1 = smapper.pushT(vi1.getType());
6.275 +
6.276 + emit(out, "var @1 = @2, @3 = @4, @5 = @6,",
6.277 + vo1, vi1, vo2, vi2, vo3, vi3);
6.278 + emit(out, " @1 = @2, @3 = @4;",
6.279 + vo4, vo1, vo5, vo2);
6.280 + } else {
6.281 + final Variable vi4 = smapper.pop();
6.282 + final Variable vo6 = smapper.pushT(vi2.getType());
6.283 + final Variable vo5 = smapper.pushT(vi1.getType());
6.284 + final Variable vo4 = smapper.pushT(vi4.getType());
6.285 + final Variable vo3 = smapper.pushT(vi3.getType());
6.286 + final Variable vo2 = smapper.pushT(vi2.getType());
6.287 + final Variable vo1 = smapper.pushT(vi1.getType());
6.288 +
6.289 + emit(out, "var @1 = @2, @3 = @4, @5 = @6, @7 = @8,",
6.290 + vo1, vi1, vo2, vi2, vo3, vi3, vo4, vi4);
6.291 + emit(out, " @1 = @2, @3 = @4;",
6.292 + vo5, vo1, vo6, vo2);
6.293 + }
6.294 + }
6.295 + break;
6.296 + }
6.297 + case opc_swap: {
6.298 + final Variable vi1 = smapper.get(0);
6.299 + final Variable vi2 = smapper.get(1);
6.300 +
6.301 + if (vi1.getType() == vi2.getType()) {
6.302 + final Variable tmp = smapper.pushT(vi1.getType());
6.303 +
6.304 + emit(out, "var @1 = @2, @2 = @3, @3 = @1;",
6.305 + tmp, vi1, vi2);
6.306 + smapper.pop(1);
6.307 + } else {
6.308 + smapper.pop(2);
6.309 + smapper.pushT(vi1.getType());
6.310 + smapper.pushT(vi2.getType());
6.311 + }
6.312 + break;
6.313 + }
6.314 case opc_bipush:
6.315 emit(out, "var @1 = @2;",
6.316 smapper.pushI(), Integer.toString(byteCodes[++i]));
6.317 @@ -1154,7 +1285,12 @@
6.318 break;
6.319 }
6.320
6.321 + case opc_wide:
6.322 + wide = true;
6.323 + break;
6.324 +
6.325 default: {
6.326 + wide = false;
6.327 emit(out, "throw 'unknown bytecode @1';",
6.328 Integer.toString(c));
6.329 }
6.330 @@ -1162,7 +1298,7 @@
6.331 if (debug(" //")) {
6.332 for (int j = prev; j <= i; j++) {
6.333 out.append(" ");
6.334 - final int cc = readByte(byteCodes, j);
6.335 + final int cc = readUByte(byteCodes, j);
6.336 out.append(Integer.toString(cc));
6.337 }
6.338 }
6.339 @@ -1198,10 +1334,15 @@
6.340 final int a = byteCodes[offsetInstruction + 3];
6.341 return (d & 0xff000000) | (c & 0xff0000) | (b & 0xff00) | (a & 0xff);
6.342 }
6.343 - private int readByte(byte[] byteCodes, int offsetInstruction) {
6.344 + private int readUByte(byte[] byteCodes, int offsetInstruction) {
6.345 return byteCodes[offsetInstruction] & 0xff;
6.346 }
6.347 -
6.348 +
6.349 + private int readUShort(byte[] byteCodes, int offsetInstruction) {
6.350 + return ((byteCodes[offsetInstruction] & 0xff) << 8)
6.351 + | (byteCodes[offsetInstruction + 1] & 0xff);
6.352 + }
6.353 +
6.354 private static void countArgs(String descriptor, char[] returnType, StringBuilder sig, StringBuilder cnt) {
6.355 int i = 0;
6.356 Boolean count = null;
7.1 --- a/vm/src/main/java/org/apidesign/vm4brwsr/VarType.java Fri Jan 25 15:47:46 2013 +0100
7.2 +++ b/vm/src/main/java/org/apidesign/vm4brwsr/VarType.java Fri Jan 25 16:47:04 2013 +0100
7.3 @@ -45,13 +45,13 @@
7.4 return VarType.DOUBLE;
7.5 case RuntimeConstants.ITEM_Long:
7.6 return VarType.LONG;
7.7 + case RuntimeConstants.ITEM_Null:
7.8 + case RuntimeConstants.ITEM_InitObject:
7.9 case RuntimeConstants.ITEM_Object:
7.10 + case RuntimeConstants.ITEM_NewObject:
7.11 return VarType.REFERENCE;
7.12
7.13 case RuntimeConstants.ITEM_Bogus:
7.14 - case RuntimeConstants.ITEM_Null:
7.15 - case RuntimeConstants.ITEM_InitObject:
7.16 - case RuntimeConstants.ITEM_NewObject:
7.17 /* unclear how to handle for now */
7.18 default:
7.19 throw new IllegalStateException("Unhandled stack map type");