为什么编程字节code不是流行或prevalent在汇编语言编程? [英] Why is programming in bytecode not as popular or prevalent as programming in assembly?

查看:207
本文介绍了为什么编程字节code不是流行或prevalent在汇编语言编程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您看到组装code和汇编codeRS所有在互联网上,但有在字节code几乎没有。这是为什么 ?在装配的需要和编程的优点都应该保持在字节code编程了。


解决方案

另一个原因字节code编程比汇编编程远不如流行/常见的是字节code的通用性 - 它的简单

字节code指令集在很大程度上是超RISC,很简单的说明。专为两个目的,提供虚拟机能够迅速转化为允许一个高层次的编译器可以轻松地创建接近本地字节code的能力/图成原生指令集和

汇编程序,而另一方面,也有这样简单的通用零部件 - 而这些都是字节code间preTER /刚刚即时编译器将实际使用来实现字节$ C $的那些C功能的。少数人独占使用原生指令集的这些部分来写汇编程序。在(刚刚在时间)编译器会为你。结果
但是,汇编器的更多的比,尤其是SIMD /向量指令。这些指令专用,高效的非常特殊的工作负载(数据流,在最广泛的意义 - 任何通过数据搅动想通过女吸血鬼喉咙)。在此日期,有其中位人为干预可以通过数量级超过一个编译的结果的情况。这样做往往需要用这样的向量指令,以一种特殊的方式,编译器可能不被强迫为你做。

必须付出的代价是不得不编写本机汇编函数。

字节code缺乏这些特殊用途的指令扩展,并延伸字节code一样,会放弃具有放在首位字节code的最大优势之一。这将使CPU类型之间不可移植 - 的,比方说,在x86 / x64矢量扩展(SSEx),ARM(霓虹灯)或PowerPC(AltiVec技术)差异太大映射在上面一个垫片层

据的的组件级编程的推移,人们并不需要一个实际的CPU指令为设置;高德纳在计算机程序设计艺术已经用了一个虚拟汇编呼吁了这么久MIX / MMIX它predates词字节code通过几十年是否存在等。人们可以通过x86汇编语言教学理念之一也可以通过.NET字节code任教。

但最主要的原因(超出学术界,见preV段),为什么人写汇编语言 - 能够利用特殊的指令集扩展成为可能特定于平台的优化 - 是不是写字节code的正当理由直接。

You see assembly code and assembly coders all over the internet but there's almost nothing on bytecode. Why is that ? The needs and the advantages of programming in assembly should all hold for programming in bytecode too.

解决方案

Another reason why bytecode programming is far less popular / common than assembly programming is the genericity of bytecode - its simplicity.

Bytecode instruction sets are largely "ultra-RISC", very simple instructions. Designed for two purposes, to provide the virtual machine with the ability to quickly translate / map into a native instruction set and to allow a high-level compiler to easily create near-native bytecode.

Assembler, on the other hand, also has such simple generic parts - and those are the ones that the bytecode interpreter / just-in-time compiler will actually use to implement bytecode functionality. Few people exclusively use these parts of a native instruction set to write assembler programs. The (Just-in-time-)compiler does that for you.
But assembler has much more than that, especially SIMD / vector instructions. These instructions are special-purpose and highly efficient for very particular workloads ("data streaming", in the widest sense - anything that churns through data like dracula through ladies' throats). To this date, there's situations where a bit of human intervention can surpass a compiler result by orders of magnitude. Doing so often requires the use of such vector instructions, in a particular way that the compiler may not be coerced into doing for you.

The price to pay is having to write a native assembly function.

Bytecode lacks these special-purpose instruction extensions, and extending bytecode like that would give away one of the largest advantages of having bytecode in the first place. It would make it unportable between CPU types - the vector extensions of, say, x86/x64 (SSEx), ARM (Neon) or PowerPC (AltiVec) are too different to map a single shim layer on top.

As far as teaching assembly-level programming goes, one doesn't need an actual CPU instruction set for that; Donald Knuth in "Art of Computer programming" has used a "virtual" assembler called MIX/MMIX for so long that it predates the existance of the word "bytecode" by a few decades. Concepts that one can teach via x86 assembly language one could also teach via .NET bytecode.

But the main reason (beyond academia, see prev paragraph) why people write assembly language - to exploit platform-specific optimizations made possible by special instruction set extensions - is not a valid reason to write bytecode directly.

这篇关于为什么编程字节code不是流行或prevalent在汇编语言编程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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