summaryrefslogtreecommitdiff
path: root/gcc/melt/warmelt-modes.melt
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-25 18:59:02 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2013-06-25 18:59:02 +0000
commitbfa3905362f28be5b539b0e7cee142bbe9652362 (patch)
tree3076bbb0d13a218150c2c6cd385467b1fab9cd8f /gcc/melt/warmelt-modes.melt
parente1ef946b671e7f4e0fa26122f65d0901d2b82246 (diff)
downloadgcc-bfa3905362f28be5b539b0e7cee142bbe9652362.tar.gz
2013-06-25 Basile Starynkevitch <basile@starynkevitch.net>
* melt-runtime.h (Melt_CallFrame): Has also a melthook_ptr_t. (Melt_CallFrameWithValues): Add constructor for hook. * melt-run.proto.h (meltfptr, meltfnum, meltfclos, meltfrout): Give definition when MELT_HAVE_CLASSY_FRAME. * melt/warmelt-genobj.melt (compile2obj_hook): The hook data parameter is named melthookdatap. * melt/warmelt-outobj.melt (outcinitfill_objinitroutine): Improve. (outcinitfill_objinithook): Improve. (output_curframe_declstruct): Emit variant for MELT_HAVE_CLASSY_FRAME. (output_curframe_declstruct_init): Ditto. (outpucod_procroutine): Slighty improved emission. * melt/warmelt-modes.melt (generate_runtypesupport_gty): Emit generation of safe casting functions. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@200402 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/melt/warmelt-modes.melt')
-rw-r--r--gcc/melt/warmelt-modes.melt23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/melt/warmelt-modes.melt b/gcc/melt/warmelt-modes.melt
index 7fe65d2d659..b0afaeea149 100644
--- a/gcc/melt/warmelt-modes.melt
+++ b/gcc/melt/warmelt-modes.melt
@@ -2215,6 +2215,29 @@ typedef melt_ptr_t meltroutfun_t (struct meltclosure_st* meltclosp_,
(add2sbuf_indentnl outbuf 0)
(add2sbuf_strconst outbuf "} melt_un_t /*end generated melt_un*/;")
(add2sbuf_indentnl outbuf 0)
+ ;; generate the casts
+ (foreach_in_multiple
+ (valdesctup)
+ (curvaldesc :long vix)
+ (debug "generate_runtypesupport_gty cast curvaldesc=" curvaldesc " vix=" vix)
+ (add2sbuf_indentnl outbuf 0)
+ (add2sbuf_indentnl outbuf 0)
+ (add2out outbuf "/* cast.valdesc #" (+i 1 vix) " " (get_field :valdesc_struct curvaldesc) "*/")
+ (add2sbuf_indentnl outbuf 0)
+ (add2out outbuf "static inline struct " (get_field :valdesc_struct curvaldesc) "* "
+ "meltcast_" (get_field :valdesc_struct curvaldesc) "(melt_ptr_t p) {")
+ (add2sbuf_indentnl outbuf 1)
+ (add2out outbuf "if (p && melt_magic_discr(p) == " (get_field :valdesc_objmagic curvaldesc) ")")
+ (add2sbuf_indentnl outbuf 2)
+ (add2out outbuf "return (struct " (get_field :valdesc_struct curvaldesc) "*) p;")
+ (add2sbuf_indentnl outbuf 1)
+ (add2out outbuf "return NULL;")
+ (add2sbuf_indentnl outbuf 0)
+ (add2out outbuf "} /* end meltcast_" (get_field :valdesc_struct curvaldesc) "*/")
+ (add2sbuf_indentnl outbuf 0)
+ ) ;end foreach valdesc
+ (add2sbuf_indentnl outbuf 0)
+
;;;
(add2sbuf_strconst outbuf "/** end generated by generate_runtypesupport_gty **/")
;;;;