diff options
author | delphinemartin <delphinemartin@google.com> | 2014-04-28 10:08:02 +0200 |
---|---|---|
committer | delphinemartin <delphinemartin@google.com> | 2014-05-15 18:53:50 +0200 |
commit | e4b6a472851a752e4fcc78022c48513f9e354b3e (patch) | |
tree | 5436b6e9c821dca1b1ee94b204eb6e7f2a7fc7fb /jill | |
parent | 74685f3d2e5b90e333660f0aae209464fd8511d2 (diff) | |
download | toolchain_jill-e4b6a472851a752e4fcc78022c48513f9e354b3e.zip toolchain_jill-e4b6a472851a752e4fcc78022c48513f9e354b3e.tar.gz toolchain_jill-e4b6a472851a752e4fcc78022c48513f9e354b3e.tar.bz2 |
Splitted OriginalTypeInfo in two markers
OriginalTypeInfo is now replaced by GenericSignature and SourceName markers.
It allows us to remove null values.
Change-Id: I6b519212317cd70c997a934454d626165d970bea
Diffstat (limited to 'jill')
3 files changed, 33 insertions, 20 deletions
diff --git a/jill/src/com/android/jill/backend/jayce/Token.java b/jill/src/com/android/jill/backend/jayce/Token.java index 424afbe..3dc0786 100644 --- a/jill/src/com/android/jill/backend/jayce/Token.java +++ b/jill/src/com/android/jill/backend/jayce/Token.java @@ -96,6 +96,7 @@ public enum Token { FIELD_REF("field-ref"), FLOAT_LITERAL("float"), FOR_STATEMENT("for"), + GENERIC_SINGATURE("generic-signature"), GOTO("goto"), GTE_OPERATION(">="), GT_OPERATION(">"), @@ -124,7 +125,6 @@ public enum Token { NEW_INSTANCE("new"), NULL_LITERAL("null-literal"), OR_OPERATION("||"), - ORIGINAL_TYPE_INFO("type-info"), PARAMETER("parameter"), PARAMETER_REF("parameter-ref"), POSTFIX_DEC_OPERATION("postfix-dec"), @@ -141,6 +141,7 @@ public enum Token { SHORT_LITERAL("short"), SHR_OPERATION(">>"), SHRU_OPERATION(">>>"), + SOURCE_NAME("source-name"), SUB_OPERATION("-"), STRING_LITERAL("string"), SWITCH_STATEMENT("switch"), diff --git a/jill/src/com/android/jill/frontend/java/ClassNodeWriter.java b/jill/src/com/android/jill/frontend/java/ClassNodeWriter.java index 4aa3f8d..ae8523b 100644 --- a/jill/src/com/android/jill/frontend/java/ClassNodeWriter.java +++ b/jill/src/com/android/jill/frontend/java/ClassNodeWriter.java @@ -77,7 +77,8 @@ public class ClassNodeWriter extends JillWriter { writeMethods(cn); annotWriter.writeAnnotations(cn); writer.writeOpenNodeList(); // Markers - writeOriginalTypeInfoMarker(cn); + writeGenericSignatureMarker(cn); + writeSourceNameMarker(cn); writeThisRefTypeInfoMarker(cn); writer.writeCloseNodeList(); sourceInfoWriter.writeDebugEnd(cn); @@ -98,7 +99,8 @@ public class ClassNodeWriter extends JillWriter { writeMethods(cn); annotWriter.writeAnnotations(cn); writer.writeOpenNodeList(); // Markers - writeOriginalTypeInfoMarker(cn); + writeGenericSignatureMarker(cn); + writeSourceNameMarker(cn); writeThisRefTypeInfoMarker(cn); writer.writeCloseNodeList(); sourceInfoWriter.writeDebugEnd(cn); @@ -119,7 +121,8 @@ public class ClassNodeWriter extends JillWriter { writeMethods(cn); annotWriter.writeAnnotations(cn); writer.writeOpenNodeList(); // Markers - writeOriginalTypeInfoMarker(cn); + writeGenericSignatureMarker(cn); + writeSourceNameMarker(cn); writer.writeCloseNodeList(); sourceInfoWriter.writeDebugEnd(cn); writer.writeClose(); @@ -144,7 +147,8 @@ public class ClassNodeWriter extends JillWriter { writeAnnotationMethods(cn); annotWriter.writeAnnotations(cn); writer.writeOpenNodeList(); // Markers - writeOriginalTypeInfoMarker(cn); + writeGenericSignatureMarker(cn); + writeSourceNameMarker(cn); writer.writeCloseNodeList(); sourceInfoWriter.writeDebugEnd(cn); writer.writeClose(); @@ -173,27 +177,28 @@ public class ClassNodeWriter extends JillWriter { } } - private void writeOriginalTypeInfoMarker(@Nonnull ClassNode cn) throws IOException { - writer.writeKeyword(Token.ORIGINAL_TYPE_INFO); - writer.writeOpen(); + private void writeGenericSignatureMarker(@Nonnull ClassNode cn) throws IOException { if (AsmHelper.isGenericSignature(cn)) { + writer.writeKeyword(Token.GENERIC_SINGATURE); + writer.writeOpen(); writer.writeString(cn.signature); - } else { - writer.writeString(null); + writer.writeClose(); } + } + + private void writeSourceNameMarker(@Nonnull ClassNode cn) throws IOException { + writer.writeKeyword(Token.SOURCE_NAME); + writer.writeOpen(); writer.writeString(AsmHelper.getSourceName(cn)); writer.writeClose(); } - private void writeOriginalTypeInfoMarker(@Nonnull FieldNode fn) throws IOException { + private void writeGenericSignatureMarker(@Nonnull FieldNode fn) throws IOException { if (fn.signature != null) { - writer.writeKeyword(Token.ORIGINAL_TYPE_INFO); + writer.writeKeyword(Token.GENERIC_SINGATURE); writer.writeOpen(); writer.writeString(fn.signature); - writer.writeString(null); writer.writeClose(); - } else { - writer.writeNull(); } } @@ -233,7 +238,7 @@ public class ClassNodeWriter extends JillWriter { } annotWriter.writeAnnotations(fn); writer.writeOpenNodeList(); // Markers - writeOriginalTypeInfoMarker(fn); + writeGenericSignatureMarker(fn); writer.writeCloseNodeList(); sourceInfoWriter.writeDebugEnd(cn, fn); writer.writeClose(); diff --git a/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java b/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java index 25651c5..049c437 100644 --- a/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java +++ b/jill/src/com/android/jill/frontend/java/MethodBodyWriter.java @@ -283,10 +283,9 @@ public class MethodBodyWriter extends JillWriter implements Opcodes { private void writeOriginalTypeInfoMarker() throws IOException { if (currentMethod.signature != null) { - writer.writeKeyword(Token.ORIGINAL_TYPE_INFO); + writer.writeKeyword(Token.GENERIC_SINGATURE); writer.writeOpen(); writer.writeString(currentMethod.signature); - writer.writeString(null); writer.writeClose(); } else { writer.writeNull(); @@ -2004,9 +2003,13 @@ public class MethodBodyWriter extends JillWriter implements Opcodes { writer.writeCloseNodeList(); writer.writeOpenNodeList(); if (v.hasSignature()) { - writer.writeKeyword(Token.ORIGINAL_TYPE_INFO); // Marker original type info + writer.writeKeyword(Token.GENERIC_SINGATURE); // Marker generic signature writer.writeOpen(); writer.writeString(v.getSignature()); + writer.writeClose(); + + writer.writeKeyword(Token.SOURCE_NAME); // Marker source name + writer.writeOpen(); writer.writeString(AsmHelper.getSourceName(currentClass)); writer.writeClose(); } @@ -2258,9 +2261,13 @@ public class MethodBodyWriter extends JillWriter implements Opcodes { annotWriter.writeAnnotations(currentMethod, parameterAnnotationIdx); writer.writeOpenNodeList(); if (param.hasSignature()) { - writer.writeKeyword(Token.ORIGINAL_TYPE_INFO); // Marker original type info + writer.writeKeyword(Token.GENERIC_SINGATURE); // Marker generic signature writer.writeOpen(); writer.writeString(param.getSignature()); + writer.writeClose(); + + writer.writeKeyword(Token.SOURCE_NAME); // Marker source name + writer.writeOpen(); writer.writeString(AsmHelper.getSourceName(currentClass)); writer.writeClose(); } |