Coder Social home page Coder Social logo

lep / jhcr Goto Github PK

View Code? Open in Web Editor NEW
32.0 32.0 2.0 357 KB

A compiler to allow hot code reload in WarCraft 3

Home Page: https://www.hiveworkshop.com/threads/jass-hot-code-reload.313811/

License: GNU Lesser General Public License v3.0

Haskell 58.95% Makefile 0.72% Shell 0.17% Objective-J 39.29% Nix 0.88%
jass warcraft3 wc3

jhcr's People

Contributors

lep avatar shuen4 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

redlove dzjerer

jhcr's Issues

some test about gamecache (discussion)

d24e65e

test trigger:
global variable integer udg_test = 0
on event do:

set udg_test  = udg_test + 1
call BJDebugMsg(I2S(udg_test))
// reloaded code was above 2 code copied 999 times (total 1000)

test result on 1.26a:
Jass VM reach op limit while processing 46th (running trigger once increase udg_test by 1 (98 times) + reach op limit)
if disable Jass VM op limit: no more free instances runtime/instruction.j while processing 267th (running trigger once increase udg_test by 1 (910 times))

test conclusion:
using gamecache instead of GetPlayerTechMaxAllowed and GetPlayerName() - works
no longer a problem to load big-sized bytecode file
however there is another problem: Jass VM op limit and instances

debug info:
image

---------------------------------------
               Jass error
---------------------------------------
op code limit exceeded

stack traceback:
    [JHCR_Parser_parse_ins:246]
    [JHCR_Parser_parse_and_init:20]
    [JHCR_Init_parseTEST:83]
    [JHCR_Init_parse:2]
---------------------------------------
---------------------------------------
               Jass error
---------------------------------------
op code limit exceeded

stack traceback:
    [JHCR_Interpreter_step:30522]
    [JHCR_Interpreter_start_interpreter_wrap:72]
---------------------------------------

image
JHCR.txt

Linux executable

Hi, how to compile this to ubuntu? I want try this with wurstscript on wine.

I try make install, make jhcr, etc, with no result.

Current progress:

make jhcr
~/.cabal/bin/cabal v1-exec -- ghc  convert
[3 of 5] Compiling Jass.Parser      ( Jass/Parser.hs, Jass/Parser.o )

Jass/Parser.hs:23:1: error:
    Could not find module ‘Text.Megaparsec’
    Use -v to see a list of the files searched for.
   |
23 | import Text.Megaparsec
   | ^^^^^^^^^^^^^^^^^^^^^^

Jass/Parser.hs:24:1: error:
    Could not find module ‘Text.Megaparsec.Char’
    Perhaps you meant Text.Parsec.Char (from parsec-3.1.13.0)
    Use -v to see a list of the files searched for.
   |
24 | import Text.Megaparsec.Char
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^

Jass/Parser.hs:25:1: error:
    Could not find module ‘Text.Megaparsec.Char.Lexer’
    Use -v to see a list of the files searched for.
   |
25 | import qualified Text.Megaparsec.Char.Lexer as L
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Jass/Parser.hs:27:1: error:
    Could not find module ‘Control.Monad.Combinators.Expr’
    Use -v to see a list of the files searched for.
   |
27 | import Control.Monad.Combinators.Expr
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
make: *** [GNUmakefile:43: convert] Error 1

p.s. i do not know anything about cabal and haskel.

Improve the Instruction optimizer

Since we can now load much bigger changes into the map, the implementation of the instruction peephole optimizer is not good enough anymore. It needs to be done linearly.

Did it work on1.27?

Hello, can I use jhcr in war3 version 1.27? I try according to your method, and when the map is running, I can't save the map. How do I do it when the map is running: "after we add the" something ", we again save the map and run the" 1-run-after-save-map-before-game-is-running.bat "

Parsing takes way too much time

I was looking at some profiles (re #9) and after the Instruction optimizer the parser takes the second place, especially makeExpressionParser.

Compilation error

Using cygwin on Windows

[16 of 21] Compiling Hot.Instruction.Compiler ( Hot\Instruction\Compiler.hs, E:\\jhcr-master\dist-newstyle\build\x86_64-windows\ghc-9.6.2\jass-hot-code-reload-1.0.0\x\jhcr\build\jhcr\jhcr-tmp\Hot\Instruction\Compiler.o )

Hot\Instruction\Compiler.hs:158:14: error: [GHC-88464]
    Variable not in scope:
      forM
        :: [(Ast Var Expr, Type, c0)]
           -> ((Ast Var Expr, Type, Register) -> CompileMonad Instruction)
           -> CompileMonad (t0 Instruction)
    Suggested fix: Perhaps use `iforM' (imported from Control.Lens)
    |
158 |     binds <- forM (zip3 args aTypes [1, 2..]) $ \(arg, typ, pos) -> typed typ $ do
    |              ^^^^

Hot\Instruction\Compiler.hs:176:17: error: [GHC-88464]
    Variable not in scope:
      void :: CompileMonad Register -> CompileMonad ()
    |
176 |     H.Call{} -> void . typed "nothing" $ compileCall e
    |                 ^^^^

Hot\Instruction\Compiler.hs:242:15: error: [GHC-88464]
    Variable not in scope:
      liftM2 :: (a0 -> b0 -> (a0, b0)) -> m a -> m b -> m (a, b)
    Suggested fix:
      Perhaps use one of these:
        `liftA2' (imported from Prelude),
        `lift' (imported from Control.Monad.Reader),
        `liftIO' (imported from Control.Monad.Reader)
    |
242 | bind2 f x y = liftM2 (,) x y >>= uncurry f
    |               ^^^^^^
Error: cabal.exe: Failed to build exe:jhcr from jass-hot-code-reload-1.0.0.

make: *** [GNUmakefile:27: build] Error 1

Using choco on Windows yielded a "no go"

Is my compiler version wrong?

incorrect JASS operator precedence in generated script file

// input
if not false and true then
    call BJDebugMsg("test")
endif

// generate (incorrect)
if (not (false and true)) then
    call BJDebugMsg ("test")
endif
// input
if (not false) and true then
    call BJDebugMsg("test")
endif

// generate (correct)
if ((not false) and true) then
    call BJDebugMsg ("test")
endif
// input
if not false and false then
    call BJDebugMsg("test")
endif

// generate (incorrect)
if (not (false and false)) then
    call BJDebugMsg ("test")
endif
// input
if (not false) and false then
    call BJDebugMsg("test")
endif

// generate (correct)
if ((not false) and false) then
    call BJDebugMsg ("test")
endif

result:
input - 1st and 2nd will run if block
generated - 1st to 3rd will run if block

TriggerEvaluate doesn't work with dummy functions

Using a completely new function as a filterfunc doesn't work currently as the dummy functions return nothing. I think we can simply change the signature to return boolean but i'm not 100% sure. Also we would need to catch filterfunc usage somehow. Maybe having two different types of dummy functions is easier but idk yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.