Writing nanobots using Java Assembly directly

Jump to navigation Jump to search

Writing nanobots using Java Assembly directly

It seems that openjdk has a wonderful tool called asmtools that allows two directional transformation between jasm and .class bytecode

https://wiki.openjdk.java.net/display/CodeTools/asmtools

Has anyone tried writing robocode bots with java assembly directly? Since the relationship between Java and Bytecode is not as direct as jasm and bytecode, writing with jasm directly may be a better way than tricks listed on this wiki.

Xor (talk)15:03, 6 May 2019

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Users.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page.

Return to Thread:Talk:Code Size/Writing nanobots using Java Assembly directly/reply.

 

I believe many of the top nanobots use java assembly or Jikes to shrink their code. I haven't used it in my bots yet, but I plan to.

Slugzilla (talk)13:18, 8 May 2019
 

I've had some success using Proguard to shrink a few bytes off of microbots when they really need it - eg. Yatagan requires this. It usually does it by re-assigning variables into a slot that is no longer used - note that the actual java asm is not type-aware, so you can stick one type of object into the variable you previously used for a different type of variable. This means you can better re-use the initial few variables, which have lower codesize cost.

IMO you'll get better effective shrinking by exploring the library - for example, the pattern matcher nanos are all using string and substring indexOf functions, they would never have space to put all of the actual matching code in.

Skilgannon (talk)21:55, 9 May 2019

I think making use of library may be much useful than micro-optimizing bytecode size. Bytecode tools can be used for a few additional bytes though.

Xor (talk)05:54, 17 May 2019