C ++到JVM编译器 [英] C++ to JVM compiler

查看:51
本文介绍了C ++到JVM编译器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

曾经有一个针对RedHat分支机构的alpha质量JVM后端

GCC,但它被放弃了,因为FOSS名人不赞成

Java (奇怪的是,因为两者都是为了粉碎微软)


既然Java再次开源,我希望这个项目能够重新启动。 C ++和Java是使用最广泛的语言。很遗憾C ++无法编译成JVM,即使有很多可以编译成平台的b $ b平台,而且还有一吨

编译成JVM的语言。


让我列出一下优点:


*明确确定内存由C ++程序引起的损坏

(valgrind和VC ++ 2005的调试模式帮助,但不能总是检测到它b $ b;它们也比JVM慢得多;

能够检测到未初始化的内存访问也很好,但我不认为JVM可以帮助这个,因为它已经初始化了所有内容)


*从Java中更容易调用C ++程序,大概是
*在一些具有JVM且没有C ++编译器的奇特平台上运行C ++(罕见)


*更快地运行一些C ++代码(Java有时会在数字上重击C ++,而且需要大量的b / b
测试 - 目前很少见,但事情似乎正在改变,有利于

JIT)


*安全地运行C ++ - 我知道有些傲慢的C ++编码员会声称他们的C ++代码无法被利用,但是有一个

以自动方式证明这一点?


(这可以成为一个很棒的夏天代码项目,除非它太难了

- 我实际上并不知道)

There used to be an alpha quality JVM backend for RedHat''s branch of
GCC, but it was abandoned, because FOSS luminaries did not approve of
Java (strange, because both are out to crush Microsoft)

Now that Java is going open-source again, I hope this project will be
resurrected. C++ and Java are the most widely used languages. It''s a
shame that C++ can not be compiled to JVM, even though there is a ton
of platforms that it can be compiled to, and there is a ton of
languages that do compile to JVM.

Let me list the advantages:

* definitively determine memory corruption caused by a C++ program
(valgrind and VC++2005''s debug mode help, but can not always detect
it; also they are much slower than JVM; it would also be nice to be
able to detect uninitialized memory access, but I don''t think JVM can
help with that, since it has everything initialized)

* call C++ programs more easily from Java, presumably

* run C++ on some exotic platforms with JVM and no C++ compiler (rare)

* run some C++ code faster (Java sometimes beats C++ on numerics-heavy
tests - currently rare, but things seem to be changing in favor of
JIT)

* run C++ safely - I know there are arrogant C++ coders who would
claim that their C++ code can not be exploited, but is there an
automated way to prove that?

(This could make a great summer-of-code project, unless it''s too hard
- I don''t actually know)

推荐答案

On Thu,2008年4月24日01:50:35 -0700(PDT), jh*****@gmail.com"

< jh ***** @ gmail.comwrote:
On Thu, 24 Apr 2008 01:50:35 -0700 (PDT), "jh*****@gmail.com"
<jh*****@gmail.comwrote:

>现在Java再次开源,我希望这个项目能够重新启动。 C ++和Java是使用最广泛的语言。很遗憾C ++无法编译成JVM,即使有很多平台可以编译成JVM,并且有大量的语言可以做到编译到JVM。
>Now that Java is going open-source again, I hope this project will be
resurrected. C++ and Java are the most widely used languages. It''s a
shame that C++ can not be compiled to JVM, even though there is a ton
of platforms that it can be compiled to, and there is a ton of
languages that do compile to JVM.

http://nestedvm.ibex.org/


NestedVM为Java字节码提供二进制翻译。通过将GCC编译为MIPS二进制文件然后将其转换为

Java类文件来完成此操作。因此,任何用C,C ++,Fortran或

编写的应用程序都可以在100%纯Java中运行,而不需要更改源代码。

无需更改源代码。

http://nestedvm.ibex.org/

NestedVM provides binary translation for Java Bytecode. This is done
by having GCC compile to a MIPS binary which is then translated to a
Java class file. Hence any application written in C, C++, Fortran, or
any other language supported by GCC can be run in 100% pure Java with
no source changes.


4月24日凌晨2:03,Razii< whatever1 ... @ hotmail.comwrote:
On Apr 24, 2:03 am, Razii <whatever1...@hotmail.comwrote:

On Thu,2008年4月24日01:50:35 -0700(PDT),jhc0 ... @ gmail.com


< jhc0 ... @ gmail.comwrote:
On Thu, 24 Apr 2008 01:50:35 -0700 (PDT), "jhc0...@gmail.com"

<jhc0...@gmail.comwrote:

既然Java再次开源,我希望这个项目能够重新启动。 C ++和Java是使用最广泛的语言。很遗憾C ++无法编译成JVM,即使有很多可以编译成平台的b $ b平台,而且还有一吨

编译为JVM的语言。
Now that Java is going open-source again, I hope this project will be
resurrected. C++ and Java are the most widely used languages. It''s a
shame that C++ can not be compiled to JVM, even though there is a ton
of platforms that it can be compiled to, and there is a ton of
languages that do compile to JVM.


http://nestedvm.ibex.org/


NestedVM为Java字节码提供二进制翻译。通过将GCC编译为MIPS二进制文件然后将其转换为

Java类文件来完成此操作。因此,任何用C,C ++,Fortran或

编写的应用程序都可以使用GCC支持的任何其他语言运行100%纯Java,而不需要更改源代码。


http://nestedvm.ibex.org/

NestedVM provides binary translation for Java Bytecode. This is done
by having GCC compile to a MIPS binary which is then translated to a
Java class file. Hence any application written in C, C++, Fortran, or
any other language supported by GCC can be run in 100% pure Java with
no source changes.



非常有趣。虽然,对于C ++调试,我不认为这种

方法总能用于内存损坏检测,例如


#include< iostream>


struct pr {

double x;

double get_y()const {return y; }

pr():x(0),y(0){}

private:

const double y;

};


int main(){

pr p;

(& px)[1] = 3; //写给const private y

std :: cout<< p.get_y()<< ''\\ n';;

}


Very interesting. Although, for C++ debugging, I don''t think this
approach would always work for memory corruption detection, e.g.

#include <iostream>

struct pr {
double x;
double get_y() const { return y; }
pr() : x(0), y(0) {}
private:
const double y;
};

int main() {
pr p;
(&p.x)[1] = 3; // write to const private y
std::cout << p.get_y() << ''\n'';
}


jh ***** @ gmail.com 写道:

非常有趣。虽然,对于C ++调试,我不认为这种

方法总是适用于内存损坏检测,例如,
Very interesting. Although, for C++ debugging, I don''t think this
approach would always work for memory corruption detection, e.g.



我不认为可以解决C ++内存调试问题更改编译器目标机器。
$ br />
我认为来自C ++程序的内存使用的困难

来自C ++语言规范。


我认为最好的方法是找到它们是使用特定的C ++工具

进行内存错误检测。


-

Andrea Francia
http://www.andreafrancia.it/


这篇关于C ++到JVM编译器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