Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' into new-packfile-api

Needed for newer parrot's

Fixed conflicts:
	src/HLL/Compiler.nqp
	src/NQP/World.nqp
	src/stage0/HLL-s0.pir
	src/stage0/NQP-s0.pir
	src/stage0/NQPCORE.setting-s0.pir
	src/stage0/NQPMO-s0.pir
	src/stage0/P6QRegex-s0.pir
	src/stage0/QAST-s0.pir
	src/stage0/QASTNode-s0.pir
	src/stage0/QRegex-s0.pir
	src/vm/parrot/stage0/ModuleLoader-s0.pir
	t/parrot/01-pirt.t
	t/qast/01-qast.t
  • Loading branch information...
commit 3113a0e90631d1e8157da11d666deb90811d2707 2 parents c1675fc + 9635b9f
@rurban rurban authored
Showing with 34,042 additions and 1,541 deletions.
  1. +21 −4 .gitignore
  2. +28 −0 3rdparty/asm/LICENSE.txt
  3. BIN  3rdparty/asm/asm-4.1.jar
  4. BIN  3rdparty/asm/asm-tree-4.1.jar
  5. +17 −15 3rdparty/dyncall/Makefile.embedded
  6. +10 −7 3rdparty/dyncall/buildsys/gmake/tool/gcc.gmake
  7. +1 −2  3rdparty/dyncall/dyncall/dyncall_callvm_sparc.c
  8. +1 −0  3rdparty/dyncall/dyncallback/dyncall_callback_ppc32.c
  9. +2 −2 3rdparty/dyncall/dyncallback/dyncall_thunk_ppc32.c
  10. +33 −0 3rdparty/jline/LICENSE.txt
  11. BIN  3rdparty/jline/jline-1.0.jar
  12. +202 −0 3rdparty/jna/ASL2.0
  13. +12 −0 3rdparty/jna/LICENSE.ASL
  14. BIN  3rdparty/jna/jna.jar
  15. +226 −73 Configure.pl
  16. +21 −31 README → README.pod
  17. +1 −1  VERSION
  18. +1 −2  docs/6model/overview.markdown
  19. +161 −0 docs/continuations.pod
  20. +63 −0 docs/jvminterop.pod
  21. +0 −200 docs/nqp-opcode.txt
  22. +1,747 −0 docs/ops.markdown
  23. +0 −3  docs/pir2nqp.todo
  24. +28 −1 docs/qast.markdown
  25. +11 −7 docs/release_guide.pod
  26. +12 −2 docs/serialization_format.markdown
  27. +44 −0 examples/CallFromJava.java
  28. +0 −4 examples/load_bytecode.nqp
  29. +93 −0 examples/rubyish/README.md
  30. +10 −0 examples/rubyish/examples-rubyish/closure.rbi
  31. +36 −0 examples/rubyish/examples-rubyish/fractal-tree.rbi
  32. +25 −0 examples/rubyish/examples-rubyish/pi.rbi
  33. +31 −0 examples/rubyish/examples-rubyish/template.rbi
  34. +1,015 −0 examples/rubyish/rubyish.nqp
  35. +21 −0 examples/rubyish/t/00hello-worldish.t
  36. +27 −0 examples/rubyish/t/arrays.t
  37. +9 −0 examples/rubyish/t/bitwise.t
  38. +27 −0 examples/rubyish/t/contextual.t
  39. +120 −0 examples/rubyish/t/functional.t
  40. +26 −0 examples/rubyish/t/hashs.t
  41. +68 −0 examples/rubyish/t/if-then-else.t
  42. +50 −0 examples/rubyish/t/infix.t
  43. +43 −0 examples/rubyish/t/inheritance.t
  44. +18 −0 examples/rubyish/t/interpolation.t
  45. +20 −0 examples/rubyish/t/lambda.t
  46. +67 −0 examples/rubyish/t/line-spanning.t
  47. +15 −0 examples/rubyish/t/loops.t
  48. +11 −0 examples/rubyish/t/modifiers.t
  49. +26 −0 examples/rubyish/t/nqp-ops.t
  50. +10 −0 examples/rubyish/t/params.t
  51. +30 −0 examples/rubyish/t/recursion.t
  52. +18 −0 examples/rubyish/t/rubyish-3-tests.t
  53. +26 −0 examples/rubyish/t/rubyish-4-tests.t
  54. +85 −0 examples/rubyish/t/scoping.t
  55. +23 −0 examples/rubyish/t/template.t
  56. +1 −0  gen/jvm/.gitignore
  57. +1 −0  gen/moar/.gitignore
  58. +1 −0  gen/parrot/.gitignore
  59. +0 −208 src/6model/sixmodelobject.c
  60. +39 −41 src/HLL/{Actions.pm → Actions.nqp}
  61. +2 −5 src/HLL/{CommandLine.pm → CommandLine.nqp}
  62. 0  src/HLL/{Compiler.pm → Compiler.nqp}
  63. +22 −16 src/HLL/{Grammar.pm → Grammar.nqp}
  64. +9 −25 src/HLL/{World.pm → World.nqp}
  65. +389 −0 src/HLL/sprintf.nqp
  66. +355 −274 src/NQP/{Actions.pm → Actions.nqp}
  67. +63 −0 src/NQP/Compiler.nqp
  68. +0 −28 src/NQP/Compiler.pm
  69. +134 −100 src/NQP/{Grammar.pm → Grammar.nqp}
  70. +161 −0 src/NQP/Optimizer.nqp
  71. 0  src/NQP/{World.pm → World.nqp}
  72. +2 −2 src/QAST/BVal.nqp
  73. +16 −6 src/QAST/Block.nqp
  74. +14 −14 src/QAST/CompUnit.nqp
  75. +7 −2 src/QAST/IVal.nqp
  76. +7 −2 src/QAST/NVal.nqp
  77. +32 −20 src/QAST/Node.nqp
  78. +19 −6 src/QAST/Op.nqp
  79. +2 −0  src/QAST/ParamTypeCheck.nqp
  80. +35 −7 src/QAST/Regex.nqp
  81. +1 −1  src/QAST/SVal.nqp
  82. +11 −2 src/QAST/SpecialArg.nqp
  83. +2 −1  src/QAST/Stmt.nqp
  84. +1 −1  src/QAST/Stmts.nqp
  85. +24 −0 src/QAST/VM.nqp
  86. +18 −9 src/QAST/Var.nqp
  87. +1 −1  src/QAST/VarWithFallback.nqp
  88. +4 −4 src/QAST/WVal.nqp
  89. +205 −53 src/QRegex/Cursor.nqp
  90. +42 −68 src/QRegex/NFA.nqp
  91. +70 −23 src/QRegex/P5Regex/Actions.nqp
  92. +44 −22 src/QRegex/P5Regex/Grammar.nqp
  93. +243 −72 src/QRegex/P6Regex/Actions.nqp
  94. +133 −61 src/QRegex/P6Regex/Grammar.nqp
  95. +180 −0 src/QRegex/P6Regex/Optimizer.nqp
  96. +0 −7 src/Regex/constants.pir
  97. 0  src/core/{Hash.pm → Hash.nqp}
  98. +7 −8 src/core/{IO.pm → IO.nqp}
  99. 0  src/core/{NQPCapture.pm → NQPCapture.nqp}
  100. +39 −32 src/core/{NQPMu.pm → NQPMu.nqp}
  101. +49 −30 src/core/{NQPRoutine.pm → NQPRoutine.nqp}
  102. +2 −0  src/core/{NativeTypes.pm → NativeTypes.nqp}
  103. +1 −1  src/core/{Regex.pm → Regex.nqp}
  104. 0  src/core/{YOUAREHERE.pm → YOUAREHERE.nqp}
  105. 0  src/core/{testing.pm → testing.nqp}
  106. +0 −1  src/gen/IGNOREME
  107. 0  src/how/{Archetypes.pm → Archetypes.nqp}
  108. +2 −0  src/how/{EXPORTHOW.pm → EXPORTHOW.nqp}
  109. 0  src/how/{NQPAttribute.pm → NQPAttribute.nqp}
  110. +53 −15 src/how/{NQPClassHOW.pm → NQPClassHOW.nqp}
  111. +9 −7 src/how/{NQPConcreteRoleHOW.pm → NQPConcreteRoleHOW.nqp}
  112. 0  src/how/{NQPCurriedRoleHOW.pm → NQPCurriedRoleHOW.nqp}
  113. 0  src/how/{NQPModuleHOW.pm → NQPModuleHOW.nqp}
  114. 0  src/how/{NQPNativeHOW.pm → NQPNativeHOW.nqp}
  115. +12 −10 src/how/{NQPParametricRoleHOW.pm → NQPParametricRoleHOW.nqp}
  116. +1 −2  src/how/{RoleToClassApplier.pm → RoleToClassApplier.nqp}
  117. 0  src/how/{RoleToRoleApplier.pm → RoleToRoleApplier.nqp}
  118. +98 −0 src/vm/jvm/HLL/Backend.nqp
  119. +191 −0 src/vm/jvm/ModuleLoader.nqp
  120. +159 −0 src/vm/jvm/NQP/Ops.nqp
  121. +5,585 −0 src/vm/jvm/QAST/Compiler.nqp
  122. +611 −0 src/vm/jvm/QAST/JASTNodes.nqp
  123. +2 −0  src/vm/jvm/runners/nqp-j
  124. +1 −0  src/vm/jvm/runners/nqp-j.bat
  125. +296 −0 src/vm/jvm/runtime/org/perl6/nqp/io/AsyncFileHandle.java
  126. +79 −0 src/vm/jvm/runtime/org/perl6/nqp/io/FileHandle.java
  127. +14 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOAsyncReadable.java
  128. +11 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOAsyncWritable.java
  129. +10 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOBindable.java
  130. +7 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOClosable.java
  131. +9 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOEncodable.java
  132. +7 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOInteractive.java
  133. +7 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOLineSeparable.java
  134. +8 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOSeekable.java
  135. +11 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOSyncReadable.java
  136. +10 −0 src/vm/jvm/runtime/org/perl6/nqp/io/IIOSyncWritable.java
  137. +78 −0 src/vm/jvm/runtime/org/perl6/nqp/io/ProcessHandle.java
  138. +40 −0 src/vm/jvm/runtime/org/perl6/nqp/io/ServerSocketHandle.java
  139. +39 −0 src/vm/jvm/runtime/org/perl6/nqp/io/SocketHandle.java
  140. +121 −0 src/vm/jvm/runtime/org/perl6/nqp/io/StandardReadHandle.java
  141. +68 −0 src/vm/jvm/runtime/org/perl6/nqp/io/StandardWriteHandle.java
  142. +262 −0 src/vm/jvm/runtime/org/perl6/nqp/io/SyncHandle.java
  143. +1,747 −0 src/vm/jvm/runtime/org/perl6/nqp/jast2bc/AutosplitMethodWriter.java
  144. +942 −0 src/vm/jvm/runtime/org/perl6/nqp/jast2bc/JASTToJVMBytecode.java
  145. +8 −0 src/vm/jvm/runtime/org/perl6/nqp/jast2bc/JavaClass.java
  146. +141 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/ArgsExpectation.java
  147. +100 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/Base64.java
  148. +5 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/BaseControlException.java
  149. +1,024 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/BootJavaInterop.java
  150. +15 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/ByteClassLoader.java
  151. +248 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/CallFrame.java
  152. +193 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/CallSiteDescriptor.java
  153. +81 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/CodeRef.java
  154. +19 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/CodeRefAnnotation.java
  155. +315 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/CompilationUnit.java
  156. +92 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/ContextKey.java
  157. +4 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/ControlException.java
  158. +9 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/EvalResult.java
  159. +249 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/ExceptionHandling.java
  160. +317 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/GlobalContext.java
  161. +93 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/HLLConfig.java
  162. +14 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/HandlerInfo.java
  163. +31 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/IOExceptionMessages.java
  164. +667 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/IndyBootstrap.java
  165. +6 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/JavaCallinException.java
  166. +9 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/LexoticException.java
  167. +160 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/LibraryLoader.java
  168. +497 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/NativeCallOps.java
  169. +5,416 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/Ops.java
  170. +5 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/ResumeException.java
  171. +71 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/ResumeStatus.java
  172. +31 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/SaveStackException.java
  173. +214 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/StaticCodeInfo.java
  174. +127 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/ThreadContext.java
  175. +21 −0 src/vm/jvm/runtime/org/perl6/nqp/runtime/UnwindException.java
  176. +29 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/BoolificationSpec.java
  177. +30 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/CodePairContainerConfigurer.java
  178. +48 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/CodePairContainerSpec.java
  179. +14 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/ContainerConfigurer.java
  180. +28 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/ContainerSpec.java
  181. +25 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/InvocationSpec.java
  182. +178 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/KnowHOWBootstrapper.java
  183. +369 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/KnowHOWMethods.java
  184. +144 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/REPR.java
  185. +88 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/REPRRegistry.java
  186. +141 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/STable.java
  187. +78 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/SerializationContext.java
  188. +644 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/SerializationReader.java
  189. +817 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/SerializationWriter.java
  190. +160 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/SixModelObject.java
  191. +44 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/StorageSpec.java
  192. +85 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/TypeObject.java
  193. +120 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CArray.java
  194. +267 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CArrayInstance.java
  195. +12 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CArrayREPRData.java
  196. +38 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CPointer.java
  197. +9 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CPointerInstance.java
  198. +38 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CStr.java
  199. +22 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CStrInstance.java
  200. +229 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CStruct.java
  201. +136 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CStructInstance.java
  202. +22 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CStructREPRData.java
  203. +34 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CallCapture.java
  204. +18 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CallCaptureInstance.java
  205. +32 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/CodeRefREPR.java
  206. +35 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/ContextRef.java
  207. +76 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/ContextRefInstance.java
  208. +35 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/Continuation.java
  209. +34 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/IOHandle.java
  210. +19 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/IOHandleInstance.java
  211. +7 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/JavaObjectWrapper.java
  212. +32 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/JavaWrap.java
  213. +43 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/KnowHOWAttribute.java
  214. +9 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/KnowHOWAttributeInstance.java
  215. +58 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/KnowHOWREPR.java
  216. +14 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/KnowHOWREPRInstance.java
  217. +33 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/Lexotic.java
  218. +7 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/LexoticInstance.java
  219. +33 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/MultiCache.java
  220. +183 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/MultiCacheInstance.java
  221. +134 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/NFA.java
  222. +9 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/NFAInstance.java
  223. +10 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/NFAStateInfo.java
  224. +143 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/NativeCall.java
  225. +21 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/NativeCallBody.java
  226. +10 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/NativeCallInstance.java
  227. +904 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6Opaque.java
  228. +170 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6OpaqueBaseInstance.java
  229. +85 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6OpaqueDelegateInstance.java
  230. +53 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6OpaqueREPRData.java
  231. +133 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6bigint.java
  232. +18 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6bigintInstance.java
  233. +167 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6int.java
  234. +16 −0 src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/P6intInstance.java
