Does any CVM [ C virtual Machine] exist?

M

Minti

Hi there everybody, I was just wondering that too many people choose
to use

language like Java because of its architecture independence, this AI
is

achieved because Java is as such a platform indeed, the code is
converted to

a byte code and this byte code can be run on any machine which has
Java

Virtual Machine or the Java Platform is installed, now my question is
that can't there be a C

Virtual machine, which would run the C byte code, wherein C byte code
is the

sort of a "compiled" and "intermediate" code before it can be run on
any

particular machine. Are there any shorcomings in this approach? I
guess

practicaly we can have a Virtual machine for every language.
Has anybody done this? Should anybody do this?

OT for c.l.c but I was just curious. Thanks
 
R

Robotnik

I would think that pretty much any virtual machine you can think of could be
implimented, if you wanted to and it didn't already exist. If you think
about it, there are tons of virtual machines out there. Emulators. I mean,
they have them for graphing calculators, video game systems, even old school
home computer system emulators, they're all virtual machines.

As for your specific question, there are none that I know of particularly,
but that certainly doesn't not mean that one does not exist.

Nic
 
J

Jeff

Minti said:
Hi there everybody, I was just wondering that too many people choose
to use
[snip]


practicaly we can have a Virtual machine for every language.
Has anybody done this? Should anybody do this?

OT for c.l.c but I was just curious. Thanks

Yes, it is OT for clc. I did a google search and found

"Just-In-Time Means Run-It-Fast"
http://www.devx.com/Intel/Article/6960

It may be helpful for you.
 
J

j

Minti said:
Hi there everybody, I was just wondering that too many people choose
to use

language like Java because of its architecture independence, this AI
is

achieved because Java is as such a platform indeed, the code is
converted to

a byte code and this byte code can be run on any machine which has
Java

Virtual Machine or the Java Platform is installed, now my question is
that can't there be a C

Virtual machine, which would run the C byte code, wherein C byte code
is the

sort of a "compiled" and "intermediate" code before it can be run on
any

particular machine. Are there any shorcomings in this approach? I
guess

practicaly we can have a Virtual machine for every language.
Has anybody done this? Should anybody do this?

OT for c.l.c but I was just curious. Thanks


--
Imanpreet Singh Arora
imanpreet_arora AT yahoo DOT co DOT in

What I can't create I can't understand -- Richard Feynman

The virtual machine in C's case is the machine that C defines for its
programs to operate within. i.e., the environment defined by the standard.
e.g., The ANSI/ISO C VM provides file-system access via fopen() and remove()
So your program runs in a machine which has these facilities.
 
G

goose

Hi there everybody, I was just wondering that too many people choose
to use

language like Java because of its architecture independence, this AI
is

achieved because Java is as such a platform indeed, the code is
converted to

a byte code and this byte code can be run on any machine which has
Java

Virtual Machine or the Java Platform is installed, now my question is
that can't there be a C

Virtual machine, which would run the C byte code, wherein C byte code
is the

sort of a "compiled" and "intermediate" code before it can be run on
any

particular machine. Are there any shorcomings in this approach? I
guess

practicaly we can have a Virtual machine for every language.
Has anybody done this? Should anybody do this?

OT for c.l.c but I was just curious. Thanks


search google for "c-flea"

goose,
posting from comp.programming
 
M

Minti

j said:
The virtual machine in C's case is the machine that C defines for its
programs to operate within. i.e., the environment defined by the standard.
e.g., The ANSI/ISO C VM provides file-system access via fopen() and remove()
So your program runs in a machine which has these facilities.


I won't call the machine that is defined by the C standard to be any
form of a Virutal machine, It is just a definition of a language, If
we go by the rule book however we would be having

<quote>
The semantic descriptions in this International Standard describe the
behavior of an abstract machine in which issues of optimization are
irrelevant.
<unquote>

Thanks for the participation but I still have not been able to find as
to if a CVM exist or if it does not, should it exist?

Cross posts to other relevant groups welcome.
 
J

j

Minti said:
"j" <[email protected]> wrote in message


I won't call the machine that is defined by the C standard to be any
form of a Virutal machine, It is just a definition of a language, If
we go by the rule book however we would be having

<quote>
The semantic descriptions in this International Standard describe the
behavior of an abstract machine in which issues of optimization are
irrelevant.
<unquote>

And what do you think the difference between ``abstract'' and ``virtual''
is?
 
S

Simon Biber

j said:
And what do you think the difference between ``abstract'' and ``virtual''
is?

"virtual" means it does not physically exist, it is simulated by a computer.

"abstract" means it is described without reference to a specific instance,
that the description applies to a whole class of different objects.
 
M

Minti

search google for "c-flea"

