bytecode design

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: bytecode design

Post by Brendan »

Hi,
jnc100 wrote:Will you insist on safe access to data or allow dereferencing abritrary pointers? If the former, you will need a concept of an object model at the bytecode level, and support for instructions such as loading and storing to array locations, fields of an object and static data, and creation and deletion of objects and arrays. If the latter, I don't see that there is anything to be gained from an additional level of interpretation/compilation where each instruction basically has a 1:1 mapping with the relevant machine code anyway.
For the latter; it allows a closed source executable to be portable, and also allows the compiler to generate native code optimised for the specific computer (possibly including techniques like profile-guided optimisation).

For example, imagine a closed source 3D game. You install it on an old Pentium III and (as part of installing the game) the OS compiles the byte-code into 32-bit native code that uses MMX; then you install the same executable on an modern Ivy Bridge and the OS compiles the byte-code into 64-bit native code that uses AVX.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: bytecode design

Post by Mikemk »

Brendan wrote:Hi,
jnc100 wrote:Will you insist on safe access to data or allow dereferencing abritrary pointers? If the former, you will need a concept of an object model at the bytecode level, and support for instructions such as loading and storing to array locations, fields of an object and static data, and creation and deletion of objects and arrays. If the latter, I don't see that there is anything to be gained from an additional level of interpretation/compilation where each instruction basically has a 1:1 mapping with the relevant machine code anyway.
For the latter; it allows a closed source executable to be portable, and also allows the compiler to generate native code optimised for the specific computer (possibly including techniques like profile-guided optimisation).

For example, imagine a closed source 3D game. You install it on an old Pentium III and (as part of installing the game) the OS compiles the byte-code into 32-bit native code that uses MMX; then you install the same executable on an modern Ivy Bridge and the OS compiles the byte-code into 64-bit native code that uses AVX.
Actually I intended managed object oriented code which doesn't have access to the pointer information, making it more difficult to produce viruses, but converting it at install time to native machine code to increase portability is also a plus.

As for the Pentium III, I'm starting with x86-64 only. Later I will add support for 32-bit and arm. Depending on how those do, I may look into other processors as well.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: bytecode design

Post by dozniak »

You need at least three different targets to get the bytecode right.
Learn to read.
User avatar
Yoda
Member
Member
Posts: 255
Joined: Tue Mar 09, 2010 8:57 am
Location: Moscow, Russia

Re: bytecode design

Post by Yoda »

m12 wrote:My questions are do you have any suggestions, and what resources are their for making the compiler? (books, tutorials, ...)
Listen to the voice of wisdom.
Enroll in Compilers course at Coursera. This is the best tutorial. The current run is almost finished but if you don't need certificate you may learn in self study version of this course.
Read the Dragon book.
Enroll in Computer architecture course at Coursera. It will start in September and will teach how to build most powerful and efficient processor architectures in the world. Most aspects of this course are also applicable to the virtual machines.
After that you'll be able (at least in theory) to design efficient bytecode and support it with the compiler.
Yet Other Developer of Architecture.
OS Boot Tools.
Russian national OSDev forum.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: bytecode design

Post by Mikemk »

Yoda wrote:
m12 wrote:My questions are do you have any suggestions, and what resources are their for making the compiler? (books, tutorials, ...)
Listen to the voice of wisdom.
Enroll in Compilers course at Coursera. This is the best tutorial. The current run is almost finished but if you don't need certificate you may learn in self study version of this course.
Read the Dragon book.
Enroll in Computer architecture course at Coursera. It will start in September and will teach how to build most powerful and efficient processor architectures in the world. Most aspects of this course are also applicable to the virtual machines.
After that you'll be able (at least in theory) to design efficient bytecode and support it with the compiler.
I can't do the courses because videos use up a lot of bandwidth. The dragon book I've heard of, and I will be taking a look at it - just not at that link. Wikipedia is blocked due to being an online forum.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
fronty
Member
Member
Posts: 188
Joined: Mon Jan 14, 2008 5:53 am
Location: Helsinki

Re: bytecode design

Post by fronty »

m12 wrote:The dragon book I've heard of, and I will be taking a look at it - just not at that link. Wikipedia is blocked due to being an online forum.
If you want another book recommendation, check Engineering a Compiler by Cooper et al., which I think is nicer to read and handles some things, eg. SSA, better than the dragon book.

JamesM probably eats us because of our horrible recommendations if he reads this, but what ever.
User avatar
dozniak
Member
Member
Posts: 723
Joined: Thu Jul 12, 2012 7:29 am
Location: Tallinn, Estonia

Re: bytecode design

Post by dozniak »

fronty wrote:JamesM probably eats us because of our horrible recommendations if he reads this, but what ever.
I haven't seen him here in a while. Sure he still reads here?
Learn to read.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: bytecode design

Post by Mikemk »

I have a lot of reading to do.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
User avatar
Yoda
Member
Member
Posts: 255
Joined: Tue Mar 09, 2010 8:57 am
Location: Moscow, Russia

Re: bytecode design

Post by Yoda »

m12 wrote:I can't do the courses because videos use up a lot of bandwidth.
The lectures are about 1Gb for the whole 11-week course and may be downloaded and viewed offline. This is lame excuse.
Yet Other Developer of Architecture.
OS Boot Tools.
Russian national OSDev forum.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: bytecode design

Post by Combuster »

This is lame excuse.
Wikipedia is blocked due to being an online forum.
I think his host is much more lame than that particular excuse.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
User avatar
brain
Member
Member
Posts: 234
Joined: Thu Nov 05, 2009 5:04 pm
Location: UK
Contact:

Re: bytecode design

Post by brain »

Yoda wrote:
m12 wrote:I can't do the courses because videos use up a lot of bandwidth.
The lectures are about 1Gb for the whole 11-week course and may be downloaded and viewed offline. This is lame excuse.

Maybe he doesn't have a whole gigabyte to spare? Oddly enough that's my monthly limit on my smartphone...
User avatar
Brendan
Member
Member
Posts: 8561
Joined: Sat Jan 15, 2005 12:00 am
Location: At his keyboard!
Contact:

Re: bytecode design

Post by Brendan »

Hi,
brain wrote:
Yoda wrote:
m12 wrote:I can't do the courses because videos use up a lot of bandwidth.
The lectures are about 1Gb for the whole 11-week course and may be downloaded and viewed offline. This is lame excuse.
Maybe he doesn't have a whole gigabyte to spare? Oddly enough that's my monthly limit on my smartphone...
Different countries are different. For example, someone in (e.g.) a European country might be used to "fibre to home", while someone in (e.g.) China might be used to something very very different.


Cheers,

Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: bytecode design

Post by Mikemk »

I live in rural east texas with no access to anything but my school's internet.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: bytecode design

Post by Combuster »

Wikipedia is blocked (...) texas (...) school's internet
Are you sure it's not North Korea? :shock:

*puts the states back on the list of developing countries*
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Mikemk
Member
Member
Posts: 409
Joined: Sat Oct 22, 2011 12:27 pm

Re: bytecode design

Post by Mikemk »

Combuster wrote:[Are you sure it's not North Korea? :shock:

*puts the states back on the list of developing countries*
lol, There's even websites blocked due to educational (at a school? Really?). The content filter is ridiculous.
Programming is 80% Math, 20% Grammar, and 10% Creativity <--- Do not make fun of my joke!
If you're new, check this out.
Post Reply