vm-implementation

Javascript API to explicitly add micro tasks or macro tasks

和自甴很熟 提交于 2019-12-03 22:00:54
问题 From my global understanding of how javascript virtual machines works, i can clearly see that the concept of micro task / macro task play a big role. Here is what i understand about that: A VM 'turn' is the fact of pulling ONE macro task out of the VM macro task queue, and execute it. During a VM turn, micro tasks can be added to the micro tasks queue of the current macro task. Micro tasks can push other micro tasks to the micro tasks queue of the current macro task. A VM turn will end when

How can a JVM decide if a class “belongs” (e.g. inner or nested classes) to another class?

与世无争的帅哥 提交于 2019-12-03 16:05:34
I want to understand class files and inner/nested classes a bit better and I'm wondering about the following things: Is the InnerClasses attribute used to refer tothe inner/nested classes in the ´containing´ class or is it used in the inner/nested classes to refer to the ‘container’ class? Is the InnerClasses attribute in class files sufficient? E.g. Do inner/nested classes have to follow the name mangling with $ or is this just a convention? Is there a way to make a class look like an inner/nested class to the JVM without setting the InnerClasses attribute and does this depend on the JLM

Is there a JavaScript (ECMAScript) implementation written in Python?

三世轮回 提交于 2019-12-03 08:49:21
问题 Are there any JavaScript (ECMAScript) implementations written in pure Python? It is okay even if its implementation is very slow. 回答1: There is one, of an unknown level of completeness, written in RPython (a subset of Python, that is to say, it runs as normal Python): https://bitbucket.org/pypy/lang-js/overview 回答2: Doesn't seem to be under active development anymore but you could check out pynarcissus , http://code.google.com/p/pynarcissus/source/browse/trunk/jsparser.py Seems like a binding

How do modern VMs handle memory allocation?

蹲街弑〆低调 提交于 2019-12-03 07:09:52
问题 I'm working on a simple stack machine written in C, mostly for learning purposes. After using malloc/free for my memory operations, I thought it would be a good idea to read some memory allocation specific code from modern virtual machines. I downloaded Lua source code and started reading it. After a while, I realized there are lots of macro stuff involved, and I couldn't find the code where real memory allocation is done (ie. malloc call). find . -exec grep -i "malloc" '{}' \; -print It

How to find out what optimizations the JVM applied to my code?

半城伤御伤魂 提交于 2019-12-03 06:15:15
The JVM (especially the HotSpot VM) is famous for having a huge number of optimizations it can apply at runtime. Is there a way to look at a certain piece of code and see what the JVM has actually done to it? One problem is that "what JVM has actually done to it" changes between invocations as the JVM is free to re-generate code. As an example I investigated some days ago what Hotspot does with final methods compared to virtual methods. Judging by microbenchmarks, my conclusions were: Client JVM: If the method is effectively final (there is not any loaded class that overrides it), the JVM uses

How does a register based virtual machine work?

拥有回忆 提交于 2019-12-03 04:33:22
问题 How does a register based virtual machine work? I am looking for introduction to how a register based virtual machine works. Can someone please help? Thank you. 回答1: One example of a register-based VM with available source code is Lua. There are a number of resources that might help... The Implementation of Lua 5.0 From the authors of Lua itself. LuLu The Lua VM implemented in Lua, companion to a blog in Japanese. A No Frills Intro to Lua 5.1 VM Instructions From a frequent contributor to the

registers vs stacks

廉价感情. 提交于 2019-12-03 00:16:36
问题 What exactly are the advantages and disadvantages to using a register-based virtual machine versus using a stack-based virtual machine? To me, it would seem as though a register based machine would be more straight-forward to program and more efficient. So why is it that the JVM, the CLR, and the Python VM are all stack-based? 回答1: This has already been answered, to a certain level, in the Parrot VM's FAQ and associated documents: A Parrot Overview The relevant text from that doc is this: the

Is there a JavaScript (ECMAScript) implementation written in Python?

巧了我就是萌 提交于 2019-12-02 22:41:34
Are there any JavaScript (ECMAScript) implementations written in pure Python? It is okay even if its implementation is very slow. There is one, of an unknown level of completeness, written in RPython (a subset of Python, that is to say, it runs as normal Python): https://bitbucket.org/pypy/lang-js/overview Doesn't seem to be under active development anymore but you could check out pynarcissus , http://code.google.com/p/pynarcissus/source/browse/trunk/jsparser.py Seems like a binding to V8 (JavaScript interpreter in Google Chromium) is available also, http://www.advogato.org/article/985.html

Whats the best way to learn about VM implementation besides actually hacking code?

半世苍凉 提交于 2019-12-02 21:13:56
I'd like to learn more about VM implementation and optimization. Right now I'm contributing (in a small way) with JRuby and am also playing/writing with my own lisp-like language implementation that runs in a VM. However I'd like to get more information on working with VM's and designing them. Is there a good resource for this type of information besides reading/working with existing code? I'm not opposed to do that, I just wondered if there were other sources I could be looking into. also check The Implementation of Lua 5.0 . it's widely regarded as the fastest VM in its class and also one of

How do modern VMs handle memory allocation?

こ雲淡風輕ζ 提交于 2019-12-02 20:43:20
I'm working on a simple stack machine written in C, mostly for learning purposes. After using malloc/free for my memory operations, I thought it would be a good idea to read some memory allocation specific code from modern virtual machines. I downloaded Lua source code and started reading it. After a while, I realized there are lots of macro stuff involved, and I couldn't find the code where real memory allocation is done (ie. malloc call). find . -exec grep -i "malloc" '{}' \; -print It printed only some Lua macros that have malloc word in their names. The Lua VM (and programming language)