Thanks for the link goose, but from what little I have read about it,
it seems that it a virtual machine for implementing C program that can
run on CPU's that are not supported by C compilers, I am taling about
a thing like wherein the code is by itself converted to some
intermediate form like say byte code, because if it could be done we
could share and embed pretty much like the Java applets. We won't have
to share possibly virus infected executable files and also we won't
have to necessarily send the source code to the client computer.

--
Imanpreet Singh Arora

imanpreet_arora AT yahoo DOT co DOT in

What I can't create I can't understand -> Richard Feynman
 
M

Marmagya

Hi,
Interesting question! I am not sure if there is any
implementation of CVM anywhere. But I would like to discuss whether such
a machine is really required. All these are my own opinions and I am not
saying they are true, but I am only putting forth what seems logical to
me. Guys out there are welcome to refute me and educate further about
these matters.
The reason Java has a VM is that it is a high level language.
High level languages are supposed to be lot more abstract and their
details are not supposed to depend on platform. Hence, if I write a
program in a high level language (not only Java), I would like to it to
compile without code changes on any platform where I can find a
compiler/interpreter.
Java takes this even further. It makes even the output of
compilation (the byte code) platform independant. So basically all this
assumes that we will have a VM for all platforms where we will be able
to run the byte code. And it is for platform dependant languages like C
to provide that VM. These language should map the properties of VM onto
the capabilities offered by a particular platform.
So I believe that C and Java offer solution to two different
problems. The mechanism used by Java to solve its set of problems will
be misfit if applied to C to solve problems in C's domain. It is not
that you cannot have a CVM, but its by design that we have VM for Java
and use C to implement that VM.
Looking in a different way, if you have a VM for C, then you
would need another language, say 'D' to implement that CVM for each
platform. Then would you think it appropriate to have a VM for D also?
Ultimately you need some way to come down to a language which implements
VM for a platform, rather than needing its own VM.

Regards
Marmagya
 
M

Marmagya

Hi group,
I correct myself:
Hi,
Interesting question! I am not sure if there is any implementation
of CVM anywhere. But I would like to discuss whether such a machine is
really required. All these are my own opinions and I am not saying they
are true, but I am only putting forth what seems logical to me. Guys out
there are welcome to refute me and educate me further about these matters
The reason Java has a VM is that it is a high level language. High
Being a high level language does not mean that the langiage has a VM, I
wrongly worded this, my apologies. I should had simply written "Java is
a high level language".
 
D

Dave Dunfield

Thanks for the link goose, but from what little I have read about it,
it seems that it a virtual machine for implementing C program that can
run on CPU's that are not supported by C compilers, I am taling about
a thing like wherein the code is by itself converted to some
intermediate form like say byte code, because if it could be done we
could share and embed pretty much like the Java applets. We won't have
to share possibly virus infected executable files and also we won't
have to necessarily send the source code to the client computer.

(I am the creator of C-FLEA)

C-FLEA uses a "virtual instruction set", which is essentially a byte code.
The ability to run code on a CPU without a native C compiler is only one
application - it is equally valid to use this tool to create single binaries
which run an vastly different target systems (I've used it for this purpose
in a number of applications).

Unlike JAVA, C-FLEA does not have a standard set of predefined user
interface functionality, however as long as you define an identical set of
virtual I/O devices and access functions on each target, you can accomplish
a similar target independance.

The point I'm trying to make is that within the concept of a virtual machine,
you have flexibility to implement pretty much any environment and features
that you wish - not just what one particular vendor may advocate.

Here's a clip from my FAQ on "what is C-FLEA":

- You can use C on ANY target system, even if a native code C compiler
is not available for it. All you have to do is to get a C-FLEA VM up
and running, and all of the C-FLEA tools and libraries will work.

- C-FLEA code is portable and platform independent. You can implement
C-FLEA VM's with similar I/O features on multiple (different) hardware
platforms, and then compile a single C-FLEA program which can be run
on all of them without requiring any changes or recompilation.

- Since you "write" the C-FLEA CPU, you can provide functionality that
cannot be achieved in a conventional system. Here are some ideas:
- Execute from non-standard memory (eg: serial)
- Encrypted memory and other Advanced security / protection schemes
- Specialized peripherals appearing as I/O ports
- Add your own instructions!
- Multitasking support right in the CPU
- Debug tracing, event traps, specialized breakpoints etc.

- C-FLEA code is very space efficient. The C-FLEA instruction set was
designed from the beginning to be ideal for a C implementation, and
as a result, you can pack a lot of C code into a fairly small image.
In most cases, programs compiled for C-FLEA will be SMALLER than the
same program compiled for a native CPU (Note: Since there is a memory
overhead for the C-FLEA VM code, the total memory required will only
be less for larger programs).

Regards,
 
C

Corey Murtagh

Marmagya wrote:

So I believe that C and Java offer solution to two different
problems. The mechanism used by Java to solve its set of problems will
be misfit if applied to C to solve problems in C's domain. It is not
that you cannot have a CVM, but its by design that we have VM for Java
and use C to implement that VM.

