Changeset 12748
- Timestamp:
- 06/09/10 11:17:17 (13 years ago)
- Location:
- trunk/abcl
- Files:
-
- 3 added
- 12 deleted
- 24 edited
- 5 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/abcl/build.xml
r12676 r12748 465 465 <include name="abcl.bat.in"/> 466 466 467 <include name="examples/**"/> 468 467 469 <!-- The remainder of these files are used by the Lisp hosted 468 470 build in 'build-abcl.lisp' but not used by Ant, so include -
trunk/abcl/nbproject/build-impl.xml
r12730 r12748 21 21 --> 22 22 <project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="abcl-impl"> 23 <fail message="Please build using Ant 1.7.1 or higher.">24 <condition>25 <not>26 <antversion atleast="1.7.1"/>27 </not>28 </condition>29 </fail>30 23 <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> 31 24 <!-- … … 56 49 <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> 57 50 <available file="${manifest.file}" property="manifest.available"/> 58 <condition property="ma in.class.available">51 <condition property="manifest.available+main.class"> 59 52 <and> 53 <isset property="manifest.available"/> 60 54 <isset property="main.class"/> 61 55 <not> … … 64 58 </and> 65 59 </condition> 66 <condition property="manifest.available+main.class">67 <and>68 <isset property="manifest.available"/>69 <isset property="main.class.available"/>70 </and>71 </condition>72 <condition property="do.mkdist">73 <and>74 <isset property="libs.CopyLibs.classpath"/>75 <not>76 <istrue value="${mkdist.disabled}"/>77 </not>78 </and>79 </condition>80 60 <condition property="manifest.available+main.class+mkdist.available"> 81 61 <and> 82 62 <istrue value="${manifest.available+main.class}"/> 83 <isset property=" do.mkdist"/>63 <isset property="libs.CopyLibs.classpath"/> 84 64 </and> 85 </condition>86 <condition property="manifest.available+mkdist.available">87 <and>88 <istrue value="${manifest.available}"/>89 <isset property="do.mkdist"/>90 </and>91 </condition>92 <condition property="manifest.available-mkdist.available">93 <or>94 <istrue value="${manifest.available}"/>95 <isset property="do.mkdist"/>96 </or>97 </condition>98 <condition property="manifest.available+main.class-mkdist.available">99 <or>100 <istrue value="${manifest.available+main.class}"/>101 <isset property="do.mkdist"/>102 </or>103 65 </condition> 104 66 <condition property="have.tests"> … … 136 98 <property name="application.args" value=""/> 137 99 <property name="source.encoding" value="${file.encoding}"/> 138 <property name="runtime.encoding" value="${source.encoding}"/>139 100 <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> 140 101 <and> … … 152 113 <istrue value="${do.depend}"/> 153 114 </condition> 154 <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> 155 <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> 156 <length length="0" string="${endorsed.classpath}" when="greater"/> 157 </condition> 158 <property name="javac.fork" value="false"/> 115 <condition else="" property="javac.compilerargs.jaxws" value="-Djava.endorsed.dirs='${jaxws.endorsed.dir}'"> 116 <and> 117 <isset property="jaxws.endorsed.dir"/> 118 <available file="nbproject/jaxws-build.xml"/> 119 </and> 120 </condition> 159 121 </target> 160 122 <target name="-post-init"> … … 191 153 <attribute default="${excludes}" name="excludes"/> 192 154 <attribute default="${javac.debug}" name="debug"/> 193 <attribute default="${empty.dir}" name="sourcepath"/> 194 <attribute default="${empty.dir}" name="gensrcdir"/> 155 <attribute default="/does/not/exist" name="sourcepath"/> 195 156 <element name="customize" optional="true"/> 196 157 <sequential> 197 <property location="${build.dir}/empty" name="empty.dir"/> 198 <mkdir dir="${empty.dir}"/> 199 <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> 200 <src> 201 <dirset dir="@{gensrcdir}" erroronmissingdir="false"> 202 <include name="*"/> 203 </dirset> 204 </src> 158 <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}"> 205 159 <classpath> 206 160 <path path="@{classpath}"/> 207 161 </classpath> 208 <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> 209 <compilerarg line="${javac.compilerargs}"/> 162 <compilerarg line="${javac.compilerargs} ${javac.compilerargs.jaxws}"/> 210 163 <customize/> 211 164 </javac> … … 246 199 <attribute default="**" name="testincludes"/> 247 200 <sequential> 248 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${build.dir}">201 <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true"> 249 202 <batchtest todir="${build.test.results.dir}"> 250 203 <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> … … 261 214 <formatter type="brief" usefile="false"/> 262 215 <formatter type="xml"/> 263 <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>264 216 <jvmarg line="${run.jvmargs}"/> 265 217 </junit> … … 318 270 <sequential> 319 271 <java classname="@{classname}" dir="${work.dir}" fork="true"> 320 <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>321 272 <jvmarg line="${debug-args-line}"/> 322 273 <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> 323 <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>324 <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>325 274 <jvmarg line="${run.jvmargs}"/> 326 275 <classpath> … … 339 288 <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> 340 289 <attribute default="${main.class}" name="classname"/> 341 <attribute default="${run.classpath}" name="classpath"/>342 290 <element name="customize" optional="true"/> 343 291 <sequential> 344 292 <java classname="@{classname}" dir="${work.dir}" fork="true"> 345 <jvmarg line="${endorsed.classpath.cmd.line.arg}"/>346 <jvmarg value="-Dfile.encoding=${runtime.encoding}"/>347 <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/>348 293 <jvmarg line="${run.jvmargs}"/> 349 294 <classpath> 350 <path path=" @{classpath}"/>295 <path path="${run.classpath}"/> 351 296 </classpath> 352 297 <syspropertyset> … … 372 317 =================== 373 318 --> 374 <target name="-deps-jar-init" unless="built-jar.properties"> 375 <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> 376 <delete file="${built-jar.properties}" quiet="true"/> 377 </target> 378 <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> 379 <echo level="warn" message="Cycle detected: abcl was already built"/> 380 </target> 381 <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> 382 <mkdir dir="${build.dir}"/> 383 <touch file="${built-jar.properties}" verbose="false"/> 384 <property file="${built-jar.properties}" prefix="already.built.jar."/> 385 <antcall target="-warn-already-built-jar"/> 386 <propertyfile file="${built-jar.properties}"> 387 <entry key="${basedir}" value=""/> 388 </propertyfile> 389 </target> 319 <target depends="init" name="deps-jar" unless="no.deps"/> 390 320 <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> 391 321 <target depends="init" name="-check-automatic-build"> … … 403 333 </target> 404 334 <target if="do.depend.true" name="-compile-depend"> 405 <pathconvert property="build.generated.subdirs"> 406 <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> 407 <include name="*"/> 408 </dirset> 409 </pathconvert> 410 <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> 335 <j2seproject3:depend/> 411 336 </target> 412 337 <target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-compile-depend" if="have.sources" name="-do-compile"> 413 <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/>338 <j2seproject3:javac/> 414 339 <copy todir="${build.classes.dir}"> 415 340 <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> … … 428 353 <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> 429 354 <j2seproject3:force-recompile/> 430 <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}"includes="${javac.includes}" sourcepath="${src.dir}"/>355 <j2seproject3:javac excludes="" includes="${javac.includes}" sourcepath="${src.dir}"/> 431 356 </target> 432 357 <target name="-post-compile-single"> … … 448 373 <!-- You can override this target in the ../build.xml file. --> 449 374 </target> 450 <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available -mkdist.available">375 <target depends="init,compile,-pre-pre-jar,-pre-jar" name="-do-jar-without-manifest" unless="manifest.available"> 451 376 <j2seproject1:jar/> 452 377 </target> 453 <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class -mkdist.available">378 <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class"> 454 379 <j2seproject1:jar manifest="${manifest.file}"/> 455 380 </target> … … 494 419 <echo>java -jar "${dist.jar.resolved}"</echo> 495 420 </target> 496 <target depends="init,compile,-pre-pre-jar,-pre-jar" if="manifest.available+mkdist.available" name="-do-jar-with-libraries-without-mainclass" unless="main.class.available">497 <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>498 <pathconvert property="run.classpath.without.build.classes.dir">499 <path path="${run.classpath}"/>500 <map from="${build.classes.dir.resolved}" to=""/>501 </pathconvert>502 <pathconvert pathsep=" " property="jar.classpath">503 <path path="${run.classpath.without.build.classes.dir}"/>504 <chainedmapper>505 <flattenmapper/>506 <globmapper from="*" to="lib/*"/>507 </chainedmapper>508 </pathconvert>509 <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>510 <copylibs compress="${jar.compress}" jarfile="${dist.jar}" manifest="${manifest.file}" runtimeclasspath="${run.classpath.without.build.classes.dir}">511 <fileset dir="${build.classes.dir}"/>512 <manifest>513 <attribute name="Class-Path" value="${jar.classpath}"/>514 </manifest>515 </copylibs>516 </target>517 <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.mkdist" name="-do-jar-with-libraries-without-manifest" unless="manifest.available">518 <property location="${build.classes.dir}" name="build.classes.dir.resolved"/>519 <pathconvert property="run.classpath.without.build.classes.dir">520 <path path="${run.classpath}"/>521 <map from="${build.classes.dir.resolved}" to=""/>522 </pathconvert>523 <pathconvert pathsep=" " property="jar.classpath">524 <path path="${run.classpath.without.build.classes.dir}"/>525 <chainedmapper>526 <flattenmapper/>527 <globmapper from="*" to="lib/*"/>528 </chainedmapper>529 </pathconvert>530 <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/>531 <copylibs compress="${jar.compress}" jarfile="${dist.jar}" runtimeclasspath="${run.classpath.without.build.classes.dir}">532 <fileset dir="${build.classes.dir}"/>533 <manifest>534 <attribute name="Class-Path" value="${jar.classpath}"/>535 </manifest>536 </copylibs>537 </target>538 421 <target name="-post-jar"> 539 422 <!-- Empty placeholder for easier customization. --> 540 423 <!-- You can override this target in the ../build.xml file. --> 541 424 </target> 542 <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,- do-jar-with-libraries-without-mainclass,-do-jar-with-libraries-without-manifest,-post-jar" description="Build JAR." name="jar"/>425 <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> 543 426 <!-- 544 427 ================= … … 556 439 <property name="javac.includes.binary" value=""/> 557 440 </target> 558 <target depends="init, compile-single" name="run-single">441 <target depends="init,-do-not-recompile,compile-single" name="run-single"> 559 442 <fail unless="run.class">Must select one file in the IDE or set run.class</fail> 560 443 <j2seproject1:java classname="${run.class}"/> 561 </target>562 <target depends="init,compile-test-single" name="run-test-with-main">563 <fail unless="run.class">Must select one file in the IDE or set run.class</fail>564 <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/>565 444 </target> 566 445 <!-- … … 571 450 <target depends="init" if="netbeans.home" name="-debug-start-debugger"> 572 451 <j2seproject1:nbjpdastart name="${debug.class}"/> 573 </target>574 <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test">575 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/>576 452 </target> 577 453 <target depends="init,compile" name="-debug-start-debuggee"> … … 591 467 <j2seproject3:debug classname="${debug.class}"/> 592 468 </target> 593 <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> 594 <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> 595 <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> 596 <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> 597 </target> 598 <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> 469 <target depends="init,-do-not-recompile,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> 599 470 <target depends="init" name="-pre-debug-fix"> 600 471 <fail unless="fix.includes">Must set fix.includes</fail> … … 619 490 <filename name="**/*.java"/> 620 491 </fileset> 621 <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">622 <include name="**/*.java"/>623 </fileset>624 492 </javadoc> 625 493 </target> … … 683 551 </target> 684 552 <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> 685 <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>553 <fail if="tests.failed">Some tests failed; see details above.</fail> 686 554 </target> 687 555 <target depends="init" if="have.tests" name="test-report"/> … … 696 564 </target> 697 565 <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> 698 <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>699 </target> 700 <target depends="init, compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>566 <fail if="tests.failed">Some tests failed; see details above.</fail> 567 </target> 568 <target depends="init,-do-not-recompile,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> 701 569 <!-- 702 570 ======================= … … 725 593 <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> 726 594 </target> 727 <target depends="init, compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>595 <target depends="init,-do-not-recompile,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> 728 596 <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> 729 597 <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> … … 762 630 =============== 763 631 --> 764 <target name="-deps-clean-init" unless="built-clean.properties"> 765 <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> 766 <delete file="${built-clean.properties}" quiet="true"/> 767 </target> 768 <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> 769 <echo level="warn" message="Cycle detected: abcl was already built"/> 770 </target> 771 <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> 772 <mkdir dir="${build.dir}"/> 773 <touch file="${built-clean.properties}" verbose="false"/> 774 <property file="${built-clean.properties}" prefix="already.built.clean."/> 775 <antcall target="-warn-already-built-clean"/> 776 <propertyfile file="${built-clean.properties}"> 777 <entry key="${basedir}" value=""/> 778 </propertyfile> 779 </target> 632 <target depends="init" name="deps-clean" unless="no.deps"/> 780 633 <target depends="init" name="-do-clean"> 781 634 <delete dir="${build.dir}"/> 782 <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>635 <delete dir="${dist.dir}"/> 783 636 </target> 784 637 <target name="-post-clean"> … … 787 640 </target> 788 641 <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> 789 <target name="-check-call-dep">790 <property file="${call.built.properties}" prefix="already.built."/>791 <condition property="should.call.dep">792 <not>793 <isset property="already.built.${call.subproject}"/>794 </not>795 </condition>796 </target>797 <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep">798 <ant antfile="${call.script}" inheritall="false" target="${call.target}">799 <propertyset>800 <propertyref prefix="transfer."/>801 <mapper from="transfer.*" to="*" type="glob"/>802 </propertyset>803 </ant>804 </target>805 642 </project> -
trunk/abcl/nbproject/genfiles.properties
r12730 r12748 5 5 # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. 6 6 nbproject/build-impl.xml.data.CRC32=742204ce 7 nbproject/build-impl.xml.script.CRC32= 29122cc48 nbproject/build-impl.xml.stylesheet.CRC32= 576378a2@1.32.1.457 nbproject/build-impl.xml.script.CRC32=b7bf05a5 8 nbproject/build-impl.xml.stylesheet.CRC32=65b8de21 9 9 nbproject/profiler-build-impl.xml.data.CRC32=71623fcd 10 10 nbproject/profiler-build-impl.xml.script.CRC32=abda56ed -
trunk/abcl/src/org/armedbear/lisp/Autoload.java
r12742 r12748 98 98 "org.armedbear.lisp.".concat(className))); 99 99 } 100 100 101 101 public void load() 102 102 { … … 685 685 autoload(Symbol.COPY_LIST, "copy_list"); 686 686 687 autoload(PACKAGE_SYS, "make-fasl-class-loader", "FaslClassLoader", false);688 autoload(PACKAGE_SYS, "get-fasl-function", "FaslClassLoader", false);689 690 687 autoload(Symbol.SET_CHAR, "StringFunctions"); 691 688 autoload(Symbol.SET_SCHAR, "StringFunctions"); -
trunk/abcl/src/org/armedbear/lisp/Function.java
r12742 r12748 176 176 } 177 177 178 public final LispObject getClassBytes() {179 LispObject o = getf(propertyList, Symbol.CLASS_BYTES, NIL);180 if(o != NIL) {181 return o;182 } else {183 ClassLoader c = getClass().getClassLoader();184 if(c instanceof FaslClassLoader) {185 return new JavaObject(((FaslClassLoader) c).getFunctionClassBytes(this));186 } else {187 return NIL;188 }189 }190 }191 192 public static final Primitive FUNCTION_CLASS_BYTES = new pf_function_class_bytes();193 public static final class pf_function_class_bytes extends Primitive {194 public pf_function_class_bytes() {195 super("function-class-bytes", PACKAGE_SYS, false, "function");196 }197 @Override198 public LispObject execute(LispObject arg) {199 if (arg instanceof Function) {200 return ((Function) arg).getClassBytes();201 }202 return type_error(arg, Symbol.FUNCTION);203 }204 }205 206 178 @Override 207 179 public LispObject execute() 208 180 { 209 return error(new WrongNumberOfArgumentsException(this , 0));181 return error(new WrongNumberOfArgumentsException(this)); 210 182 } 211 183 … … 213 185 public LispObject execute(LispObject arg) 214 186 { 215 return error(new WrongNumberOfArgumentsException(this , 1));187 return error(new WrongNumberOfArgumentsException(this)); 216 188 } 217 189 … … 220 192 221 193 { 222 return error(new WrongNumberOfArgumentsException(this , 2));194 return error(new WrongNumberOfArgumentsException(this)); 223 195 } 224 196 … … 228 200 229 201 { 230 return error(new WrongNumberOfArgumentsException(this , 3));202 return error(new WrongNumberOfArgumentsException(this)); 231 203 } 232 204 … … 236 208 237 209 { 238 return error(new WrongNumberOfArgumentsException(this , 4));210 return error(new WrongNumberOfArgumentsException(this)); 239 211 } 240 212 … … 245 217 246 218 { 247 return error(new WrongNumberOfArgumentsException(this , 5));219 return error(new WrongNumberOfArgumentsException(this)); 248 220 } 249 221 … … 254 226 255 227 { 256 return error(new WrongNumberOfArgumentsException(this , 6));228 return error(new WrongNumberOfArgumentsException(this)); 257 229 } 258 230 … … 264 236 265 237 { 266 return error(new WrongNumberOfArgumentsException(this , 7));238 return error(new WrongNumberOfArgumentsException(this)); 267 239 } 268 240 … … 274 246 275 247 { 276 return error(new WrongNumberOfArgumentsException(this , 8));248 return error(new WrongNumberOfArgumentsException(this)); 277 249 } 278 250 -
trunk/abcl/src/org/armedbear/lisp/Interpreter.java
r12717 r12748 178 178 catch (ClassNotFoundException e) { } // FIXME: what to do? 179 179 180 Load.loadSystemFile("j.lisp" , false); // not being autoloaded180 Load.loadSystemFile("j.lisp"); 181 181 182 182 initialized = true; … … 218 218 private static synchronized void initializeSystem() 219 219 { 220 Load.loadSystemFile("system" , false); // not being autoloaded220 Load.loadSystemFile("system"); 221 221 } 222 222 … … 309 309 310 310 else 311 Load.loadSystemFile(args[i + 1] , false); // not being autoloaded311 Load.loadSystemFile(args[i + 1]); 312 312 ++i; 313 313 } else { -
trunk/abcl/src/org/armedbear/lisp/Lisp.java
r12742 r12748 44 44 import java.net.URLDecoder; 45 45 import java.util.Hashtable; 46 import java.util.zip.ZipEntry; 47 import java.util.zip.ZipFile; 46 48 47 49 public final class Lisp … … 700 702 * This version is used by the interpreter. 701 703 */ 702 static final LispObject nonLocalGo(Binding binding, 703 LispObject tag) 704 public static final LispObject nonLocalGo(Binding binding, 705 LispObject tag) 706 704 707 { 705 708 if (binding.env.inactive) … … 736 739 * This version is used by the interpreter. 737 740 */ 738 static final LispObject nonLocalReturn(Binding binding, 739 Symbol block, 740 LispObject result) 741 public static final LispObject nonLocalReturn(Binding binding, 742 Symbol block, 743 LispObject result) 744 741 745 { 742 746 if (binding == null) … … 1265 1269 input = url.openStream(); 1266 1270 } catch (IOException e) { 1267 System.err.println("Failed to read class bytes from boot class " + url);1268 1271 error(new LispError("Failed to read class bytes from boot class " + url)); 1269 1272 } … … 2385 2388 internSpecial("*LOAD-STREAM*", PACKAGE_SYS, NIL); 2386 2389 2387 // ### *fasl-loader*2388 public static final Symbol _FASL_LOADER_ =2389 exportSpecial("*FASL-LOADER*", PACKAGE_SYS, NIL);2390 2391 2390 // ### *source* 2392 2391 // internal symbol … … 2762 2761 } 2763 2762 2764 private static final SpecialOperator WITH_INLINE_CODE = new with_inline_code();2765 private static class with_inline_code extends SpecialOperator {2766 with_inline_code() {2767 super("with-inline-code", PACKAGE_JVM, true, "(&optional target repr) &body body");2768 }2769 @Override2770 public LispObject execute(LispObject args, Environment env)2771 {2772 return error(new SimpleError("This is a placeholder. It should only be called in compiled code, and tranformed by the compiler using special form handlers."));2773 }2774 }2775 2776 2763 } -
trunk/abcl/src/org/armedbear/lisp/Load.java
r12742 r12748 217 217 } 218 218 219 public static final LispObject loadSystemFile(String filename) 220 221 { 222 final LispThread thread = LispThread.currentThread(); 223 return loadSystemFile(filename, 224 Symbol.LOAD_VERBOSE.symbolValue(thread) != NIL, 225 Symbol.LOAD_PRINT.symbolValue(thread) != NIL, 226 false); 227 } 228 219 229 public static final LispObject loadSystemFile(String filename, boolean auto) 220 230 … … 243 253 } 244 254 245 private static final Symbol FASL_LOADER = PACKAGE_SYS.intern("*FASL-LOADER*");246 255 static final LispObject COMPILE_FILE_INIT_FASL_TYPE = new SimpleString("_"); 247 256 … … 270 279 url = Lisp.class.getResource(path); 271 280 if (url == null || url.toString().endsWith("/")) { 272 url = Lisp.class.getResource(path .replace('-', '_')+ ".abcl");281 url = Lisp.class.getResource(path + ".abcl"); 273 282 if (url == null) { 274 283 url = Lisp.class.getResource(path + ".lisp"); … … 324 333 final SpecialBindingsMark mark = thread.markSpecialBindings(); 325 334 thread.bindSpecial(_WARN_ON_REDEFINITION_, NIL); 326 thread.bindSpecial(FASL_LOADER, NIL);327 335 try { 328 336 Stream stream = new Stream(Symbol.SYSTEM_STREAM, in, Symbol.CHARACTER); … … 433 441 } 434 442 435 private static Symbol[] savedSpecials =436 new Symbol[] { // CLHS Specified437 Symbol.CURRENT_READTABLE, Symbol._PACKAGE_,438 // Compiler policy439 _SPEED_, _SPACE_, _SAFETY_, _DEBUG_, _EXPLAIN_ };440 441 443 // A nil TRUENAME signals a load from stream which has no possible path 442 444 private static final LispObject loadFileFromStream(LispObject pathname, … … 452 454 final LispThread thread = LispThread.currentThread(); 453 455 final SpecialBindingsMark mark = thread.markSpecialBindings(); 454 455 for (Symbol special : savedSpecials)456 thread.bindSpecialToCurrentValue(special);457 456 // "LOAD binds *READTABLE* and *PACKAGE* to the values they held before 457 // loading the file." 458 thread.bindSpecialToCurrentValue(Symbol.CURRENT_READTABLE); 459 thread.bindSpecialToCurrentValue(Symbol._PACKAGE_); 458 460 int loadDepth = Fixnum.getValue(_LOAD_DEPTH_.symbolValue(thread)); 459 461 thread.bindSpecial(_LOAD_DEPTH_, Fixnum.getInstance(++loadDepth)); 462 // Compiler policy. 463 thread.bindSpecialToCurrentValue(_SPEED_); 464 thread.bindSpecialToCurrentValue(_SPACE_); 465 thread.bindSpecialToCurrentValue(_SAFETY_); 466 thread.bindSpecialToCurrentValue(_DEBUG_); 467 thread.bindSpecialToCurrentValue(_EXPLAIN_); 460 468 final String prefix = getLoadVerbosePrefix(loadDepth); 461 469 try { … … 554 562 555 563 private static final LispObject loadStream(Stream in, boolean print, 564 LispThread thread) 565 { 566 return loadStream(in, print, thread, false); 567 } 568 569 private static final LispObject loadStream(Stream in, boolean print, 556 570 LispThread thread, boolean returnLastResult) 557 571 … … 570 584 if (obj == EOF) 571 585 break; 572 586 result = eval(obj, env, thread); 573 587 if (print) { 574 588 Stream out = -
trunk/abcl/src/org/armedbear/lisp/Readtable.java
r12725 r12748 172 172 173 173 @Override 174 public finalLispObject typeOf()174 public LispObject typeOf() 175 175 { 176 176 return Symbol.READTABLE; … … 178 178 179 179 @Override 180 public finalLispObject classOf()180 public LispObject classOf() 181 181 { 182 182 return BuiltInClass.READTABLE; … … 184 184 185 185 @Override 186 public finalLispObject typep(LispObject type)186 public LispObject typep(LispObject type) 187 187 { 188 188 if (type == Symbol.READTABLE) … … 194 194 195 195 @Override 196 public finalString toString()196 public String toString() 197 197 { 198 198 return unreadableString("READTABLE"); 199 199 } 200 200 201 public finalLispObject getReadtableCase()201 public LispObject getReadtableCase() 202 202 { 203 203 return readtableCase; 204 204 } 205 205 206 public finalboolean isWhitespace(char c)206 public boolean isWhitespace(char c) 207 207 { 208 208 return getSyntaxType(c) == SYNTAX_TYPE_WHITESPACE; 209 209 } 210 210 211 public finalbyte getSyntaxType(char c)211 public byte getSyntaxType(char c) 212 212 { 213 213 return syntax.get(c); 214 214 } 215 215 216 public finalboolean isInvalid(char c)216 public boolean isInvalid(char c) 217 217 { 218 218 switch (c) … … 231 231 } 232 232 233 public finalvoid checkInvalid(char c, Stream stream)233 public void checkInvalid(char c, Stream stream) 234 234 { 235 235 // "... no mechanism is provided for changing the constituent trait of a … … 248 248 } 249 249 250 public finalLispObject getReaderMacroFunction(char c)250 public LispObject getReaderMacroFunction(char c) 251 251 { 252 252 return readerMacroFunctions.get(c); 253 253 } 254 254 255 finalLispObject getMacroCharacter(char c)255 LispObject getMacroCharacter(char c) 256 256 { 257 257 LispObject function = getReaderMacroFunction(c); … … 272 272 } 273 273 274 finalvoid makeDispatchMacroCharacter(char dispChar, LispObject non_terminating_p)274 void makeDispatchMacroCharacter(char dispChar, LispObject non_terminating_p) 275 275 { 276 276 byte syntaxType; … … 285 285 } 286 286 287 public finalLispObject getDispatchMacroCharacter(char dispChar, char subChar)287 public LispObject getDispatchMacroCharacter(char dispChar, char subChar) 288 288 289 289 { … … 300 300 } 301 301 302 public finalvoid setDispatchMacroCharacter(char dispChar, char subChar,302 public void setDispatchMacroCharacter(char dispChar, char subChar, 303 303 LispObject function) 304 304 -
trunk/abcl/src/org/armedbear/lisp/SlotDefinition.java
r12738 r12748 45 45 } 46 46 47 public SlotDefinition(StandardClass clazz)48 {49 super(clazz, clazz.getClassLayout().getLength());50 slots[SlotDefinitionClass.SLOT_INDEX_LOCATION] = NIL;51 }52 53 47 public SlotDefinition(LispObject name, LispObject readers) 54 48 { … … 120 114 } 121 115 122 // ### make-slot-definition &optional class116 // ### make-slot-definition 123 117 private static final Primitive MAKE_SLOT_DEFINITION = 124 new Primitive("make-slot-definition", PACKAGE_SYS, true, " &optional class")118 new Primitive("make-slot-definition", PACKAGE_SYS, true, "") 125 119 { 126 120 @Override … … 128 122 { 129 123 return new SlotDefinition(); 130 }131 @Override132 public LispObject execute(LispObject slotDefinitionClass)133 {134 return new SlotDefinition((StandardClass) slotDefinitionClass);135 124 } 136 125 }; -
trunk/abcl/src/org/armedbear/lisp/StandardClass.java
r12738 r12748 384 384 STANDARD_CLASS.setDirectSlotDefinitions(standardClassSlotDefinitions()); 385 385 } 386 387 public static final StandardClass DIRECT_SLOT_DEFINITION =388 addStandardClass(Symbol.DIRECT_SLOT_DEFINITION, list(SLOT_DEFINITION));389 public static final StandardClass EFFECTIVE_SLOT_DEFINITION =390 addStandardClass(Symbol.EFFECTIVE_SLOT_DEFINITION, list(SLOT_DEFINITION));391 386 392 387 // BuiltInClass.FUNCTION is also null here (see previous comment). … … 727 722 SLOT_DEFINITION.setSlotDefinitions(SLOT_DEFINITION.getDirectSlotDefinitions()); 728 723 729 DIRECT_SLOT_DEFINITION.setCPL(DIRECT_SLOT_DEFINITION, SLOT_DEFINITION,730 STANDARD_OBJECT, BuiltInClass.CLASS_T);731 DIRECT_SLOT_DEFINITION.finalizeClass();732 EFFECTIVE_SLOT_DEFINITION.setCPL(EFFECTIVE_SLOT_DEFINITION, SLOT_DEFINITION,733 STANDARD_OBJECT, BuiltInClass.CLASS_T);734 EFFECTIVE_SLOT_DEFINITION.finalizeClass();735 736 724 // STANDARD-METHOD 737 725 Debug.assertTrue(STANDARD_METHOD.isFinalized()); -
trunk/abcl/src/org/armedbear/lisp/Stream.java
r12726 r12748 1139 1139 sb.append(readMultipleEscape(rt)); 1140 1140 flags = new BitSet(sb.length()); 1141 flags.set(0, sb.length()); 1141 for (int i = sb.length(); i-- > 0;) 1142 flags.set(i); 1142 1143 } else if (rt.isInvalid(c)) { 1143 1144 rt.checkInvalid(c, this); // Signals a reader-error. … … 1180 1181 if (flags == null) 1181 1182 flags = new BitSet(sb.length()); 1182 flags.set(begin, end); 1183 for (int i = begin; i < end; i++) 1184 flags.set(i); 1183 1185 continue; 1184 1186 } -
trunk/abcl/src/org/armedbear/lisp/Symbol.java
r12738 r12748 2944 2944 public static final Symbol STANDARD_READER_METHOD = 2945 2945 PACKAGE_MOP.addExternalSymbol("STANDARD-READER-METHOD"); 2946 public static final Symbol DIRECT_SLOT_DEFINITION =2947 PACKAGE_MOP.addExternalSymbol("DIRECT-SLOT-DEFINITION");2948 public static final Symbol EFFECTIVE_SLOT_DEFINITION =2949 PACKAGE_MOP.addExternalSymbol("EFFECTIVE-SLOT-DEFINITION");2950 2946 2951 2947 // Java interface. -
trunk/abcl/src/org/armedbear/lisp/clos.lisp
r12741 r12748 61 61 (find-class 'standard-generic-function)) 62 62 (defconstant +the-T-class+ (find-class 'T)) 63 (defconstant +the-direct-slot-definition-class+ (find-class 'direct-slot-definition))64 (defconstant +the-effective-slot-definition-class+ (find-class 'effective-slot-definition))65 63 66 64 ;; Don't use DEFVAR, because that disallows loading clos.lisp … … 262 260 `(function (lambda () ,initform))) 263 261 264 (defun init-slot-definition (slot &key name 265 (initargs ()) 266 (initform nil) 267 (initfunction nil) 268 (readers ()) 269 (writers ()) 270 (allocation :instance) 271 (allocation-class nil) 272 &allow-other-keys) 273 (set-slot-definition-name slot name) 274 (set-slot-definition-initargs slot initargs) 275 (set-slot-definition-initform slot initform) 276 (set-slot-definition-initfunction slot initfunction) 277 (set-slot-definition-readers slot readers) 278 (set-slot-definition-writers slot writers) 279 (set-slot-definition-allocation slot allocation) 280 (set-slot-definition-allocation-class slot allocation-class) 281 slot) 282 283 (defun make-direct-slot-definition (class &rest args) 284 (let ((slot-class (direct-slot-definition-class class))) 285 (if (eq slot-class +the-direct-slot-definition-class+) 286 (let ((slot (make-slot-definition +the-direct-slot-definition-class+))) 287 (apply #'init-slot-definition slot :allocation-class class args) 288 slot) 289 (progn 290 (let ((slot (apply #'make-instance slot-class :allocation-class class 291 args))) 292 slot))))) 293 294 (defun make-effective-slot-definition (class &rest args) 295 (let ((slot-class (effective-slot-definition-class class))) 296 (if (eq slot-class +the-effective-slot-definition-class+) 297 (let ((slot (make-slot-definition +the-effective-slot-definition-class+))) 298 (apply #'init-slot-definition slot args) 299 slot) 300 (progn 301 (let ((slot (apply #'make-instance slot-class args))) 302 slot))))) 262 (defun make-direct-slot-definition (class &key name 263 (initargs ()) 264 (initform nil) 265 (initfunction nil) 266 (readers ()) 267 (writers ()) 268 (allocation :instance) 269 &allow-other-keys) 270 (let ((slot (make-slot-definition))) 271 (set-slot-definition-name slot name) 272 (set-slot-definition-initargs slot initargs) 273 (set-slot-definition-initform slot initform) 274 (set-slot-definition-initfunction slot initfunction) 275 (set-slot-definition-readers slot readers) 276 (set-slot-definition-writers slot writers) 277 (set-slot-definition-allocation slot allocation) 278 (set-slot-definition-allocation-class slot class) 279 slot)) 280 281 (defun make-effective-slot-definition (&key name 282 (initargs ()) 283 (initform nil) 284 (initfunction nil) 285 (allocation :instance) 286 (allocation-class nil) 287 &allow-other-keys) 288 (let ((slot (make-slot-definition))) 289 (set-slot-definition-name slot name) 290 (set-slot-definition-initargs slot initargs) 291 (set-slot-definition-initform slot initform) 292 (set-slot-definition-initfunction slot initfunction) 293 (set-slot-definition-allocation slot allocation) 294 (set-slot-definition-allocation-class slot allocation-class) 295 slot)) 303 296 304 297 ;;; finalize-inheritance … … 463 456 464 457 (defun std-compute-effective-slot-definition (class direct-slots) 458 (declare (ignore class)) 465 459 (let ((initer (find-if-not #'null direct-slots 466 460 :key #'%slot-definition-initfunction))) 467 461 (make-effective-slot-definition 468 class469 462 :name (%slot-definition-name (car direct-slots)) 470 463 :initform (if initer … … 566 559 :direct-default-initargs direct-default-initargs) 567 560 class)) 568 569 ;(defun convert-to-direct-slot-definition (class canonicalized-slot)570 ; (apply #'make-instance571 ; (apply #'direct-slot-definition-class572 ; class canonicalized-slot)573 ; canonicalized-slot))574 561 575 562 (defun std-after-initialization-for-classes (class … … 1913 1900 (redefine-class-forwarder (setf class-direct-default-initargs) direct-default-initargs) 1914 1901 1915 (defgeneric direct-slot-definition-class (class &rest initargs)) 1916 1917 (defmethod direct-slot-definition-class ((class class) &rest initargs) 1918 (declare (ignore initargs)) 1919 +the-direct-slot-definition-class+) 1920 1921 (defgeneric effective-slot-definition-class (class &rest initargs)) 1922 1923 (defmethod effective-slot-definition-class ((class class) &rest initargs) 1924 (declare (ignore initargs)) 1925 +the-effective-slot-definition-class+) 1902 1926 1903 1927 1904 (fmakunbound 'documentation) … … 2235 2212 (defmethod shared-initialize ((instance standard-object) slot-names &rest initargs) 2236 2213 (std-shared-initialize instance slot-names initargs)) 2237 2238 (defmethod shared-initialize ((slot slot-definition) slot-names2239 &rest initargs2240 &key name initargs initform initfunction2241 readers writers allocation2242 &allow-other-keys)2243 ;;Keyword args are duplicated from init-slot-definition only to have2244 ;;them checked.2245 (declare (ignore slot-names)) ;;TODO?2246 (declare (ignore name initargs initform initfunction readers writers allocation))2247 (apply #'init-slot-definition slot initargs))2248 2214 2249 2215 ;;; change-class -
trunk/abcl/src/org/armedbear/lisp/compile-file.lisp
r12742 r12748 41 41 (defvar *output-file-pathname*) 42 42 43 (defun base-classname (&optional (output-file-pathname *output-file-pathname*))44 (sanitize-class-name (pathname-name output-file-pathname)))45 46 (defun fasl-loader-classname (&optional (output-file-pathname *output-file-pathname*))47 (%format nil "~A_0" (base-classname output-file-pathname)))48 49 43 (declaim (ftype (function (t) t) compute-classfile-name)) 50 44 (defun compute-classfile-name (n &optional (output-file-pathname … … 52 46 "Computes the name of the class file associated with number `n'." 53 47 (let ((name 54 (sanitize-class-name 55 (%format nil "~A_~D" (pathname-name output-file-pathname) n)))) 48 (%format nil "~A-~D" 49 (substitute #\_ #\. 50 (pathname-name output-file-pathname)) n))) 56 51 (namestring (merge-pathnames (make-pathname :name name :type "cls") 57 52 output-file-pathname)))) 58 59 (defun sanitize-class-name (name)60 (let ((name (copy-seq name)))61 (dotimes (i (length name))62 (declare (type fixnum i))63 (when (or (char= (char name i) #\-)64 (char= (char name i) #\.)65 (char= (char name i) #\Space))66 (setf (char name i) #\_)))67 name))68 69 53 70 54 (declaim (ftype (function () t) next-classfile-name)) … … 86 70 (declaim (ftype (function (t) t) verify-load)) 87 71 (defun verify-load (classfile) 88 #|(if (> *safety* 0)89 72 (if (> *safety* 0) 73 (and classfile 90 74 (let ((*load-truename* *output-file-pathname*)) 91 75 (report-error 92 76 (load-compiled-function classfile)))) 93 t)|# 94 (declare (ignore classfile)) 95 t) 77 t)) 96 78 97 79 (declaim (ftype (function (t) t) process-defconstant)) … … 163 145 (let* ((expr `(lambda ,lambda-list 164 146 ,@decls (block ,block-name ,@body))) 165 (saved-class-number *class-number*)166 147 (classfile (next-classfile-name)) 167 148 (internal-compiler-errors nil) … … 188 169 (setf form 189 170 `(fset ',name 190 (sys::get-fasl-function *fasl-loader* 191 ,saved-class-number) 171 (proxy-preloaded-function ',name ,(file-namestring classfile)) 192 172 ,*source-position* 193 173 ',lambda-list … … 246 226 (eval form) 247 227 (let* ((expr (function-lambda-expression (macro-function name))) 248 (saved-class-number *class-number*)249 228 (classfile (next-classfile-name))) 250 229 (with-open-file … … 263 242 `(put ',name 'macroexpand-macro 264 243 (make-macro ',name 265 (sys::get-fasl-function *fasl-loader* ,saved-class-number))) 244 (proxy-preloaded-function 245 '(macro-function ,name) 246 ,(file-namestring classfile)))) 266 247 `(fset ',name 267 248 (make-macro ',name 268 (sys::get-fasl-function *fasl-loader* ,saved-class-number)) 249 (proxy-preloaded-function 250 '(macro-function ,name) 251 ,(file-namestring classfile))) 269 252 ,*source-position* 270 253 ',(third form))))))))) … … 366 349 ;; was already used in verify-load before I used it, 367 350 ;; however, binding *load-truename* isn't fully compliant, I think. 368 (when compile-time-too 369 (let ((*load-truename* *output-file-pathname*) 370 (*fasl-loader* (make-fasl-class-loader 371 *class-number* 372 (concatenate 'string "org.armedbear.lisp." (base-classname)) 373 nil))) 351 (let ((*load-truename* *output-file-pathname*)) 352 (when compile-time-too 374 353 (eval form)))) 375 354 … … 388 367 (let ((lambda-expression (cadr function-form))) 389 368 (jvm::with-saved-compiler-policy 390 (let* ((saved-class-number *class-number*) 391 (classfile (next-classfile-name)) 369 (let* ((classfile (next-classfile-name)) 392 370 (result 393 371 (with-open-file … … 402 380 (cond (compiled-function 403 381 (setf (getf tail key) 404 `(sys::get-fasl-function *fasl-loader* ,saved-class-number))) 405 ;; `(load-compiled-function ,(file-namestring classfile)))) 382 `(load-compiled-function ,(file-namestring classfile)))) 406 383 (t 407 384 ;; FIXME This should be a warning or error of some sort... … … 436 413 (precompiler:precompile-form form nil *compile-file-environment*))) 437 414 (let* ((expr `(lambda () ,form)) 438 (saved-class-number *class-number*)439 415 (classfile (next-classfile-name)) 440 416 (result … … 450 426 (setf form 451 427 (if compiled-function 452 `(funcall ( sys::get-fasl-function *fasl-loader* ,saved-class-number))428 `(funcall (load-compiled-function ,(file-namestring classfile))) 453 429 (precompiler:precompile-form form nil *compile-file-environment*))))) 454 430 … … 597 573 :stream out) 598 574 (%stream-terpri out) 599 ;; Note: Beyond this point, you can't use DUMP-FORM, 600 ;; because the list of uninterned symbols has been fixed now. 601 (when *fasl-uninterned-symbols* 602 (write (list 'setq '*fasl-uninterned-symbols* 603 (coerce (mapcar #'car 604 (nreverse *fasl-uninterned-symbols*)) 605 'vector)) 606 :stream out)) 607 (%stream-terpri out) 608 609 (when (> *class-number* 0) 610 (generate-loader-function) 611 (write (list 'setq '*fasl-loader* 612 `(sys::make-fasl-class-loader 613 ,*class-number* 614 ,(concatenate 'string "org.armedbear.lisp." (base-classname)))) :stream out)) 575 ;; Note: Beyond this point, you can't use DUMP-FORM, 576 ;; because the list of uninterned symbols has been fixed now. 577 (when *fasl-uninterned-symbols* 578 (write (list 'setq '*fasl-uninterned-symbols* 579 (coerce (mapcar #'car 580 (nreverse *fasl-uninterned-symbols*)) 581 'vector)) 582 :stream out)) 583 (%stream-terpri out) 584 ;; we work with a fixed variable name here to work around the 585 ;; lack of availability of the circle reader in the fasl reader 586 ;; but it's a toplevel form anyway 587 (write `(dotimes (i ,*class-number*) 588 (function-preload 589 (%format nil "~A-~D.cls" 590 ,(substitute #\_ #\. (pathname-name output-file)) 591 (1+ i)))) 592 :stream out 593 :circle t) 615 594 (%stream-terpri out)) 616 595 … … 631 610 (merge-pathnames (make-pathname :type type) 632 611 output-file))) 633 (pathnames nil) 634 (fasl-loader (namestring (merge-pathnames (make-pathname :name (fasl-loader-classname) :type "cls") 635 output-file)))) 636 (when (probe-file fasl-loader) 637 (push fasl-loader pathnames)) 612 (pathnames ())) 638 613 (dotimes (i *class-number*) 639 614 (let* ((pathname (compute-classfile-name (1+ i)))) … … 657 632 (namestring output-file) elapsed)))) 658 633 (values (truename output-file) warnings-p failure-p))) 659 660 (defmacro ncase (expr min max &rest clauses)661 "A CASE where all test clauses are numbers ranging from a minimum to a maximum."662 ;;Expr is subject to multiple evaluation, but since we only use ncase for663 ;;fn-index below, let's ignore it.664 (let* ((half (floor (/ (- max min) 2)))665 (middle (+ min half)))666 (if (> (- max min) 10)667 `(if (< ,expr ,middle)668 (ncase ,expr ,min ,middle ,@(subseq clauses 0 half))669 (ncase ,expr ,middle ,max ,@(subseq clauses half)))670 `(case ,expr ,@clauses))))671 672 (defun generate-loader-function ()673 (let* ((basename (base-classname))674 (expr `(lambda (fasl-loader fn-index)675 (identity fasl-loader) ;;to avoid unused arg676 (ncase fn-index 0 ,(1- *class-number*)677 ,@(loop678 :for i :from 1 :to *class-number*679 :collect680 (let ((class (%format nil "org/armedbear/lisp/~A_~A" basename i)))681 `(,(1- i)682 (jvm::with-inline-code ()683 (jvm::emit 'jvm::aload 1)684 (jvm::emit-invokevirtual jvm::+lisp-object-class+ "javaInstance"685 nil jvm::+java-object+)686 (jvm::emit 'jvm::checkcast "org/armedbear/lisp/FaslClassLoader")687 (jvm::emit 'jvm::dup)688 (jvm::emit-push-constant-int ,(1- i))689 (jvm::emit 'jvm::new ,class)690 (jvm::emit 'jvm::dup)691 (jvm::emit-invokespecial-init ,class '())692 (jvm::emit-invokevirtual "org/armedbear/lisp/FaslClassLoader" "putFunction"693 (list "I" jvm::+lisp-object+) jvm::+lisp-object+)694 (jvm::emit 'jvm::pop))695 t))))))696 (classname (fasl-loader-classname))697 (classfile (namestring (merge-pathnames (make-pathname :name classname :type "cls")698 *output-file-pathname*))))699 (jvm::with-saved-compiler-policy700 (jvm::with-file-compilation701 (with-open-file702 (f classfile703 :direction :output704 :element-type '(unsigned-byte 8)705 :if-exists :supersede)706 (jvm:compile-defun nil expr nil707 classfile f nil))))))708 634 709 635 (defun compile-file-if-needed (input-file &rest allargs &key force-compile -
trunk/abcl/src/org/armedbear/lisp/compiler-pass1.lisp
r12742 r12748 1299 1299 (return-from p1-function-call 1300 1300 (let ((*inline-declarations* 1301 (remove op *inline-declarations* :key #'car :test #'equal)))1301 (remove op *inline-declarations* :key #'car))) 1302 1302 (p1 expansion)))))) 1303 1303 … … 1433 1433 (UNWIND-PROTECT p1-unwind-protect) 1434 1434 (THREADS:SYNCHRONIZED-ON 1435 p1-threads-synchronized-on) 1436 (JVM::WITH-INLINE-CODE identity))) 1435 p1-threads-synchronized-on))) 1437 1436 (install-p1-handler (%car pair) (%cadr pair)))) 1438 1437 -
trunk/abcl/src/org/armedbear/lisp/compiler-pass2.lisp
r12742 r12748 199 199 n))) 200 200 201 (defconstant +fasl-loader-class+202 "org/armedbear/lisp/FaslClassLoader")203 201 (defconstant +java-string+ "Ljava/lang/String;") 204 202 (defconstant +java-object+ "Ljava/lang/Object;") … … 2270 2268 (setf g (symbol-name (gensym "LFUN"))) 2271 2269 (let* ((pathname (abcl-class-file-pathname (local-function-class-file local-function))) 2272 (class-name (concatenate 'string "org/armedbear/lisp/" (pathname-name pathname)))2273 2270 (*code* *static-code*)) 2274 2271 ;; fixme *declare-inline* 2275 (declare-field g +lisp-object+ +field-access-private+) 2276 (emit 'new class-name) 2277 (emit 'dup) 2278 (emit-invokespecial-init class-name '()) 2279 2280 ;(emit 'ldc (pool-string (pathname-name pathname))) 2281 ;(emit-invokestatic +fasl-loader-class+ "faslLoadFunction" 2282 ;(list +java-string+) +lisp-object+) 2283 2284 ; (emit 'ldc (pool-string (file-namestring pathname))) 2285 2286 ; (emit-invokestatic +lisp-function-proxy-class+ "loadPreloadedFunction" 2287 ; (list +java-string+) +lisp-object+) 2272 (declare-field g +lisp-object+ +field-access-default+) 2273 (emit 'ldc (pool-string (file-namestring pathname))) 2274 (emit-invokestatic +lisp-function-proxy-class+ "loadPreloadedFunction" 2275 (list +java-string+) +lisp-object+) 2288 2276 (emit 'putstatic *this-class* g +lisp-object+) 2289 2277 (setf *static-code* *code*) … … 2430 2418 (typep form 'double-float) 2431 2419 (characterp form) 2420 (stringp form) 2421 (packagep form) 2422 (pathnamep form) 2423 (vectorp form) 2432 2424 (stringp form) 2433 2425 (packagep form) … … 5107 5099 (emit 'getstatic *this-class* 5108 5100 g +lisp-object+))))) ; Stack: template-function 5109 ((and (member name *functions-defined-in-current-file* :test #'equal) 5110 (not (notinline-p name))) 5101 ((member name *functions-defined-in-current-file* :test #'equal) 5111 5102 (emit 'getstatic *this-class* 5112 5103 (declare-setf-function name) +lisp-object+) … … 7558 7549 (compile-function-call form target representation)))) 7559 7550 7560 #|(defknown p2-java-jcall (t t t) t)7561 (define-inlined-function p2-java-jcall (form target representation)7562 ((and (> *speed* *safety*)7563 (< 1 (length form))7564 (eq 'jmethod (car (cadr form)))7565 (every #'stringp (cdr (cadr form)))))7566 (let ((m (ignore-errors (eval (cadr form)))))7567 (if m7568 (let ((must-clear-values nil)7569 (arg-types (raw-arg-types (jmethod-params m))))7570 (declare (type boolean must-clear-values))7571 (dolist (arg (cddr form))7572 (compile-form arg 'stack nil)7573 (unless must-clear-values7574 (unless (single-valued-p arg)7575 (setf must-clear-values t))))7576 (when must-clear-values7577 (emit-clear-values))7578 (dotimes (i (jarray-length raw-arg-types))7579 (push (jarray-ref raw-arg-types i) arg-types))7580 (emit-invokevirtual (jclass-name (jmethod-declaring-class m))7581 (jmethod-name m)7582 (nreverse arg-types)7583 (jmethod-return-type m)))7584 ;; delay resolving the method to run-time; it's unavailable now7585 (compile-function-call form target representation))))|#7586 7551 7587 7552 (defknown p2-char= (t t t) t) … … 8260 8225 t) 8261 8226 8262 (defun p2-with-inline-code (form target representation)8263 ;;form = (with-inline-code (&optional target-var repr-var) ...body...)8264 (destructuring-bind (&optional target-var repr-var) (cadr form)8265 (eval `(let (,@(when target-var `((,target-var ,target)))8266 ,@(when repr-var `((,repr-var ,representation))))8267 ,@(cddr form)))))8268 8269 8227 (defun compile-1 (compiland stream) 8270 8228 (let ((*all-variables* nil) … … 8559 8517 (install-p2-handler 'java:jconstructor 'p2-java-jconstructor) 8560 8518 (install-p2-handler 'java:jmethod 'p2-java-jmethod) 8561 ; (install-p2-handler 'java:jcall 'p2-java-jcall)8562 8519 (install-p2-handler 'char= 'p2-char=) 8563 8520 (install-p2-handler 'characterp 'p2-characterp) … … 8644 8601 (install-p2-handler 'write-8-bits 'p2-write-8-bits) 8645 8602 (install-p2-handler 'zerop 'p2-zerop) 8646 (install-p2-handler 'with-inline-code 'p2-with-inline-code)8647 8603 t) 8648 8604 -
trunk/abcl/src/org/armedbear/lisp/disassemble.lisp
r12742 r12748 48 48 (unless (compiled-function-p function) 49 49 (setf function (compile nil function))) 50 (let ((class-bytes (function-class-bytes function))) 51 (when class-bytes 52 (with-input-from-string 53 (stream (disassemble-class-bytes class-bytes)) 54 (loop 55 (let ((line (read-line stream nil))) 56 (unless line (return)) 57 (write-string "; ") 58 (write-string line) 59 (terpri)))) 60 (return-from disassemble))) 61 (%format t "; Disassembly is not available.~%")))) 50 (when (getf (function-plist function) 'class-bytes) 51 (with-input-from-string 52 (stream (disassemble-class-bytes (getf (function-plist function) 'class-bytes))) 53 (loop 54 (let ((line (read-line stream nil))) 55 (unless line (return)) 56 (write-string "; ") 57 (write-string line) 58 (terpri)))) 59 (return-from disassemble))) 60 (%format t "; Disassembly is not available.~%"))) -
trunk/abcl/src/org/armedbear/lisp/gui.lisp
r12742 r12748 1 1 (in-package :extensions) 2 3 (require :java)4 2 5 3 (defvar *gui-backend* :swing) -
trunk/abcl/src/org/armedbear/lisp/java/DialogPromptStream.java
r12742 r12748 1 package abcl;1 package org.armedbear.lisp.java; 2 2 3 3 import java.io.IOException; … … 7 7 8 8 import org.armedbear.lisp.Stream; 9 10 9 /** 11 * A bidirectional stream that captures input from a modal dialog. The 12 * dialog reports a label (prompt line) which shows to the user 13 * everything that has been printed to the stream up to the moment 14 * when the dialog became visible. It is usable as a drop-in 15 * replacement for e.g. *debug-io*.<br /> This is an abstract class 16 * that does not depend on any GUI library. Subclasses are expected to 17 * provide the actual code to show the dialog and read input from the 18 * user. 19 * 10 * A bidirectional stream that captures input from a modal dialog. The dialog reports a label (prompt line) 11 * which shows to the user everything that has been printed to the stream up to the moment when the dialog 12 * became visible. It is usable as a drop-in replacement for e.g. *debug-io*.<br /> 13 * This is an abstract class that does not depend on any GUI library. Subclasses are expected to provide 14 * the actual code to show the dialog and read input from the user. 20 15 * @author Alessio Stalla 21 16 * -
trunk/abcl/src/org/armedbear/lisp/java/swing/SwingDialogPromptStream.java
r12742 r12748 1 package swing;1 package org.armedbear.lisp.java.swing; 2 2 3 3 import java.awt.BorderLayout; … … 13 13 import javax.swing.JTextField; 14 14 15 import abcl.DialogPromptStream;15 import org.armedbear.lisp.java.DialogPromptStream; 16 16 17 17 public class SwingDialogPromptStream extends DialogPromptStream { -
trunk/abcl/src/org/armedbear/lisp/load.lisp
r12742 r12748 39 39 (external-format :default)) 40 40 (declare (ignore external-format)) ; FIXME 41 (let (*fasl-loader*) 42 (%load (if (streamp filespec) 43 filespec 44 (merge-pathnames (pathname filespec))) 45 verbose print if-does-not-exist))) 41 (%load (if (streamp filespec) 42 filespec 43 (merge-pathnames (pathname filespec))) 44 verbose print if-does-not-exist)) 46 45 47 46 (defun load-returning-last-result (filespec … … 52 51 (external-format :default)) 53 52 (declare (ignore external-format)) ; FIXME 54 (let (*fasl-loader*) 55 (%load-returning-last-result (if (streamp filespec) 56 filespec 57 (merge-pathnames (pathname filespec))) 58 verbose print if-does-not-exist))) 53 (%load-returning-last-result (if (streamp filespec) 54 filespec 55 (merge-pathnames (pathname filespec))) 56 verbose print if-does-not-exist)) -
trunk/abcl/src/org/armedbear/lisp/precompiler.lisp
r12742 r12748 33 33 34 34 35 (export '(process-optimization-declarations 35 (export '(*inline-declarations* 36 process-optimization-declarations 36 37 inline-p notinline-p inline-expansion expand-inline 37 38 *defined-functions* *undefined-functions* note-name-defined)) 39 40 (defvar *inline-declarations* nil) 38 41 39 42 (declaim (ftype (function (t) t) process-optimization-declarations)) … … 84 87 (defun inline-p (name) 85 88 (declare (optimize speed)) 86 (let ((entry (assoc name *inline-declarations* :test #'equal)))89 (let ((entry (assoc name *inline-declarations*))) 87 90 (if entry 88 91 (eq (cdr entry) 'INLINE) … … 92 95 (defun notinline-p (name) 93 96 (declare (optimize speed)) 94 (let ((entry (assoc name *inline-declarations* :test #'equal)))97 (let ((entry (assoc name *inline-declarations*))) 95 98 (if entry 96 99 (eq (cdr entry) 'NOTINLINE) … … 959 962 'precompiler)))) 960 963 (unless (and handler (fboundp handler)) 961 (error "No handler for ~S." (let ((*package* (find-package :keyword))) 962 (format nil "~S" symbol)))) 964 (error "No handler for ~S." symbol)) 963 965 (setf (get symbol 'precompile-handler) handler))) 964 966 … … 1023 1025 1024 1026 (THREADS:SYNCHRONIZED-ON 1025 precompile-threads-synchronized-on) 1026 1027 (JVM::WITH-INLINE-CODE precompile-identity))) 1027 precompile-threads-synchronized-on))) 1028 1028 (install-handler (first pair) (second pair)))) 1029 1029 -
trunk/abcl/src/org/armedbear/lisp/proclaim.lisp
r12742 r12748 32 32 (in-package #:system) 33 33 34 (export '(check-declaration-type proclaimed-type proclaimed-ftype ftype-result-type *inline-declarations*))34 (export '(check-declaration-type proclaimed-type proclaimed-ftype ftype-result-type)) 35 35 36 36 (defmacro declaim (&rest decls) … … 44 44 :format-arguments (list name))) 45 45 46 (defvar *inline-declarations* nil)47 46 (defvar *declaration-types* (make-hash-table :test 'eq)) 48 47 … … 93 92 ((INLINE NOTINLINE) 94 93 (dolist (name (cdr declaration-specifier)) 95 (if (symbolp name) 96 (setf (get name '%inline) (car declaration-specifier)) 97 (push (cons name (car declaration-specifier)) *inline-declarations*)))) 94 (when (symbolp name) ; FIXME Need to support non-symbol function names. 95 (setf (get name '%inline) (car declaration-specifier))))) 98 96 (DECLARATION 99 97 (dolist (name (cdr declaration-specifier)) -
trunk/abcl/src/org/armedbear/lisp/scripting/AbclScriptEngine.java
r12740 r12748 279 279 } 280 280 281 @Override 281 282 public <T> T getInterface(Class<T> clasz) { 282 283 try { … … 288 289 289 290 @SuppressWarnings("unchecked") 291 @Override 290 292 public <T> T getInterface(Object thiz, Class<T> clasz) { 291 293 Symbol s = findSymbol("jmake-proxy", "JAVA"); … … 294 296 } 295 297 298 @Override 296 299 public Object invokeFunction(String name, Object... args) throws ScriptException, NoSuchMethodException { 297 300 Symbol s; … … 318 321 } 319 322 323 @Override 320 324 public Object invokeMethod(Object thiz, String name, Object... args) throws ScriptException, NoSuchMethodException { 321 325 throw new UnsupportedOperationException("Common Lisp does not have methods in the Java sense. Use invokeFunction instead."); -
trunk/abcl/src/org/armedbear/lisp/scripting/AbclScriptEngineFactory.java
r12740 r12748 32 32 private static final AbclScriptEngine THE_ONLY_ONE_ENGINE = new AbclScriptEngine(); 33 33 34 public String getEngineName() { 35 return "ABCL Script"; 36 } 34 @Override 35 public String getEngineName() { 36 return "ABCL Script"; 37 } 37 38 38 public String getEngineVersion() { 39 return "0.1"; 40 } 39 @Override 40 public String getEngineVersion() { 41 return "0.1"; 42 } 41 43 42 public List<String> getExtensions() { 43 List<String> extensions = new ArrayList<String>(1); 44 extensions.add("lisp"); 45 return Collections.unmodifiableList(extensions); 46 } 44 @Override 45 public List<String> getExtensions() { 46 List<String> extensions = new ArrayList<String>(1); 47 extensions.add("lisp"); 48 return Collections.unmodifiableList(extensions); 49 } 47 50 48 public String getLanguageName() { 49 return "ANSI Common Lisp"; 50 } 51 @Override 52 public String getLanguageName() { 53 return "ANSI Common Lisp"; 54 } 51 55 52 public String getLanguageVersion() { 53 return "ANSI X3.226:1994"; 54 } 56 @Override 57 public String getLanguageVersion() { 58 return "ANSI X3.226:1994"; 59 } 55 60 56 public static String escape(String raw) { 57 StringBuilder sb = new StringBuilder(); 58 int len = raw.length(); 59 char c; 60 for(int i = 0; i < len; ++i) { 61 c = raw.charAt(i); 62 if(c != '"') { 63 sb.append(c); 64 } else { 65 sb.append("\\\""); 66 } 61 public static String escape(String raw) { 62 StringBuilder sb = new StringBuilder(); 63 int len = raw.length(); 64 char c; 65 for(int i = 0; i < len; ++i) { 66 c = raw.charAt(i); 67 if(c != '"') { 68 sb.append(c); 69 } else { 70 sb.append("\\\""); 71 } 72 } 73 return sb.toString(); 67 74 } 68 return sb.toString();69 }70 75 71 public String getMethodCallSyntax(String obj, String method, String... args) { 72 StringBuilder sb = new StringBuilder(); 73 sb.append("(jcall \""); 74 sb.append(method); 75 sb.append("\" "); 76 sb.append(obj); 77 for(String arg : args) { 78 sb.append(" "); 79 sb.append(arg); 76 @Override 77 public String getMethodCallSyntax(String obj, String method, String... args) { 78 StringBuilder sb = new StringBuilder(); 79 sb.append("(jcall \""); 80 sb.append(method); 81 sb.append("\" "); 82 sb.append(obj); 83 for(String arg : args) { 84 sb.append(" "); 85 sb.append(arg); 86 } 87 sb.append(")"); 88 return sb.toString(); 80 89 } 81 sb.append(")");82 return sb.toString();83 }84 85 public List<String> getMimeTypes() {86 return Collections.unmodifiableList(new ArrayList<String>());87 }88 90 89 public List<String> getNames() { 90 List<String> names = new ArrayList<String>(1); 91 names.add("ABCL"); 92 names.add("cl"); 93 names.add("Lisp"); 94 names.add("Common Lisp"); 95 return Collections.unmodifiableList(names); 96 } 91 @Override 92 public List<String> getMimeTypes() { 93 return Collections.unmodifiableList(new ArrayList<String>()); 94 } 97 95 98 public String getOutputStatement(String str) { 99 return "(cl:print \"" + str + "\")"; 100 } 96 @Override 97 public List<String> getNames() { 98 List<String> names = new ArrayList<String>(1); 99 names.add("ABCL"); 100 names.add("cl"); 101 names.add("Lisp"); 102 names.add("Common Lisp"); 103 return Collections.unmodifiableList(names); 104 } 101 105 102 public Object getParameter(String key) { 103 // TODO Auto-generated method stub104 return null;105 106 @Override 107 public String getOutputStatement(String str) { 108 return "(cl:print \"" + str + "\")"; 109 } 106 110 107 public String getProgram(String... statements) { 108 StringBuilder sb = new StringBuilder(); 109 sb.append("(cl:progn"); 110 for(String stmt : statements) { 111 sb.append("\n\t"); 112 sb.append(stmt); 111 @Override 112 public Object getParameter(String key) { 113 // TODO Auto-generated method stub 114 return null; 113 115 } 114 sb.append(")"); 115 return sb.toString(); 116 } 117 118 public ScriptEngine getScriptEngine() { 119 return THE_ONLY_ONE_ENGINE; 120 } 116 117 @Override 118 public String getProgram(String... statements) { 119 StringBuilder sb = new StringBuilder(); 120 sb.append("(cl:progn"); 121 for(String stmt : statements) { 122 sb.append("\n\t"); 123 sb.append(stmt); 124 } 125 sb.append(")"); 126 return sb.toString(); 127 } 128 129 @Override 130 public ScriptEngine getScriptEngine() { 131 return THE_ONLY_ONE_ENGINE; 132 } 121 133 122 134 }
Note: See TracChangeset
for help on using the changeset viewer.