Sorry, we could not display the entire diff because too many files (510) changed.
View
25 .gitignore
@@ -21,10 +21,10 @@ Makefile
*.bundle
*~
*.pbc
-src/ops/*.h
-src/ops/*.c
-src/pmc/pmc_*.h
-src/pmc/*.c
+src/vm/parrot/ops/*.h
+src/vm/parrot/ops/*.c
+src/vm/parrot/pmc/pmc_*.h
+src/vm/parrot/pmc/*.c
/nqp
nqp.c
nqp_group.c
@@ -39,3 +39,20 @@ config.status
config.default
3rdparty/dyncall/ConfigVars
3rdparty/dyncall/*/*.a
+/nqp_const.pir
+bin
+nqp-runtime.jar
+*.class
+*.jar
+/nqp-j
+/nqp-p
+/nqp-m
+/nqp-j.bat
+/nqp-p.bat
+/nqp-m.bat
+/jvmconfig.properties
+*.moarvm
+MoarVM
+MANIFEST
+
+/nqp.bat
View
28 3rdparty/asm/LICENSE.txt
@@ -0,0 +1,28 @@
+
+ ASM: a very small and fast Java bytecode manipulation framework
+ Copyright (c) 2000-2011 INRIA, France Telecom
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ THE POSSIBILITY OF SUCH DAMAGE.
View
BIN  3rdparty/asm/asm-4.1.jar
Binary file not shown
View
BIN  3rdparty/asm/asm-tree-4.1.jar
Binary file not shown
View
32 3rdparty/dyncall/Makefile.embedded
@@ -1,20 +1,20 @@
MAKEFILE = Makefile.embedded
-MAKE_CMD = ${MAKE} -f ${MAKEFILE}
+MAKE_CMD = ${MAKE} -f ${MAKEFILE}
all:
- cd dynload ; ${MAKE_CMD}
- cd dyncall ; ${MAKE_CMD}
- cd dyncallback ; ${MAKE_CMD}
-tests:
- cd test ; ${MAKE_CMD}
+ cd dynload && ${MAKE_CMD}
+ cd dyncall && ${MAKE_CMD}
+ cd dyncallback && ${MAKE_CMD}
+tests:
+ cd test && ${MAKE_CMD}
clean:
- cd dynload ; ${MAKE_CMD} clean
- cd dyncall ; ${MAKE_CMD} clean
- cd dyncallback ; ${MAKE_CMD} clean
- cd test ; ${MAKE_CMD} clean
+ cd dynload && ${MAKE_CMD} clean
+ cd dyncall && ${MAKE_CMD} clean
+ cd dyncallback && ${MAKE_CMD} clean
+ cd test && ${MAKE_CMD} clean
install:
- cd dynload ; ${MAKE_CMD} install
- cd dyncall ; ${MAKE_CMD} install
- cd dyncallback ; ${MAKE_CMD} install
+ cd dynload && ${MAKE_CMD} install
+ cd dyncall && ${MAKE_CMD} install
+ cd dyncallback && ${MAKE_CMD} install
bsd:
${MAKE_CMD} all
linux:
@@ -22,8 +22,10 @@ linux:
linux64:
CFLAGS="${CFLAGS} -m64" ASFLAGS="${ASFLAGS} -m64" ${MAKE_CMD} all
minix-gcc:
- cd dyncall ; CC=gcc CFLAGS= ${MAKE_CMD}
- cd dyncallback ; CC=gcc CFLAGS= ${MAKE_CMD}
+ cd dyncall && CC=gcc CFLAGS= ${MAKE_CMD}
+ cd dyncallback && CC=gcc CFLAGS= ${MAKE_CMD}
+mingw32:
+ ${MAKE_CMD} CC=gcc AS="gcc -c" all
osx:
${MAKE_CMD} all
osx-universal:
View
17 3rdparty/dyncall/buildsys/gmake/tool/gcc.gmake
@@ -46,18 +46,21 @@ endif
# --- Assemble ----------------------------------------------------------------
# FIXME:
-# Windows filenames are case-insensitive, ie %.s and %.S match the same files
+# Windows filenames are case-insensitive, ie %.s and %.S match the same files.
+# Additionally, mingw32-make 3.81 (which ships with older versions of
+# Strawberry Perl) is subtly different from gmake 3.82 (which ships with newer
+# ones).
#
-# For now, just put the %.S rule after the %.s rule: apparently, GNU make will
-# execute the rule defined last, and $(COMPILE.S) works for .s files as well
-# (see dyncall/README-Developer.txt)
-
-$(BUILD_DIR)/%.o: %.s
- $(COMPILE.s) $(OUTPUT_OPTION) $<
+# Putting the %.s rule after the %.S rule and using $(COMPILE.S) for both
+# .s and .S files (which should be ok - see dyncall/README-Developer.txt)
+# was the only combination I could get to work.
$(BUILD_DIR)/%.o: %.S
$(COMPILE.S) $(OUTPUT_OPTION) $<
+$(BUILD_DIR)/%.o: %.s
+ $(COMPILE.S) $(OUTPUT_OPTION) $<
+
# auto-dependency: disabled, due to problems when including *.d files, see targets.gmake for details
# $(CC) -MM -MT $@ $(CPPFLAGS) $< > $(BUILD_DIR)/$*.d
View
3  3rdparty/dyncall/dyncall/dyncall_callvm_sparc.c
@@ -32,8 +32,7 @@
/* the six output registers %o0-%o5 are always loaded, thus we need to ensure the argument buffer has space for at least 24 bytes. */
static DCCallVM* dc_callvm_new_sparc(DCCallVM_vt* vt, DCsize size)
{
- size=DC_MAX(size,sizeof(void*)*(6+1));
- DCCallVM_sparc* self = (DCCallVM_sparc*) dcAllocMem(sizeof(DCCallVM_sparc)+size);
+ DCCallVM_sparc* self = (DCCallVM_sparc*) dcAllocMem(sizeof(DCCallVM_sparc)+DC_MAX(size,sizeof(void*)*(6+1)));
dc_callvm_base_init(&self->mInterface, vt);
dcVecInit(&self->mVecHead,size);
return (DCCallVM*)self;
View
1  3rdparty/dyncall/dyncallback/dyncall_callback_ppc32.c
@@ -25,6 +25,7 @@
#include "dyncall_callback.h"
#include "dyncall_callback_ppc32.h"
+#include "dyncall_alloc_wx.h"
void dcbInitCallback(DCCallback* pcb, const char* signature, DCCallbackHandler* handler, void* userdata)
{
View
4 3rdparty/dyncall/dyncallback/dyncall_thunk_ppc32.c
@@ -25,8 +25,8 @@
#include "dyncall_thunk.h"
-unsigned short hi16(x) { return ( (unsigned short) (((unsigned int)x)>>16UL) ); }
-unsigned short lo16(x) { return ( (unsigned short) ((unsigned int)x) ); }
+unsigned short hi16(unsigned int x) { return ( (unsigned short) (((unsigned int)x)>>16UL) ); }
+unsigned short lo16(unsigned int x) { return ( (unsigned short) ((unsigned int)x) ); }
void dcbInitThunk(DCThunk* p, void (*entry)())
{
View
33 3rdparty/jline/LICENSE.txt
@@ -0,0 +1,33 @@
+Copyright (c) 2002-2006, Marc Prud'hommeaux <mwp1@cornell.edu>
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following
+conditions are met:
+
+Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with
+the distribution.
+
+Neither the name of JLine nor the names of its contributors
+may be used to endorse or promote products derived from this
+software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
+BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
+IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+OF THE POSSIBILITY OF SUCH DAMAGE.
+
View
BIN  3rdparty/jline/jline-1.0.jar
Binary file not shown
View
202 3rdparty/jna/ASL2.0
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
View
12 3rdparty/jna/LICENSE.ASL
@@ -0,0 +1,12 @@
+This copy of JNA is licensed under the
+Apache (Software) License, version 2.0 ("the License").
+See the License for details about distribution rights, and the
+specific rights regarding derivate works.
+
+You may obtain a copy of the License at:
+
+http://www.apache.org/licenses/
+
+A copy is also included in the downloadable source code package
+containing JNA, in file "ASL2.0", under the same directory
+as this file.
View
BIN  3rdparty/jna/jna.jar
Binary file not shown
View
299 Configure.pl
@@ -6,18 +6,20 @@
use warnings;
use Text::ParseWords;
use Getopt::Long;
-use Cwd;
+use Cwd qw/abs_path cwd/;
use lib "tools/lib";
-use NQP::Configure qw(cmp_rev read_parrot_config
+use NQP::Configure qw(cmp_rev read_parrot_config gen_moar
fill_template_file fill_template_text
slurp system_or_die verify_install sorry gen_parrot);
+my %known_backends = (parrot => 1, jvm => 1, moar => 1);
MAIN: {
if (-r "config.default") {
unshift @ARGV, shellwords(slurp('config.default'));
}
- my %config;
+ my $slash = $^O eq 'MSWin32' ? '\\' : '/';
+ my %config = (perl => $^X);
$config{'nqp_config_status'} = join(' ', map { "\"$_\""} @ARGV);
my $exe = $NQP::Configure::exe;
@@ -26,6 +28,8 @@
GetOptions(\%options, 'help!', 'prefix=s',
'with-parrot=s', 'gen-parrot:s',
'make-install!', 'makefile-timing!',
+ 'backends=s', 'gen-moar:s', 'moar-option=s@',
+ 'git-protocol=s',
'parrot-config=s', 'parrot-option=s@');
# Print help if it's requested
@@ -37,12 +41,39 @@
# Deprecated --parrot-config option
if ($options{'parrot-config'}) {
sorry "The --parrot-config option has been removed.",
- "Use --with-parrot to specify the parrot executable to use."
+ "Use --prefix to specify a directory in which parrot is installed.";
}
- my $prefix = $options{'prefix'} || cwd().'/install';
- my $with_parrot = $options{'with-parrot'};
- my $gen_parrot = $options{'gen-parrot'};
+ my $default_backend;
+ my %backends;
+ if ($options{backends}) {
+ for my $be (split /,/, $options{backends}) {
+ $be = lc $be;
+ unless ($known_backends{$be}) {
+ die "Unknown backend: '$be'; Known backends: " .
+ join(', ', sort keys %known_backends) . "\n";
+ }
+ $default_backend ||= $be;
+ $backends{$be} = 1;
+ }
+ }
+ if (defined $options{'gen-parrot'}) {
+ $backends{parrot} = 1;
+ $default_backend ||= 'parrot';
+ }
+ if (defined $options{'gen-moar'}) {
+ $backends{moar} = 1;
+ $default_backend ||= 'moar';
+ }
+ unless (%backends) {
+ # TODO: come up with more sensible defaults
+ $backends{parrot} = 1;
+ $default_backend = 'parrot';
+ }
+
+ mkdir($options{'prefix'}) if $options{'prefix'} && $^O =~ /Win32/ && !-d $options{'prefix'};
+ my $prefix = ($options{'prefix'} && abs_path($options{'prefix'})) || cwd().'/install';
+ $config{prefix} = $prefix;
# Save options in config.status
unlink('config.status');
@@ -51,92 +82,207 @@
"$^X Configure.pl $config{'nqp_config_status'} \$*\n";
close($CONFIG_STATUS);
}
+ $config{'makefile-timing'} = $options{'makefile-timing'};
+ $config{'stagestats'} = '--stagestats' if $options{'makefile-timing'};
+ $config{'shell'} = $^O eq 'MSWin32' ? 'cmd' : 'sh';
+ $config{'bat'} = $^O eq 'MSWin32' ? '.bat' : '';
+ $config{'cpsep'} = $^O eq 'MSWin32' ? ';' : ':';
+ $config{'slash'} = $slash;
- my ($par_want) = split(' ', slurp('tools/build/PARROT_REVISION'));
+ open my $MAKEFILE, '>', 'Makefile'
+ or die "Cannot open 'Makefile' for writing: $!";
- if (defined $gen_parrot) {
- $with_parrot = gen_parrot($par_want, %options, prefix => $prefix);
+ my @prefixes = sort map substr($_, 0, 1), keys %backends;
+ print $MAKEFILE "\n# Makefile code generated by Configure.pl:\n";
+
+ my $launcher = substr($default_backend, 0, 1) . '-runner-default';
+ print $MAKEFILE "all: ", join(' ', map("$_-all", @prefixes), $launcher), "\n";
+ for my $t (qw/clean test qregex-test install/) {
+ print $MAKEFILE "$t: ", join(' ', map "$_-$t", @prefixes), "\n";
}
- my @errors;
- my %par_config;
- if ($with_parrot) {
- %par_config = read_parrot_config($with_parrot)
- or push @errors, "Unable to read configuration from $with_parrot.";
- }
- else {
- %par_config = read_parrot_config("$prefix/bin/parrot$exe", "parrot$exe")
- or push @errors, "Unable to find parrot.";
- $with_parrot = fill_template_text('@bindir@/parrot@exe@', %par_config);
- }
+ fill_template_file(
+ 'tools/build/Makefile-common.in',
+ $MAKEFILE,
+ %config,
+ );
- %config = (%config, %par_config);
- my $par_have = $config{'parrot::git_describe'} || '';
- if ($par_have && cmp_rev($par_have, $par_want) < 0) {
- push @errors, "Parrot revision $par_want required (currently $par_have).";
- }
+ if ($backends{parrot}) {
+ my $with_parrot = $options{'with-parrot'};
+ my $gen_parrot = $options{'gen-parrot'};
+ my ($par_want) = split(' ', slurp('tools/build/PARROT_REVISION'));
- if (!@errors) {
- push @errors, verify_install([@NQP::Configure::required_parrot_files],
- %config);
- push @errors,
- "(Perhaps you need to 'make install', 'make install-dev',",
- "or install the 'devel' package for Parrot?)"
- if @errors;
- }
+ if (defined $gen_parrot) {
+ $with_parrot = gen_parrot($par_want, %options, prefix => $prefix);
+ }
- if (@errors && !defined $gen_parrot) {
- push @errors,
- "\nTo automatically clone (git) and build a copy of Parrot $par_want,",
- "try re-running Configure.pl with the '--gen-parrot' option.",
- "Or, use '--with-parrot=' to explicitly specify the Parrot",
- "executable to use to build NQP.";
- }
+ my @errors;
- sorry(@errors) if @errors;
+ my %par_config;
+ if ($with_parrot) {
+ %par_config = read_parrot_config($with_parrot)
+ or push @errors, "Unable to read configuration from $with_parrot.";
+ }
+ else {
+ %par_config = read_parrot_config("$prefix/bin/parrot$exe", "parrot$exe")
+ or push @errors, "Unable to find parrot.";
+ $with_parrot = fill_template_text('@bindir@/parrot@exe@', %par_config);
+ }
- print "Using $with_parrot (version $config{'parrot::git_describe'}).\n";
+ %config = (%config, %par_config);
+ my $par_have = $config{'parrot::git_describe'} || '';
+ if ($par_have && cmp_rev($par_have, $par_want) < 0) {
+ push @errors, "Parrot revision $par_want required (currently $par_have).";
+ }
- $config{'makefile-timing'} = $options{'makefile-timing'};
- $config{'stagestats'} = '--stagestats' if $options{'makefile-timing'};
- $config{'shell'} = $^O eq 'MSWin32' ? 'cmd' : 'sh';
- if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
- $config{'dll'} = '$(PARROT_BIN_DIR)/$(PARROT_LIB_SHARED)';
- $config{'dllcopy'} = '$(PARROT_LIB_SHARED)';
- $config{'make_dllcopy'} =
- '$(PARROT_DLL_COPY) : $(PARROT_DLL)'."\n\t".'$(CP) $(PARROT_DLL) .';
- }
+ if (!@errors) {
+ push @errors, verify_install([@NQP::Configure::required_parrot_files],
+ %config);
+ push @errors,
+ "(Perhaps you need to 'make install', 'make install-dev',",
+ "or install the 'devel' package for Parrot?)"
+ if @errors;
+ }
- my $make = fill_template_text('@make@', %config);
+ if (@errors && !defined $gen_parrot) {
+ push @errors,
+ "\nTo automatically clone (git) and build a copy of Parrot $par_want,",
+ "try re-running Configure.pl with the '--gen-parrot' option.",
+ "Or, use '--with-parrot=' to explicitly specify the Parrot",
+ "executable to use to build NQP.";
+ }
- if ($make eq 'nmake') {
- system_or_die('cd 3rdparty\dyncall && Configure.bat' .
- ($config{'parrot::archname'} =~ /x64/ ? ' /target-x64' : ''));
- $config{'dyncall_build'} = 'cd 3rdparty\dyncall && nmake Nmakefile';
- }
- else {
- if ($^O eq 'MSWin32') {
- my $configure_args =
- $config{'parrot::archname'} =~ /x86/ ? ' /target-x86' : ' /target-x64';
+ sorry(@errors) if @errors;
+
+ print "Using $with_parrot (version $config{'parrot::git_describe'}).\n";
+
+ if ($^O eq 'MSWin32' or $^O eq 'cygwin') {
+ $config{'dll'} = '$(PARROT_BIN_DIR)/$(PARROT_LIB_SHARED)';
+ $config{'dllcopy'} = '$(PARROT_LIB_SHARED)';
+ $config{'make_dllcopy'} =
+ '$(PARROT_DLL_COPY) : $(PARROT_DLL)'."\n\t".'$(CP) $(PARROT_DLL) .';
+ }
+
+ my $make = fill_template_text('@make@', %config);
+
+ if ($make eq 'nmake') {
+ system_or_die('cd 3rdparty\dyncall && Configure.bat' .
+ ($config{'parrot::archname'} =~ /x64/ ? ' /target-x64' : ''));
+ $config{'dyncall_build'} = 'cd 3rdparty\dyncall && nmake Nmakefile';
+ }
+ else {
+ if ($^O eq 'MSWin32') {
+ my $configure_args =
+ $config{'parrot::archname'} =~ /x86/ ? ' /target-x86' : ' /target-x64';
- $configure_args .= $config{'parrot::cc'} eq 'gcc' ? ' /tool-gcc' : '';
+ $configure_args .= $config{'parrot::cc'} eq 'gcc' ? ' /tool-gcc' : '';
- system_or_die('cd 3rdparty\dyncall && Configure.bat' . $configure_args);
- $config{'dyncall_build'} = "cd 3rdparty/dyncall && $make BUILD_DIR=. -f GNUmakefile";
- } else {
- system_or_die('cd 3rdparty/dyncall && sh configure');
- if ($^O eq 'netbsd') {
- $config{'dyncall_build'} = "cd 3rdparty/dyncall && BUILD_DIR=. $make -f BSDmakefile";
+ system_or_die('cd 3rdparty\dyncall && Configure.bat' . $configure_args);
+ $config{'dyncall_build'} = "cd 3rdparty/dyncall && $make BUILD_DIR=. -f Makefile.embedded mingw32";
} else {
- $config{'dyncall_build'} = "cd 3rdparty/dyncall && BUILD_DIR=. $make";
+ my $target_args = '';
+ # heuristic according to
+ # https://github.com/perl6/nqp/issues/100#issuecomment-18523608
+ if ($^O eq 'darwin' && qx/ld 2>&1/ =~ /inferred architecture x86_64/) {
+ $target_args = " --target-x64";
+ }
+ system_or_die('cd 3rdparty/dyncall && sh configure' . $target_args);
+
+ if ($^O eq 'netbsd') {
+ $config{'dyncall_build'} = "cd 3rdparty/dyncall && BUILD_DIR=. $make -f BSDmakefile";
+ } else {
+ $config{'dyncall_build'} = "cd 3rdparty/dyncall && BUILD_DIR=. $make";
+ }
+ }
+ }
+
+ fill_template_file(
+ 'tools/build/Makefile-Parrot.in', $MAKEFILE,
+ %config,
+ );
+ if ($^O eq 'MSWin32') {
+ fill_template_file('src/vm/parrot/nqp.bat', 'gen/parrot/nqp_launcher', %config);
+ }
+ else {
+ fill_template_file('src/vm/parrot/nqp.sh', 'gen/parrot/nqp_launcher', %config);
+ }
+ chmod 0755, 'gen/parrot/nqp_launcher';
+ }
+ if ($backends{moar}) {
+ my @errors;
+ my ($moar_want) = split(' ', slurp('tools/build/MOAR_REVISION'));
+ my $moar_path = gen_moar($moar_want, %config, %options);
+ if (!$moar_path) {
+ push @errors,
+ "No suitable MoarVM (moar executable) found using the --prefix\n" .
+ "(You can get a MoarVM built automatically with --gen-moar.)";
+ }
+ sorry(@errors) if @errors;
+ $config{'make'} = $^O eq 'MSWin32' ? 'nmake' : 'make';
+ $config{moar} = $moar_path;
+ fill_template_file(
+ 'tools/build/Makefile-Moar.in',
+ $MAKEFILE,
+ %config,
+ );
+ }
+
+ if ($backends{jvm}) {
+ my @errors;
+
+ my $got;
+ if (!@errors) {
+ my @jvm_info = `java -showversion 2>&1`;
+ my $jvm_found = 0;
+ my $jvm_ok = 0;
+ for (@jvm_info) {
+ if (/(?:java|jdk) version "(\d+)\.(\d+)/) {
+ $jvm_found = 1;
+ if ($1 > 1 || $1 == 1 && $2 >= 7) {
+ $jvm_ok = 1;
+ }
+ $got = $_;
+ last;
+ }
+ }
+
+ if (!$jvm_found) {
+ push @errors,
+ "No JVM (java executable) in path; cannot continue";
+ }
+ elsif (!$jvm_ok) {
+ push @errors,
+ "Need at least JVM 1.7 (got $got)";
}
}
+
+ sorry(@errors) if @errors;
+
+ print "Using $got\n";
+
+ $config{'make'} = $^O eq 'MSWin32' ? 'nmake' : 'make';
+ $config{'runner'} = $^O eq 'MSWin32' ? 'nqp.bat' : 'nqp';
+
+ fill_template_file(
+ 'tools/build/Makefile-JVM.in',
+ $MAKEFILE,
+ %config,
+ );
}
- fill_template_file('tools/build/Makefile.in', 'Makefile', %config);
+ my $ext = '';
+ if ($^O eq 'MSWin32') {
+ $ext = $default_backend eq 'parrot' ? '.exe' : '.bat';
+ }
- {
+ print $MAKEFILE qq[t/*/*.t: all\n\tprove -r -v --exec ./nqp$ext \$\@\n];
+
+ close $MAKEFILE
+ or die "Error while writing to 'Makefile': $!";
+
+ my $make = fill_template_text('@make@', %config);
+ unless ($options{'no-clean'}) {
no warnings;
print "Cleaning up ...\n";
if (open my $CLEAN, '-|', "$make clean") {
@@ -162,18 +308,25 @@
# Print some help text.
sub print_help {
- print <<'END';
+ my $backends = join ',',keys %known_backends;
+ print <<"END";
Configure.pl - NQP Configure
General Options:
--help Show this text
--prefix=dir Install files in dir
+ --backends=list Backends to use: $backends
--with-parrot=path/to/bin/parrot
Parrot executable to use to build NQP
--gen-parrot[=branch]
Download and build a copy of Parrot to use
--parrot-option='--option=value'
Options to pass to parrot configuration for --gen-parrot
+ --gen-moar Download and build a copy of MoarVM to use
+ --moar-option='--option=value'
+ Options to pass to MoarVM configuration for --gen-moar
+ --git-protocol={ssh,https,git}
+ Protocol to use for git clone. Default: https
Configure.pl also reads options from 'config.default' in the current directory.
END
View
52 README → README.pod
@@ -1,6 +1,6 @@
=head1 NQP - Not Quite Perl (6)
-NQP is Copyright (C) 2009-2012 by The Perl Foundation. See F<LICENSE>
+NQP is Copyright (C) 2009-2013 by The Perl Foundation. See F<LICENSE>
for licensing details.
This is "Not Quite Perl" -- a lightweight Perl 6-like environment
@@ -8,12 +8,13 @@ for virtual machines. The key feature of NQP is that it's
designed to be a very small environment (as compared with, say, perl6
or Rakudo) and is focused on being a high-level way to create
compilers and libraries for virtual machines (such as the Parrot
-Virtual Machine [1]). Unlike a full-fledged implementation of Perl 6,
-NQP strives to have as small a runtime footprint as it can, while
-still providing a Perl 6 object model and regular expression engine
-for the virtual machine.
+Virtual Machine [1], the JVM, and MoarVM [2]). Unlike a full-fledged
+implementation of Perl 6, NQP strives to have as small a runtime footprint
+as it can, while still providing a Perl 6 object model and regular expression
+engine for the virtual machine.
[1] http://parrot.org/
+ [2] https://github.com/MoarVM/MoarVM
=head2 Building from source
@@ -29,38 +30,28 @@ If you don't have git installed, you can get a tarball or zip
of NQP from github by visiting http://github.com/perl6/nqp/tree/master
and clicking "Download". Then unpack the tarball or zip.
+NQP can run on three different backends: Parrot, MoarVM and the Java Virtual
+Machine (JVM). Decide on which backends you want it to run, and configure and
+build it as follows:
+
Once you have a copy of NQP, build it as follows:
$ cd nqp
- $ perl Configure.pl --gen-parrot
+ $ perl Configure.pl --backends=moar,parrot,jvm
$ make
-This will create a "nqp" or "nqp.exe" executable in the
+If you don't have parrot installed, you can have Configure.pl generate one for
+you by passing the C<--gen-parrot> option to it as well.
+
+The C<make> step will create a "nqp" or "nqp.exe" executable in the
current directory. Programs can then be run from the build
directory using a command like:
$ ./nqp hello.nqp
-The C<--gen-parrot> option above tells Configure.pl to automatically
-download and build the most appropriate version of Parrot into a
-local "parrot/" subdirectory, install that Parrot into the
-"parrot_install/" subdirectory, and use that for building NQP.
-It's okay to use the C<--gen-parrot> option on later invocations
-of Configure.pl; the configure system will re-build Parrot only
-if a newer version is needed for whatever version of Rakudo you're
-working with.
-
-You can use C<--parrot-config=/path/to/parrot_config> instead
-of C<--gen-parrot> to use an already installed Parrot for building
-NQP. This installed Parrot must include its development
-environment; typically this is done via Parrot's C<make install>
-target or by installing prebuilt C<parrot-devel> and/or C<libparrot-dev>
-packages. The version of the already installed Parrot must satisfy a
-minimum specified by the NQP being built -- Configure.pl will
-verify this for you. Released versions of NQP always build
-against the latest release of Parrot; checkouts of the HEAD revision
-from github often require a version of Parrot that is newer than
-the most recent Parrot monthly release.
+By default, NQP searches for the parrot executable and installs to the
+directory C<./install>. You can change that with the C<--prefix> option to
+Configure.pl.
Once built, NQP's C<make install> target will install NQP
and its libraries into the Parrot installation that was used to
@@ -82,9 +73,8 @@ NQP is the successor implementation of "nqp-rx" [2]. Unlike nqp-rx,
which aimed to have almost no runtime component whatsoever, this new
version of NQP accepts that a minimal Perl 6 object metamodel,
multidispatcher, and regular expression engine are needed on top of
-the underlying virtual machine. Also, nqp-rx is likely to only run
-on Parrot, whereas we expect NQP to eventually run on other virtual
-machine backends.
+the underlying virtual machine. Also, nqp-rx only ran on Parrot,
+whereas NQP also runs on the JVM and is designed to be portable to
+more.
[2] http://github.com/perl6/nqp-rx
-
View
2  VERSION
@@ -1 +1 @@
-2013.01
+2014.01
View
3  docs/6model/overview.markdown
@@ -131,8 +131,7 @@ following.
method new_type() {
my $meta-object := self.new();
- return pir::repr_type_object_for__PPs(
- $meta-object, 'HashAttrStore');
+ return nqp::newtype($meta-object, 'HashAttrStore');
}
method add_method($type, $name, $code) {
View
161 docs/continuations.pod
@@ -0,0 +1,161 @@
+=head1 Continuations in NQP
+
+This document describes a somewhat experimental and JVM-only NQP feature: the
+ability to freeze and thaw stack frames for implementing unusual control flow.
+
+=head2 Interface
+
+I think that the best abstraction to what I'm trying to build here is the
+B<delimited continuation> (L<https://en.wikipedia.org/wiki/Delimited_continuation>).
+
+=over 4
+
+=item nqp::continuationreset($tag, { ... })
+
+Executes the argument, marking the stack for a subsequent C<nqp::continuationshift>
+operation within the dynamic scope. The C<$tag> is an object which can be used
+later by C<nqp::continuationshift> to find a specific reset frame.
+
+=item nqp::continuationcontrol($protect, $tag, -> $cont { ... })
+
+Slices off the part of the evaluation stack between the current call frame and
+the innermost enclosing C<nqp::continuationreset>. If C<$tag> is not null,
+only resets with the same tag are considered; otherwise the innermost reset
+will be taken regardless of tag. If there is no such reset, or if there is a
+non-saveable frame (aka continuation barrier) between the current position and
+the matching reset, an error occurs. The sliced-off part of the stack is
+wrapped in an NQP object and passed to the callback function; it is removed
+from the stack, so B<if the callback returns without using the continuation,
+the effect is to cause C<nqp::continuationreset> to return immediately with the
+returned value>.
+
+C<$protect> is an integer. If it is 1, the reset will be retained on the stack
+while the handler is being executed; if it is 0, the reset will be removed.
+Other values are undefined. In no case will the matched reset be included in
+the captured continuation object (although an unmatched reset which is skipped
+over would be). Thus, C<control(1, ...)> corresponds to the standard C<control>
+operator, while C<control(0, ...)> corresponds to the standard C<control0>
+operator. To simulate C<shift> and C<shift0>, manually add the reset before
+invoking the continuation.
+
+=item nqp::continuationinvoke($cont, $inject)
+
+Pastes the saved call frames onto the current stack, such that
+C<nqp::continuationshift> calls C<$inject> within the restored dynamic scope
+and returns its return value. Control returns to the caller when the callback
+to C<nqp::continuationreset> returns, with the same value. This can be used
+multiple times on the same continuation. (Actually, delimited continuations
+are traditionally represented as functions, so this operator is implicit and
+unnamed. But sixmodel makes that slightly tricky.)
+
+=item nqp::continuationclone($cont)
+
+Produces a shallow clone of the passed continuation. This is presently
+necessary in situations where a continuation must be active twice at the same
+time. At present, lexical variables will remain shared but locals will not.
+B<Details here are subject greatly to change.>
+
+ # should be 3 * 3 * 10 = 90
+ # will infinite loop if the clones are removed
+ my $cont := nqp::continuationreset(nqp::null(), {
+ 3 * nqp::continuationcontrol(0, nqp::null(), -> $k { $k });
+ });
+ my $val := nqp::continuationinvoke(nqp::continuationclone($cont),
+ { nqp::continuationinvoke(nqp::continuationclone($cont), { 10 }) });
+
+=back
+
+By way of example, here is Scheme's call/cc implemented using NQP delimited
+continuations:
+
+ # for proper R5RS semantics, run this once wrapping your main function
+ sub run_main($f) {
+ nqp::continuationreset(nqp::null(), $f);
+ }
+
+ sub callcc($f) {
+ # first get the current continuation
+ nqp::continuationcontrol(1, nqp::null(), -> $dcont {
+ my $scheme_cont := -> $val {
+ # when the scheme continuation is invoked, we need to *replace*
+ # the current continuation with this one
+ nqp::continuationcontrol(1, nqp::null(), -> $c {
+ nqp::continuationinvoke($dcont, { $val })
+ });
+ };
+ nqp::continuationinvoke($dcont, { $f($scheme_cont) });
+ });
+ }
+
+And here is something resembling gather/take:
+
+ my $SENTINEL := [];
+ sub yield($value) {
+ nqp::continuationcontrol(0, nqp::null(), -> $dcont {
+ [$value, { nqp::continuationinvoke($dcont, {0}) }]
+ });
+ }
+
+ sub start_iter($body) {
+ my $state := { $body(); yield($SENTINEL) };
+ -> {
+ my $pkt := nqp::continuationreset(nqp::null(), $state);
+ $state := $pkt[1];
+ $pkt[0];
+ }
+ }
+
+Complete examples may be found in t/jvm/01-continuations.t in the source distribution.
+
+=head1 Conjectures
+
+=head2 Lazy recursive reinstate optimization
+
+Consider the following (Perl 6):
+
+ my $N = 10000;
+
+ sub flatten($x) {
+ multi go(@k) { go($_) for @k }
+ multi go($k) { take $k }
+
+ gather go($x);
+ }
+
+ my $list = [^$N];
+ $list = [$list] for ^$N;
+ say flatten($list).perl;
+
+This takes O(N^2) time on the current implementation. Why? Because each time
+take is invoked, we are N frames deep, so each take does O(N) work, and there
+are N calls to take. We can improve this to O(N) by doing the continuation
+operations B<lazily>. That is, when reinstating a continuation only reinstate
+the top frame(s) that will be executed, and skip the work of reinstating the
+non-top frames only to resave them later. The design of this is a bit
+handwavey at the moment.
+
+=head2 Multiple callers
+
+There are two sensible ways to define the caller of a call frame. Either the
+frame which caused this frame to exist (henceforth, the static caller) or the
+frame which caused this frame to be active (henceforth, the dynamic caller).
+They are the same for most frames, but differ in the case of the top frame of a
+gather. The static caller of such a frame is the frame containing C<gather>;
+the dynamic caller is the frame corresponding to C<GatherIter.reify>. We need
+both: contextuals use the static caller (TimToady has said so quite
+explicitly), while exceptions and control flow ought to use the dynamic caller
+(people expect lazy exceptions to show up and backtrace at the point where the
+list is used). So we might need to B<add a dynamicCaller field to CallFrame
+and come up with updating logic>. Niecza does precisely this, and I think
+parrot is doing something similar.
+
+=head2 Saner cloning
+
+C<nqp::continuationclone> is bad because it exposes details of what the JVM
+implementation can do without warning and what requires warnings. It would be
+better to expliclty declare exactly what you intend to do with the continuation
+as a bit flag passed to control and/or invoke, and let the op set figure out
+itself when cloning is needed. Flags could include "I don't intend to call
+this at all" (control used as an escape operator), "I intend to call this
+exactly once" (coroutines), "I may use this more than once, but only on one
+thread", "I want to use this on several threads".
View
63 docs/jvminterop.pod
@@ -0,0 +1,63 @@
+=head1 Basic principles
+
+We have some degree of interop with native Java objects provided through the
+C<BootJavaInterop> class. The name Boot is intended to suggest that it will
+not be used directly in most cases; instead it can either be subclassed to
+provide useful (and fast) HLL-specific marshaling, or it can be wrapped with
+NQP code to achieve a similar effect.
+
+=head1 Common data model
+
+All Java objects are wrapped in instances of the C<JavaWrap> REPR. The
+instances share a common methodless class by default, but a subclass of
+C<BootJavaInterop> can define an alternate class, or even dynamically create
+one class per Java type. Marshalling and unmarshalling is done automatically
+on calls in a statically type-directed way: a function which declares a return
+type of C<String> will appear to return C<str>, but a function with a declared
+type of C<Object> will wrap any return value even if it is a string.
+
+When dynamically creating classes, return values are wrapped in a wrapper type
+appropriate to their B<static> type. To use methods that exist only on a
+specific run-time subclass, a cast must be used. This is a deliberate
+difference from the Niecza CLR interop system, intended to avoid several
+related semantic traps that exist in Niecza. For instance:
+
+ $obj.method1.method2;
+
+If C<method1> is declared to return an object of type C<Class2> with a single
+method C<method2>, and actually does so, this works in both NQP and Niecza.
+But if C<method1> is changed to return an object of type C<Class3> which is a
+subclass of C<Class2> but has additional methods that shadow or ambiguously
+overload C<method2>, it will B<not> work in Niecza because the binding is
+effectively too late to reflect host-language subclass substitutability; but
+it will work on NQP, because the binding is forced to be done based on the
+static type.
+
+When handling these "pseudostatic types", no attempt is made to reflect Java's
+generic type system. That would just be crazy.
+
+=head1 Direct use
+
+ my $interop := nqp::jvmbootinterop();
+
+ $interop.typeForName('java.lang.Thread').unbox(
+ $interop.implementClass(
+ [ ['extends','java.lang.Thread'], ['instance_method', 'run', '()V', method () { say("Hello thread") }] ],
+ ).newInstance
+ ).start;
+
+ $interop.typeForName('java.lang.Thread')."constructor/new/(Ljava/lang/Runnable;Ljava/lang/String;)V"(
+ $interop.proxy('java.lang.Runnable', nqp::hash( 'run', sub () { say("hello thread2") } )),
+ "AnotherThread"
+ ).start;
+
+=head1 Subclassing
+
+The C<BootJavaInterop> class has a large number of protected methods which can
+be overriden to support things like automatic creation of C<STable>s to permit
+method calls against Java objects and types, or adding marshalling rules like
+C<java.math.BigInteger> <-> C<Int>.
+
+=head1 Wrapping
+
+TBD
View
200 docs/nqp-opcode.txt
@@ -1,200 +0,0 @@
-General notes:
- * Not really attempting to be exhaustive just yet -- only want
- to get the most significant ones done in this pass.
- * Avoid "set" -- use "bind" or "assign" if that's what we're really doing.
- Or, if we want to keep "set", make sure it always means "bind".
- * A suffix of _i, _n, or _s generally denotes an int/num/str version
- of the opcode. Stick to lowercase letters here...
- * ... except that bigints might be a _I suffix :-)
- * Perhaps reserve _b for a boolean native type
- * Might want to reserve _l and _h for "native" list/hash versions of opcodes
- * Might want to reserve _o for object/instance versions of opcodes
- * aim for consistency with underscores and the like
- (i.e., unlike parrot, don't mix "get_foo" and "getbar")
- * Use the p6-defined terms where possible (e.g., "elems" and "chars"
- instead of "elements" and "length")
- * Generally return an appropriate argument instead of void
- * Items marked (?) mean that the opcode itself might be questionable
- for inclusion in the set.
-
-(Updated for QAST, 2012-07-29 by pmichaud)
-
- control opcodes:
- nqp::if(test, iftrue, iffalse)
- nqp::unless(test, iffalse, iftrue)
- nqp::ifnull(val, valifnull)
- nqp::defor(val, valifundef)
- nqp::while(test, body)
- nqp::until(test, body)
- nqp::repeat_while(test, body)
- nqp::repeat_until(test, body)
- nqp::loop(init, test, next, body)
- nqp::for(list, body [, next])
- nqp::stmts(stmt0, stmt1, ...)
- nqp::throw pir::throw__0P
- nqp::rethrow pir::rethrow__0P
- nqp::die pir::die__0P
- nqp::die_s pir::die__0s
- nqp::exit pir::exit__vi
- nqp::sleep pir::sleep__vn
- (need ops to fetch caller, outer, context, etc?)
-
- binding opcodes:
- nqp::bind(var, value)
-
- I/O:
- nqp::print pir::print
- nqp::say pir::say
- nqp::stat pir::stat__Isi
- nqp::open pir::open__Pss
-
- arithmetic:
- nqp::add_i pir::add__Iii
- nqp::add_n pir::add__Nnn
- nqp::add_I
- ...etc...
- nqp::isnanorinf
-
- string:
- nqp::chars pir::length__Is
- nqp::concat pir::concat__Sss
- nqp::concat_s pir::concat__Sss
- nqp::join pir::join__SsP
- nqp::x pir::repeat__Ssi
- nqp::substr pir::substr__Ssii
- nqp::lc pir::downcase__Ss
- nqp::uc pir::upcase__Ss
- nqp::index pir::index__Issi
- nqp::chr pir::chr__Si
- nqp::ord pir::ord__Si
- nqp::chars pir::length__Is
- nqp::split pir::split__Pss
- nqp::iscclass pir::iscclass__Isii (?)
- nqp::findcclass pir::find_cclass__Iisii (?)
- nqp::findnotcclass pir::find_not_cclass__Iisii (?)
-
- relational:
- nqp::iseq_i pir::iseq__Iii
- nqp::iseq_n pir::iseq__Inn
- nqp::iseq_s pir::iseq__Iss
- nqp::iseq_I
- ...etc...
-
- aggregate:
- nqp::list(item0, item1, ...) create a low-level list
- nqp::qlist(item0, item1, ...) temporary for QRPA
- nqp::list_i(int0, int1, ...) create a low-level integer list
- nqp::list_s(str0, str1, ...) create a low-level string list
- nqp::hash(key0, val0, ...) create a low-level hash
-
- nqp::pop pir::pop__PP
- nqp::push pir::push__0PP
- nqp::push_s pir::push__0Ps
- nqp::shift pir::shift__PP
- nqp::unshift pir::unshift__0PP
- nqp::splice pir::splice__0PPii
- nqp::bindpos pir::set__1QiP
- nqp::bindkey pir::set__1QsP
- nqp::atpos pir::set__PQi
- nqp::atkey pir::set__PQs
- nqp::existpos pir::exists__IQi
- nqp::existkey pir::exists__IQs
- nqp::deletekey pir::delete__0Qs
- nqp::elems pir::elements__IP
-
- object:
- nqp::bindattribute pir::setattribute__0PPsP
- nqp::getattribute pir::getattribute__PPPs
- nqp::findmethod pir::find_method__PPs (?)
- nqp::can pir::can__IPs (?)
- nqp::null pir::null__P
- nqp::isnull pir::isnull__IP
- nqp::defined pir::defined__IP
- nqp::istrue pir::istrue__IP
- nqp::clone pir::clone__PP
- nqp::typecheck or ::isa pir::type_check__IPP
- or ::istype
- nqp::?? pir::isa__IPs (reject)
- nqp::?? pir::typeof__SP (reject)
- nqp::?? pir::does__IPs (reject)
- nqp::create pir::repr_instance_of__PP
-
- nqp::unbox_i pir::repr_unbox_int__IP
- nqp::unbox_n pir::repr_unbox_num__NP
- nqp::unbox_s pir::repr_unbox_str__SP
- nqp::box_i pir::repr_box_int__PPi
- nqp::box_n pir::repr_box_num__PPn
- nqp::box_s pir::repr_box_str__PPs
- nqp::what or nqp::getwhat pir::get_what__PP
- nqp::how or nqp::gethow pir::get_how__PP
- nqp::who or nqp::getwho pir::get_who__PP
- nqp::where pir::get_id__IP
-
- Rakudo-specific:
- nqp::p6box_i pir::perl6_box_int__Pi
- nqp::p6box_n pir::perl6_box_num__Pn
- nqp::p6box_s pir::perl6_box_str__Ps
- nqp::p6iscontainer pir::is_container__IP
- nqp::?? (::p6capturepos?) pir::perl6_current_args__P
- nqp::p6assign or ::p6store pir::perl6_container_store__0PP
- nqp::p6bool or ::p6box_b pir::perl6_booleanize__PI
- nqp::p6list_a pir::perl6_list_from_rpa__PPPP
- nqp::p6iter_a pir::perl6_iter_from_rpa__PPP
-
- STable ops (?)
- ...??...
-
- Debugging
- nqp::deb
-
-
-nqp::deb(flags, msg)
- The nqp::deb opcode provides access into NQP's debug log mechanism.
- The opcode takes a flag selector argument and a string to be logged.
-
- The C<flags> are arranged as a bit field that are bitwise-anded
- with the current debugging level flag to determine if the string
- should be computed and logged. The lower bits of the flag form
- a bitmask that determins the type of event being logged
- are a bitmask determining the type of event
- determine the type of event being logged:
-
- Bits (values) Event
- 0-3 0x0f open for user programs and short-term debugging
- 4 0x10 subroutine entry/exit
- 5 0x20 regex events
- 6 0x40 compiler events
- 7 0x80 library/setting events
- 8-27 0x0fffff00 reserved
-
- The top nibble of the flag is used to further filter event
- logging. Bits 28 and 29 combine to form a "detail level"
- filter with levels 0 (lowest) to 3 (highest). Thus a nqp::deb()
- call can specify both the type of event and the level of detail:
- nqp::deb(0x10, '...') # ordinary sub event
- nqp::deb(0x10000010, '...') # sub event at detail level 1
- nqp::deb(0x20000020, '...') # regex event at detail level 2
- nqp::deb(0x30000090, '...') # library+sub event at detail level 3
- Events at the higher levels of detail are logged only if the
- global flag selector requests those higher levels of detail.
-
- Bits 30 and 31 are reserved for future use; it's speculated that
- 4 levels of detail will be sufficient but if we need more we can
- grab bit 30 for that.
-
- The C<msg> argument is the string to be logged. Within the message
- string, '%sub%' will be replaced with the identity (name and subid)
- of the currently executing sub, and '%caller%' will be replaced
- with the identity of the current sub's caller.
-
- The HLL::Compiler class (and its subclasses) support a
- --nqpevent="logfile;level" option that enables event and debug
- logging. C<logfile> specifies a file where events are to
- be logged; if omitted, the standard error is used. The C<level>
- specifies the global debug flag, if omitted it defaults to 31 (0x1f),
- which displays all user-level debug events and subroutine events
- at detail level 0. (Currently the option handler can only handle
- decimal values for the detail level; this will be fixed to accept
- '0x...' hex values soon.)
-
-
View
1,747 docs/ops.markdown
@@ -0,0 +1,1747 @@
+# NQP Opcodes
+
+Opcodes (ops) are used both directly when writing NQP, and during code
+generation in QAST nodes.
+
+When invoking them directly, you'll need to prefix them with nqp::, e.g.
+
+ nqp::mul_n(6,9);
+
+The ops are listed below by type. Each entry shows the name of the op,
+its variants, and their arguments and types, and may provide a short
+description. Some opcodes differ only by argument types - in that case,
+they are listed under their common name (e.g. `mul`), with each of their
+variants (e.g. `mul_i`, `mul_n`) together with a single description.
+
+Opcode variants may contain a type suffix, which usually indicates:
+
+* `_i` argument is native int
+* `_n` argument is native float
+* `_s` argument is native string
+* `_b` argument is code blocks
+* `_I` argument is Big Integer
+
+They may also have a numeric suffix, which typically indicates the number
+of arguments required.
+
+In opcode signatures below, we use the following types, which may not
+correspond directly to NQP types.
+
+* int - native int
+* num - native float
+* str - native string
+* Int - BigInt
+* Mu - any NQP or VM object
+* Mu:T - a type object, e.g. `Int`
+* Exception - an Exception object
+* Handle - an I/O Handle object
+* Iterable - something iterable
+* Context - a Context object
+* LexPad - a Context object
+* @ - this sigil indicates an array parameter
+* % - this sigil indicates a hash parameter
+* ... - indicates variable args are accepted
+
+VM-specific opcodes are denoted with a `jvm`, e.g. on the same line
+as the header. No annotation indicates this opcode should be supported on
+all nqp backends.
+
+Some individual opcodes may be marked with _Internal_ or _Deprecated_.
+Both of these indicate the opcodes are not intended to be used. Deprecated
+opcodes will eventually be removed from NQP. Internal opcodes are typically
+used at compile time to replace opcodes that take a variable number of
+arguments.
+
+# Arithmetic Opcodes
+
+## abs
+* `abs_i(int $i)`
+* `abs_n(num $n)`
+* `abs_I(Int $i, Mu:T $type)`
+
+Return the absolute value of a number.
+`_I` variant returns an object of the given type.
+
+## add
+* `add_i(int $l, int $r)`
+* `add_n(num $l, num $r)`
+* `add_I(Int $l, Int $r, Mu:T $type)`
+
+Add two numbers together, returning the result.
+`_I` variant returns an object of the given type.
+
+## div
+* `div_i(int $l, int $r)`
+* `div_n(num $l, num $r)`
+* `div_I(Int $l, Int $r, Mu:T $type)`
+* `div_In(Int $l, Int $r)`
+
+Divide $l by $r, returning the result.
+`_I` variant returns an object of the given type. The `_In` variant returns
+a native num, using a scale of 309, and a rounding mode equivalent to Java's
+`ROUND_HALF_UP`.
+
+## gcd
+* `gcd_i(int $l, int $r)`
+* `gcd_I(Int $l, Int $r, Mu:T $type)`
+
+Return the greatest common multiple of two numbers.
+`_I` variant returns an object of the given type.
+
+## lcm
+* `lcm_i(int $l, int $r)`
+* `lcm_I(Int $l, Int $r, Mu:T $type)`
+
+Return the lowest common multiple of two numbers.
+`_I` variant returns an object of the given type.
+
+## mod
+* `mod_i(int $l, int $r)`
+* `mod_n(num $l, num $r)`
+* `mod_I(Int $l, Int $r, Mu:T $type)`
+
+Return the modulus of $l by $r.
+`_I` variant returns an object of the given type.
+
+## mul
+* `mul_i(int $l, int $r)`
+* `mul_n(num $l, num $r)`
+* `mul_I(Int $l, Int $r, Mu:T $type)`
+
+Multiple two numbers, returning the result.
+`_I` variant returns an object of the given type.
+
+## neg
+* `neg_i(int $i)`
+* `neg_n(num $n)`
+* `neg_I(Int $i, Mu:T $type)`
+
+Return the negative of a number.
+`_I` variant returns an object of the given type.
+
+## sub
+* `sub_i(int $l, int $r)`
+* `sub_n(num $l, num $r)`
+* `sub_I(Int $l, Int $r, Mu:T $type)`
+
+Subtract $r from $l, returning the result.
+`_I` variant returns an object of the given type.
+
+# Numeric Opcodes
+
+## base
+* `base_I(Int $i, int $radix)`
+
+Returns a string representing the integer `$i` in base `$radix`
+
+## ceil
+* `ceil_n(num $n)`
+
+Return the ceiling of a number.
+
+## exp
+* `exp_n(num $exponent)`
+
+Return the value of `e` raised to $exponent;
+
+## floor
+* `floor_n(num $n)`
+
+Return the floor of a number.
+
+## inf
+* `inf()`
+
+Return infinity.
+
+## log
+* `log_n(num $n)`
+
+Return the log base 10 of a number.
+
+## ln
+* `ln_n(num $n)`
+
+Return the natural logarithm of a number.
+
+## expmod
+* `expmod_I(Int $base, Int $exponent, Int $modulus, Mu:T $type)`
+
+Return a bigint that is `$base` raised to `$exponent` modulus `$modulus`.
+`_I` variant returns an object of the given type.
+
+## nan
+* `nan()`
+
+Return NaN.
+
+## neginf
+* `neginf()`
+
+Return negative infinity.
+
+## pow
+* `pow_n(num $base, num $exponent)`
+* `pow_I(Int $base, Int $exponent, Mu:T $type_num, Mu:T $type_bigint)`
+
+Return the value of $base raised to $exponent;
+`_I` variant returns an object of `$type_num` for negative exponents,
+and of type `$type_bigint` for positive exponents.
+
+## rand
+* `rand_n(num $n)`
+* `rand_I(Int $i, Mu:T $type)`
+
+Returns a psuedo-random bigint up to the value of the
+given number.
+`_I` variant returns an object of the given type.
+
+## sqrt
+* `sqrt_n(num $l, num $r)`
+
+# Trigonometric Opcodes
+
+Each opcode corresponds directly to the trigonmetric function of the same
+name. `h` indicates a hyperbolic variant.
+
+## asec
+* `asec_n(num $n)`
+
+## asin
+* `asin_n(num $n)`
+
+## acos
+* `acos_n(num $n)`
+
+## atan
+* `atan_n(num $n)`
+
+## atan2
+* `atan2_n(num $l, num $r)`
+
+## cos
+* `cos_n(num $n)`
+
+## cosh
+* `cosh_n(num $n)`
+
+## sin
+* `sin_n(num $n)`
+
+## sinh
+* `sinh_n(num $n)`
+
+## sec
+* `sec_n(num $n)`
+
+## sech
+* `sech_n(num $n)`
+
+## tan
+* `tan_n(num $n)`
+
+## tanh
+* `tanh_n(num $n)`
+
+# Relational / Logic Opcodes
+
+## cmp
+* `cmp_i(int $l, int $r)`
+* `cmp_n(num $l, num $r)`
+* `cmp_s(str $l, str $r)`
+* `cmp_I(Int $l, Int $r)`
+
+Compare two values, returns -1 if $l is greater than $r, 0 if they are equal,
+and 1 if $r is greater than $l.
+
+## eqat
+* `eqat(str $haystack, str $needle, int $pos)`
+
+Return 1 if the string `$haystack` has the string `$needle` at position `$pos`,
+or 0 otherwise.
+
+## iseq
+* `iseq_i(int $l, int $r)`
+* `iseq_n(num $l, num $r)`
+* `iseq_s(str $l, str $r)`
+* `iseq_I(Int $l, Int $r)`
+
+Return non-zero if the two parameters are equal.
+
+## isgt
+* `isgt_i(int $l, int $r)`
+* `isgt_n(num $l, num $r)`
+* `isgt_s(str $l, str $r)`
+* `isgt_I(Int $l, Int $r)`
+
+Return non-zero if $l is greater than two $r.
+
+## isge
+* `isge_i(int $l, int $r)`
+* `isge_n(num $l, num $r)`
+* `isge_s(str $l, str $r)`
+* `isge_I(Int $l, Int $r)`
+
+Return non-zero if $l is greater than or equal two $r.
+
+## islt
+* `islt_i(int $l, int $r)`
+* `islt_n(num $l, num $r)`
+* `islt_s(str $l, str $r)`
+* `islt_I(Int $l, Int $r)`
+
+Return non-zero if $l is less than two $r.
+
+## isle
+* `isle_i(int $l, int $r)`
+* `isle_n(num $l, num $r)`
+* `isle_s(str $l, str $r)`
+* `isle_I(Int $l, Int $r)`
+
+Return non-zero if $l is less than or equal two $r.
+
+## isne
+* `isne_i(int $l, int $r)`
+* `isne_n(num $l, num $r)`
+* `isne_s(str $l, str $r)`
+* `isne_I(Int $l, Int $r)`
+
+Return non-zero if the two parameters are not equal.
+
+## not
+* `not_i(int $val)`
+
+Return 1 if `$val` is 0, 1 otherwise.
+
+# Array opcodes
+
+## atpos
+* `atpos(@arr, int $i)`
+* `atpos_i(@arr, int $i)`
+* `atpos_n(@arr, int $i)`
+* `atpos_s(@arr, int $i)`
+
+Return whatever is bound to @arr at position $i.
+
+## bindpos
+* `bindpos(@arr, int $i, Mu $v)`
+* `bindpos_i(@arr, int $i, int $v)`
+* `bindpos_n(@arr, int $i, num $v)`
+* `bindpos_s(@arr, int $i, str $v)`
+
+Bind $v to @arr at position $i and return $v.
+
+## elems
+* `elems(@arr)`
+* `elems(%hash)`
+
+Return the number of elements in `@arr`, or the number of keys in `%hash`.
+
+## existspos
+* `existspos(@arr, int $i)`
+
+Return 1 if anything is bound to `@arr` at position `$i`,
+0 otherwise.
+
+## list
+* `list(...)`
+* `list_i(...)`
+* `list_n(...)`
+* `list_s(...)`
+* `list_b(...)`
+
+Create a list of the given parameters. If no arguments are passed,
+an empty list is created. If a typed variant is used, the parameters
+are coerced to the appropriate type.
+
+## push
+* `push(@arr, Mu $v)`
+* `push_i(Array int @arr, int $v)`
+* `push_n(Array num @arr, num $v)`
+* `push_s(Array str @arr, str $v)`
+
+"Push $v onto the end of @arr."
+Bind $v to @arr at the position at the end of @arr, i.e., the position that is just after the last position of @arr that has been bound to.
+Return the number of elements of @arr on Parrot, $v on JVM.
+
+## pop
+* `pop(@arr)`
+* `pop_i(@arr)`
+* `pop_n(@arr)`
+* `pop_s(@arr)`
+
+"Pop the last value off the end of @arr."
+Return the value of @arr at its last bound position, and unbind @arr at that position.
+
+## setelems
+* `setelems(@arr, int $i)`
+
+Set the size of `@arr` to `$i` elements. If less than the current size,
+any elements after the newlast position are unbound. If greater, the empty
+elments at the end are bound with potentially VM specific null entries.
+
+## shift
+* `shift(@arr)`
+* `shift_i(@arr)`
+* `shift_n(@arr)`
+* `shift_s(@arr)`
+
+"Shift the last value from the beginning of @arr."
+Return the value of @arr at index 0, unbind @arr at index 0, and move all other binding of @arr to the index one below what they were previously bound to.
+
+## splice
+* `splice(@arr, @from, int $offset, int $count)`
+
+Remove the elements in `@arr` starting at `$offset`, for `$count` positions.
+Replace them with all the elements from `@from`.
+
+## unshift
+* `unshift(@arr, Mu $v)`
+* `unshift_i(@arr, int $v)`
+* `unshift_n(@arr, num $v)`
+* `unshift_s(@arr, str $v)`
+
+"Shift $v into the beginning of @arr."
+Bind $v to @arr at index 0, move all other bindings of @arr to the index one above what they were previously bound to.
+Return the number of elements of @arr on Parrot, $v on JVM.
+
+## iterator
+* `iterator()`
+
+Returns an iterator object to iterate over a list's items. For example:
+
+```perl
+
+my $list := nqp::list('a', 'b', 'c');
+my $iter := nqp::iterator($list);
+
+while $iter {
+ say(nqp::shift($iter));
+}
+
+```
+
+You can also use `nqp::iterator()` to iterate over a hash's key-value pairs.
+
+# Hash opcodes
+
+## atkey
+* `atkey(%hash, String $key)`
+* `atkey_i(%hash, String $key)`
+* `atkey_n(%hash, String $key)`
+* `atkey_s(%hash, String $key)`
+
+Return the value of %hash at key $key.
+
+## bindkey
+* `bindkey(%hash, String $key, Mu $v)`
+* `bindkey_i(%hash, String $key, int $v)`
+* `bindkey_n(%hash, String $key, num $v)`
+* `bindkey_s(%hash, String $key, str $v)`
+
+Bind key $key of %hash to $v and return $v.
+
+## existskey
+* `existskey(%hash, String $key)`
+
+Return non-zero if %hash has key $key bound to something.
+
+## deletekey
+* `deletekey(%hash, String $key)`
+
+Delete the given key from %hash.
+
+## iterkey
+* `iterkey_s($pair)`
+
+Returns the key associated with the given key-value pair.
+For example:
+
+```perl
+
+for %hash {
+ say(nqp::iterkey_s($_), ' => ', nqp::iterval($_));
+}
+
+```
+
+## iterval
+* `iterval($pair)`
+
+Returns the value associated with the given key-value pair.
+
+# String Opcodes
+
+## chars
+* `chars(str $str)`
+
+Return the number of characters in the string.
+
+## chr
+* `chr(int $codepoint)`
+
+Given a unicode codepoint, return a str containing its character. Will
+throw an exception on invalid codepoints.
+
+## codepointfromname
+* `codepointfromname(str $name)`
+
+Returns the codepoint for the given unicode character name, or -1 if no
+match was found.
+
+## concat
+* `concat(str $l, str $r)`
+
+Return a string that is the concatenation of the two passed in strings.
+
+## escape
+* `escape(str $str)`
+
+Given a string, return an escaped version that replaces the following
+characters with their escaped equivalents: "\\", "\b", "\n", "\r",
+"\t", "\f", "\"", "\a", and "\e".
+
+## findcclass
+* `findcclass(int $class, str $str, int $i, int $count)`
+
+Search the string starting at the `$i`th character, for `$count` characters.
+Return the position of the first character that is of the specified class
+(`nqp::const::CCLASS_*`). If no characters match, return the position of the
+first character after the given range, or the length of the string, whichever
+is smaller.
+
+## findnotcclass
+* `findnotcclass(int $class, str $str, int $i, int $count)`
+
+Search the string starting at the `$i`th character, for `$count` characters.
+Return the position of the first character that is not of the specified class
+(`nqp::const::CCLASS_*`). If no characters match, return the position of the
+first character after the given range, or the length of the string, whichever
+is smaller.
+
+## flip
+* `flip(str $str)`
+
+Return a string with the characters of `$string` in reverse order.
+
+## hash
+* `hash(...)`
+
+Return a hash. The first argument is a key, the second its value, and so on.
+Be sure to pass an even number of arguments, a VM specific error may occur
+otherwise.
+
+## index
+* `index(str $haystack, str $needle)`
+* `index(str $haystack, str $needle, int $pos)`
+
+Return the position in `$haystack` at which `$needle` appears, or -1
+if `$needle` does not appear. Begin searching at position `$pos` if specified,
+or at 0, otherwise.
+
+* `indexfrom(str $haystack, str $needle, int $pos)` _Internal_
+
+`index` is converted to this internal opcode by the compiler.
+
+## iscclass
+* `iscclass(int $class, str $str, int $i)`
+
+Return 1 if the `$i`th character of $str is of the specified class,
+(`nqp::const::CCLASS_*`), 0 otherwise.
+
+## join
+* `join(str $delim, @arr)`
+
+Joins the separate strings of `@arr` into a single string with
+fields separated by the value of EXPR, and returns that new string.
+
+## lc
+* `lc(str $str)`
+
+Return lowercase copy of string.
+
+## ord
+* `ord(str $str)`
+* `ord(str $str, int $i)`
+
+Return the unicode codepoint of the first character in `$str`, or
+at the `$i`th character, if it's specified.
+
+* `ordat(str $str, int $i)` _Internal_
+* `ordfirst(str $str)` _Internal_
+
+`ord` is converted to these internal opcodes by the compiler.
+
+## radix
+* `radix(int $radix, String $str, int $pos, int $flags)`
+* `radix_I(int $radix, String $str, int $pos, int $flags, Mu:T $type)`
+
+Convert string $str into a number starting at offset $pos and using radix $radix.
+The result of the conversion returns an array with
+
+ out[0] = converted value
+ out[1] = radix ** (number of digits converted)
+ out[2] = offset after consuming digits, -1 if no digits consumed
+
+The opcode skips single underscores between pairs of digits, per the Perl 6
+specification.
+
+The $flags is a bitmask that modifies the parse and/or result:
+
+ 0x01: negate the result (useful if you've already parsed a minus)
+ 0x02: parse a leading +/- and negate the result on -
+ 0x04: parse trailing zeroes but do not include in result
+ (for parsing values after a decimal point)
+
+## replace
+* `replace(str $str, int $offset, int $count, str $replacement)`
+
+Replace the the characters of `$str` starting at `$offset` for `$count`
+characters, with the `$replacement` string.
+
+## rindex
+* `rindex(str $haystack, str $needle)`
+* `rindex(str $haystack, str $needle, int $pos)`
+
+Searching backwards through the `$haystack`, return the position at which
+`$needle` appears, or -1 if it does not. Begin searching at `$pos` if
+specified, otherwise start from the last position.
+
+* `rindexfrom(str $haystack, str $needle, int $pos)` _Internal_
+* `rindexfromend(str $haystack, str $needle)` _Internal_
+
+`rindex` is converted to these internal opcodes by the compiler.
+
+## uc
+* `uc(str $str)`
+
+Return uppercase copy of string.
+
+## split
+* `split(str $delimiter, str $string)`
+
+Splits the string `$string` into an array of elements; these elements are
+the substrings between delimiters in the original string.
+
+If the original string begins or ends with the delimiter, the resulting
+array will begin or end with an empty element.
+
+## substr
+* `substr(str $str, int $position)`
+* `substr(str $str, int $position, int $length)`
+
+Return the portion of the string starting at the given position.
+If `$length` is specified, only return that many characters. The
+numbered variants required the args specified - the unnumbered
+version may use either signature.
+
+* `substr2(str $str, int $position)` _Internal_
+* `substr3(str $str, int $position, int $length)` _Internal_
+
+`substr` is converted to these internal opcodes by the compiler.
+
+## tc
+* `tc(str $str)`
+
+Return titlecase copy of string.
+
+## x
+* `x(str $str, int $count)`
+
+Return a new string containing `$count` copies of `$str`.
+
+## sprintf
+* `sprintf(str $pattern, @values)`
+
+Returns a string formatted by the printf conventions similar to Perl 5 / C. Machine sized numeric
+types, their limits and therefor overflows are not implemented though.
+
+## sprintfdirectives
+* `sprintfdirectives(str $pattern)`
+
+This takes the same pattern as `sprintf` does, and computes the needed value-count that `sprintf`
+would have to provide.
+
+## sprintfaddargumenthandler
+* `sprintfaddargumenthandler(Mu $handler)`
+
+Lets you register a handler-instance that supports the sprintf op when it has to numify
+custom types. This handler has to provide two methods, `mine` and `int`. `mine` gets the
+the value in question and returns true if this handler is in charge for this type, false otherwise.
+The method `int` does the conversion for patterns like %d.
+
+```perl
+my class MyHandler {
+ method mine($x) { $x ~~ MyType }
+ method int($x) { $x.Int }
+}
+```
+
+# Conditional Opcodes
+
+## if
+* `if(Block $condition, Block $then)`
+* `if(Block $condition, Block $then, Block $else)`
+
+If the `$condition` evaluates to a non-zero value, run the `$then` block.
+If not, and an `$else` block is present, run that instead.
+
+## unless
+* `unless(Block $condition, Block $then)`
+* `unless(Block $condition, Block $then, Block $else)`
+
+If the `$condition` evaluates to 0, run the `$then` block.
+If not, and an `$else` block is present, run that instead.
+
+# Loop/Control Opcodes
+
+## for
+* `for(Iterable $iter, Block $body)`
+
+Invoke the `$body` for every item available in `$iter`.
+
+## ifnull
+* `ifnull(Block $cond, Block $body)`
+
+If the `$cond` evaluates to null, evaluate the `$body`, otherwise return
+the result of `$cond`.
+
+## defor
+* `defor(Block $cond, Block $body)`
+
+If the `$cond` evaluates to defined value, return it, otherwise, evaluate
+the `$body`.
+
+## repeat_until
+* `repeat_until(Block $condition, Block $body)`
+* `repeat_until(Block $condition, Block $body, Block $post)`
+
+First run the `$body`. Then, enter a loop, running the `$body`
+only if the condition returns 0.
+
+If a `$post` block is present, run that at the end, regardless of `$condition`.
+
+## repeat_while
+* `repeat_while(Block $condition, Block $body)`
+* `repeat_while(Block $condition, Block $body, Block $post)`
+
+First run the `$body`. Then, enter a loop, running the `$body`
+only if the condition returns a non-0 value.
+
+If a `$post` block is present, run that at the end, regardless of `$condition`.
+
+## until
+* `until(Block $condition, Block $body)`
+* `until(Block $condition, Block $body, Block $post)`
+
+Enter a loop, running the `$body` only if the condition returns 0.
+
+If a `$post` block is present, run that at the end, regardless of `$condition`.
+
+## while
+* `while(Block $condition, Block $body)`
+* `while(Block $condition, Block $body, Block $post)`
+
+Enter a loop, running the `$body` only if the condition returns a non-0 value.
+
+If a `$post` block is present, run that at the end, regardless of `$condition`.
+
+# Exceptional Opcodes
+
+## backtrace
+* `backtrace(Exception $ex)`
+
+Return an array of hashes, describing the backtrace of the given exception.
+
+## backtracestrings
+* `backtracestrings(Exception $ex)`
+
+Return an array of strings, describing the backtrace of the given exception.
+
+## die
+* `die(str $message)`
+* `die_s(str $message)`
+
+Create and throw an exception using the given message.
+
+## exception
+* `exception()`
+
+Return the current exception object.
+
+## getextype
+* `getextype(Exception $ex)`
+
+Gets the exception category (`nqp::const::CONTROL_*`)
+
+## getmessage
+* `getmessage(Exception $ex)`
+
+Gets the exception message.
+
+## getpayload
+* `getpayload(Exception $ex)`
+
+Gets the exception payload.
+
+## newexception
+* `newexception()`