Skip to content

Commit da467bc

Browse files
committed
[Daemon] Rename DaemonJVMOptions.maxMemory to maxHeapSize
1 parent 0d37ad9 commit da467bc

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

compiler/daemon/daemon-common/src/org/jetbrains/kotlin/daemon/common/DaemonParams.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ fun Iterable<String>.filterExtractProps(vararg groups: OptionsGroup, prefix: Str
196196

197197

198198
data class DaemonJVMOptions(
199-
var maxMemory: String = "",
199+
var maxHeapSize: String = "",
200200
var maxRam: String = "",
201201
var maxRamFraction: String = "",
202202
var maxRamPercentage: String = "",
@@ -205,7 +205,7 @@ data class DaemonJVMOptions(
205205
var jvmParams: MutableCollection<String> = arrayListOf()
206206
) : OptionsGroup {
207207
override val mappers: List<PropMapper<*, *, *>>
208-
get() = listOf(StringPropMapper(this, DaemonJVMOptions::maxMemory, listOf("Xmx"), mergeDelimiter = "").keepIf { hasMaxHeapSize },
208+
get() = listOf(StringPropMapper(this, DaemonJVMOptions::maxHeapSize, listOf("Xmx"), mergeDelimiter = "").keepIf { hasMaxHeapSize },
209209
StringPropMapper(this, DaemonJVMOptions::maxRam, listOf("XX:MaxRAM"), mergeDelimiter = "=").keepIf { hasMaxHeapSize },
210210
StringPropMapper(this, DaemonJVMOptions::maxRamFraction, listOf("XX:MaxRAMFraction"), mergeDelimiter = "=").keepIf { hasMaxHeapSize },
211211
StringPropMapper(this, DaemonJVMOptions::maxRamPercentage, listOf("XX:MaxRAMPercentage"), mergeDelimiter = "=").keepIf { hasMaxHeapSize },
@@ -217,7 +217,7 @@ data class DaemonJVMOptions(
217217
get() = RestPropMapper(this, DaemonJVMOptions::jvmParams)
218218

219219
internal val hasMaxHeapSize: Boolean
220-
get() = maxMemory.isNotBlank() || maxRam.isNotBlank() || maxRamFraction.isNotBlank() || maxRamPercentage.isNotBlank()
220+
get() = maxHeapSize.isNotBlank() || maxRam.isNotBlank() || maxRamFraction.isNotBlank() || maxRamPercentage.isNotBlank()
221221
}
222222

223223

@@ -319,7 +319,7 @@ fun configureDaemonJVMOptions(opts: DaemonJVMOptions,
319319
val maxMemBytes = Runtime.getRuntime().maxMemory()
320320
// rounding up
321321
val maxMemMegabytes = maxMemBytes / (1024 * 1024) + if (maxMemBytes % (1024 * 1024) == 0L) 0 else 1
322-
opts.maxMemory = "${maxMemMegabytes}m"
322+
opts.maxHeapSize = "${maxMemMegabytes}m"
323323
}
324324
}
325325

@@ -409,7 +409,7 @@ private fun String.memToBytes(): Long? =
409409

410410

411411
private val daemonJVMOptionsMemoryProps =
412-
listOf(DaemonJVMOptions::maxMemory, DaemonJVMOptions::maxMetaspaceSize, DaemonJVMOptions::reservedCodeCacheSize,
412+
listOf(DaemonJVMOptions::maxHeapSize, DaemonJVMOptions::maxMetaspaceSize, DaemonJVMOptions::reservedCodeCacheSize,
413413
DaemonJVMOptions::maxRam, DaemonJVMOptions::maxRamFraction, DaemonJVMOptions::maxRamPercentage)
414414

415415
infix fun DaemonJVMOptions.memorywiseFitsInto(other: DaemonJVMOptions): Boolean =

compiler/daemon/daemon-tests/test/org/jetbrains/kotlin/daemon/BaseDaemonSessionTest.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ abstract class BaseDaemonSessionTest {
5252

5353
open val defaultDaemonJvmOptions
5454
get() = DaemonJVMOptions(
55-
maxMemory = "384m"
55+
maxHeapSize = "384m"
5656
)
5757

5858
@AfterEach

compiler/daemon/daemon-tests/test/org/jetbrains/kotlin/daemon/CompilerDaemonTest.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
106106
additionalArgs.add("D${CompilerSystemProperties.COMPILE_DAEMON_LOG_PATH_PROPERTY.property}=\"${logFile.loggerCompatiblePath}\"")
107107
}
108108
args.forEach { additionalArgs.add(it) }
109-
val baseOpts = if (xmx > 0) DaemonJVMOptions(maxMemory = "${xmx}m") else DaemonJVMOptions()
109+
val baseOpts = if (xmx > 0) DaemonJVMOptions(maxHeapSize = "${xmx}m") else DaemonJVMOptions()
110110
return configureDaemonJVMOptions(
111111
baseOpts,
112112
*additionalArgs.toTypedArray(),
@@ -158,16 +158,16 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
158158
try {
159159
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, "-aaa,-bbb\\,ccc,-ddd,-Xmx200m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100,-xxx\\,yyy")
160160
val opts = configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
161-
assertEquals("200m", opts.maxMemory)
161+
assertEquals("200m", opts.maxHeapSize)
162162
assertEquals("10k", opts.maxMetaspaceSize)
163163
assertEquals("100", opts.reservedCodeCacheSize)
164164
assertEquals(arrayListOf("aaa", "bbb,ccc", "ddd", "xxx,yyy", "ea"), opts.jvmParams)
165165

166166
System.setProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, "-Xmx300m,-XX:MaxMetaspaceSize=10k,-XX:ReservedCodeCacheSize=100")
167167
val opts2 = configureDaemonJVMOptions(inheritMemoryLimits = false, inheritAdditionalProperties = false, inheritOtherJvmOptions = false)
168-
assertEquals("300m", opts2.maxMemory)
168+
assertEquals("300m", opts2.maxHeapSize)
169169
assertEquals( -1, DaemonJVMOptionsMemoryComparator().compare(opts, opts2))
170-
assertEquals("300m", listOf(opts, opts2).maxWithOrNull(DaemonJVMOptionsMemoryComparator())?.maxMemory)
170+
assertEquals("300m", listOf(opts, opts2).maxWithOrNull(DaemonJVMOptionsMemoryComparator())?.maxHeapSize)
171171

172172
val myXmxParam = ManagementFactory.getRuntimeMXBean().inputArguments.first { it.startsWith("-Xmx") }
173173
TestCase.assertNotNull(myXmxParam)
@@ -176,7 +176,7 @@ class CompilerDaemonTest : KotlinIntegrationTestBase() {
176176
val opts3 = configureDaemonJVMOptions(inheritMemoryLimits = true,
177177
inheritOtherJvmOptions = true,
178178
inheritAdditionalProperties = false)
179-
assertEquals(myXmxVal, opts3.maxMemory)
179+
assertEquals(myXmxVal, opts3.maxHeapSize)
180180
}
181181
finally {
182182
restoreSystemProperty(CompilerSystemProperties.COMPILE_DAEMON_JVM_OPTIONS_PROPERTY.property, backupJvmOptions)

compiler/daemon/daemon-tests/test/org/jetbrains/kotlin/daemon/common/ConfigureDaemonJvmOptionsTest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class ConfigureDaemonJvmOptionsTest {
2121
inheritOtherJvmOptions = true,
2222
inheritAdditionalProperties = true
2323
)
24-
assertNotEquals("", opts.maxMemory)
24+
assertNotEquals("", opts.maxHeapSize)
2525
assertEquals("", opts.maxRam)
2626
assertEquals("", opts.maxRamFraction)
2727
assertEquals("", opts.maxRamPercentage)
@@ -30,12 +30,12 @@ class ConfigureDaemonJvmOptionsTest {
3030
@Test
3131
fun `inheritMemoryLimits should keep maxMemory`() {
3232
val opts = configureDaemonJVMOptions(
33-
DaemonJVMOptions(maxMemory = "maxMemoryValue"),
33+
DaemonJVMOptions(maxHeapSize = "maxMemoryValue"),
3434
inheritMemoryLimits = true,
3535
inheritOtherJvmOptions = true,
3636
inheritAdditionalProperties = true
3737
)
38-
assertEquals("maxMemoryValue", opts.maxMemory)
38+
assertEquals("maxMemoryValue", opts.maxHeapSize)
3939
assertEquals("", opts.maxRam)
4040
assertEquals("", opts.maxRamFraction)
4141
assertEquals("", opts.maxRamPercentage)
@@ -49,7 +49,7 @@ class ConfigureDaemonJvmOptionsTest {
4949
inheritOtherJvmOptions = true,
5050
inheritAdditionalProperties = true
5151
)
52-
assertEquals("", opts.maxMemory)
52+
assertEquals("", opts.maxHeapSize)
5353
assertEquals("maxRamValue", opts.maxRam)
5454
assertEquals("", opts.maxRamFraction)
5555
assertEquals("", opts.maxRamPercentage)
@@ -63,7 +63,7 @@ class ConfigureDaemonJvmOptionsTest {
6363
inheritOtherJvmOptions = true,
6464
inheritAdditionalProperties = true
6565
)
66-
assertEquals("", opts.maxMemory)
66+
assertEquals("", opts.maxHeapSize)
6767
assertEquals("", opts.maxRam)
6868
assertEquals("maxRamFractionValue", opts.maxRamFraction)
6969
assertEquals("", opts.maxRamPercentage)
@@ -77,7 +77,7 @@ class ConfigureDaemonJvmOptionsTest {
7777
inheritOtherJvmOptions = true,
7878
inheritAdditionalProperties = true
7979
)
80-
assertEquals("", opts.maxMemory)
80+
assertEquals("", opts.maxHeapSize)
8181
assertEquals("", opts.maxRam)
8282
assertEquals("", opts.maxRamFraction)
8383
assertEquals("maxRamPercentageValue", opts.maxRamPercentage)
@@ -87,7 +87,7 @@ class ConfigureDaemonJvmOptionsTest {
8787
fun `inheritMemoryLimits should keep all limits`() {
8888
val opts = configureDaemonJVMOptions(
8989
DaemonJVMOptions(
90-
maxMemory = "maxMemoryValue",
90+
maxHeapSize = "maxMemoryValue",
9191
maxRam = "maxRamValue",
9292
maxRamFraction = "maxRamFractionValue",
9393
maxRamPercentage = "maxRamPercentageValue"
@@ -96,7 +96,7 @@ class ConfigureDaemonJvmOptionsTest {
9696
inheritOtherJvmOptions = true,
9797
inheritAdditionalProperties = true
9898
)
99-
assertEquals("maxMemoryValue", opts.maxMemory)
99+
assertEquals("maxMemoryValue", opts.maxHeapSize)
100100
assertEquals("maxRamValue", opts.maxRam)
101101
assertEquals("maxRamFractionValue", opts.maxRamFraction)
102102
assertEquals("maxRamPercentageValue", opts.maxRamPercentage)

0 commit comments

Comments
 (0)