In theory, yes. C and Java are targetted at different audiences. In
practice however, they both get used for a lot of things that they're
not exactly suited for... more often in C than Java.
Looking in a different way, if you have a VM for C, then you would
need another language, say 'D' to implement that CVM for each platform.
Then would you think it appropriate to have a VM for D also? Ultimately
you need some way to come down to a language which implements VM for a
platform, rather than needing its own VM.

There's no reason why you couldn't implement the VM in C using a
compiler that targets a specific platform.

A CVM would be an interesting thing in that it would provide a
cross-platform target for C compilation. Whether it would be /used/
though is a different question :)
 
E

Ed Davis

now my question is that can't there be a C Virtual machine,
which would run the C byte code, wherein C byte code is the
sort of a "compiled" and "intermediate" code before it can be
run on any particular machine.

See:

http://ivm.sourceforge.net/

From the website:

Build One Program ? Run It Everywhere Compile your programs to
run on any platform supporting The Internet Virtual Machine.

You can have the real thing. Why program in proprietary
languages, such as Java and C-Sharp that are incompatible
derivatives of C++? Tried and tested standards, C and C++ are the
most widely used programming languages worldwide. With the
Internet Virtual Machine, they come with runtime portability.

www.softintegration.com/company/press/

From the website:

About SoftIntegration -- C interpreter for C/C++ developers ...
toolkit. This toolkit adds new graphics and animation
capabilities to Chr --- a cross-platform C virtual machine with
classes. ...


Additionally, I believe there is a byte-code back-end for LCC,
and there is also a small-C that produces byte-code.
 
J

j

Simon Biber said:
"virtual" means it does not physically exist, it is simulated by a computer.

"abstract" means it is described without reference to a specific instance,
that the description applies to a whole class of different objects.

I apologize. I posted this right before I went to bed and didn't mean to ask
what the difference is between ``abstract'' and ``virtual'' but rather
between ``abstract machine'' and ``virtual machine''

Though, something which is abstract is something that was drawn out while
something virtual is of virtue. Virtual isn't all that meaningful by itself.

Consider this, what can you draw out of the observation that a bee you saw
spent most of its time sitting on various flowers? Well, you might
hypothesize that it was gathering pollen and then draw out of that
observation that bees generally spend their time doing that. i.e., once you
have abstracted, you have taken some virtue from something, which you may
use elsewhere. That is what you have ``drawn out'' of it.

Now, a standard is generally supposed to be an encoding of these drawn out
properties. The abstraction produces the virtues that we want. A virtual
machine is comprised of those virtues. There is no requirement that a
virtual machine be implemented. Consider that you can run a C program with
just your understanding of the specification/standard.. is that a virtual
machine?

Once we do something with the specification we have produced a machine of
some kind, even if that is imagining how a program should work.

 
M

Minti

The reason Java has a VM is that it is a high level language.
High level languages are supposed to be lot more abstract and their
details are not supposed to depend on platform. Hence, if I write a
program in a high level language (not only Java), I would like to it to
compile without code changes on any platform where I can find a
compiler/interpreter.
Java takes this even further. It makes even the output of
compilation (the byte code) platform independant. So basically all this
assumes that we will have a VM for all platforms where we will be able
to run the byte code. And it is for platform dependant languages like C
to provide that VM. These language should map the properties of VM onto
the capabilities offered by a particular platform.

As a matter of fact it is possible to implement a JVM within Java
itself only.
So I believe that C and Java offer solution to two different
problems. The mechanism used by Java to solve its set of problems will
be misfit if applied to C to solve problems in C's domain. It is not
that you cannot have a CVM, but its by design that we have VM for Java
and use C to implement that VM.

Read above, obviously C seems to be better choice for doing a stuff
like creating compliers but Java can do that stuff also, cosider
The Jalapeño Virtual Machine
at

http://www-124.ibm.com/developerworks/oss/jikesrvm/info/pubs.shtml

Looking in a different way, if you have a VM for C, then you
would need another language, say 'D' to implement that CVM for each
platform.

Would you belive me that you can write a C compiler using C language,
or do you think that assembly language was written in binary, if we
follow the language hierarchy. ;-).
Then would you think it appropriate to have a VM for D also?
Ultimately you need some way to come down to a language which implements
VM for a platform, rather than needing its own VM.

Regards
Marmagya

<snip my origninal post>
 
I

Irrwahn Grausewitz

Marmagya said:
Looking in a different way, if you have a VM for C, then you
would need another language, say 'D' to implement that CVM for each
platform. Then would you think it appropriate to have a VM for D also?
Ultimately you need some way to come down to a language which implements
VM for a platform, rather than needing its own VM.
Cross-Platform-Development is your friend.

<SNIP>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,079
Messages
2,570,574
Members
47,207
Latest member
HelenaCani

Latest Threads

Top