Skip to content

Commit

Permalink
Update dependency: deps/kwasm_release (#241)
Browse files Browse the repository at this point in the history
* deps/kwasm_release: Set Version 0.1.38

* kmultiversx/: sync poetry files 0.1.38

* deps/k_release: sync release file version 7.0.17

* Add target `mx-semantics.source`

* Set Version: 0.1.41

---------

Co-authored-by: devops <[email protected]>
Co-authored-by: Tamás Tóth <[email protected]>
  • Loading branch information
3 people authored Apr 25, 2024
1 parent a806622 commit f92c286
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 156 deletions.
2 changes: 1 addition & 1 deletion deps/k_release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.0.9
7.0.17
2 changes: 1 addition & 1 deletion deps/kwasm_release
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.35
0.1.38
251 changes: 126 additions & 125 deletions kmultiversx/poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions kmultiversx/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 = "kmultiversx"
version = "0.1.40"
version = "0.1.41"
description = "Python tools for Elrond semantics"
authors = [
"Runtime Verification, Inc. <[email protected]>",
Expand All @@ -20,7 +20,7 @@ mx-semantics = "kmultiversx.kdist.plugin"

[tool.poetry.dependencies]
python = "^3.10"
pykwasm = { git = "https://github.com/runtimeverification/wasm-semantics.git", tag = "v0.1.35", subdirectory = "pykwasm" }
pykwasm = { git = "https://github.com/runtimeverification/wasm-semantics.git", tag = "v0.1.38", subdirectory = "pykwasm" }
pycryptodomex = "^3.18.0"
hypothesis = "^6.82.6"

Expand Down
63 changes: 37 additions & 26 deletions kmultiversx/src/kmultiversx/kdist/plugin.py
Original file line number Diff line number Diff line change
@@ -1,52 +1,62 @@
from __future__ import annotations

import shutil
from pathlib import Path
from typing import TYPE_CHECKING

from pyk.kbuild.utils import k_version
from pyk.kdist.api import Target
from pyk.ktool.kompile import KompileBackend, kompile
from pykwasm.kdist.plugin import SOURCE_DIR as WASM_DIR

if TYPE_CHECKING:
from collections.abc import Mapping
from collections.abc import Callable, Mapping
from typing import Any, Final


CURRENT_DIR: Final = Path(__file__).parent
SOURCE_DIR: Final = CURRENT_DIR / 'mx-semantics'
PLUGIN_DIR: Final = CURRENT_DIR.parents[3] / 'deps/plugin' # TODO Distribute plugin files with Python


class SourceTarget(Target):
SRC_DIR: Final = Path(__file__).parent

def build(self, output_dir: Path, deps: dict[str, Path], args: dict[str, Any], verbose: bool) -> None:
shutil.copytree(deps['wasm-semantics.source'] / 'wasm-semantics', output_dir / 'wasm-semantics')
shutil.copytree(self.SRC_DIR / 'mx-semantics', output_dir / 'mx-semantics')

def source(self) -> tuple[Path, ...]:
return (self.SRC_DIR,)

def deps(self) -> tuple[str]:
return ('wasm-semantics.source',)


class KompileTarget(Target):
_kompile_args: dict[str, Any]
_kompile_args: Callable[[Path], Mapping[str, Any]]

def __init__(self, kompile_args: Mapping[str, Any]):
self._kompile_args = dict(kompile_args)
def __init__(self, kompile_args: Callable[[Path], Mapping[str, Any]]):
self._kompile_args = kompile_args

def build(self, output_dir: Path, deps: dict[str, Path], args: dict[str, Any], verbose: bool) -> None:
# TODO Pass K_OPTS='-Xmx8G -Xss512m'
kompile(
output_dir=output_dir,
verbose=verbose,
**self._kompile_args,
)

def source(self) -> tuple[Path, ...]:
return (SOURCE_DIR,)
kompile_args = self._kompile_args(deps['mx-semantics.source'])
kompile(output_dir=output_dir, verbose=verbose, **kompile_args)

def context(self) -> dict[str, str]:
return {'k-version': k_version().text}

def deps(self) -> tuple[str]:
return ('mx-semantics.source',)


def llvm_target(main_file: Path, main_module: str, syntax_module: str) -> KompileTarget:
def llvm_target(main_file_name: str, main_module: str, syntax_module: str) -> KompileTarget:
return KompileTarget(
{
lambda src_dir: {
'backend': KompileBackend.LLVM,
'main_file': main_file,
'main_file': src_dir / 'mx-semantics' / main_file_name,
'main_module': main_module,
'syntax_module': syntax_module,
'include_dirs': [WASM_DIR, PLUGIN_DIR],
'include_dirs': [src_dir, PLUGIN_DIR],
'md_selector': 'k',
'hook_namespaces': ['KRYPTO'],
'opt_level': 2,
Expand All @@ -70,14 +80,14 @@ def llvm_target(main_file: Path, main_module: str, syntax_module: str) -> Kompil
)


def haskell_target(main_file: Path, main_module: str, syntax_module: str) -> KompileTarget:
def haskell_target(main_file_name: str, main_module: str, syntax_module: str) -> KompileTarget:
return KompileTarget(
{
lambda src_dir: {
'backend': KompileBackend.HASKELL,
'main_file': main_file,
'main_file': src_dir / 'mx-semantics' / main_file_name,
'main_module': main_module,
'syntax_module': syntax_module,
'include_dirs': [WASM_DIR, PLUGIN_DIR],
'include_dirs': [src_dir, PLUGIN_DIR],
'md_selector': 'k',
'hook_namespaces': ['KRYPTO'],
'warnings_to_errors': True,
Expand All @@ -86,8 +96,9 @@ def haskell_target(main_file: Path, main_module: str, syntax_module: str) -> Kom


__TARGETS__: Final = {
'llvm-mandos': llvm_target(SOURCE_DIR / 'mandos.md', 'MANDOS', 'MANDOS-SYNTAX'),
'llvm-kasmer': llvm_target(SOURCE_DIR / 'kasmer.md', 'KASMER', 'KASMER-SYNTAX'),
'haskell-mandos': haskell_target(SOURCE_DIR / 'mandos.md', 'MANDOS', 'MANDOS-SYNTAX'),
'haskell-kasmer': haskell_target(SOURCE_DIR / 'kasmer.md', 'KASMER', 'KASMER-SYNTAX'),
'source': SourceTarget(),
'llvm-mandos': llvm_target('mandos.md', 'MANDOS', 'MANDOS-SYNTAX'),
'llvm-kasmer': llvm_target('kasmer.md', 'KASMER', 'KASMER-SYNTAX'),
'haskell-mandos': haskell_target('mandos.md', 'MANDOS', 'MANDOS-SYNTAX'),
'haskell-kasmer': haskell_target('kasmer.md', 'KASMER', 'KASMER-SYNTAX'),
}
2 changes: 1 addition & 1 deletion package/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.1.40
0.1.41

0 comments on commit f92c286

Please sign in to comment.