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

Partially revert #2427 #2444

Merged
merged 3 commits into from
May 24, 2024
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion kevm-pyk/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "kevm-pyk"
version = "1.0.570"
version = "1.0.571"
description = ""
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion kevm-pyk/src/kevm_pyk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
if TYPE_CHECKING:
from typing import Final

VERSION: Final = '1.0.570'
VERSION: Final = '1.0.571'
66 changes: 40 additions & 26 deletions kevm-pyk/src/kevm_pyk/kompile.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@

from pyk.kdist import kdist
from pyk.ktool import TypeInferenceMode
from pyk.ktool.kompile import HaskellKompile, KompileArgs, LLVMKompile, MaudeKompile, PykBackend
from pyk.ktool.kompile import kompile as pyk_kompile
from pyk.ktool.kompile import HaskellKompile, KompileArgs, LLVMKompile, LLVMKompileType, MaudeKompile
from pyk.utils import run_process

from . import config
Expand All @@ -19,7 +18,7 @@
from pathlib import Path
from typing import Final

from pyk.ktool.kompile import Kompile, LLVMKompileType
from pyk.ktool.kompile import Kompile


_LOGGER: Final = logging.getLogger(__name__)
Expand Down Expand Up @@ -141,29 +140,6 @@ def run_kompile(
output_dir=output_dir, debug=debug, verbose=verbose, type_inference_mode=type_inference_mode
)

case KompileTarget.HASKELL:
return pyk_kompile(
backend=PykBackend.BOOSTER,
output_dir=output_dir,
debug=debug,
verbose=verbose,
type_inference_mode=type_inference_mode,
# ---
main_file=main_file,
main_module=main_module,
syntax_module=syntax_module,
include_dirs=include_dirs,
md_selector=KompileTarget.LLVM.md_selector,
hook_namespaces=HOOK_NAMESPACES,
emit_json=emit_json,
read_only=read_only,
# --- LLVM ---
ccopts=ccopts,
opt_level=optimization,
# --- Haskell ---
haskell_binary=haskell_binary,
)

case KompileTarget.MAUDE:
kompile_maude = MaudeKompile(
base_args=base_args,
Expand Down Expand Up @@ -191,6 +167,44 @@ def _kompile_haskell() -> None:

return output_dir

case KompileTarget.HASKELL:
base_args_llvm = KompileArgs(
main_file=main_file,
main_module=main_module,
syntax_module=syntax_module,
include_dirs=include_dirs,
md_selector=KompileTarget.LLVM.md_selector,
hook_namespaces=HOOK_NAMESPACES,
emit_json=emit_json,
read_only=read_only,
)
kompile_llvm = LLVMKompile(
base_args=base_args_llvm, ccopts=ccopts, opt_level=optimization, llvm_kompile_type=LLVMKompileType.C
)
kompile_haskell = HaskellKompile(base_args=base_args, haskell_binary=haskell_binary)

def _kompile_llvm() -> None:
kompile_llvm(
output_dir=output_dir / 'llvm-library',
debug=debug,
verbose=verbose,
type_inference_mode=type_inference_mode,
)

def _kompile_haskell() -> None:
kompile_haskell(
output_dir=output_dir, debug=debug, verbose=verbose, type_inference_mode=type_inference_mode
)

with concurrent.futures.ThreadPoolExecutor(max_workers=2) as executor:
futures = [
executor.submit(_kompile_llvm),
executor.submit(_kompile_haskell),
]
[future.result() for future in futures]

return output_dir

case _:
raise ValueError(f'Unsupported target: {target.value}')

Expand Down
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.570
1.0.571