Page 2 of 3
Re: bytecode design
Posted: Sat Apr 13, 2013 11:45 am
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
Re: bytecode design
Posted: Sat Apr 13, 2013 1:26 pm
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.
Re: bytecode design
Posted: Sun Apr 14, 2013 2:12 am
by dozniak
You need at least three different targets to get the bytecode right.
Re: bytecode design
Posted: Tue Apr 16, 2013 6:25 am
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.
Re: bytecode design
Posted: Tue Apr 16, 2013 7:12 am
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.
Re: bytecode design
Posted: Tue Apr 16, 2013 9:15 am
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.
Re: bytecode design
Posted: Tue Apr 16, 2013 2:20 pm
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?
Re: bytecode design
Posted: Tue Apr 16, 2013 4:45 pm
by Mikemk
I have a lot of reading to do.
Re: bytecode design
Posted: Wed Apr 17, 2013 2:14 am
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.
Re: bytecode design
Posted: Wed Apr 17, 2013 2:42 am
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.
Re: bytecode design
Posted: Wed Apr 17, 2013 2:58 am
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...
Re: bytecode design
Posted: Wed Apr 17, 2013 3:18 am
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
Re: bytecode design
Posted: Wed Apr 17, 2013 6:52 am
by Mikemk
I live in rural east texas with no access to anything but my school's internet.
Re: bytecode design
Posted: Wed Apr 17, 2013 7:36 am
by Combuster
Wikipedia is blocked (...) texas (...) school's internet
Are you sure it's not North Korea?
*puts the states back on the list of developing countries*
Re: bytecode design
Posted: Wed Apr 17, 2013 7:45 am
by Mikemk
Combuster wrote:[Are you sure it's not North Korea?
*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.