Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package io.github.charlietap.chasm.compiler

import io.github.charlietap.chasm.compiler.passes.ControlFlowPass
import io.github.charlietap.chasm.compiler.passes.FrameSlotPass
import io.github.charlietap.chasm.compiler.passes.FusionPass
import io.github.charlietap.chasm.compiler.passes.GCPass
import io.github.charlietap.chasm.compiler.passes.JumpPass
import io.github.charlietap.chasm.compiler.passes.Pass
import io.github.charlietap.chasm.compiler.passes.PassContext
import io.github.charlietap.chasm.config.GCStrategy
Expand All @@ -24,6 +26,8 @@ fun Compiler(
module = module,
control = ::ControlFlowPass,
fusion = ::FusionPass,
frameSlot = ::FrameSlotPass,
jump = ::JumpPass,
gc = ::GCPass,
)

Expand All @@ -32,12 +36,18 @@ internal inline fun Compiler(
module: Module,
noinline control: Pass,
noinline fusion: Pass,
noinline frameSlot: Pass,
noinline jump: Pass,
noinline gc: Pass,
): Module {
val context = PassContext(config, module)
val passes = buildList {
add(control)
if (config.bytecodeFusion) add(fusion)
if (config.bytecodeFusion) {
add(fusion)
add(frameSlot)
add(jump)
}
if (config.gcStrategy != GCStrategy.MANUAL) add(gc)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ internal fun Instruction.isAllocating(): Boolean = when (this) {
is FusedAggregateInstruction.StructNew,
is FusedAggregateInstruction.StructNewDefault,
is FusedAggregateInstruction.ArrayNew,
is FusedAggregateInstruction.ArrayNewData,
is FusedAggregateInstruction.ArrayNewDefault,
is FusedAggregateInstruction.ArrayNewElement,
is FusedAggregateInstruction.ArrayNewFixed,
-> true
else -> false
Expand Down
Loading