mirror of
https://github.com/GayPizzaSpecifications/pork.git
synced 2025-08-02 21:00:56 +00:00
upgrade to java 22 and fix miscompile of variable loads
This commit is contained in:
parent
6e225aab88
commit
4100752f1c
@ -3,5 +3,5 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<Wrapper> {
|
tasks.withType<Wrapper> {
|
||||||
gradleVersion = "8.11.1"
|
gradleVersion = "8.13"
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
@file:Suppress("UnstableApiUsage")
|
@file:Suppress("UnstableApiUsage")
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
@ -12,19 +13,21 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.0")
|
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:2.1.10")
|
||||||
implementation("org.jetbrains.kotlin:kotlin-serialization:1.7.3")
|
implementation("org.jetbrains.kotlin:kotlin-serialization:2.1.10")
|
||||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0")
|
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.10.1")
|
||||||
implementation("com.charleskorn.kaml:kaml:0.66.0")
|
implementation("com.charleskorn.kaml:kaml:0.72.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
java {
|
java {
|
||||||
sourceCompatibility = JavaVersion.toVersion(17)
|
sourceCompatibility = JavaVersion.toVersion(22)
|
||||||
targetCompatibility = JavaVersion.toVersion(17)
|
targetCompatibility = JavaVersion.toVersion(22)
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<KotlinCompile> {
|
tasks.withType<KotlinCompile> {
|
||||||
kotlinOptions.jvmTarget = "17"
|
compilerOptions {
|
||||||
|
jvmTarget.set(JvmTarget.JVM_22)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gradlePlugin {
|
gradlePlugin {
|
||||||
|
@ -5,7 +5,7 @@ import org.gradle.api.Plugin
|
|||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.plugins.JavaPluginExtension
|
import org.gradle.api.plugins.JavaPluginExtension
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
open class PorkModulePlugin : Plugin<Project> {
|
open class PorkModulePlugin : Plugin<Project> {
|
||||||
@ -17,20 +17,22 @@ open class PorkModulePlugin : Plugin<Project> {
|
|||||||
target.repositories.maven(url = "https://gitlab.com/api/v4/projects/49101454/packages/maven")
|
target.repositories.maven(url = "https://gitlab.com/api/v4/projects/49101454/packages/maven")
|
||||||
|
|
||||||
target.extensions.getByType<JavaPluginExtension>().apply {
|
target.extensions.getByType<JavaPluginExtension>().apply {
|
||||||
val javaVersion = JavaVersion.toVersion(17)
|
val javaVersion = JavaVersion.toVersion(22)
|
||||||
sourceCompatibility = javaVersion
|
sourceCompatibility = javaVersion
|
||||||
targetCompatibility = javaVersion
|
targetCompatibility = javaVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
target.tasks.withType<KotlinCompile> {
|
target.tasks.withType<KotlinCompile> {
|
||||||
kotlinOptions.jvmTarget = "17"
|
compilerOptions {
|
||||||
|
jvmTarget.set(JvmTarget.JVM_22)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
target.dependencies {
|
target.dependencies {
|
||||||
add("implementation", "org.jetbrains.kotlin:kotlin-bom")
|
add("implementation", "org.jetbrains.kotlin:kotlin-bom")
|
||||||
add("implementation", "org.jetbrains.kotlinx:kotlinx-serialization-json:1.7.3")
|
add("implementation", "org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.0")
|
||||||
add("api", "gay.pizza.dough:dough-core:0.1.0-SNAPSHOT")
|
add("api", "gay.pizza.dough:dough-core:0.2.0-SNAPSHOT")
|
||||||
add("api", "gay.pizza.dough:dough-fs:0.1.0-SNAPSHOT")
|
add("api", "gay.pizza.dough:dough-fs:0.2.0-SNAPSHOT")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,9 @@ class IrStubOpEmitter(val irDefinition: IrDefinition, val code: CodeBuilder) : I
|
|||||||
if (callOrStubVar.stubVar != null) {
|
if (callOrStubVar.stubVar != null) {
|
||||||
code.emit(Opcode.LoadLocal, listOf(callOrStubVar.stubVar.index))
|
code.emit(Opcode.LoadLocal, listOf(callOrStubVar.stubVar.index))
|
||||||
} else {
|
} else {
|
||||||
code.emit(Opcode.Integer, listOf(code.nextOpInst() + 2u))
|
val retRel = MutableRel(0u)
|
||||||
|
retRel.rel = code.nextOpInst() + 2u
|
||||||
|
code.patch(Opcode.ReturnAddress, listOf(0u), 0, symbol, retRel)
|
||||||
code.patch(Opcode.Call, listOf(0u), mapOf(0 to callOrStubVar.call!!))
|
code.patch(Opcode.Call, listOf(0u), mapOf(0 to callOrStubVar.call!!))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@ import gay.pizza.pork.ast.gen.Symbol
|
|||||||
import gay.pizza.pork.bir.IrSymbolGraph
|
import gay.pizza.pork.bir.IrSymbolGraph
|
||||||
import gay.pizza.pork.bir.IrWorld
|
import gay.pizza.pork.bir.IrWorld
|
||||||
import gay.pizza.pork.bytecode.CompiledWorld
|
import gay.pizza.pork.bytecode.CompiledWorld
|
||||||
|
import gay.pizza.pork.bytecode.ConstantTag
|
||||||
|
import gay.pizza.pork.bytecode.Opcode
|
||||||
import gay.pizza.pork.compiler.Compiler
|
import gay.pizza.pork.compiler.Compiler
|
||||||
import gay.pizza.pork.minimal.FileTool
|
import gay.pizza.pork.minimal.FileTool
|
||||||
|
|
||||||
@ -61,7 +63,15 @@ class CompileCommand : CliktCommand(help = "Compile Pork", name = "compile") {
|
|||||||
if (annotations.isNotEmpty()) {
|
if (annotations.isNotEmpty()) {
|
||||||
annotation = " ; ${annotations.joinToString(", ") { it.text}}"
|
annotation = " ; ${annotations.joinToString(", ") { it.text}}"
|
||||||
}
|
}
|
||||||
println(" ${symbol.offset + index.toUInt()} ${op}${annotation}")
|
print(" ${symbol.offset + index.toUInt()} ${op}${annotation}")
|
||||||
|
if (op.code == Opcode.Constant) {
|
||||||
|
val constant = compiledWorld.constantPool.constants[op.args[0].toInt()]
|
||||||
|
val constantString = when (constant.tag) {
|
||||||
|
ConstantTag.String -> "\"" + constant.readAsString() + "\""
|
||||||
|
}
|
||||||
|
print(" ; constant: $constantString")
|
||||||
|
}
|
||||||
|
println()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user