From a1c377b0a6e7ecc3ad69c1577aec3706ca2a7512 Mon Sep 17 00:00:00 2001 From: Florian Weikert Date: Mon, 9 Nov 2015 17:05:29 +0000 Subject: Compile for loops with break/continue to byte code -- MOS_MIGRATED_REVID=107389651 --- .../lib/syntax/compiler/ByteCodeMethodCalls.java | 41 ++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java') diff --git a/src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java b/src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java index 5027610e29..55e9cc1bf6 100644 --- a/src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java +++ b/src/main/java/com/google/devtools/build/lib/syntax/compiler/ByteCodeMethodCalls.java @@ -18,6 +18,8 @@ import com.google.common.collect.ImmutableMap; import net.bytebuddy.implementation.bytecode.StackManipulation; +import java.util.Iterator; +import java.util.List; import java.util.Map; /** @@ -30,6 +32,14 @@ import java.util.Map; */ public class ByteCodeMethodCalls { + /** + * Byte code invocations for {@link Object}. + */ + public static class BCObject { + public static final StackManipulation equals = + ByteCodeUtils.invoke(Object.class, "equals", Object.class); + } + /** * Byte code invocations for {@link Boolean}. */ @@ -67,15 +77,24 @@ public class ByteCodeMethodCalls { public static final StackManipulation builder = ByteCodeUtils.invoke(ImmutableList.class, "builder"); + public static final StackManipulation copyOf = + ByteCodeUtils.invoke(ImmutableList.class, "copyOf", Iterable.class); + + public static final StackManipulation iterator = + ByteCodeUtils.invoke(ImmutableList.class, "iterator"); + /** - * Byte code invocations for {@link com.google.common.collect.ImmutableList.Builder}. - */ + * Byte code invocations for {@link ImmutableList.Builder}. + */ public static class Builder { public static final StackManipulation build = ByteCodeUtils.invoke(ImmutableList.Builder.class, "build"); public static final StackManipulation add = ByteCodeUtils.invoke(ImmutableList.Builder.class, "add", Object.class); + + public static final StackManipulation addAll = + ByteCodeUtils.invoke(ImmutableList.Builder.class, "addAll", Iterable.class); } } @@ -86,4 +105,22 @@ public class ByteCodeMethodCalls { public static final StackManipulation valueOf = ByteCodeUtils.invoke(Integer.class, "valueOf", int.class); } + + /** + * Byte code invocations for {@link Iterator}. + */ + public static class BCIterator { + + public static final StackManipulation hasNext = ByteCodeUtils.invoke(Iterator.class, "hasNext"); + + public static final StackManipulation next = ByteCodeUtils.invoke(Iterator.class, "next"); + } + + /** + * Byte code invocations for {@link List}. + */ + public static class BCList { + public static final StackManipulation add = + ByteCodeUtils.invoke(List.class, "add", Object.class); + } } -- cgit v1.2.3