is hashlink bytecode portable across Operating systems and CPU architectures?

433 views
Skip to first unread message

Zaxebo Yaxebo

unread,
Jan 8, 2017, 4:26:03 PM1/8/17
to Haxe
Dear all,

Is hashlink bytecode portable across Operating systems and CPU architectures   ?
  - if i compile on linux and take the .hl extension file to MSWindows, is it guaranteed to run irrespective of Linux and Windows using hashlink vm present there?
  - if i compile on x86- 64bit and can i take the output .hl extension file to ARM 32bit and run it using hashlink vm present there?

What about neko bytecode?

ref: Java bytecode is portable across OS, 32/64 bit, CPU architectures http://stackoverflow.com/a/17145891

regards,
Zax

JLM

unread,
Jan 9, 2017, 6:29:41 AM1/9/17
to Haxe
If your using the hl byte code you will need a hl specific machine for each target, and Nicolas has stated that he is working on aspects of the 64bit machine but the hl byte code is not platform specific.

"virtual assembler will be translated to a real assembler by the JIT so it can be run on the CPU. However, when stored on hard drive (in a .hl file) it is not CPU-specific and could be translated to any CPU assembler (x86, x86-64, ARM, etc.).

If you want to look at the HL byte code ouput of the Haxe compiler, simply add -D dump to your Haxe parameters, for example:"

- quote from part 1 of the hashlink blog post ( https://haxe.org/blog/hashlink-indepth/ )

Zaxebo Yaxebo

unread,
Jan 9, 2017, 2:49:10 PM1/9/17
to Haxe
Thanks @JLM
Hence, I take the answer that same HL bytecode file can run portably across all 32bit/64 bit , OS(linux,windows,FreeBSD/..), endianness and CPU architectures(x86/RISC/..). That is, it is as portable as java bytecode.

My another question is that: whether "neko" bytecode is also is stated to be as same "portable" as above hashlink/java bytecode to be portable across bit(32bit/64 bit),OSes, endianness and CPU architectures
.
Zax

JLM

unread,
Jan 10, 2017, 5:11:22 AM1/10/17
to Haxe
Zax

HL and Neko byte code are equally platform independant, but I think you have to commit to 32 or 64 for Neko, you may also want to look at Cppia.

Cppia requires you precompile a core engine for the target the common case is NME toolkit and then the cppia script is read in, it is essentially a string that is translated at runtime, so I am unsure but I don't think it is platform limited.  NME is a fork of OpenFL so you have a wide range of platforms although you could set it up with other platforms.  Simplified code use!

cpp.cppia.Host.run(sys.io.File.getContent(inFilename));

What is quite nice for Android target which I have tried, you precompile the Acadnme project or grab it from google play put it on your android device, this is a precompiled core of NME and generic libraries then you can create your application locally and the application code is loaded up to the server from a terminal command in seconds and your application will run almost like a pure c++ NME application.

Hugh has a demo example use of Cppia with NME specifically for Android.  But with NME it's fairly easy to run Cppia projects locally as well and it compiles very fast.
https://github.com/nmehost/acadnme

But getting back to Neko and HL.  In my opinion HL is kind of still a bit new I have no idea yet how to actually get the SDL etc... additional libraries working on my mac, on windows it's just a matter of downloading the prebuild, on linux I expect it's easier as dependancies are opensource generally linux so setup to work on linux but seem problematic via macport.  Then HL 64bit is not complete so while HL is a better solution it's not yet mature.  Neko has builds that run directly on android, rasberry PI etc.... or has had.  But HL does not have aspects like threads etc ... 

But with Haxe you don't have to commit to a HL, Neko or even Cppia as theoretically you can complie the same code to all of them, so you could start your setup with Neko and then switch to HL or Cppia.  But normally you have to create some platform specific code, with Neko you often have a NME dll or OpenFL one or similar, same with Cppia, and stuff like HL SDL is platform specific cpp that you tap into.  So it is only your user code that is really truely platform agnostic and that is only if you have a precompiled engine to run it as explained.

I am far from expert, I mainly just tinker with these tech, and I am sure Nicolas or Hugh or others can advise more deeply, truth is you probably need to make your own tests and read through some of the code examples etc...

Best

Justin


JLM

unread,
Jan 10, 2017, 5:22:10 AM1/10/17
to Haxe
Yep my tech knowledge is probably not deep enough to properly answer your question I am more of a front end developer.  I think you probably should do some tests and come back with specific questions, since you can complie haxe to neko, cppia, hl you might find it just as quick to answer your own questions through experimentation.

hosey hosey

unread,
Jan 10, 2017, 11:17:39 AM1/10/17
to haxe...@googlegroups.com
And Openfl is actually a port of NME

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages