[svn:parrot] r44141 - in trunk: . compilers/data_json compilers/imcc compilers/json compilers/nqp compilers/pct compilers/pge compilers/tge config/auto/sizes config/gen config/gen/makefiles docs/book/draft docs/book/pct docs/dev docs/pdds examples/embed examples/languages/abc examples/languages/squaak examples/pge ext/nqp-rx include/parrot lib/Parrot lib/Parrot/Configure/Step ports/cpan ports/cygwin ports/debian ports/fedora ports/mandriva ports/suse runtime/parrot/languages runtime/parrot/library runtime/parrot/library/Math src src/call src/gc src/interp src/runcore t/compilers/tge t/oo t/pmc t/src t/steps/init/hints tools/build tools/dev tools/util

plobsing at svn.parrot.org plobsing at svn.parrot.org
Thu Feb 18 19:38:52 UTC 2010


Author: plobsing
Date: Thu Feb 18 19:38:51 2010
New Revision: 44141
URL: https://trac.parrot.org/parrot/changeset/44141

Log:
merge branch opengl_dynamic_nci

Modified:
   trunk/   (props changed)
   trunk/MANIFEST.SKIP
   trunk/compilers/data_json/Rules.mak   (props changed)
   trunk/compilers/imcc/Rules.mak   (props changed)
   trunk/compilers/json/Rules.mak   (props changed)
   trunk/compilers/nqp/Rules.mak   (props changed)
   trunk/compilers/pct/Rules.mak   (props changed)
   trunk/compilers/pge/Rules.mak   (props changed)
   trunk/compilers/tge/Rules.mak   (props changed)
   trunk/config/auto/sizes/intval_maxmin_c.in   (props changed)
   trunk/config/gen/makefiles/root.in
   trunk/config/gen/opengl.pm
   trunk/docs/book/draft/README   (props changed)
   trunk/docs/book/draft/appa_glossary.pod   (props changed)
   trunk/docs/book/draft/appb_patch_submission.pod   (props changed)
   trunk/docs/book/draft/appc_command_line_options.pod   (props changed)
   trunk/docs/book/draft/appd_build_options.pod   (props changed)
   trunk/docs/book/draft/appe_source_code.pod   (props changed)
   trunk/docs/book/draft/ch01_introduction.pod   (props changed)
   trunk/docs/book/draft/ch02_getting_started.pod   (props changed)
   trunk/docs/book/draft/ch07_dynpmcs.pod   (props changed)
   trunk/docs/book/draft/ch08_dynops.pod   (props changed)
   trunk/docs/book/draft/ch10_opcode_reference.pod   (props changed)
   trunk/docs/book/draft/ch11_directive_reference.pod   (props changed)
   trunk/docs/book/draft/ch12_operator_reference.pod   (props changed)
   trunk/docs/book/draft/chXX_hlls.pod   (props changed)
   trunk/docs/book/draft/chXX_library.pod   (props changed)
   trunk/docs/book/draft/chXX_testing_and_debugging.pod   (props changed)
   trunk/docs/book/pct/ch01_introduction.pod   (props changed)
   trunk/docs/book/pct/ch02_getting_started.pod   (props changed)
   trunk/docs/book/pct/ch03_compiler_tools.pod   (props changed)
   trunk/docs/book/pct/ch04_pge.pod   (props changed)
   trunk/docs/book/pct/ch05_nqp.pod   (props changed)
   trunk/docs/dev/c_functions.pod   (props changed)
   trunk/docs/pdds/pdd30_install.pod   (props changed)
   trunk/examples/embed/cotorra.c   (props changed)
   trunk/examples/languages/abc/   (props changed)
   trunk/examples/languages/squaak/   (props changed)
   trunk/examples/pge/demo.pir   (props changed)
   trunk/ext/nqp-rx/Rules.mak   (props changed)
   trunk/include/parrot/call.h   (props changed)
   trunk/include/parrot/gc_api.h   (props changed)
   trunk/include/parrot/runcore_api.h   (props changed)
   trunk/include/parrot/runcore_profiling.h   (props changed)
   trunk/include/parrot/runcore_trace.h   (props changed)
   trunk/lib/Parrot/Configure/Step/Test.pm   (props changed)
   trunk/lib/Parrot/H2inc.pm   (props changed)
   trunk/ports/cpan/pause_guide.pod   (props changed)
   trunk/ports/cygwin/parrot-1.0.0-1.cygport   (props changed)
   trunk/ports/debian/libparrot-dev.install.in   (props changed)
   trunk/ports/debian/libparrot.install.in   (props changed)
   trunk/ports/debian/parrot-doc.install.in   (props changed)
   trunk/ports/debian/parrot.install.in   (props changed)
   trunk/ports/fedora/parrot.spec.fedora   (props changed)
   trunk/ports/mandriva/parrot.spec.mandriva   (props changed)
   trunk/ports/suse/parrot.spec.suse   (props changed)
   trunk/runtime/parrot/languages/   (props changed)
   trunk/runtime/parrot/library/Math/Rand.pir   (props changed)
   trunk/runtime/parrot/library/OpenGL.pir
   trunk/runtime/parrot/library/Rules.mak   (props changed)
   trunk/src/   (props changed)
   trunk/src/call/ops.c   (props changed)
   trunk/src/call/pcc.c   (props changed)
   trunk/src/gc/alloc_memory.c   (props changed)
   trunk/src/gc/alloc_resources.c   (props changed)
   trunk/src/gc/api.c   (props changed)
   trunk/src/gc/malloc.c   (props changed)
   trunk/src/gc/malloc_trace.c   (props changed)
   trunk/src/gc/mark_sweep.c   (props changed)
   trunk/src/gc/system.c   (props changed)
   trunk/src/interp/inter_cb.c   (props changed)
   trunk/src/interp/inter_create.c   (props changed)
   trunk/src/interp/inter_misc.c   (props changed)
   trunk/src/runcore/cores.c   (props changed)
   trunk/src/runcore/main.c   (props changed)
   trunk/src/runcore/profiling.c   (props changed)
   trunk/src/runcore/trace.c   (props changed)
   trunk/t/compilers/tge/NoneGrammar.tg   (props changed)
   trunk/t/oo/root_new.t   (props changed)
   trunk/t/pmc/namespace-old.t   (props changed)
   trunk/t/src/embed.t   (props changed)
   trunk/t/steps/init/hints/linux-01.t   (props changed)
   trunk/tools/build/cc_flags.pl   (props changed)
   trunk/tools/build/h2inc.pl   (props changed)
   trunk/tools/build/nativecall.pir
   trunk/tools/dev/fetch_languages.pl   (props changed)
   trunk/tools/dev/mk_gitignore.pl   (props changed)
   trunk/tools/util/perlcritic-cage.conf   (props changed)

Modified: trunk/MANIFEST.SKIP
==============================================================================
--- trunk/MANIFEST.SKIP	Thu Feb 18 19:08:42 2010	(r44140)
+++ trunk/MANIFEST.SKIP	Thu Feb 18 19:38:51 2010	(r44141)
@@ -1,6 +1,6 @@
 # ex: set ro:
 # $Id$
-# generated by tools/dev/mk_manifest_and_skip.pl Mon Feb  8 05:37:36 2010 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Wed Feb 10 13:22:49 2010 UT
 #
 # This file should contain a transcript of the svn:ignore properties
 # of the directories in the Parrot subversion repository. (Needed for
@@ -648,6 +648,10 @@
 ^src/fingerprint\.c/
 ^src/glut_callbacks\.c$
 ^src/glut_callbacks\.c/
+^src/glut_nci_thunks\.c$
+^src/glut_nci_thunks\.c/
+^src/glut_nci_thunks\.nci$
+^src/glut_nci_thunks\.nci/
 ^src/install_config\.c$
 ^src/install_config\.c/
 ^src/jit_cpu\.c$

Modified: trunk/config/gen/makefiles/root.in
==============================================================================
--- trunk/config/gen/makefiles/root.in	Thu Feb 18 19:08:42 2010	(r44140)
+++ trunk/config/gen/makefiles/root.in	Thu Feb 18 19:38:51 2010	(r44141)
@@ -158,7 +158,7 @@
     $(LIBRARY_DIR)/config.pir \
     src/platform.c \
 #IF(platform_asm):    src/platform_asm.s \
-#IF(has_opengl):    config/gen/call_list/opengl.in \
+#IF(has_opengl):    src/glut_nci_thunks.nci \
 #IF(has_glut):    src/glut_callbacks.c \
     src/core_pmcs.c \
 #IF(has_crypto):    src/dynpmc/md2.pmc \
@@ -256,6 +256,7 @@
 GEN_SOURCES = \
     src/core_ops.c \
     src/nci.c \
+    src/glut_nci_thunks.c \
     src/core_ops_switch.c \
     src/parrot_config.c \
     src/null_config.c \
@@ -1840,6 +1841,7 @@
     src/nci_test$(O) \
     $(LIBNCI_TEST_SO) \
     src/glut_callbacks$(O) \
+    src/glut_nci_thunks$(O) \
     $(LIBGLUTCB_SO) \
     install_config.fpmc
 	$(PERL) $(BUILD_TOOLS_DIR)/c2str.pl --init
@@ -2405,9 +2407,18 @@
 # for use by runtime/parrot/library/OpenGL.pir
 src/glut_callbacks$(O): $(GENERAL_H_FILES)
 
-$(LIBGLUTCB_SO): $(LIBPARROT) src/glut_callbacks$(O)
+src/glut_nci_thunks.c: $(PARROT) runtime/parrot/library/data_json.pbc tools/build/nativecall.pir
+	$(PARROT) tools/build/nativecall.pir \
+	    --loader-name=Parrot_glut_nci_loader \
+	    --loader-storage-class=PARROT_DYNEXT_EXPORT \
+	    <src/glut_nci_thunks.nci \
+	    >src/glut_nci_thunks.c
+
+src/glut_nci_thunks$(O): $(GENERAL_H_FILES)
+
+$(LIBGLUTCB_SO): $(LIBPARROT) src/glut_callbacks$(O) src/glut_nci_thunks$(O)
 	$(LD) $(LD_LOAD_FLAGS) $(LDFLAGS) \
-    @ld_out@$@ src/glut_callbacks$(O) \
+    @ld_out@$@ src/glut_callbacks$(O) src/glut_nci_thunks$(O) \
     $(ALL_PARROT_LIBS) @opengl_lib@
 
 # emacs etags

Modified: trunk/config/gen/opengl.pm
==============================================================================
--- trunk/config/gen/opengl.pm	Thu Feb 18 19:08:42 2010	(r44140)
+++ trunk/config/gen/opengl.pm	Thu Feb 18 19:38:51 2010	(r44141)
@@ -15,7 +15,7 @@
 
 =item F<runtime/parrot/library/OpenGL_funcs.pir>
 
-=item F<config/gen/call_list/opengl.in>
+=item F<src/glut_nci_thunks.nci>
 
 =item F<src/glut_callbacks.c>
 
@@ -436,7 +436,7 @@
 
 my $MACRO_FILE = 'runtime/parrot/include/opengl_defines.pasm';
 my $FUNCS_FILE = 'runtime/parrot/library/OpenGL_funcs.pir';
-my $SIGS_FILE  = 'config/gen/call_list/opengl.in';
+my $SIGS_FILE  = 'src/glut_nci_thunks.nci';
 my $C_FILE     = 'src/glut_callbacks.c';
 
 
@@ -812,6 +812,8 @@
 .sub _glutcb_func_list
     .local pmc glutcb_funcs
     glutcb_funcs = new 'ResizableStringArray'
+    push glutcb_funcs, 'Parrot_glut_nci_loader'
+    push glutcb_funcs, 'vJ'
     push glutcb_funcs, 'glutcbCloseFunc'
     push glutcb_funcs, 'vJP'
     push glutcb_funcs, 'glutcbDisplayFunc'

Modified: trunk/runtime/parrot/library/OpenGL.pir
==============================================================================
--- trunk/runtime/parrot/library/OpenGL.pir	Thu Feb 18 19:08:42 2010	(r44140)
+++ trunk/runtime/parrot/library/OpenGL.pir	Thu Feb 18 19:38:51 2010	(r44141)
@@ -91,6 +91,7 @@
     load_bytecode 'OpenGL_funcs.pbc'
     _load_opengl_libs()
     _wrap_opengl_entry_points()
+    _load_nci_thunks()
     _export_opengl_functions()
 .end
 
@@ -241,6 +242,25 @@
 
 =back
 
+=head2 Thunk Loading
+
+These routines ensure that all NCI thunks necessary for calling OpenGL functions are
+available to Parrot.
+
+=cut
+
+.sub _load_nci_thunks
+    # load the nci thunks
+    .local pmc ns, loader
+    ns = get_namespace
+    loader = ns['Parrot_glut_nci_loader']
+    loader()
+
+    # delete loader the function, it isn't for public consumption
+    $P0 = new ['Undef']
+    set_global 'Parrot_glut_nci_loader', $P0
+.end
+
 =head2 Symbol Export
 
 These routines allow OpenGL symbols to exported to other namespaces to more

Modified: trunk/tools/build/nativecall.pir
==============================================================================
--- trunk/tools/build/nativecall.pir	Thu Feb 18 19:08:42 2010	(r44140)
+++ trunk/tools/build/nativecall.pir	Thu Feb 18 19:38:51 2010	(r44141)
@@ -86,7 +86,7 @@
 .macro_const THUNK_NAME_PROTO       'thunk-name-proto'
 .macro_const LOADER_STORAGE_CLASS   'loader-storage-class'
 .macro_const LOADER_NAME            'loader-name'
-
+.macro_const CORE                   'core'
 
 .sub 'get_options'
     .param pmc argv
@@ -97,6 +97,7 @@
     getopt = new ['Getopt';'Obj']
     push getopt, 'help|h'
     push getopt, 'version|v'
+    push getopt, 'core'
     push getopt, 'target=s'
     push getopt, 'thunk-storage-class=s'
     push getopt, 'thunk-name-proto=s'
@@ -139,6 +140,7 @@
 Options
     --help              print this message and exit
     --version           print the version number of this utility
+    --core              output a thunks file suitable for inclusion in Parrot core. Default is no.
     --target <target>   select what to output (valid options are 'head', 'thunks',
                         'loader', 'coda', 'all', 'names', and 'signatures'). Default value is 'all'
     --thunk-storage-class <storage class>
@@ -164,6 +166,14 @@
 .sub 'fixup_opts'
     .param pmc opts
 
+    $I0 = defined opts['core']
+    if $I0 goto in_core
+        opts['core'] = ''
+        goto end_core
+    in_core:
+        opts['core'] = 'true'
+    end_core:
+
     $I0 = defined opts['target']
     if $I0 goto end_target
         opts['target'] = 'all'
@@ -220,7 +230,18 @@
 
 .sub 'get_head'
     .param pmc ignored :slurpy
-    .return (<<'HEAD')
+
+    .local string in_core
+    in_core = 'read_from_opts'(.CORE)
+
+    .local string ext_defn
+    ext_defn = ''
+    if in_core goto end_ext_defn
+        ext_defn = '#define PARROT_IN_EXTENSION'
+    end_ext_defn:
+
+    .local string head
+    head = 'sprintf'(<<'HEAD', ext_defn)
 /* ex: set ro ft=c:
  * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
  *
@@ -242,35 +263,27 @@
  *  Notes:
  *  References:
  */
+
+%s
 #include "parrot/parrot.h"
-#include "parrot/hash.h"
-#include "parrot/oplib/ops.h"
-#include "pmc/pmc_managedstruct.h"
 #include "pmc/pmc_nci.h"
-#include "pmc/pmc_pointer.h"
-#include "pmc/pmc_callcontext.h"
 
-#ifdef PARROT_IN_CORE
-/* external libraries don't have to care about string subsystem */
-#  include "nci.str"
+
+#ifdef PARROT_IN_EXTENSION
+/* external libraries can't have strings statically compiled into parrot */
+#  define CONST_STRING(i, s) Parrot_str_new_constant(i, s)
+#else
+#  include "core.str"
 #endif
 
 /* HEADERIZER HFILE: none */
 /* HEADERIZER STOP */
 
-/*
- * if the architecture can build some or all of these signatures
- * enable the define below
- * - the JITed function will be called first
- * - if it returns NULL, the hardcoded version will do the job
- */
-
-#include "frame_builder.h"
-
 /* All our static functions that call in various ways. Yes, terribly
    hackish, but that is just fine */
 
 HEAD
+    .return (head)
 .end
 
 .sub 'get_thunks'


More information about the parrot-commits mailing list