Questions tagged [bytecode]
Use this tag for questions regarding the meta-layer code is compiled to before beeing interpreted by a virtual machine. E.g. Java Bytecode for Java or CIL for C#.
22 questions
0
votes
1
answer
183
views
Bytecode format and loading in language VMs
I am thinking about how to build a language VM. I have been able to get some of the basic constructs right, including jumps to functions within the chunk of bytecode that is currently loaded.
But now ...
2
votes
1
answer
310
views
How should a bytecode VM call external C functions?
I am trying to implement a basic bytecode VM, which I plan to target with a compiler. How can I implement the ability to call external C functions using the bytecode, i.e., call arbitrary functions in ...
173
votes
4
answers
36k
views
Why is JavaScript not compiled to bytecode before sending over the network?
You'd often see that JavaScript is actually being transported over the web with all the useless stuff that doesn't need to be there -- Comments, particularly those containing licenses, indentations ('\...
-2
votes
2
answers
758
views
Converting Java code run by dependency to native code
Is it, at least theoretically, possible to convert a Java application into native code that can be run by something else written in Java? One example of this could be a Minecraft Spigot server. You ...
37
votes
8
answers
13k
views
What is the use of converting source code to Java bytecode?
If one needs different JVMs for different architectures I can't figure out what is the logic behind introducing this concept. In other languages we need different compilers for different machines, but ...
7
votes
2
answers
2k
views
What is the common procedure when producing jump targets in bytecode?
Over the course of the past few days, I've been trying many different methods for correctly calculating jump targets in bytecode, but none have been practical or reliable. Furthermore, the methods I'...
0
votes
4
answers
2k
views
Is there a way to see how many operations a function, block of code or a statement costs?
Let's say I have a phone that can process 1 million operations per second and a micro controller that can perform 1000.
Is there a way to tell how many operations a performed by a function or block ...
6
votes
3
answers
3k
views
How are literal values encoded into bytecode?
Note: This question is somewhat related to How exactly is bytecode "parsed"?, but it is not a duplicate of it. In this question, I'm asking about a specific part of how bytecode is generated, not how ...
3
votes
4
answers
1k
views
Would you use Byte Arrays or XML if size was not an issue?
In my basic understanding of ByteArrays the benefit is that it is smaller in file size.
The down size of a ByteArray is that for any given format you have to know the about the file format to get ...
7
votes
3
answers
714
views
What is the procedure(if any) to select bytes to represent opcodes?
TL;DR
What procedure is followed when selecting bytes to represent opcodes? Are byte(s) for opcodes just randomly chosen, and them mapped to mnemonics?
I recently learned from this answer that ...
4
votes
3
answers
3k
views
How exactly is bytecode "parsed"?
How is Bytecode "parsed"?
It is my understand that Bytecode is a binary, intermediate representation of the syntax of a given programming language. Certain programming languages convert their source ...
2
votes
1
answer
1k
views
Do bytecode compilers compile syntax directly or intermediate assembly language?
I am going to write a very simple VM and bytecode compiler. Is it typical for a bytecode compiler to read the syntax and attempt to create the bytecode directly or is there an intermediate stage to ...
6
votes
2
answers
899
views
How do JIT interpreters handle variable names?
Let's say I am to design a JIT interpreter that translates IL or bytecode to executable instructions at runtime. Every time a variable name is encountered in the code, the JIT interpreter has to ...
2
votes
2
answers
274
views
What should JITed bytecode do exactly?
I'm working on a VM (and a scripting language for it) that I plan to implement JITing for. I'm only working on the "plumbing" of it now, but I don't want the JIT compiler to be an afterthought. ...
11
votes
3
answers
8k
views
Why does Python need both a compiler and an interpreter?
I can understand the fact that Java needs both a compiler and an interpreter. It compiles source code to bytecode and then a virtual machine (on Windows, on Linux, on Android, etc.) translates that ...