8222484: Specialize generation of simple String concatenation expressions

Reviewed-by: jrose, jlaskey
This commit is contained in:
Claes Redestad 2019-04-17 00:06:38 +02:00
parent 7d9e7e1e0b
commit 781fb29580
5 changed files with 177 additions and 96 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -62,6 +62,11 @@ public class StringConcat {
return "string" + stringValue;
}
@Benchmark
public String concatMethodConstString() {
return "string".concat(stringValue);
}
@Benchmark
public String concatConstIntConstInt() {
return "string" + intValue + "string" + intValue;