Questions tagged [bytecode]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer
103 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 ...
mydoghasworms's user avatar
2 votes
1 answer
218 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 ...
Greatcode's user avatar
173 votes
4 answers
35k 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 ('\...
zombiesauce's user avatar
  • 1,439
-2 votes
2 answers
668 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 ...
User's user avatar
  • 3
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 ...
Pranjal Kumar's user avatar
7 votes
2 answers
1k 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'...
Christian Dean's user avatar
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 ...
1.21 gigawatts's user avatar
6 votes
3 answers
2k 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 ...
Christian Dean's user avatar
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 ...
1.21 gigawatts's user avatar
7 votes
3 answers
630 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 ...
Christian Dean's user avatar
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 ...
Christian Dean's user avatar
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 ...
Synaps3's user avatar
  • 147
6 votes
2 answers
772 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 ...
MathuSum Mut's user avatar
2 votes
2 answers
241 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. ...
Famand's user avatar
  • 21
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 ...
aris's user avatar
  • 119
15 votes
5 answers
13k views

Compilation to bytecode vs machine code

Does compilation that produces an interim bytecode (like with Java), rather than going "all the way" to machine code, generally involve less complexity (and thus likely take less time)?
Julian A.'s user avatar
  • 253
4 votes
1 answer
592 views

Why is the Java bytecode instruction set not orthogonal?

Section 2.11.1 of the JVM 8 Specification includes the words: In other words, the instruction set is intentionally not orthogonal. From my perspective, that implies that the Java bytecode ...
kd8azz's user avatar
  • 143
0 votes
1 answer
179 views

Is using digital signatures and bytecode machines a viable technique to make reverse engineering hard? [duplicate]

If I have a private key with which I sign byte code, and a public key with which I can decipher the signed code to verify its authenticity, can I protect that byte code from being reverse engineered ...
user2800708's user avatar
1 vote
2 answers
2k views

Why does a bytecode VM use stack or registers opposed to direct operations? [duplicate]

I'm working on a simple bytecode interpreter to learn how virtual machines work. I've read about VMs and it seems that all of them are either stack based or register based. At the time it made sense, ...
Synaps3's user avatar
  • 147
66 votes
4 answers
22k views

Why do VMs need to be "stack machines" or "register machines" etc.?

(This is an extremely newbie-ish question). I've been studying a little about Virtual Machines. Turns out a lot of them are designed very similarly to physical or theoretical computers. I read that ...
Aviv Cohn's user avatar
  • 21.3k
6 votes
6 answers
12k views

Is Java Bytecode interpreted? [closed]

The definition of interpretation (correct me if I'm wrong) is parsing code like so: 1- Translate currently parsed line to some intermediate language. 2- Run the translated line. 3- Move to the next ...
NPElover's user avatar
  • 181
2 votes
4 answers
3k views

What exactly is Virtual Machine Bytecode? [closed]

I want to work on a very simple compiler for a very simple language. The compiler will compile the code to some basic bytecode. Later, a virtual machine program will run the bytecode, and execute the ...
Aviv Cohn's user avatar
  • 21.3k