memory use java_Graal Java compiler would enable high-quality code, efficient memory use

Participants in the OpenJDK email-based discussion group, including representatives from Oracle, have been advocating for the Graal project. The effort would explore implementing a dynamic compiler that can be used in a native JVM such as HotSpot or a metacircular JVM such as Maxine. On its project site, Oracle describes the Maxine VM as a next-generation platform written in Java, compatible with modern Java IDEs and the standard Java Development Kit, and featuring a modular architecture. The Graal compiler from the Maxine code base would serve as the starting point of the dynamic compiler project.

[ See Oracle's two-year roadmap for Java, which features enterprise and standard edition upgrades for the platform. | Subscribe to InfoWorld's Enterprise Java newsletter for more about Java. ]

"What is clear here is that Graal is about getting improved compiled performance from Java," said analyst Al Hilwa of IDC. "There is a back-to-native movement, in many ways stimulated by Apple's iOS development tools, which revolves around a native-compiled model for Objective-C. For a long time the pendulum swung toward virtual machine languages like Java. But the success of iOS devices has begun to shift it back. In this light Java has to up its game in terms of performance that is comparable to what is possible with native compilers and also in terms of integrating with native code."

A Java architect lauded Oracle's Graal compiler and JVM efforts, as well as their potential impact on Java coding. "Think about coding in Java, compiling it using a compiler written in Java, and running it in JVM, which is again written in Java -- it's Java all the way and imagine the seamless integration between application and VM," said Hari Gottipati, principal architect at Apollo Group, parent company of the University of Phoenix. "I am sure the entire Java community is going to be excited about it." He also is a board member of the Phoenix Java User's Group.

Graal was the subject of a presentation scheduled for Oracle's JVM Language Summit last July, entitled "Graal -- Bytecode Agnostic Compiler for the JVM," by Thomas Wuerthinger of Oracle Labs. In addition to pondering Graal, Oracle has been working to converge the JRockit JVM with HotSpot, which was acquired when Oracle bought Sun in early 2010. That effort is expected to be completed with the release of JDK 8 in 2013.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: Java 8有许多JVM特性,包括: 1. Lambda表达式:这是Java 8中最为突出的特性之一,可以让您使用简单的匿名函数来编写更简洁的代码。 2. Stream API:可以帮助您对集合进行并行化处理,从而提升程序的执行效率。 3. 默认方法:可以在接口中添加默认方法,从而可以在不修改已有代码的情况下为接口添加新功能。 4. 新的日期和时间API:Java 8引入了新的java.time包,该包提供了用于处理日期、时间和时区的类。 5. 函数式编程:Java 8中引入了函数式编程的概念,允许将函数作为参数传递给另一个函数,从而提升代码的可读性和可维护性。 6. Nashorn JavaScript引擎:可以在JVM上运行JavaScript代码,提升程序的执行效率。 7. 其他特性:Java 8还包括许多其他的JVM特性,如新的JVM指令、动态语言支持、增强的类加载器等。 ### 回答2: Java 8引入了一些新的JVM特性,主要包括以下几点: 1. 元数据存储(Metaspace):Java 8中,元数据被移到本地内存中,取代了永久代的概念。这意味着可以更灵活地管理元数据,并且不容易遇到永久代内存溢出的问题。 2. 压缩指针(Compressed Pointers):在64位的JVM中,指针通常占用8字节,但实际上只有36位是有效的。Java 8引入了压缩指针,将指针的开销减少到了4字节,节约了内存空间。 3. 并行类加载器(Parallel Classloading):Java 8中引入了一种新的并行类加载器,通过多线程同时加载类,加速了类的初始化过程。 4. 无锁优化(Lock-free Optimization):Java 8对于锁的实现进行了优化,引入了更高效的CAS(Compare-And-Swap)指令,减少了锁的开销。 5. 元空间(Metaspace):在Java 8之前,类和元数据存储在永久代中。但Java 8中,永久代被元空间(Metaspace)取代,将类的元数据存储在本地内存中。 6. 内存模型改进:Java 8对内存模型进行了改进,引入了新的指令(如volatile关键字的改进),提供了更强大的内存可见性和顺序性保证。 7. JVM统计数据记录(JVM Statistics Gathering):通过JVM统计数据记录API,可以方便地收集各种关于JVM运行状态和性能的数据,用于优化和分析。 Java 8的这些JVM特性,不仅在性能上有所提升,还改进了内存管理、类加载和锁的实现等方面,提升了Java应用程序的稳定性和可扩展性。 ### 回答3: Java 8引入了许多新的JVM特性,包括以下几个方面: 1. 元数据区分配重构:Java 8通过将元数据从永久代(PermGen)移动到堆内存中的元数据区(Metaspace)来进行重构。这消除了之前可能出现的永久代溢出问题。 2. 基于堆的字符串存储:Java 8中引入了一个新的字符串存储结构,称为Compact Strings,它将字符串数据存储在堆中,而不是原本的字符数组,并采用一种更有效的方式来存储和操作字符串。 3. 阻塞式非必要中断:在以前的版本中,非必要中断(停止执行线程)可能会导致线程进入一个长时间的等待状态。Java 8改进了中断机制,使得非必要中断更为高效,当线程被中断时,它通常会立即退出。 4. 更好的JIT编译器:Java 8引入了一个新的JIT编译器,称为Graal,该编译器采用一种全新的编译策略,可以提供更高的性能。 5. 元空间大小自动调整:在Java 8之前,永久代的大小是固定的,并且经常会引起内存溢出问题。Java 8使用元数据区(Metaspace),该区域的大小会根据应用程序的需求自动进行调整,从而避免了永久代溢出的问题。 6. 安全性改进:Java 8引入了一些安全性改进,包括更严格的类文件验证机制,以及更好的安全沙箱实现,提高了Java应用程序的安全性。 总之,Java 8的JVM特性包括元数据区分配重构、基于堆的字符串存储、阻塞式非必要中断的改进、更好的JIT编译器、元空间大小自动调整以及安全性改进,这些特性使Java 8在性能和安全性方面都有了显著的提升。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值