Finding a multilanguage compiler or optimizer (c, c++, java)

瘦欲@ 提交于 2020-01-04 04:37:12

问题


In a nutshell, I am searching for a method to edit an open source compiler or optimizer to change traditional lock implementations to software transnational memory transactions. I have three target languages, C, C++, and Java. One idea might be to use GCC as it now has stm support. The problem is, I can't think of a way to implement these changes to the java bytecode dumped by GCJ. The same problem arises for llvm.

tldr; trying to find a compiler or optimizer like gcc or llvm that I can easily hack into chaning the source code or a intermediate representation of the source code.


回答1:


If you want a tool that can parse and transform C, C++ and Java, you might consider our DMS Software Reengineering Toolkit.

DMS parses the source code for a language, builds ASTs, allows you to apply procedural or pattern-direct rewrites on those ASTs, and can regenerate valid source text for the modified programs. Source-to-source transformations are significantly easier to write than procedural ones, because you have to know a lot less about the structure of the tree to navigate/modify it.

DMS has front ends for Java, C, C99, and C++11 all in a variety of dialects, enabling DMS to parse and prettyprint those languages, and construct full symbol tables, which are absolutely essential for doing any serious transformations on code. For C and Java, DMS can provide control flow, dataflow and call graphs, which are useful in many analysis and transformation tasks. For C++, DMS has control flow analysis with data flow analysis coming along.

You should be able to find "traditional" lock implementations by specifying patterns that are idioms for the locks, and then apply transforms to remove them.



来源:https://stackoverflow.com/questions/10688936/finding-a-multilanguage-compiler-or-optimizer-c-c-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!