lep / jhcr Goto Github PK
View Code? Open in Web Editor NEWA 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
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
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
---------------------------------------
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]
---------------------------------------
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.
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?
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 "
I was looking at some profiles (re #9) and after the Instruction optimizer the parser takes the second place, especially makeExpressionParser.
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.
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.
// 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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.