Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CALCITE-6465: Rework code generator to use Flink code splitter #3901

Open
wants to merge 30 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6ac2d2e
WIP: Integrate Flink code splitter
jduo Aug 2, 2024
c63821e
Remove exclusion of flink-core
jduo Aug 2, 2024
5556360
Fix format violations
jduo Aug 21, 2024
d3cf335
Refactor so that only methods get code-split
jduo Aug 21, 2024
739c747
Remove extra newline
jduo Aug 21, 2024
e9e20e1
Update calls to Expressions.toString()
jduo Sep 10, 2024
dc783a9
Merge fixes
jduo Sep 18, 2024
b7553e4
Fix whitespace differences in generated code
jduo Sep 19, 2024
f63b665
Checker framework
jduo Sep 19, 2024
4216e80
Autostyle
jduo Sep 19, 2024
2077d1e
Parameterize use of method splitting
jduo Sep 19, 2024
fd2de3d
Enable method splitting in linq4j tests
jduo Sep 20, 2024
8f04243
Make method-splitting in library code based on a CalciteSystemProperty
jduo Sep 20, 2024
dd5b995
Fix commented-out code
jduo Sep 20, 2024
8f62b88
Revert unintended change around assert
jduo Sep 20, 2024
1766b35
Revert unintended change
jduo Sep 20, 2024
cd33092
Fix merge issues
jduo Sep 20, 2024
dc1c66d
PR feedback
jduo Sep 24, 2024
2ce8cac
Turn off method-splitting for EnumUtils tests
jduo Sep 25, 2024
6d545db
Make method splitting happen on class declarations
jduo Sep 27, 2024
6200d82
Simplify the test case
jduo Sep 27, 2024
39e14a4
Fix typo in comment
jduo Sep 28, 2024
d969ee4
Make configuration of method splitting a threshold instead of a toggle
jduo Sep 28, 2024
232eb8e
Revert accidental change
jduo Sep 28, 2024
2887c0d
Fix some bugs introduced during refactoring
jduo Sep 28, 2024
fdd0d18
Fix Javadoc linter errors
jduo Sep 30, 2024
80c8587
PR feedback
jduo Oct 3, 2024
4a258d8
Clarify testLargeMethod
jduo Oct 4, 2024
c28f962
Add comments about circular dependency concerns
jduo Oct 4, 2024
4f95aa0
Expand on method-splitting tests
jduo Oct 4, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions bom/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ dependencies {
apiv("org.apache.commons:commons-pool2")
apiv("org.apache.commons:commons-collections4")
apiv("org.apache.commons:commons-text")
apiv("org.apache.flink:flink-table-code-splitter")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a note above this list of declarations that we import flink-table-code-splitter but we must not import core flink modules.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

apiv("org.apache.geode:geode-core")
apiv("org.apache.hadoop:hadoop-client", "hadoop")
apiv("org.apache.hadoop:hadoop-common", "hadoop")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ public static Bindable toBindable(Map<String, Object> parameters,
parameters);

final ClassDeclaration expr = relImplementor.implementRoot(rel, prefer);
String s = Expressions.toString(expr.memberDeclarations, "\n", false);
String s =
Expressions.toString(expr.memberDeclarations,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

put "\n", false, on previous line

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"\n", false,
CalciteSystemProperty.ENABLE_METHOD_SPLITTING.value());

if (CalciteSystemProperty.DEBUG.value()) {
Util.debugCode(System.out, s);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,13 @@ public final class CalciteSystemProperty<T> {
public static final CalciteSystemProperty<Integer> FUNCTION_LEVEL_CACHE_MAX_SIZE =
intProperty("calcite.function.cache.maxSize", 0, v -> v >= 0);

/** Whether to enable automatic method splitting when generating Java code.
*
* <p>Some queries can generate methods exceeding the JVM limit of 4000 characters per method.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you include a citation for your statement "JVM limit of 4000 characters per method"?

Java 7 had a limit 65534 bytes (bytecode size). When did that change?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I got this 4K from Flink's documentation on the configuration option relating to this:
https://github.com/apache/flink/blob/4101316ef37d3a7082bff57cb732f4e9e0349d09/flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/config/TableConfigOptions.java#L225

So it's not exactly that the JVM has a limit of 4K, it's that the default JIT allows 8K only. Let me find a source for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's specified here in OpenJDK (other vendors use the same limit): https://github.com/openjdk/jdk11u-dev/blob/a754a3d8972abc67aee768d31a2dc2e8214274cf/src/hotspot/share/runtime/globals.hpp#L2391

It's considered a developer option though, rather than an end-user option, so documentation is limited.

* Enable this feature to automatically detect and split methods larger than the limit. */
public static final CalciteSystemProperty<Boolean> ENABLE_METHOD_SPLITTING =
booleanProperty("calcite.linq.enable_method_splitting", false);

private static CalciteSystemProperty<Boolean> booleanProperty(String key,
boolean defaultValue) {
// Note that "" -> true (convenient for command-lines flags like '-Dflag')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ static Scalar.Producer baz(ParameterExpression context_,
final ClassDeclaration classDeclaration =
Expressions.classDecl(Modifier.PUBLIC, "Buzz", null,
ImmutableList.of(Scalar.Producer.class), declarations);
String s = Expressions.toString(declarations, "\n", false);
String s =
Expressions.toString(declarations, "\n", false,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The declarations here usually do not look like ClassDeclarations either.

CalciteSystemProperty.ENABLE_METHOD_SPLITTING.value());
if (CalciteSystemProperty.DEBUG.value()) {
Util.debugCode(System.out, s);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ private static String compile(RexBuilder rexBuilder, List<RexNode> constExps,
Expressions.methodDecl(Modifier.PUBLIC, Object[].class,
BuiltInMethod.FUNCTION1_APPLY.method.getName(),
ImmutableList.of(root0_), blockBuilder.toBlock());
String code = Expressions.toString(methodDecl);
String code =
Expressions.toString(methodDecl, CalciteSystemProperty.ENABLE_METHOD_SPLITTING.value());
if (CalciteSystemProperty.DEBUG.value()) {
Util.debugCode(System.out, code);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public final class EnumUtilsTest {
EnumUtils.convert(date, int.class);
final Expression dateToInteger =
EnumUtils.convert(date, Integer.class);
assertThat(Expressions.toString(dateToInt),
assertThat(Expressions.toString(dateToInt, true),
is("org.apache.calcite.runtime.SqlFunctions.toInt(x)"));
assertThat(Expressions.toString(dateToInteger),
assertThat(Expressions.toString(dateToInteger, true),
is("org.apache.calcite.runtime.SqlFunctions.toIntOptional(x)"));

// java.sql.Time x;
Expand All @@ -59,9 +59,9 @@ public final class EnumUtilsTest {
EnumUtils.convert(time, int.class);
final Expression timeToInteger =
EnumUtils.convert(time, Integer.class);
assertThat(Expressions.toString(timeToInt),
assertThat(Expressions.toString(timeToInt, true),
is("org.apache.calcite.runtime.SqlFunctions.toInt(x)"));
assertThat(Expressions.toString(timeToInteger),
assertThat(Expressions.toString(timeToInteger, true),
is("org.apache.calcite.runtime.SqlFunctions.toIntOptional(x)"));

// java.sql.TimeStamp x;
Expand All @@ -71,9 +71,9 @@ public final class EnumUtilsTest {
EnumUtils.convert(timestamp, long.class);
final Expression timeStampToLong =
EnumUtils.convert(timestamp, Long.class);
assertThat(Expressions.toString(timeStampToLongPrimitive),
assertThat(Expressions.toString(timeStampToLongPrimitive, true),
is("org.apache.calcite.runtime.SqlFunctions.toLong(x)"));
assertThat(Expressions.toString(timeStampToLong),
assertThat(Expressions.toString(timeStampToLong, true),
is("org.apache.calcite.runtime.SqlFunctions.toLongOptional(x)"));
}

Expand All @@ -86,77 +86,77 @@ public final class EnumUtilsTest {
Expressions.convert_(intVariable, byte.class);
final Expression converted0 =
EnumUtils.convert(bytePrimitiveConverted, Byte.class);
assertThat(Expressions.toString(converted0),
assertThat(Expressions.toString(converted0, true),
is("Byte.valueOf((byte) intV)"));

// (char)(int) -> Character: Character.valueOf((char) intV)
final Expression characterPrimitiveConverted =
Expressions.convert_(intVariable, char.class);
final Expression converted1 =
EnumUtils.convert(characterPrimitiveConverted, Character.class);
assertThat(Expressions.toString(converted1),
assertThat(Expressions.toString(converted1, true),
is("Character.valueOf((char) intV)"));

// (short)(int) -> Short: Short.valueOf((short) intV)
final Expression shortPrimitiveConverted =
Expressions.convert_(intVariable, short.class);
final Expression converted2 =
EnumUtils.convert(shortPrimitiveConverted, Short.class);
assertThat(Expressions.toString(converted2),
assertThat(Expressions.toString(converted2, true),
is("Short.valueOf((short) intV)"));

// (long)(int) -> Long: Long.valueOf(intV)
final Expression longPrimitiveConverted =
Expressions.convert_(intVariable, long.class);
final Expression converted3 =
EnumUtils.convert(longPrimitiveConverted, Long.class);
assertThat(Expressions.toString(converted3),
assertThat(Expressions.toString(converted3, true),
is("Long.valueOf(intV)"));

// (float)(int) -> Float: Float.valueOf(intV)
final Expression floatPrimitiveConverted =
Expressions.convert_(intVariable, float.class);
final Expression converted4 =
EnumUtils.convert(floatPrimitiveConverted, Float.class);
assertThat(Expressions.toString(converted4),
assertThat(Expressions.toString(converted4, true),
is("Float.valueOf(intV)"));

// (double)(int) -> Double: Double.valueOf(intV)
final Expression doublePrimitiveConverted =
Expressions.convert_(intVariable, double.class);
final Expression converted5 =
EnumUtils.convert(doublePrimitiveConverted, Double.class);
assertThat(Expressions.toString(converted5),
assertThat(Expressions.toString(converted5, true),
is("Double.valueOf(intV)"));

final Expression byteConverted =
EnumUtils.convert(intVariable, Byte.class);
assertThat(Expressions.toString(byteConverted),
assertThat(Expressions.toString(byteConverted, true),
is("Byte.valueOf((byte) intV)"));

final Expression shortConverted =
EnumUtils.convert(intVariable, Short.class);
assertThat(Expressions.toString(shortConverted),
assertThat(Expressions.toString(shortConverted, true),
is("Short.valueOf((short) intV)"));

final Expression integerConverted =
EnumUtils.convert(intVariable, Integer.class);
assertThat(Expressions.toString(integerConverted),
assertThat(Expressions.toString(integerConverted, true),
is("Integer.valueOf(intV)"));

final Expression longConverted =
EnumUtils.convert(intVariable, Long.class);
assertThat(Expressions.toString(longConverted),
assertThat(Expressions.toString(longConverted, true),
is("Long.valueOf((long) intV)"));

final Expression floatConverted =
EnumUtils.convert(intVariable, Float.class);
assertThat(Expressions.toString(floatConverted),
assertThat(Expressions.toString(floatConverted, true),
is("Float.valueOf((float) intV)"));

final Expression doubleConverted =
EnumUtils.convert(intVariable, Double.class);
assertThat(Expressions.toString(doubleConverted),
assertThat(Expressions.toString(doubleConverted, true),
is("Double.valueOf((double) intV)"));
}

Expand All @@ -167,8 +167,8 @@ public final class EnumUtilsTest {
final ConstantExpression nullLiteral2 = Expressions.constant(null, Object.class);
final Expression e1 = EnumUtils.convert(nullLiteral1, String.class);
final Expression e2 = EnumUtils.convert(nullLiteral2, String.class);
assertThat(Expressions.toString(e1), is("(String) null"));
assertThat(Expressions.toString(e2), is("(String) (Object) null"));
assertThat(Expressions.toString(e1, true), is("(String) null"));
assertThat(Expressions.toString(e2, true), is("(String) (Object) null"));
}

@Test void testMethodCallExpression() {
Expand All @@ -178,7 +178,7 @@ public final class EnumUtilsTest {
final MethodCallExpression arrayMethodCall =
EnumUtils.call(null, SqlFunctions.class,
BuiltInMethod.ARRAY.getMethodName(), Arrays.asList(arg0, arg1));
assertThat(Expressions.toString(arrayMethodCall),
assertThat(Expressions.toString(arrayMethodCall, true),
is("org.apache.calcite.runtime.SqlFunctions.array(1, \"x\")"));

// test for Object.class argument type
Expand All @@ -187,7 +187,7 @@ public final class EnumUtilsTest {
EnumUtils.call(null, XmlFunctions.class,
BuiltInMethod.EXTRACT_VALUE.getMethodName(),
Arrays.asList(arg1, nullLiteral));
assertThat(Expressions.toString(xmlExtractMethodCall),
assertThat(Expressions.toString(xmlExtractMethodCall, true),
is("org.apache.calcite.runtime.XmlFunctions.extractValue(\"x\", (String) null)"));

// test "mod(decimal, long)" match to "mod(decimal, decimal)"
Expand All @@ -196,7 +196,7 @@ public final class EnumUtilsTest {
final MethodCallExpression modMethodCall =
EnumUtils.call(null, SqlFunctions.class, "mod",
Arrays.asList(arg2, arg3));
assertThat(Expressions.toString(modMethodCall),
assertThat(Expressions.toString(modMethodCall, true),
is("org.apache.calcite.runtime.SqlFunctions.mod("
+ "java.math.BigDecimal.valueOf(125L, 1), "
+ "new java.math.BigDecimal(\n 3L))"));
Expand All @@ -207,7 +207,7 @@ public final class EnumUtilsTest {
final MethodCallExpression geoMethodCall =
EnumUtils.call(null, SpatialTypeFunctions.class, "ST_MakePoint",
Arrays.asList(arg4, arg5));
assertThat(Expressions.toString(geoMethodCall),
assertThat(Expressions.toString(geoMethodCall, true),
is("org.apache.calcite.runtime.SpatialTypeFunctions.ST_MakePoint("
+ "new java.math.BigDecimal(\n 1), "
+ "new java.math.BigDecimal(\n 2))"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ public final class PhysTypeTest {
+ " }\n"
+ "}\n"
+ ")";
assertEquals(Expressions.toString(e), expected);
assertEquals(Expressions.toString(e, true), expected);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private void assertJavaCodeContains(String expected, Node node) {
}

private void assertJavaCodeContains(String expected, List<Node> nodes) {
final String javaCode = Expressions.toString(nodes, "\n", false);
final String javaCode = Expressions.toString(nodes, "\n", false, true);
assertThat(javaCode, containsString(expected));
}

Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ dropwizard-metrics.version=4.0.5
# do not upgrade this, new versions are Category X license.
elasticsearch.version=7.10.2
embedded-redis.version=0.6
flink-table-code-splitter.version=1.20.0
jts-core.version=1.19.0
jts-io-common.version=1.19.0
proj4j.version=1.2.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,9 @@ static List<String> innodbFieldNames(final RelDataType rowType) {
InnodbMethod.INNODB_QUERYABLE_QUERY.method, fields,
selectFields, cond, ascOrder));
if (CalciteSystemProperty.DEBUG.value()) {
System.out.println("Innodb: " + Expressions.toString(enumerable));
System.out.println(
"Innodb: " + Expressions.toString(enumerable,
CalciteSystemProperty.ENABLE_METHOD_SPLITTING.value()));
}
list.add(Expressions.return_(null, enumerable));
return implementor.result(physType, list.toBlock());
Expand Down
1 change: 1 addition & 0 deletions linq4j/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,5 @@ dependencies {

implementation("com.google.guava:guava")
implementation("org.apache.calcite.avatica:avatica-core")
implementation("org.apache.flink:flink-table-code-splitter")
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public Type getType() {
}

@Override public String toString() {
ExpressionWriter writer = new ExpressionWriter(true);
ExpressionWriter writer = new ExpressionWriter(true, true);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this would read from the CalciteSystemProperty but calcite-core depends on linq4j so it can't be looked up here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will this have any practical impact on the actual code generation? (like splitting in some circumstances where the CalciteSystemProperty has not been set to true). If not, I'd say this is acceptable.
It's true that it is a bit unfortunate that we cannot check the CalciteSystemProperty here, but I can't think of a better solution at this point.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally this would read from the CalciteSystemProperty but calcite-core depends on linq4j so it can't be looked up here.

I do not know this code, but wonder if the split configuration values be passed by value into the linq4j layer. If possible , this would avoid the dependancy recursion.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this toString() method is used in code generation, just logging/debugging.
This option is passed in to Expressions static functions, which is really where ExpressionWriters are instantiated most of the time.

accept(writer, 0, 0);
return writer.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,24 @@ class ExpressionWriter {

private final Spacer spacer = new Spacer(0);
private final StringBuilder buf = new StringBuilder();
private boolean indentPending;
private final boolean generics;
private final boolean methodSplitting;
private boolean indentPending;

ExpressionWriter() {
this(true);
this(true, true);
}

ExpressionWriter(boolean generics) {
ExpressionWriter(boolean generics, boolean methodSplitting) {
this.generics = generics;
this.methodSplitting = methodSplitting;
}

public ExpressionWriter duplicateState() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

public method needs javadoc

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this package-private rather than adding javadoc -- it really seems like most of the methods in ExpressionWriter can be package-private.

final ExpressionWriter writer = new ExpressionWriter(this.generics, this.methodSplitting);
writer.indentPending = this.indentPending;
writer.spacer.add(this.spacer.get());
return writer;
}

public void write(Node expression) {
Expand Down Expand Up @@ -73,6 +82,10 @@ public boolean requireParentheses(Expression expression, int lprec,
return true;
}

public boolean usesMethodSplitting() {
return methodSplitting;
}

/**
* Increases the indentation level.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ private Expressions() {}
* extra type information in generics.
*/
public static String toString(List<? extends Node> expressions, String sep,
boolean generics) {
final ExpressionWriter writer = new ExpressionWriter(generics);
boolean generics, boolean methodSplit) {
jduo marked this conversation as resolved.
Show resolved Hide resolved
final ExpressionWriter writer = new ExpressionWriter(generics, methodSplit);
for (Node expression : expressions) {
writer.write(expression);
writer.append(sep);
Expand All @@ -70,8 +70,8 @@ public static String toString(List<? extends Node> expressions, String sep,
/**
* Converts an expression to Java source code.
*/
public static String toString(Node expression) {
return toString(Collections.singletonList(expression), "", true);
public static String toString(Node expression, boolean methodSplit) {
jduo marked this conversation as resolved.
Show resolved Hide resolved
return toString(Collections.singletonList(expression), "", true, methodSplit);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
package org.apache.calcite.linq4j.tree;

import org.apache.commons.lang3.StringUtils;
import org.apache.flink.table.codesplit.JavaCodeSplitter;

import org.checkerframework.checker.nullness.qual.Nullable;

import java.lang.reflect.Modifier;
Expand Down Expand Up @@ -57,20 +60,39 @@ public MethodDeclaration(int modifier, String name, Type resultType,
}

@Override public void accept(ExpressionWriter writer) {
String modifiers = Modifier.toString(modifier);
writer.append(modifiers);
final ExpressionWriter writerForUnsplitMethod = writer.usesMethodSplitting()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the impression the intent of this line is not very obvious, perhaps a comment would help to clarify it.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in dc1c66d

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jduo , just a small comment, because I find the comment a bit confusing (maybe I'm getting it wrong), where it says:

... serialize the method declaration directly to the supplied writer if method splitting is enabled or ...

shouldn't it say "disabled" ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that's correct. I've updated this comment, but note that it is now in ClassDeclaration instead of MethodDeclaration. The method splitter requires an enclosing class to write some of its output too (it can extract variable names to instance variables and move blocks of code to generated private methods to reduce the size of a method).

? writer.duplicateState() : writer;

final String modifiers = Modifier.toString(modifier);
writerForUnsplitMethod.append(modifiers);
if (!modifiers.isEmpty()) {
writer.append(' ');
writerForUnsplitMethod.append(' ');
}
//noinspection unchecked
writer
writerForUnsplitMethod
.append(resultType)
.append(' ')
.append(name)
.list("(", ", ", ")",
() -> (Iterator) parameters.stream().map(ParameterExpression::declString).iterator())
.append(' ')
.append(body);

if (writer.usesMethodSplitting()) {
// Specifies a threshold where generated code will be split into sub-function calls.
// Java has a maximum method length of 64 KB. This setting allows for finer granularity if
// necessary.
// Default value is 4000 instead of 64KB as by default JIT refuses to work on methods with
// more than 8K byte code.
final int defaultMaxGeneratedCodeLength = 4000;
final int defaultMaxMembersGeneratedCode = 10000;

writer.append(
StringUtils.stripStart(
JavaCodeSplitter.split(writerForUnsplitMethod.toString(),
defaultMaxGeneratedCodeLength, defaultMaxMembersGeneratedCode),
" "));
}
writer.newlineAndIndent();
}

Expand Down
Loading
Loading